| @@ -8,6 +8,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.ListMerchantDTO; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantRelation; | |||
| @@ -506,4 +507,11 @@ public class WxMerchantController extends BaseController { | |||
| return wxProfitPaymentReceiverService.updateTtReceiverImportStatus(merchant); | |||
| } | |||
| @ApiOperation("全查询商户") | |||
| @GetMapping("/listMerchant") | |||
| public ResultData listMerchant(ListMerchantDTO dto) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::listMerchant"); | |||
| return new ResultData(wxMerchantService.listMerchant(getTenantInfo(), dto)); | |||
| } | |||
| } | |||
| @@ -5,8 +5,10 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.PageMerchantMicroPayDTO; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.PageMerchantMicroPayVO; | |||
| import com.iformall.domain.vo.WxMerchantMicroPayVo; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| import com.iformall.enums.EnumOrderType; | |||
| @@ -18,6 +20,8 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @RestController | |||
| @RequestMapping("wxMerchantMicroPay") | |||
| @@ -69,4 +73,21 @@ public class WxMerchantMicroPayController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("商户收银分页查询") | |||
| @GetMapping("/page") | |||
| public ResultData pageMerchantMicroPay(PageMerchantMicroPayDTO dto) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::pageMerchantMicroPay"); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| PageInfo<PageMerchantMicroPayVO> page = markingDataReportService.pageMerchantMicroPay(dto); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("商户收银导出") | |||
| @GetMapping("/export") | |||
| @SystemControllerLog(description = "收银台-商户收银导出") | |||
| public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::exportMerchantMicroPay"); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| markingDataReportService.exportMerchantMicroPay(dto, response); | |||
| } | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.domain.dto; | |||
| import lombok.Data; | |||
| /** | |||
| * 全查询商户参数 | |||
| * @author xmzhao71 | |||
| * @date 2023-09-11 | |||
| */ | |||
| @Data | |||
| public class ListMerchantDTO { | |||
| /** | |||
| * 商户名称 | |||
| */ | |||
| private String merchantName; | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.domain.dto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import java.util.Date; | |||
| /** | |||
| * a端收银记录分页查询DTO | |||
| * @author xmzhao71 | |||
| * @date 2023-09-11 | |||
| */ | |||
| @Data | |||
| public class PageMerchantMicroPayDTO extends TenantEntity { | |||
| /** | |||
| * 页码 | |||
| */ | |||
| private Integer pageNum; | |||
| /** | |||
| * 每页数量 | |||
| */ | |||
| private Integer pageSize; | |||
| /** | |||
| * 开始时间 例:1999-01-01 00:00:00 | |||
| */ | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| private Date startDate; | |||
| /** | |||
| * 结束时间 例:1999-01-01 23:59:59 | |||
| */ | |||
| @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |||
| private Date endDate; | |||
| /** | |||
| * 商户id | |||
| */ | |||
| private Long merchantId; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| @Data | |||
| public class ExportMerchantMicroPayVO { | |||
| @Excel(name = "订单编号", width = 20, orderNum = "1") | |||
| private Long orderNumber; | |||
| @Excel(name = "订单金额(元)", width = 20, orderNum = "2") | |||
| private String paymentStr; | |||
| @Excel(name = "交易时间", width = 20, orderNum = "3", format = "yyyy-MM-dd HH:mm:ss") | |||
| private Date paymentTime; | |||
| @Excel(name = "订单状态", width = 20, orderNum = "4", replace = {"待付款_0", "已支付_1", "已取消_2", "待退款_3", "已退款_4", "退款失败_5", " _-1"}) | |||
| private Integer orderStatus; | |||
| @Excel(name = "商户名称", width = 20, orderNum = "5") | |||
| private String merchantName; | |||
| @Excel(name = "商户手机号", width = 20, orderNum = "6") | |||
| private String merchantPhone; | |||
| private Long merchantId; | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.domain.vo; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @ApiModel(description = "全查询商户返回数据") | |||
| @Data | |||
| public class ListMerchantVO { | |||
| @ApiModelProperty(value="id") | |||
| private Long id; | |||
| @ApiModelProperty(value="商户名") | |||
| private String merchantName; | |||
| @ApiModelProperty(value = "业态") | |||
| private Integer businessId; | |||
| @ApiModelProperty(value = "手机号") | |||
| private String phone; | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import io.swagger.annotations.ApiModel; | |||
| import lombok.Data; | |||
| @ApiModel(description = "收银分页查询返回数据") | |||
| @Data | |||
| public class PageMerchantMicroPayVO extends WxOrder { | |||
| private Long merchantId; | |||
| private String merchantName; | |||
| private String merchantPhone; | |||
| /** | |||
| * 将PageMerchantMicroPayVO对象转为ExportMerchantMicroPayVO对象 | |||
| * @param data | |||
| * @return {@link ExportMerchantMicroPayVO} | |||
| */ | |||
| public static ExportMerchantMicroPayVO mapping(PageMerchantMicroPayVO data) { | |||
| ExportMerchantMicroPayVO vo = new ExportMerchantMicroPayVO(); | |||
| vo.setOrderNumber(data.getOrderNumber()); | |||
| vo.setPaymentStr(data.getPaymentStr()); | |||
| vo.setPaymentTime(data.getPaymentTime()); | |||
| vo.setOrderStatus(data.getOrderStatus()); | |||
| vo.setMerchantId(data.getMerchantId()); | |||
| return vo; | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.PageMerchantMicroPayDTO; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.*; | |||
| @@ -69,4 +70,11 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<Long> getComposeOrderIds(WxOrder wxOrder); | |||
| SumMicroPayVO sumMicroPay(Map dateMap); | |||
| /** | |||
| * 查询租户的收银记录 | |||
| * @param dto | |||
| * @return {@link List}<{@link PageMerchantMicroPayVO}> | |||
| */ | |||
| List<PageMerchantMicroPayVO> listMerchantMicroPay(PageMerchantMicroPayDTO dto); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.dto.PageMerchantMicroPayDTO; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| @@ -14,7 +15,7 @@ import java.util.Map; | |||
| /** | |||
| * Created by syf on 2018/8/28. | |||
| */ | |||
| public interface MarkingDataReportService { | |||
| public interface MarkingDataReportService { | |||
| Map<String,Object> getCouponData(TenantEntity tenantEntity); | |||
| Map<String,Object> getSceneData(TenantEntity tenantEntity); | |||
| @@ -39,4 +40,15 @@ public interface MarkingDataReportService { | |||
| void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto); | |||
| /** | |||
| * 分页查询收银记录 | |||
| * @param dto | |||
| */ | |||
| PageInfo<PageMerchantMicroPayVO> pageMerchantMicroPay(PageMerchantMicroPayDTO dto); | |||
| /** | |||
| * 导出收银记录 | |||
| * @param dto | |||
| */ | |||
| void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response); | |||
| } | |||
| @@ -1,17 +1,16 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.ListMerchantDTO; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantCorp; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.domain.vo.*; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| @@ -224,4 +223,6 @@ public interface WxMerchantService { | |||
| List<Long> selectByMerchantIds(String merchantName); | |||
| WxMerchant initMerchantByPoi(MallUserInfo user,String poiName,String poiId,String phone) throws Exception; | |||
| List<ListMerchantVO> listMerchant(TenantEntity tenantEntity, ListMerchantDTO dto); | |||
| } | |||
| @@ -3,16 +3,14 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||
| import com.iformall.domain.dto.PageMerchantMicroPayDTO; | |||
| import com.iformall.domain.dto.WxOrderReportDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.service.WxCouponActionLogService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -28,6 +26,7 @@ import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.time.LocalDate; | |||
| import java.util.*; | |||
| import java.util.function.Function; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| @@ -59,6 +58,8 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Lazy | |||
| @Autowired | |||
| @@ -623,6 +624,33 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| excelService.exportExcel(wxUserVisitList, null, "触达用户数", TouchUsersReportVo.class, "触达用户数" + ".xlsx", response, false); | |||
| } | |||
| @Override | |||
| public PageInfo<PageMerchantMicroPayVO> pageMerchantMicroPay(PageMerchantMicroPayDTO dto) { | |||
| PageInfo<PageMerchantMicroPayVO> pageResult = PageHelper.startPage(dto.getPageNum(), dto.getPageSize()).doSelectPageInfo(() -> wxOrderMapper.listMerchantMicroPay(dto)); | |||
| Map<Long, ListMerchantVO> merchantMap = wxMerchantService.listMerchant(dto, null).stream().collect(Collectors.toMap(ListMerchantVO::getId, Function.identity())); | |||
| List<PageMerchantMicroPayVO> result = pageResult.getList().stream().map(x -> { | |||
| ListMerchantVO vo = merchantMap.get(x.getMerchantId()); | |||
| x.setMerchantName(vo.getMerchantName()); | |||
| x.setMerchantPhone(vo.getPhone()); | |||
| return x; | |||
| }).collect(Collectors.toList()); | |||
| pageResult.setList(result); | |||
| return pageResult; | |||
| } | |||
| @Override | |||
| public void exportMerchantMicroPay(PageMerchantMicroPayDTO dto, HttpServletResponse response) { | |||
| List<PageMerchantMicroPayVO> vos = wxOrderMapper.listMerchantMicroPay(dto); | |||
| Map<Long, ListMerchantVO> merchantMap = wxMerchantService.listMerchant(dto, null).stream().collect(Collectors.toMap(ListMerchantVO::getId, Function.identity())); | |||
| List<ExportMerchantMicroPayVO> result = vos.stream().map(PageMerchantMicroPayVO::mapping).map(x -> { | |||
| ListMerchantVO vo = merchantMap.get(x.getMerchantId()); | |||
| x.setMerchantName(vo.getMerchantName()); | |||
| x.setMerchantPhone(vo.getPhone()); | |||
| return x; | |||
| }).collect(Collectors.toList()); | |||
| excelService.exportExcel(result, null, "收银记录", ExportMerchantMicroPayVO.class, "收银记录.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public PageInfo<TouchUsersReportVo> getTouchUsersReportList(MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||
| @@ -8,6 +8,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.ListMerchantDTO; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| @@ -2295,4 +2296,24 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| return merchant; | |||
| } | |||
| @Override | |||
| public List<ListMerchantVO> listMerchant(TenantEntity tenantEntity, ListMerchantDTO dto) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| Optional.ofNullable(dto).ifPresent(x -> wxMerchant.setName(x.getMerchantName())); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(wxMerchant); | |||
| return merchants.stream().map(x -> { | |||
| ListMerchantVO vo = new ListMerchantVO(); | |||
| vo.setId(x.getId()); | |||
| vo.setMerchantName(x.getName()); | |||
| vo.setBusinessId(x.getBusinessId()); | |||
| vo.setPhone(x.getLinkPhone()); | |||
| return vo; | |||
| }).collect(Collectors.toList()); | |||
| } | |||
| } | |||
| @@ -1201,4 +1201,29 @@ | |||
| </if> | |||
| </select> | |||
| <select id="listMerchantMicroPay" resultType="com.iformall.domain.vo.PageMerchantMicroPayVO"> | |||
| SELECT | |||
| 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.`pay_version`, | |||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`,o.`ref_detail`,m.id AS merchantId | |||
| FROM | |||
| wx_order_89 o | |||
| INNER JOIN wx_merchant_b_user mbu ON o.product_id = mbu.id | |||
| INNER JOIN wx_merchant m ON mbu.merchant_id = m.id | |||
| WHERE | |||
| o.order_status = 1 | |||
| AND o.type = 1 | |||
| AND m.status = 1 | |||
| <if test="startDate != null"> | |||
| AND o.create_date <![CDATA[ >= ]]> #{startDate} | |||
| </if> | |||
| <if test="endDate != null"> | |||
| AND o.create_date <![CDATA[ <= ]]> #{endDate} | |||
| </if> | |||
| <if test="merchantId != null"> | |||
| AND m.id = #{merchantId} | |||
| </if> | |||
| ORDER BY | |||
| o.create_date DESC | |||
| </select> | |||
| </mapper> | |||