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

fix card

release_toaliyun_real
lin 3 лет назад
Родитель
Сommit
fc50cc6262
11 измененных файлов: 415 добавлений и 298 удалений
  1. +70
    -70
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardInfoController.java
  2. +21
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java
  3. +50
    -50
      mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java
  4. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java
  5. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantSubsidy.java
  6. +16
    -16
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java
  7. +0
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java
  8. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantSubsidyMapper.java
  9. +194
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  10. +31
    -149
      mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml
  11. +22
    -0
      mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml

+ 70
- 70
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardInfoController.java Просмотреть файл

@@ -83,76 +83,76 @@ public class WxCardInfoController extends BaseController {
return new ResultData(page);
}

@ApiOperation("C端扫B端储值卡交易流水(消费记录 + 补贴)列表接口")
@GetMapping("cardSpendlist")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
@SystemControllerLog(description = "储值卡支付-储值卡交易流水")
public ResultData cardSpendlist(@ModelAttribute WxCardSpendVo wxCardSpendVo, Integer pageNum, Integer pageSize) {
String ipStr = getIpAddr();
logger.info("cardPay/cardSpendlist: " + ipStr);
if (wxCardSpendVo == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
}
wxCardSpendVo.updateTenantInfo(getTenantInfo());
if(StringUtils.isNotBlank(wxCardSpendVo.getPayStatusStr())) {
String [] statusAttr = wxCardSpendVo.getPayStatusStr().split(",");
List<Integer> tmpList = new ArrayList<Integer>();
for(String status: statusAttr) {
tmpList.add(Integer.valueOf(status));
}
if(!tmpList.isEmpty()) {
wxCardSpendVo.setPayStatusS(tmpList);
}
}
List<Integer> sources = new ArrayList<Integer>();
sources.add(EnumMerchantSubsidySource.CARD.getCode());
wxCardSpendVo.setSources(sources);
wxCardSpendVo.setCardSpendListShow(1);
final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize);
return new ResultData(page);
}
@ApiOperation("C端扫B端储值卡交易流水SUM")
@GetMapping("sum")
@SystemControllerLog(description = "储值卡支付-储值卡交易流水SUM")
public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
String ipStr = getIpAddr();
logger.info("cardPay/sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
if (wxCardSpend == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
}
wxCardSpend.updateTenantInfo(getTenantInfo());
List<Integer> sources = new ArrayList<Integer>();
sources.add(EnumMerchantSubsidySource.CARD.getCode());
wxCardSpend.setSources(sources);
wxCardSpend.setCardSpendListShow(1);
final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend);
return new ResultData(mapList);
}
@ApiOperation("交易流水导出")
@GetMapping("/exportData")
@SystemControllerLog(description = "储值卡支付-储值卡交易流水导出")
public void exportData(@ModelAttribute WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) {
logger.info("[" + getIpAddr() + "] cardPay/exportData");
if (wxCardSpendVo == null) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
}
wxCardSpendVo.updateTenantInfo(getTenantInfo());
if(StringUtils.isNotBlank(wxCardSpendVo.getPayStatusStr())) {
String [] statusAttr = wxCardSpendVo.getPayStatusStr().split(",");
List<Integer> tmpList = new ArrayList<Integer>();
for(String status: statusAttr) {
tmpList.add(Integer.valueOf(status));
}
if(!tmpList.isEmpty()) {
wxCardSpendVo.setPayStatusS(tmpList);
}
}
wxCardSpendService.exportData(wxCardSpendVo, request, response);
}
// @ApiOperation("C端扫B端储值卡交易流水(消费记录 + 补贴)列表接口")
// @GetMapping("cardSpendlist")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// @SystemControllerLog(description = "储值卡支付-储值卡交易流水")
// public ResultData cardSpendlist(@ModelAttribute WxCardSpendVo wxCardSpendVo, Integer pageNum, Integer pageSize) {
// String ipStr = getIpAddr();
// logger.info("cardPay/cardSpendlist: " + ipStr);
// if (wxCardSpendVo == null) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
// }
// wxCardSpendVo.updateTenantInfo(getTenantInfo());
// if(StringUtils.isNotBlank(wxCardSpendVo.getPayStatusStr())) {
// String [] statusAttr = wxCardSpendVo.getPayStatusStr().split(",");
// List<Integer> tmpList = new ArrayList<Integer>();
// for(String status: statusAttr) {
// tmpList.add(Integer.valueOf(status));
// }
// if(!tmpList.isEmpty()) {
// wxCardSpendVo.setPayStatusS(tmpList);
// }
// }
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpendVo.setSources(sources);
// wxCardSpendVo.setCardSpendListShow(1);
// final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize);
// return new ResultData(page);
// }
//
// @ApiOperation("C端扫B端储值卡交易流水SUM")
// @GetMapping("sum")
// @SystemControllerLog(description = "储值卡支付-储值卡交易流水SUM")
// public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
// String ipStr = getIpAddr();
// logger.info("cardPay/sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
// if (wxCardSpend == null) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
// }
// wxCardSpend.updateTenantInfo(getTenantInfo());
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpend.setSources(sources);
// wxCardSpend.setCardSpendListShow(1);
// final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend);
// return new ResultData(mapList);
// }
//
// @ApiOperation("交易流水导出")
// @GetMapping("/exportData")
// @SystemControllerLog(description = "储值卡支付-储值卡交易流水导出")
// public void exportData(@ModelAttribute WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) {
// logger.info("[" + getIpAddr() + "] cardPay/exportData");
// if (wxCardSpendVo == null) {
// throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
// }
// wxCardSpendVo.updateTenantInfo(getTenantInfo());
// if(StringUtils.isNotBlank(wxCardSpendVo.getPayStatusStr())) {
// String [] statusAttr = wxCardSpendVo.getPayStatusStr().split(",");
// List<Integer> tmpList = new ArrayList<Integer>();
// for(String status: statusAttr) {
// tmpList.add(Integer.valueOf(status));
// }
// if(!tmpList.isEmpty()) {
// wxCardSpendVo.setPayStatusS(tmpList);
// }
// }
// wxCardSpendService.exportData(wxCardSpendVo, request, response);
// }

