| @@ -50,16 +50,16 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| return new ResultData(markingDataReportService.listMicroPayOrderReportByDateAndMerchant(wxOrderReportDto)); | return new ResultData(markingDataReportService.listMicroPayOrderReportByDateAndMerchant(wxOrderReportDto)); | ||||
| } | } | ||||
| @ApiOperation("获得昨日刷卡列表") | |||||
| @GetMapping("/listYesterday") | |||||
| @SystemControllerLog(description = "收银台-获得昨日刷卡列表") | |||||
| public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | |||||
| if (wxOrderReportDto == null) | |||||
| wxOrderReportDto = new WxOrderReportDto(); | |||||
| wxOrderReportDto.updateTenantInfo(getTenantInfo()); | |||||
| final PageInfo<WxMerchantMicroPayVo> page = markingDataReportService.listMerchantMicroPayOrderReportByDate(wxOrderReportDto, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| // @ApiOperation("获得昨日刷卡列表") | |||||
| // @GetMapping("/listYesterday") | |||||
| // @SystemControllerLog(description = "收银台-获得昨日刷卡列表") | |||||
| // public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | |||||
| // logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | |||||
| // if (wxOrderReportDto == null) | |||||
| // wxOrderReportDto = new WxOrderReportDto(); | |||||
| // wxOrderReportDto.updateTenantInfo(getTenantInfo()); | |||||
| // final PageInfo<WxMerchantMicroPayVo> page = markingDataReportService.listMerchantMicroPayOrderReportByDate(wxOrderReportDto, pageNum, pageSize); | |||||
| // return new ResultData(page); | |||||
| // } | |||||
| } | } | ||||
| @@ -112,7 +112,15 @@ public class DaliyAmountSchedule { | |||||
| dateAmountRecord.setPayPrice(total_price); | dateAmountRecord.setPayPrice(total_price); | ||||
| dateAmountRecord.setType(EnumDateAmtType.VERIFY_RECORD.getCode()); | dateAmountRecord.setType(EnumDateAmtType.VERIFY_RECORD.getCode()); | ||||
| wxDateAmountRecordService.saveAmount(dateAmountRecord); | wxDateAmountRecordService.saveAmount(dateAmountRecord); | ||||
| // | |||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(merchant); | |||||
| merchantBUserQ.setMerchantId(merchant.getId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| if (null == bUserIds || bUserIds.size() <= 0 ) { | |||||
| return; | |||||
| } | |||||
| dateMap.put("bUserIds", bUserIds); | |||||
| Map microPayMap = wxOrderMapper.dayMicroPayAmountList(dateMap); | Map microPayMap = wxOrderMapper.dayMicroPayAmountList(dateMap); | ||||
| Long countMic = (Long) microPayMap.get("count"); | Long countMic = (Long) microPayMap.get("count"); | ||||
| BigDecimal totalPriceMic = (BigDecimal) microPayMap.get("total_price"); | BigDecimal totalPriceMic = (BigDecimal) microPayMap.get("total_price"); | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.po; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | import com.iformall.service.order.entity.WxComposeChildOrderShare; | ||||
| @@ -28,6 +29,8 @@ public class WxPayOrder extends TenantEntity { | |||||
| private Date updateTime; | private Date updateTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | ||||
| private Long orderId; | private Long orderId; | ||||
| @TableField(exist = false) | |||||
| protected List<Long> orderIds; | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="openId") | @io.swagger.annotations.ApiModelProperty(value="",name="openId") | ||||
| @@ -1,6 +1,11 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxPayOrder; | |||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -63,5 +68,44 @@ public class WxOrderPayExpVo extends WxOrder { | |||||
| } | } | ||||
| } | } | ||||
| public void initByMerchant(WxMerchant merchant) { | |||||
| this.setMerchantName(merchant.getName()); | |||||
| } | |||||
| public void initByMerchantBUser(WxMerchantBUser merchantBUser) { | |||||
| this.setBUserName(merchantBUser.getName()); | |||||
| this.setBUserPhone(merchantBUser.getPhone()); | |||||
| } | |||||
| public void initByCUserBasicInfo(WxCUserBasicInfo user) { | |||||
| this.setCUserPhone(user.getPhone()); | |||||
| this.setNickName(user.getNickName()); | |||||
| this.setCUserName(user.getName()); | |||||
| } | |||||
| public void initByWxOrder(WxOrder o) { | |||||
| this.setId(o.getId()); | |||||
| this.setOrderNumber(o.getOrderNumber()); | |||||
| this.setTenantId(o.getTenantId()); | |||||
| this.setParentOrderId(o.getParentOrderId()); | |||||
| this.setCUserId(o.getCUserId()); | |||||
| this.setCouponChannelId(o.getCouponChannelId()); | |||||
| this.setProductId(o.getProductId()); | |||||
| this.setType(o.getType()); | |||||
| this.setPayVendor(o.getPayVendor()); | |||||
| this.setPaymentType(o.getPaymentType()); | |||||
| this.setPayment(o.getPayment()); | |||||
| this.setPaymentTime(o.getPaymentTime()); | |||||
| this.setFreightPrice(o.getFreightPrice()); | |||||
| this.setOrderStatus(o.getOrderStatus()); | |||||
| this.setCreateDate(o.getCreateDate()); | |||||
| this.setUpdateDate(o.getUpdateDate()); | |||||
| this.setDetail(o.getDetail()); | |||||
| } | |||||
| public void initByPayOrder(WxPayOrder payOrder) { | |||||
| this.setPayOrderId(payOrder.getId()); | |||||
| this.setTransactionId(payOrder.getTransactionId()); | |||||
| } | |||||
| } | } | ||||
| @@ -1,5 +1,8 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -84,5 +87,39 @@ public class WxOrderPayVo extends WxOrder { | |||||
| } | } | ||||
| } | } | ||||
| public void initByMerchant(WxMerchant merchant) { | |||||
| this.setMerchantName(merchant.getName()); | |||||
| } | |||||
| public void initByMerchantBUser(WxMerchantBUser merchantBUser) { | |||||
| this.setBUserName(merchantBUser.getName()); | |||||
| this.setBUserPhone(merchantBUser.getPhone()); | |||||
| } | |||||
| public void initByCUserBasicInfo(WxCUserBasicInfo user) { | |||||
| this.setCUserPhone(user.getPhone()); | |||||
| this.setNickName(user.getNickName()); | |||||
| this.setCUserName(user.getName()); | |||||
| } | |||||
| public void initByWxOrder(WxOrder o) { | |||||
| this.setId(o.getId()); | |||||
| this.setOrderNumber(o.getOrderNumber()); | |||||
| this.setTenantId(o.getTenantId()); | |||||
| this.setParentOrderId(o.getParentOrderId()); | |||||
| this.setCUserId(o.getCUserId()); | |||||
| this.setCouponChannelId(o.getCouponChannelId()); | |||||
| this.setProductId(o.getProductId()); | |||||
| this.setType(o.getType()); | |||||
| this.setPayVendor(o.getPayVendor()); | |||||
| this.setPaymentType(o.getPaymentType()); | |||||
| this.setPayment(o.getPayment()); | |||||
| this.setPaymentTime(o.getPaymentTime()); | |||||
| this.setFreightPrice(o.getFreightPrice()); | |||||
| this.setOrderStatus(o.getOrderStatus()); | |||||
| this.setCreateDate(o.getCreateDate()); | |||||
| this.setUpdateDate(o.getUpdateDate()); | |||||
| this.setDetail(o.getDetail()); | |||||
| } | |||||
| } | } | ||||
| @@ -34,8 +34,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| /** B端收银台(收款码支付) */ | /** B端收银台(收款码支付) */ | ||||
| Map dayMicroPayAmountList(Map dateMap); | Map dayMicroPayAmountList(Map dateMap); | ||||
| List<WxOrderPayVo> findListOfMicroPayOrderByDate(Map dateMap); | |||||
| List<WxOrderPayExpVo> findListOfExpMicroPayOrderByDate(Map dateMap); | |||||
| List<WxOrder> findListOfMicroPayOrderByDate(Map dateMap); | |||||
| List<WxOrder> findListOfExpMicroPayOrderByDate(Map dateMap); | |||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistory(HashMap<String,Object> params); | List<MarkingSceneDataVo> queryForSceneRepotyHistory(HashMap<String,Object> params); | ||||
| @@ -43,7 +43,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(HashMap<String,Object> params); | List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(HashMap<String,Object> params); | ||||
| List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(@Param("wxOrderReportDto") WxOrderReportDto wxOrderReportDto, @Param("tenantEntitys")List<TenantEntity> tenantEntitys); | |||||
| //List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(@Param("wxOrderReportDto") WxOrderReportDto wxOrderReportDto, @Param("tenantEntitys")List<TenantEntity> tenantEntitys); | |||||
| List<WxOrder> findListOrder(WxOrderQueryVo record); | List<WxOrder> findListOrder(WxOrderQueryVo record); | ||||
| @@ -35,7 +35,7 @@ public interface MarkingDataReportService { | |||||
| List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(WxOrderReportDto wxOrderReportDto); | List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(WxOrderReportDto wxOrderReportDto); | ||||
| PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageNum, Integer pageSize); | |||||
| //PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageNum, Integer pageSize); | |||||
| void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto); | void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto); | ||||
| @@ -2,16 +2,19 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | import com.iformall.domain.dto.MarkingCouponDataReportDto; | ||||
| import com.iformall.domain.dto.WxOrderReportDto; | import com.iformall.domain.dto.WxOrderReportDto; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.EnumCarCmd; | import com.iformall.enums.EnumCarCmd; | ||||
| import com.iformall.enums.EnumCouponSendSendType; | import com.iformall.enums.EnumCouponSendSendType; | ||||
| import com.iformall.enums.EnumCouponType; | import com.iformall.enums.EnumCouponType; | ||||
| import com.iformall.enums.EnumOrderType; | import com.iformall.enums.EnumOrderType; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.MarkingDataReportService; | import com.iformall.service.MarkingDataReportService; | ||||
| @@ -57,6 +60,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Autowired | @Autowired | ||||
| private ExcelService excelService; | private ExcelService excelService; | ||||
| @Autowired | |||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| private WxCouponOrderService wxCouponOrderService; | private WxCouponOrderService wxCouponOrderService; | ||||
| @@ -606,10 +612,10 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Override | @Override | ||||
| public Map<String, Object> listOrderReportByDate(WxOrderReportDto wxOrderReportDto) { | public Map<String, Object> listOrderReportByDate(WxOrderReportDto wxOrderReportDto) { | ||||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||||
| //List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||||
| HashMap<String, Object> params = new HashMap<>(); | HashMap<String, Object> params = new HashMap<>(); | ||||
| params.put("tenantEntitys",tenantEntitys); | |||||
| // params.put("tenantId", wxOrderReportDto.getTenantId()); | |||||
| //params.put("tenantEntitys",tenantEntitys); | |||||
| params.put("tenantId", wxOrderReportDto.getTenantId()); | |||||
| if (wxOrderReportDto.getStartTime() != null) { | if (wxOrderReportDto.getStartTime() != null) { | ||||
| params.put("startTime", convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | params.put("startTime", convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | ||||
| } else { | } else { | ||||
| @@ -709,6 +715,14 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| params.put("endTime", addDay(1)); | params.put("endTime", addDay(1)); | ||||
| } | } | ||||
| params.put("tenantId", wxOrderReportDto.getTenantId()); | params.put("tenantId", wxOrderReportDto.getTenantId()); | ||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(wxOrderReportDto); | |||||
| merchantBUserQ.setMerchantId(wxOrderReportDto.getMerchantId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| if (null == bUserIds || bUserIds.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| params.put("bUserIds", bUserIds); | |||||
| List<WxOrderReportVo> list = wxOrderMapper.listMicroPayOrderReportByDateAndMerchant(params); | List<WxOrderReportVo> list = wxOrderMapper.listMicroPayOrderReportByDateAndMerchant(params); | ||||
| String startdate = DateUtils.getTimeBefore(30, new Date()); | String startdate = DateUtils.getTimeBefore(30, new Date()); | ||||
| @@ -730,24 +744,24 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| return wxOrderReportVoList; | return wxOrderReportVoList; | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageIndex, Integer pageSize) { | |||||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||||
| if (wxOrderReportDto.getStartTime() != null) { | |||||
| wxOrderReportDto.setStartTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| } else { | |||||
| wxOrderReportDto.setStartTime(addDay(-1)); | |||||
| } | |||||
| if (wxOrderReportDto.getEndTime() != null) { | |||||
| wxOrderReportDto.setEndTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| } else { | |||||
| wxOrderReportDto.setEndTime(addDay(0)); | |||||
| } | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto,tenantEntitys); | |||||
| return new PageInfo<>(list); | |||||
| } | |||||
| // @Override | |||||
| // public PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageIndex, Integer pageSize) { | |||||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | |||||
| // if (wxOrderReportDto.getStartTime() != null) { | |||||
| // wxOrderReportDto.setStartTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| // } else { | |||||
| // wxOrderReportDto.setStartTime(addDay(-1)); | |||||
| // } | |||||
| // if (wxOrderReportDto.getEndTime() != null) { | |||||
| // wxOrderReportDto.setEndTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| // } else { | |||||
| // wxOrderReportDto.setEndTime(addDay(0)); | |||||
| // } | |||||
| // PageHelper.startPage(pageIndex, pageSize); | |||||
| // List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto,tenantEntitys); | |||||
| // | |||||
| // return new PageInfo<>(list); | |||||
| // } | |||||
| @Override | @Override | ||||
| public void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto) { | public void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto) { | ||||
| @@ -269,23 +269,139 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| dateMap.put("type", type); | dateMap.put("type", type); | ||||
| dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | ||||
| dateMap.put("finalTenantId", wxMerchantBUser.getFinalTenantId()); | dateMap.put("finalTenantId", wxMerchantBUser.getFinalTenantId()); | ||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(wxMerchant); | |||||
| merchantBUserQ.setMerchantId(wxMerchant.getId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| if (null == bUserIds || bUserIds.size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| } | |||||
| dateMap.put("bUserIds", bUserIds); | |||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| if (pageIndex == null || pageSize == null) { | if (pageIndex == null || pageSize == null) { | ||||
| List<WxOrderPayVo> list; | List<WxOrderPayVo> list; | ||||
| list = wxOrderMapper.findListOfMicroPayOrderByDate(dateMap); | |||||
| logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | |||||
| list = orderPayVoPageInfo(wxMerchantBUser,1, 10000, dateMap).getList(); | |||||
| int total_price = 0; | int total_price = 0; | ||||
| for (WxOrder order : list) { | |||||
| total_price = total_price + order.getPayment(); | |||||
| if (null != list) { | |||||
| logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | |||||
| for (WxOrderPayVo order : list) { | |||||
| total_price = total_price + order.getPayment(); | |||||
| } | |||||
| } | } | ||||
| resultMap.put("amount", total_price); | resultMap.put("amount", total_price); | ||||
| } else { | } else { | ||||
| resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfMicroPayOrderByDate(dateMap))); | |||||
| resultMap.put("list", orderPayVoPageInfo(wxMerchantBUser,pageIndex, pageSize, dateMap)); | |||||
| } | } | ||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } | } | ||||
| private PageInfo<WxOrderPayVo> orderPayVoPageInfo(TenantEntity tenantEntity,Integer pageIndex,Integer pageSize,Map dateMap) { | |||||
| PageInfo<WxOrder> orderPageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfMicroPayOrderByDate(dateMap)); | |||||
| PageInfo<WxOrderPayVo> voPageInfo = new PageInfo<WxOrderPayVo>(); | |||||
| voPageInfo.setPageNum(orderPageInfo.getPageNum()); | |||||
| voPageInfo.setPageSize(orderPageInfo.getPageSize()); | |||||
| voPageInfo.setPages(orderPageInfo.getPages()); | |||||
| voPageInfo.setTotal(orderPageInfo.getTotal()); | |||||
| voPageInfo.setList(toOrderPayVoList(tenantEntity,orderPageInfo.getList())); | |||||
| return voPageInfo; | |||||
| } | |||||
| private List<WxOrderPayVo> toOrderPayVoList(TenantEntity tenantEntity,List<WxOrder> orderList) { | |||||
| if (null == orderList || orderList.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| List<Long> bUserIds = new ArrayList<Long>(); | |||||
| List<Long> cUserIds = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < orderList.size(); i++ ){ | |||||
| WxOrder o = orderList.get(i); | |||||
| if (null != o && null != o.getProductId() && (!bUserIds.contains(o.getProductId()))) { | |||||
| bUserIds.add(o.getProductId()); | |||||
| } | |||||
| if (null != o && null != o.getCUserId() && (!cUserIds.contains(o.getCUserId()))) { | |||||
| cUserIds.add(o.getCUserId()); | |||||
| } | |||||
| } | |||||
| if (bUserIds.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| Map<Long,WxMerchantBUser> bUserMap = new HashMap<Long,WxMerchantBUser>(); | |||||
| Map<Long,Long> bUserMerchantMap = new HashMap<Long,Long>(); | |||||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||||
| if (bUserIds.size() > 0) { | |||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(tenantEntity); | |||||
| merchantBUserQ.setIds(bUserIds);; | |||||
| List<WxMerchantBUser> buserList = wxMerchantBUserMapper.findSimpleList(merchantBUserQ); | |||||
| if (null != buserList && buserList.size() > 0 ) { | |||||
| for (int i = 0 ; i < buserList.size(); i++) { | |||||
| WxMerchantBUser buser = buserList.get(i); | |||||
| bUserMap.put(buser.getId(),buser); | |||||
| bUserMerchantMap.put(buser.getId(), buser.getMerchantId()); | |||||
| if (!merchantIdList.contains(buser.getMerchantId())) { | |||||
| merchantIdList.add(buser.getMerchantId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); | |||||
| if (merchantIdList.size() > 0 ) { | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(tenantEntity); | |||||
| merchantQ.setIds(bUserIds); | |||||
| List<WxMerchant> mList = wxMerchantMapper.findIdNameList(merchantQ); | |||||
| if (null != mList && mList.size() > 0 ) { | |||||
| for (int i = 0 ; i < mList.size(); i++) { | |||||
| WxMerchant m = mList.get(i); | |||||
| merchantMap.put(m.getId(),m); | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
| if (cUserIds.size() > 0 ) { | |||||
| WxCUserBasicInfo cuserQ = new WxCUserBasicInfo(); | |||||
| cuserQ.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||||
| cuserQ.setIds(cUserIds); | |||||
| List<WxCUserBasicInfo> userList = wxCUserBasicInfoMapper.findList(cuserQ); | |||||
| if (null != userList && userList.size() > 0 ) { | |||||
| for (int i = 0 ; i < userList.size(); i++) { | |||||
| WxCUserBasicInfo u = userList.get(i); | |||||
| cUserMap.put(u.getId(),u); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<WxOrderPayVo> voList = new ArrayList<WxOrderPayVo>(); | |||||
| for (int i = 0 ; i < orderList.size(); i++ ) { | |||||
| WxOrder o = orderList.get(i); | |||||
| WxOrderPayVo vo = new WxOrderPayVo(); | |||||
| vo.initByWxOrder(o); | |||||
| if (null != o.getProductId()) { | |||||
| Long merchantId = bUserMerchantMap.get(o.getProductId()); | |||||
| if (null != merchantId ) { | |||||
| WxMerchant merchant = merchantMap.get(merchantId); | |||||
| if (null != merchant) { | |||||
| vo.initByMerchant(merchant); | |||||
| } | |||||
| } | |||||
| WxMerchantBUser buser = bUserMap.get(o.getProductId()) ; | |||||
| if (null != buser) { | |||||
| vo.initByMerchantBUser(buser); | |||||
| } | |||||
| } | |||||
| if (null != o.getCUserId()){ | |||||
| WxCUserBasicInfo user = cUserMap.get(o.getCUserId()); | |||||
| if (null != user) { | |||||
| vo.initByCUserBasicInfo(user); | |||||
| } | |||||
| } | |||||
| voList.add(vo); | |||||
| } | |||||
| return voList; | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData microPayExpListOnDateAsPage(Long bUserId, Integer type, String date, Integer pageIndex, Integer pageSize) { | public ResultData microPayExpListOnDateAsPage(Long bUserId, Integer type, String date, Integer pageIndex, Integer pageSize) { | ||||
| @@ -334,22 +450,159 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | ||||
| dateMap.put("finalTenantId", wxMerchantBUser.getFinalTenantId()); | dateMap.put("finalTenantId", wxMerchantBUser.getFinalTenantId()); | ||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(wxMerchant); | |||||
| merchantBUserQ.setMerchantId(wxMerchant.getId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| if (null == bUserIds || bUserIds.size() <= 0 ) { | |||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| } | |||||
| dateMap.put("bUserIds", bUserIds); | |||||
| if (pageIndex == null || pageSize == null) { | if (pageIndex == null || pageSize == null) { | ||||
| List<WxOrderPayExpVo> list; | List<WxOrderPayExpVo> list; | ||||
| list = wxOrderMapper.findListOfExpMicroPayOrderByDate(dateMap); | |||||
| list = orderPayExpVoPageInfo(wxMerchant, 1, 10000, dateMap).getList(); | |||||
| logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | ||||
| int total_price = 0; | int total_price = 0; | ||||
| for (WxOrder order : list) { | |||||
| total_price = total_price + order.getPayment(); | |||||
| } | |||||
| if (null != list) { | |||||
| for (WxOrderPayExpVo order : list) { | |||||
| total_price = total_price + order.getPayment(); | |||||
| } | |||||
| } | |||||
| resultMap.put("amount", total_price); | resultMap.put("amount", total_price); | ||||
| } else { | } else { | ||||
| resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfExpMicroPayOrderByDate(dateMap))); | |||||
| resultMap.put("list", orderPayExpVoPageInfo(wxMerchant, pageIndex, pageSize, dateMap)); | |||||
| } | } | ||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } | } | ||||
| private PageInfo<WxOrderPayExpVo> orderPayExpVoPageInfo(TenantEntity tenantEntity,Integer pageIndex,Integer pageSize,Map dateMap) { | |||||
| PageInfo<WxOrder> orderPageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfExpMicroPayOrderByDate(dateMap)); | |||||
| PageInfo<WxOrderPayExpVo> voPageInfo = new PageInfo<WxOrderPayExpVo>(); | |||||
| voPageInfo.setPageNum(orderPageInfo.getPageNum()); | |||||
| voPageInfo.setPageSize(orderPageInfo.getPageSize()); | |||||
| voPageInfo.setPages(orderPageInfo.getPages()); | |||||
| voPageInfo.setTotal(orderPageInfo.getTotal()); | |||||
| voPageInfo.setList(toOrderPayExpVoList(tenantEntity,orderPageInfo.getList())); | |||||
| return voPageInfo; | |||||
| } | |||||
| private List<WxOrderPayExpVo> toOrderPayExpVoList(TenantEntity tenantEntity,List<WxOrder> orderList) { | |||||
| if (null == orderList || orderList.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| List<Long> bUserIds = new ArrayList<Long>(); | |||||
| List<Long> cUserIds = new ArrayList<Long>(); | |||||
| List<Long> orderIds = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < orderList.size(); i++ ){ | |||||
| WxOrder o = orderList.get(i); | |||||
| if (null != o && null != o.getProductId() && (!bUserIds.contains(o.getProductId()))) { | |||||
| bUserIds.add(o.getProductId()); | |||||
| } | |||||
| if (null != o && null != o.getCUserId() && (!cUserIds.contains(o.getCUserId()))) { | |||||
| cUserIds.add(o.getCUserId()); | |||||
| } | |||||
| orderIds.add(o.getId()); | |||||
| } | |||||
| if (bUserIds.size() <= 0 ) { | |||||
| return null; | |||||
| } | |||||
| Map<Long,WxMerchantBUser> bUserMap = new HashMap<Long,WxMerchantBUser>(); | |||||
| Map<Long,Long> bUserMerchantMap = new HashMap<Long,Long>(); | |||||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||||
| if (bUserIds.size() > 0) { | |||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(tenantEntity); | |||||
| merchantBUserQ.setIds(bUserIds); | |||||
| List<WxMerchantBUser> buserList = wxMerchantBUserMapper.findSimpleList(merchantBUserQ); | |||||
| if (null != buserList && buserList.size() > 0 ) { | |||||
| for (int i = 0 ; i < buserList.size(); i++) { | |||||
| WxMerchantBUser buser = buserList.get(i); | |||||
| bUserMap.put(buser.getId(),buser); | |||||
| bUserMerchantMap.put(buser.getId(), buser.getMerchantId()); | |||||
| if (!merchantIdList.contains(buser.getMerchantId())) { | |||||
| merchantIdList.add(buser.getMerchantId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); | |||||
| if (merchantIdList.size() > 0 ) { | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(tenantEntity); | |||||
| merchantQ.setIds(bUserIds); | |||||
| List<WxMerchant> mList = wxMerchantMapper.findIdNameList(merchantQ); | |||||
| if (null != mList && mList.size() > 0 ) { | |||||
| for (int i = 0 ; i < mList.size(); i++) { | |||||
| WxMerchant m = mList.get(i); | |||||
| merchantMap.put(m.getId(),m); | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
| if (cUserIds.size() > 0 ) { | |||||
| WxCUserBasicInfo cuserQ = new WxCUserBasicInfo(); | |||||
| cuserQ.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||||
| cuserQ.setIds(cUserIds); | |||||
| List<WxCUserBasicInfo> userList = wxCUserBasicInfoMapper.findList(cuserQ); | |||||
| if (null != userList && userList.size() > 0 ) { | |||||
| for (int i = 0 ; i < userList.size(); i++) { | |||||
| WxCUserBasicInfo u = userList.get(i); | |||||
| cUserMap.put(u.getId(),u); | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxPayOrder> payOrderMap = new HashMap<Long,WxPayOrder>(); | |||||
| if (orderIds.size() > 0 ) { | |||||
| WxPayOrder payOrderQ = new WxPayOrder(); | |||||
| payOrderQ.updateTenantInfo(tenantEntity); | |||||
| payOrderQ.setOrderIds(orderIds);; | |||||
| List<WxPayOrder> pyList = wxPayOrderMapper.findList(payOrderQ); | |||||
| if (null != pyList && pyList.size() > 0 ) { | |||||
| for (int i = 0 ; i < pyList.size(); i++) { | |||||
| WxPayOrder po = pyList.get(i); | |||||
| payOrderMap.put(po.getOrderId(),po); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<WxOrderPayExpVo> voList = new ArrayList<WxOrderPayExpVo>(); | |||||
| for (int i = 0 ; i < orderList.size(); i++ ) { | |||||
| WxOrder o = orderList.get(i); | |||||
| WxOrderPayExpVo vo = new WxOrderPayExpVo(); | |||||
| vo.initByWxOrder(o); | |||||
| if (null != o.getProductId()) { | |||||
| Long merchantId = bUserMerchantMap.get(o.getProductId()); | |||||
| if (null != merchantId ) { | |||||
| WxMerchant merchant = merchantMap.get(merchantId); | |||||
| if (null != merchant) { | |||||
| vo.initByMerchant(merchant); | |||||
| } | |||||
| } | |||||
| WxMerchantBUser buser = bUserMap.get(o.getProductId()) ; | |||||
| if (null != buser) { | |||||
| vo.initByMerchantBUser(buser); | |||||
| } | |||||
| } | |||||
| if (null != o.getCUserId()){ | |||||
| WxCUserBasicInfo user = cUserMap.get(o.getCUserId()); | |||||
| if (null != user) { | |||||
| vo.initByCUserBasicInfo(user); | |||||
| } | |||||
| } | |||||
| WxPayOrder payOrder = payOrderMap.get(o.getId()); | |||||
| if (null != payOrder) { | |||||
| vo.initByPayOrder(payOrder); | |||||
| } | |||||
| voList.add(vo); | |||||
| } | |||||
| return voList; | |||||
| } | |||||
| /** | /** | ||||
| * 拼团数量 | * 拼团数量 | ||||
| * | * | ||||
| @@ -128,10 +128,7 @@ | |||||
| <select id="findSimpleList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap"> | <select id="findSimpleList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultMap="BaseResultMap"> | ||||
| select id,name,phone,merchant_id | select id,name,phone,merchant_id | ||||
| from wx_merchant_b_user | from wx_merchant_b_user | ||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| where `tenant_id` = #{tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -519,10 +519,8 @@ | |||||
| </select> | </select> | ||||
| <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | ||||
| select count(*) as count, IFNULL(sum(o.payment), 0) as total_price | |||||
| select count(1) as count, IFNULL(sum(o.payment), 0) as total_price | |||||
| from wx_order o | from wx_order o | ||||
| inner join wx_merchant_b_user bu on bu.id = product_id | |||||
| inner join wx_merchant m on m.id = bu.merchant_id | |||||
| where o.`type` = 1 and o.`order_status` = 1 | where o.`type` = 1 and o.`order_status` = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| @@ -535,18 +533,17 @@ | |||||
| and o.pay_vendor = #{payVendor} | and o.pay_vendor = #{payVendor} | ||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and bu.`merchant_id` = #{merchantId} | |||||
| <if test=" null != bUserIds "> | |||||
| and o.product_id in | |||||
| <foreach collection="bUserIds" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||||
| #{bUserIdItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and o.`c_user_id` = #{cUserId} | and o.`c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| <if test=" null != bUserId "> | |||||
| and bu.`id` = #{bUserId} | |||||
| </if> | |||||
| <if test=" null != couponChannelId "> | <if test=" null != couponChannelId "> | ||||
| and o.`coupon_channel_id` = #{couponChannelId} | and o.`coupon_channel_id` = #{couponChannelId} | ||||
| </if> | </if> | ||||
| @@ -564,48 +561,12 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <resultMap id="PayVoResultMap" type="com.iformall.domain.vo.WxOrderPayVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||||
| <result column="coupon_channel_id" jdbcType="BIGINT" property="couponChannelId"/> | |||||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||||
| <result column="type" jdbcType="TINYINT" property="type"/> | |||||
| <result column="pay_vendor" jdbcType="TINYINT" property="payVendor"/> | |||||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||||
| <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/> | |||||
| <result column="order_status" jdbcType="INTEGER" property="orderStatus"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName" /> | |||||
| <result column="c_user_name" jdbcType="VARCHAR" property="cUserName" /> | |||||
| </resultMap> | |||||
| <sql id="allPayOrderColumns"> | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`, | |||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | |||||
| m.name as merchant_name, bu.name, bu.phone as bphone, | |||||
| cubi.phone, cubi.nick_name, cubi.name c_user_name | |||||
| </sql> | |||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | |||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="BaseResultMap"> | |||||
| select | select | ||||
| <include refid="allPayOrderColumns"/> | |||||
| from wx_order o | |||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | |||||
| inner join wx_merchant m on m.id = bu.merchant_id | |||||
| LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`, | |||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail` | |||||
| where o.order_status = '1' and o.`type` = 1 | where o.order_status = '1' and o.`type` = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| @@ -616,11 +577,11 @@ | |||||
| <if test=" null != payVendor "> | <if test=" null != payVendor "> | ||||
| and o.pay_vendor = #{payVendor} | and o.pay_vendor = #{payVendor} | ||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and bu.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != bUserId "> | |||||
| and bu.`id` = #{bUserId} | |||||
| <if test=" null != bUserIds "> | |||||
| and o.product_id in | |||||
| <foreach collection="bUserIds" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||||
| #{bUserIdItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| <if test="startDate != null"> | <if test="startDate != null"> | ||||
| AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | ||||
| @@ -631,51 +592,13 @@ | |||||
| order by o.create_date desc | order by o.create_date desc | ||||
| </select> | </select> | ||||
| <resultMap id="PayExpVoResultMap" type="com.iformall.domain.vo.WxOrderPayExpVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||||
| <result column="coupon_channel_id" jdbcType="BIGINT" property="couponChannelId"/> | |||||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||||
| <result column="type" jdbcType="TINYINT" property="type"/> | |||||
| <result column="pay_vendor" jdbcType="TINYINT" property="payVendor"/> | |||||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||||
| <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/> | |||||
| <result column="order_status" jdbcType="INTEGER" property="orderStatus"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName" /> | |||||
| <result column="c_user_name" jdbcType="VARCHAR" property="cUserName" /> | |||||
| <result column="pay_order_id" jdbcType="BIGINT" property="payOrderId"/> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/> | |||||
| </resultMap> | |||||
| <sql id="allExpPayOrderColumns"> | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`, | |||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | |||||
| m.name as merchant_name, bu.name, bu.phone as bphone, | |||||
| cubi.phone, cubi.nick_name, cubi.name c_user_name, | |||||
| po.id as pay_order_id, po.transaction_id | |||||
| </sql> | |||||
| <select id="findListOfExpMicroPayOrderByDate" parameterType="map" resultMap="PayExpVoResultMap"> | <select id="findListOfExpMicroPayOrderByDate" parameterType="map" resultMap="PayExpVoResultMap"> | ||||
| select | select | ||||
| <include refid="allExpPayOrderColumns"/> | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`, | |||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail` | |||||
| from wx_order o | from wx_order o | ||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | |||||
| inner join wx_merchant m on m.id = bu.merchant_id | |||||
| left join wx_pay_order po on po.order_id = o.id | |||||
| LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id | |||||
| where o.order_status = '0' and o.`type` = 1 | where o.order_status = '0' and o.`type` = 1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and o.`tenant_id` = #{tenantId} | and o.`tenant_id` = #{tenantId} | ||||
| @@ -686,11 +609,11 @@ | |||||
| <if test=" null != payVendor "> | <if test=" null != payVendor "> | ||||
| and o.pay_vendor = #{payVendor} | and o.pay_vendor = #{payVendor} | ||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and bu.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != bUserId "> | |||||
| and bu.`id` = #{bUserId} | |||||
| <if test=" null != bUserIds "> | |||||
| and o.product_id in | |||||
| <foreach collection="bUserIds" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||||
| #{bUserIdItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| <if test="startDate != null"> | <if test="startDate != null"> | ||||
| AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | ||||
| @@ -703,9 +626,7 @@ | |||||
| <select id="queryForSceneRepotyHistory" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | <select id="queryForSceneRepotyHistory" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | ||||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount | select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount | ||||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||||
| </foreach>) o | |||||
| from wx_order o | |||||
| where o.`type` = #{type} | where o.`type` = #{type} | ||||
| <if test=" null != payVendor "> | <if test=" null != payVendor "> | ||||
| and o.pay_vendor = #{payVendor} | and o.pay_vendor = #{payVendor} | ||||
| @@ -726,15 +647,8 @@ | |||||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, | select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, | ||||
| count(o.id) count, | count(o.id) count, | ||||
| IFNULL (SUM(o.payment),0) amount | IFNULL (SUM(o.payment),0) amount | ||||
| from ( | |||||
| <foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||||
| </foreach> | |||||
| ) o | |||||
| where 1=1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and o.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| from wx_order o | |||||
| where o.`tenant_id` = #{tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and o.`parent_tenant_id` = #{parentTenantId} | and o.`parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| @@ -756,9 +670,13 @@ | |||||
| <select id="listMicroPayOrderReportByDateAndMerchant" resultType="com.iformall.domain.vo.WxOrderReportVo" parameterType="hashmap"> | <select id="listMicroPayOrderReportByDateAndMerchant" resultType="com.iformall.domain.vo.WxOrderReportVo" parameterType="hashmap"> | ||||
| select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) count, IFNULL (SUM(o.payment),0) amount | select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) count, IFNULL (SUM(o.payment),0) amount | ||||
| from wx_order o | from wx_order o | ||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | |||||
| inner join wx_merchant m on m.id = bu.merchant_id | |||||
| where m.`id` = #{merchantId} and o.tenant_id = #{tenantId} and o.`type` = 1 and o.`order_status` = 1 | |||||
| where o.tenant_id = #{tenantId} and o.`type` = 1 and o.`order_status` = 1 | |||||
| <if test=" null != bUserIds "> | |||||
| and o.product_id in | |||||
| <foreach collection="bUserIds" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||||
| #{bUserIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != payVendor "> | <if test=" null != payVendor "> | ||||
| and o.pay_vendor = #{payVendor} | and o.pay_vendor = #{payVendor} | ||||
| </if> | </if> | ||||
| @@ -769,7 +687,7 @@ | |||||
| </select> | </select> | ||||
| <resultMap id="WxMerchantMicroPayVo" type="com.iformall.domain.vo.WxMerchantMicroPayVo"> | |||||
| <!-- <resultMap id="WxMerchantMicroPayVo" type="com.iformall.domain.vo.WxMerchantMicroPayVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | ||||
| @@ -819,7 +737,7 @@ | |||||
| <if test=" null != wxOrderReportDto.sortColumns"> order by ${wxOrderReportDto.sortColumns} </if> | <if test=" null != wxOrderReportDto.sortColumns"> order by ${wxOrderReportDto.sortColumns} </if> | ||||
| <if test=" null == wxOrderReportDto.sortColumns"> order by wm.create_date desc </if> | <if test=" null == wxOrderReportDto.sortColumns"> order by wm.create_date desc </if> | ||||
| </select> | |||||
| </select> --> | |||||
| <resultMap id="orderMap" type="com.iformall.domain.po.WxOrder"> | <resultMap id="orderMap" type="com.iformall.domain.po.WxOrder"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| @@ -144,7 +144,12 @@ | |||||
| <if test=" null != composeOrder "> | <if test=" null != composeOrder "> | ||||
| and `compose_order` = #{composeOrder} | and `compose_order` = #{composeOrder} | ||||
| </if> | </if> | ||||
| <if test=" null != orderIds "> | |||||
| and order_id in | |||||
| <foreach collection="orderIds" index="index" item="orderIdItem" open="(" separator="," close=")"> | |||||
| #{orderIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||