@ApiOperation("更新卡消费支付状态")
@PostMapping("/updatePayStatus")


+ 21
- 5
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java Просмотреть файл

@@ -114,12 +114,28 @@ public class WxCardPayController extends BaseController {
return new ResultData(page);
}

@ApiOperation("C端扫B端储值卡交易流水SUM")
@GetMapping("sum")
// @ApiOperation("C端扫B端储值卡交易流水SUM")
// @GetMapping("sum")
// @SystemControllerLog(description = "储值卡支付-储值卡交易流水SUM")
// public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
// String ipStr = getIpAddr();
// logger.info("cardPay/sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
// if (wxCardSpend == null) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
// }
// wxCardSpend.updateTenantInfo(getTenantInfo());
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpend.setSources(sources);
// wxCardSpend.setCardSpendListShow(1);
// final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend);
// return new ResultData(mapList);
// }
@ApiOperation("储值卡交易流水SUM")
@GetMapping("sumCard")
@SystemControllerLog(description = "储值卡支付-储值卡交易流水SUM")
public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
String ipStr = getIpAddr();
logger.info("cardPay/sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
public ResultData sumCard(@ModelAttribute WxCardSpendVo wxCardSpend) {
if (wxCardSpend == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空");
}


+ 50
- 50
mallinkCApi/src/main/java/com/iformall/controller/WxCardPayController.java Просмотреть файл

@@ -199,54 +199,54 @@ public class WxCardPayController extends BaseController {
}
@ApiOperation("C端扫B端储值卡交易流水列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData cardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend, Integer pageNum, Integer pageSize) {
String ipStr = getIpAddr();
logger.info("list: " + ipStr + " :" + wxCardSpend.toString());
Long memberId;
try {
memberId = getMemberId();
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}
return cardSpendList(wxCardSpend,memberId, pageNum, pageSize);
}
private ResultData cardSpendList(WxCardSpendVo wxCardSpend,Long cUserId,Integer pageNum, Integer pageSize) {
if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
wxCardSpend.updateTenantInfo(getTenantInfo());
wxCardSpend.setOwnerId(cUserId);
List<Integer> sources = new ArrayList<Integer>();
sources.add(EnumMerchantSubsidySource.CARD.getCode());
wxCardSpend.setSources(sources);
wxCardSpend.setCardSpendListShow(1);
final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize);
return new ResultData(page);
}
@ApiOperation("C端扫B端储值卡交易流水SUM接口")
@GetMapping("sum")
public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
String ipStr = getIpAddr();
logger.info("sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
Long memberId;
try {
memberId = getMemberId();
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}
return sumCardSpendList(wxCardSpend,memberId);
}
private ResultData sumCardSpendList(WxCardSpendVo wxCardSpend,Long cUserId) {
if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
wxCardSpend.updateTenantInfo(getTenantInfo());
wxCardSpend.setOwnerId(cUserId);
final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForOwner(wxCardSpend);
return new ResultData(mapList);
}
// @ApiOperation("C端扫B端储值卡交易流水列表接口")
// @GetMapping("list")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// public ResultData cardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend, Integer pageNum, Integer pageSize) {
// String ipStr = getIpAddr();
// logger.info("list: " + ipStr + " :" + wxCardSpend.toString());
// Long memberId;
// try {
// memberId = getMemberId();
// } catch (Exception e) {
// return new ResultData(Result.ERROR,e.getMessage());
// }
// return cardSpendList(wxCardSpend,memberId, pageNum, pageSize);
// }
//
// private ResultData cardSpendList(WxCardSpendVo wxCardSpend,Long cUserId,Integer pageNum, Integer pageSize) {
// if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
// wxCardSpend.updateTenantInfo(getTenantInfo());
// wxCardSpend.setOwnerId(cUserId);
// List<Integer> sources = new ArrayList<Integer>();
// sources.add(EnumMerchantSubsidySource.CARD.getCode());
// wxCardSpend.setSources(sources);
// wxCardSpend.setCardSpendListShow(1);
// final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize);
// return new ResultData(page);
// }
//
// @ApiOperation("C端扫B端储值卡交易流水SUM接口")
// @GetMapping("sum")
// public ResultData sumCardSpendList(@ModelAttribute WxCardSpendVo wxCardSpend) {
// String ipStr = getIpAddr();
// logger.info("sumCardSpendList: " + ipStr + " :" + wxCardSpend.toString());
// Long memberId;
// try {
// memberId = getMemberId();
// } catch (Exception e) {
// return new ResultData(Result.ERROR,e.getMessage());
// }
// return sumCardSpendList(wxCardSpend,memberId);
// }
//
// private ResultData sumCardSpendList(WxCardSpendVo wxCardSpend,Long cUserId) {
// if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo();
// wxCardSpend.updateTenantInfo(getTenantInfo());
// wxCardSpend.setOwnerId(cUserId);
// final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForOwner(wxCardSpend);
// return new ResultData(mapList);
// }
}

+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCardSpend.java Просмотреть файл

@@ -21,14 +21,20 @@ public class WxCardSpend extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="储值卡ID",name="cardId")
private Long cardId;
@TableField(exist = false)
private List<Long> cardIdList;
@io.swagger.annotations.ApiModelProperty(value="持有人ID",name="ownerId")
private Long ownerId;
@TableField(exist = false)
private List<Long> ownerIdList;
@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
private Long merchantId;

@Excel(name = "订单号", width = 20, orderNum = "5")
@io.swagger.annotations.ApiModelProperty(value="订单账号",name="orderId")
private Long orderId;
@TableField(exist = false)
private List<Long> orderIdList;
@io.swagger.annotations.ApiModelProperty(value="POS订单账号",name="posOrderId")
private Long posOrderId;
@io.swagger.annotations.ApiModelProperty(value="ip地址",name="ip")


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantSubsidy.java Просмотреть файл

@@ -32,6 +32,8 @@ public class WxMerchantSubsidy extends TenantEntity {
@Excel(name="交易单号",width = 20,orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId")
private Long orderId;
@TableField(exist = false)
private List<Long> orderIdList;

@io.swagger.annotations.ApiModelProperty(value="订单支付类型(0:券1:付款码支付,2:C扫码支付,3,储值卡)",name="orderType")
private Integer orderType;
@@ -139,4 +141,6 @@ public class WxMerchantSubsidy extends TenantEntity {
@Excel(name = "结算来源", width = 20, orderNum = "3", replace = {"补贴_0", "卡消费_1", "券核销_2", "砍价核销_3", "拼团核销_4", "收银分账_5", " _-1"})
@io.swagger.annotations.ApiModelProperty(value = "结算来源0补贴1卡消费2券核销3砍价核销4拼团核销5收银分账", name = "source")
private Integer source;
@TableField(exist = false)
private List<Integer> sourceList;
}

+ 16
- 16
mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java Просмотреть файл

@@ -16,31 +16,33 @@ import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
public class WxCardSpendVo extends WxCardSpend {

@io.swagger.annotations.ApiModelProperty(value="卡类型EnumCardInfoType",name="cardType")
@Excel(name = "卡类型", width = 20,replace = {"电子卡_0","实体卡_1"}, orderNum = "1")
private Integer cardType;
@Excel(name = "卡号", width = 20, orderNum = "2")
@io.swagger.annotations.ApiModelProperty(value="卡号",name="cardId")
private Long cardId;
@Excel(name = "消费者", width = 20, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="持有人昵称",name="onickName")
private String onickName;
@Excel(name = "手机", width = 20, orderNum = "4")
@io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone")
private String ouPhone;
/**卡信息*/
@io.swagger.annotations.ApiModelProperty(value="卡券名称",name="title")
@Excel(name = "卡名称", width = 20, orderNum = "3")
@Excel(name = "卡名称", width = 20, orderNum = "5")
private String title;

@io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName")
@Excel(name = "消费商户", width = 20, orderNum = "4")
@Excel(name = "消费商户", width = 20, orderNum = "6")
private String merchantName;

@Excel(name = "补贴额(包含通道费)", width = 20, orderNum = "6")
@io.swagger.annotations.ApiModelProperty(value="补贴额(包含通道费)",name="subsidy")
private Integer subsidy;
@Excel(name = "线上补贴额/实收补贴额(通道费扣除)", width = 20, orderNum = "7")
@io.swagger.annotations.ApiModelProperty(value="线上补贴额/实收补贴额(通道费扣除)",name="realSubsidy")
private Integer realSubsidy;
@io.swagger.annotations.ApiModelProperty(value="补贴状态(0:未补贴, 1:已补贴)",name="status")
private Integer status;

@Excel(name = "消费者", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="持有人昵称",name="onickName")
private String onickName;


@Excel(name = "手机", width = 20, orderNum = "2")
@io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="ouPhone")
private String ouPhone;
@io.swagger.annotations.ApiModelProperty(value="账单来源查询条件",name="sources")
@TableField(exist = false)
private List<Integer> sources;
@@ -54,7 +56,5 @@ public class WxCardSpendVo extends WxCardSpend {
private Date couponOnlineStartDate;
@TableField(exist = false)
private Date couponOnlineEndDate;
@TableField(exist = false)
private List<Long> cardIdList;

}

+ 0
- 2
mallinkService/src/main/java/com/iformall/mapper/WxCardSpendMapper.java Просмотреть файл

@@ -15,8 +15,6 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> {

List<Map<String,Object>> getMerchantCount(WxCardSpend wxCardSpend);

List<WxCardSpendVo> findCardSpendVoList(WxCardSpendVo wxCardSpend);

List<Map<String,Object>> sumCardSpendVoForMerchant(WxCardSpendVo wxCardSpend);

List<Map<String,Object>> sumCardSpendVoForOwner(WxCardSpendVo wxCardSpend);


+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxMerchantSubsidyMapper.java Просмотреть файл

@@ -13,6 +13,7 @@ public interface WxMerchantSubsidyMapper extends CommonMapper<WxMerchantSubsidy,
WxMerchantSubsidy selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxMerchantSubsidy> findList(WxMerchantSubsidy wxMerchantSubsidy);
List<Long> findOrderIdList(WxMerchantSubsidy wxMerchantSubsidy);

int updateByCond(WxMerchantSubsidy wxMerchantSubsidy);



+ 194
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
package com.iformall.service.impl;

import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -12,6 +13,7 @@ import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.PromotionCalc;
import com.iformall.domain.vo.WxCardSpendVo;
import com.iformall.domain.vo.WxCardVo;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
@@ -20,6 +22,7 @@ import com.iformall.utils.Constant;
import com.iformall.utils.PayUtils;
import com.iformall.utils.RedisLock;

import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +33,11 @@ import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@@ -93,6 +100,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
@Autowired
WxCouponChannelMapper wxCouponChannelMapper;
@Autowired
WxCUserBasicInfoMapper wxCUserBasicInfoMapper;
@Override
public WxCouponMerchant checkMerchantInCoupon(WxCardInfo cardInfo, Long merchantId) {
WxCouponMerchant couponMerchant = null;
@@ -394,15 +404,168 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
return false;
}

private List<WxCardSpendVo> handleToCardSpendVoList(List<WxCardSpend> list,TenantEntity tenantEntity) {
if (null != list && list.size() > 0 ){
List<Long> merchantIdList = new ArrayList<Long>();
List<Long> cardInfoIdList = new ArrayList<Long>();
List<Long> merchantSubsidyOrderIdList = new ArrayList<Long>();
List<Long> userIdList = new ArrayList<Long>();
List<Long> couponIdList = new ArrayList<Long>();
for (int i = 0 ; i < list.size(); i++ ){
WxCardSpend _wcs = list.get(i);
if (null != _wcs.getMerchantId() && (!merchantIdList.contains(_wcs.getMerchantId()))) {
merchantIdList.add(_wcs.getMerchantId()) ;
}
if (null != _wcs.getCardId() && (!cardInfoIdList.contains(_wcs.getCardId()))) {
cardInfoIdList.add(_wcs.getCardId()) ;
}
if (null != _wcs.getOrderId() && (!merchantSubsidyOrderIdList.contains(_wcs.getOrderId()))) {
merchantSubsidyOrderIdList.add(_wcs.getOrderId()) ;
}
if (null != _wcs.getOwnerId() && (!userIdList.contains(_wcs.getOwnerId()))) {
userIdList.add(_wcs.getOwnerId()) ;
}
}
Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>();
if (merchantIdList.size() > 0 ){
WxMerchant mq = new WxMerchant();
mq.updateTenantInfo(tenantEntity);
mq.setIds(merchantIdList);
List<WxMerchant> merchantList = wxMerchantMapper.findList(mq);
if (null != merchantList && merchantList.size() > 0 ){
for (int i = 0 ;i < merchantList.size();i++){
WxMerchant m = merchantList.get(i);
merchantMap.put(m.getId(), m);
}
}
}
Map<Long,Long> cardCouponIdMap = new HashMap<Long,Long>();
if (cardInfoIdList.size() > 0 ){
WxCardInfo ciq = new WxCardInfo();
ciq.updateTenantInfo(tenantEntity);
ciq.setIds(cardInfoIdList);
List<WxCardInfo> cardInfoList = wxCardInfoMapper.findList(ciq);
if (null != cardInfoList && cardInfoList.size() > 0 ){
for (int i = 0 ;i < cardInfoList.size();i++){
WxCardInfo ci = cardInfoList.get(i);
if (null != ci.getId() && (!couponIdList.contains(ci.getId()))) {
couponIdList.add(ci.getId()) ;
cardCouponIdMap.put(ci.getId(),ci.getCouponId());
}
}
}
}
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>();
if (couponIdList.size() > 0 ){
WxCoupon cq = new WxCoupon();
cq.updateTenantInfo(tenantEntity);
cq.setIds(couponIdList);
List<WxCoupon> couponList = wxCouponMapper.findList(cq);
if (null != couponList && couponList.size() > 0 ){
for (int i = 0 ;i < couponList.size();i++){
WxCoupon c = couponList.get(i);
couponMap.put(c.getId(),c);
}
}
}
Map<Long,WxMerchantSubsidy> orderSubsidyMap = new HashMap<Long,WxMerchantSubsidy>();
if (merchantSubsidyOrderIdList.size() > 0 ){
WxMerchantSubsidy msq = new WxMerchantSubsidy();
msq.updateTenantInfo(tenantEntity);
msq.setOrderIdList(merchantSubsidyOrderIdList);
List<WxMerchantSubsidy> msqList = wxMerchantSubsidyMapper.findList(msq);
if (null != msqList && msqList.size() > 0 ){
for (int i = 0 ;i < msqList.size();i++){
WxMerchantSubsidy c = msqList.get(i);
orderSubsidyMap.put(c.getOrderId(),c);
}
}
}
Map<Long,WxCUserBasicInfo> userMap = new HashMap<Long,WxCUserBasicInfo>();
if (userIdList.size() > 0 ){
WxCUserBasicInfo u = new WxCUserBasicInfo();
u.setFinalTenantId(tenantEntity.getFinalTenantId());
u.setIds(userIdList);
List<WxCUserBasicInfo> msqList = wxCUserBasicInfoMapper.findList(u);
if (null != msqList && msqList.size() > 0 ){
for (int i = 0 ;i < msqList.size();i++){
WxCUserBasicInfo c = msqList.get(i);
userMap.put(c.getId(),c);
}
}
}
List<WxCardSpendVo> retList = new ArrayList<WxCardSpendVo>();
for (int i = 0 ; i < list.size(); i++ ){
WxCardSpend _wcs = list.get(i);
WxCardSpendVo vo = new WxCardSpendVo();
try {
BeanUtils.copyProperties(vo, _wcs);
if (null != _wcs.getMerchantId()) {
WxMerchant merchant = merchantMap.get(_wcs.getMerchantId());
if (null != merchant) {
vo.setMerchantName(merchant.getName());
}
}
if (null != _wcs.getCardId()) {
Long couponId = cardCouponIdMap.get(_wcs.getCardId());
if (null != couponId) {
WxCoupon coupon = couponMap.get(couponId);
if (null != coupon) {
vo.setTitle(coupon.getTitle());
}
}
}
if (null != _wcs.getOrderId()) {
WxMerchantSubsidy subsidy = orderSubsidyMap.get(_wcs.getOrderId());
if (null != subsidy) {
vo.setSubsidy(subsidy.getSubsidy());
vo.setRealSubsidy(subsidy.getRealSubsidy());
vo.setStatus(subsidy.getStatus());
}
}
if (null != _wcs.getOwnerId()) {
WxCUserBasicInfo user = userMap.get(_wcs.getOwnerId());
if (null != user) {
vo.setOnickName(user.getNickName());
vo.setOuPhone(user.getPhone());
}
}
retList.add(vo);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
return null;
}

@Override
public PageInfo<WxCardSpendVo> listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize) {
handleCouponOnlineStartDate(record);
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record));
handleQueryParam(record);
PageInfo<WxCardSpend> cardInfoPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findList(record));
PageInfo<WxCardSpendVo> pageInfo = new PageInfo<WxCardSpendVo>();
pageInfo.setList(handleToCardSpendVoList(cardInfoPage.getList(),record));
pageInfo.setPageNum(cardInfoPage.getPageNum());
pageInfo.setPageSize(cardInfoPage.getPageSize());
pageInfo.setPages(cardInfoPage.getPages());
pageInfo.setTotal(cardInfoPage.getTotal());
return pageInfo;
}

//处理券投放时间
private void handleCouponOnlineStartDate(WxCardSpendVo record){
private void handleQueryParam(WxCardSpendVo record){
//处理券投放时间
if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) {
WxCouponChannel wxCouponChannelQ = new WxCouponChannel();
wxCouponChannelQ.updateTenantInfo(record);
@@ -423,6 +586,31 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
}
}
}
if (null != record.getStatus() || null != record.getSources() || null != record.getCardSpendListShow()) {
WxMerchantSubsidy subq = new WxMerchantSubsidy();
subq.updateTenantInfo(record);
subq.setStatus(record.getStatus());
subq.setSourceList(record.getSources());
subq.setCardSpendListShow(record.getCardSpendListShow());
List<Long> orderList = wxMerchantSubsidyMapper.findOrderIdList(subq);
if (null == orderList || orderList.size() <=0 ){
record.setId(-999L);
}else {
record.setOrderIdList(orderList);
}
}
if (StringUtils.isNotBlank(record.getOuPhone())) {
WxCUserBasicInfo uq = new WxCUserBasicInfo();
uq.setFinalTenantId(record.getFinalTenantId());
uq.setPhone(record.getOuPhone());
List<Long> uids = wxCUserBasicInfoMapper.findIdList(uq);
if (null == uids || uids.size() <=0 ){
record.setId(-999L);
}else {
record.setOwnerIdList(uids);
}
}
}

@Override
@@ -668,8 +856,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {

@Override
public void exportData(WxCardSpendVo record, HttpServletRequest request, HttpServletResponse response) {
handleCouponOnlineStartDate(record);
List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(record);
handleQueryParam(record);
List<WxCardSpendVo> list = listAsPage(record,0,50000).getList();
excelService.exportExcel(list, null, "卡消费记录", WxCardSpendVo.class, "卡消费记录.xlsx", response, false);
}



+ 31
- 149
mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml Просмотреть файл

@@ -89,10 +89,38 @@
<if test=" null != payFrom ">
and `pay_from` = #{payFrom}
</if>
<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
<if test=" null != startdate">
and `create_date` &gt;= #{startdate}
</if>
<if test="null != enddate">
and `create_date` &lt;= and #{enddate}
</if>
<if test=" null != payStatusS ">
and `pay_status` in
<foreach collection="payStatusS" index="index" item="psItem" open="(" separator="," close=")">
#{psItem}
</foreach>
</if>
<if test=" null != cardIdList ">
and `card_id` in
<foreach collection="cardIdList" index="index" item="cardIdItem" open="(" separator="," close=")">
#{cardIdItem}
</foreach>
</if>
<if test=" null != ownerIdList ">
and owner_id in
<foreach collection="ownerIdList" index="index" item="owneridItem" open="(" separator="," close=")">
#{owneridItem}
</foreach>
</if>
<if test=" null != orderIdList ">
and order_id in
<foreach collection="orderIdList" index="index" item="oidItem" open="(" separator="," close=")">
#{oidItem}
</foreach>
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -229,152 +257,6 @@
group by cs.merchant_id
</select>

<resultMap id="VoResultMap" type="com.iformall.domain.vo.WxCardSpendVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="card_id" jdbcType="BIGINT" property="cardId"/>
<result column="owner_id" jdbcType="BIGINT" property="ownerId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="order_id" jdbcType="BIGINT" property="orderId"/>
<result column="pos_order_id" jdbcType="BIGINT" property="posOrderId"/>
<result column="deduction_amount" jdbcType="INTEGER" property="deductionAmount"/>
<result column="payment" jdbcType="INTEGER" property="payment"/>
<result column="real_payment" jdbcType="INTEGER" property="realPayment"/>
<result column="card_remain_amount" jdbcType="INTEGER" property="cardRemainAmount"/>
<result column="card_before_amount" jdbcType="INTEGER" property="cardBeforeAmount"/>
<result column="card_remain_real_amount" jdbcType="INTEGER" property="cardRemainRealAmount"/>
<result column="card_before_real_amount" jdbcType="INTEGER" property="cardBeforeRealAmount"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="pay_status" jdbcType="INTEGER" property="payStatus"/>

<result column="title" jdbcType="VARCHAR" property="title"/>

<result column="name" jdbcType="VARCHAR" property="merchantName"/>

<result column="subsidy" jdbcType="INTEGER" property="subsidy"/>
<result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy"/>
<result column="status" jdbcType="INTEGER" property="status"/>

<result column="onick_name" jdbcType="VARCHAR" property="onickName"/>
<result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/>
</resultMap>

<sql id="allVoColumns">
cs.`id`,cs.`tenant_id`,cs.`parent_tenant_id`,cs.`card_id`,cs.`owner_id`,cs.`merchant_id`,cs.`order_id`,cs.`deduction_amount`,cs.`payment`,cs.`real_payment`,
cs.`card_remain_amount`,cs.`card_before_amount`,cs.`card_remain_real_amount`,cs.`card_before_real_amount`,
cs.`create_date`,cs.`update_date`, cs.`pay_status`,
m.`name`, c.`title`,
ms.`subsidy`,ms.`real_subsidy`,ms.`status`,
ou.`nick_name` as onick_name, ou.`phone` as ou_phone
</sql>

<sql id="dynamicVoWhereConditions">
where 1 = 1
<if test=" null != id ">
and cs.`id` = #{id}
</if>
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cardId ">
and cs.`card_id` = #{cardId}
</if>
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != merchantId ">
and cs.`merchant_id` = #{merchantId}
</if>
<if test=" null != orderId ">
and cs.`order_id` = #{orderId}
</if>
<if test=" null != deductionAmount ">
and cs.`deduction_amount` = #{deductionAmount}
</if>
<if test=" null != payment ">
and cs.`payment` = #{payment}
</if>
<if test=" null != realPayment ">
and cs.`real_payment` = #{realPayment}
</if>
<if test=" null != cardRemainAmount ">
and cs.`card_remain_amount` = #{cardRemainAmount}
</if>
<if test=" null != cardBeforeAmount ">
and cs.`card_before_amount` = #{cardBeforeAmount}
</if>
<if test=" null != cardRemainRealAmount ">
and cs.`card_remain_real_amount` = #{cardRemainRealAmount}
</if>
<if test=" null != cardBeforeRealAmount ">
and cs.`card_before_real_amount` = #{cardBeforeRealAmount}
</if>
<if test=" null != payStatus ">
and cs.`pay_status` = #{payStatus}
</if>
<if test=" null != status ">
and ms.`status` = #{status}
</if>
<if test=" null != sources ">
and ( ms.source is null or ms.source in
<foreach collection="sources" index="index" item="sourceItem" open="(" separator="," close=")">
#{sourceItem}
</foreach>
)
</if>
<if test=" null != cardSpendListShow ">
and ( ms.card_spend_list_show is null or ms.card_spend_list_show = #{cardSpendListShow} )
</if>

<if test=" null != ouPhone and '' != ouPhone ">
and ou.`phone` = #{ouPhone}
</if>
<if test=" null != startdate and null!=enddate">
and cs.`create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != payStatusS ">
and cs.`pay_status` in
<foreach collection="payStatusS" index="index" item="sItem" open="(" separator="," close=")">
#{sItem}
</foreach>
</if>
<if test=" null != cardIdList ">
and cs.`card_id` in
<foreach collection="cardIdList" index="index" item="cardIdItem" open="(" separator="," close=")">
#{cardIdItem}
</foreach>
</if>
<if test=" null != ids ">
and cs.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
</sql>

<select id="findCardSpendVoList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultMap="VoResultMap">
select
<include refid="allVoColumns"/>
from wx_card_spend cs
left join wx_coupon_order co on co.id = cs.card_id
left join wx_coupon c on c.id = co.coupon_id
left join wx_merchant m on m.id = cs.merchant_id
left join wx_merchant_subsidy ms on ms.order_id = cs.order_id
left join wx_c_user_basic_info ou on ou.id = co.owner_id
<include refid="dynamicVoWhereConditions"/>
order by cs.create_date DESC
</select>

<select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap">
select cs.merchant_id, m.name as merchantName,
IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount,


+ 22
- 0
mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml Просмотреть файл

@@ -94,12 +94,29 @@
and `source` = #{source}
</if>
<if test=" null != cardSpendListShow ">
and ( card_spend_list_show is null or card_spend_list_show = #{cardSpendListShow} )
</if>
<if test=" null != sourceList ">
and (source is null or`source` in
<foreach collection="sourceList" index="index" item="sourceItem" open="(" separator="," close=")">
#{sourceItem}
</foreach>
)
</if>
<if test=" null != statusS ">
and `status` in
<foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")">
#{sItem}
</foreach>
</if>
<if test=" null != orderIdList ">
and order_id in
<foreach collection="orderIdList" index="index" item="oidItem" open="(" separator="," close=")">
#{oidItem}
</foreach>
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -122,6 +139,11 @@
<include refid="dynamicWhereConditions" />
</select>
<select id="findOrderIdList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultType="Long">
select distinct order_id from wx_merchant_subsidy
<include refid="dynamicWhereConditions" />
</select>
<update id="updateByCond" parameterType="com.iformall.domain.po.WxMerchantSubsidy">
update wx_merchant_subsidy
set `status` = #{status}


Загрузка…
Отмена
Сохранить