| @@ -54,7 +54,7 @@ public class WxCardInfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCardSpendService wxCardSpendService; | WxCardSpendService wxCardSpendService; | ||||
| @ApiOperation("批次消费卡的卡列表") | |||||
| @ApiOperation("批次消费卡(已激活电子卡电子卡)的卡列表") | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @@ -1,8 +1,9 @@ | |||||
| alter table wx_card_info add column coupon_password varchar(50) comment '卡密'; | alter table wx_card_info add column coupon_password varchar(50) comment '卡密'; | ||||
| alter table wx_card_info add column c_user_id bigint(20) comment '用户编码'; | |||||
| alter table wx_card_info add column c_user_id bigint(20) comment '购买用户编码'; | |||||
| alter table wx_card_info add column owner_user_id bigint(20) comment '持有用户编码'; | |||||
| ###待做####### | ###待做####### | ||||
| ##coupon_password_id,coupon_password,c_user_id 刷数据 | |||||
| ##coupon_password_id,coupon_password,c_user_id,owner_user_id 刷数据,后两者不能为空 | |||||
| # 转赠验证wx_coupon_order的c_user_id不变 | # 转赠验证wx_coupon_order的c_user_id不变 | ||||
| @@ -173,11 +173,15 @@ public class WxCardPayController extends BaseController { | |||||
| } | } | ||||
| //查看所有者与扫码者是否为一致 | //查看所有者与扫码者是否为一致 | ||||
| WxCouponOrder couponOrder = wxCouponOrderService.getById(cardInfo.getId(),cardInfo.getTenantId()); | |||||
| if (!couponOrder.getOwnerId().equals(cUserId)) { | |||||
| logger.error("卡已被领取: " + cardInfo.getId()); | |||||
| return new ResultData(ErrorCode.CARD_TRANSFERED); | |||||
| } | |||||
| if (!cardInfo.getOwnerUserId().equals(cUserId)) { | |||||
| logger.error("卡已被领取: " + cardInfo.getId()); | |||||
| return new ResultData(ErrorCode.CARD_TRANSFERED); | |||||
| } | |||||
| // WxCouponOrder couponOrder = wxCouponOrderService.getById(cardInfo.getId(),cardInfo.getTenantId()); | |||||
| // if (!couponOrder.getOwnerId().equals(cUserId)) { | |||||
| // logger.error("卡已被领取: " + cardInfo.getId()); | |||||
| // return new ResultData(ErrorCode.CARD_TRANSFERED); | |||||
| // } | |||||
| WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | ||||
| if(couponMerchant == null) { | if(couponMerchant == null) { | ||||
| @@ -77,7 +77,6 @@ public class WxCouponPasswordController extends BaseController { | |||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(500, e.getMessage()); | return new ResultData(500, e.getMessage()); | ||||
| } | } | ||||
| WxCUserBasicInfo member = userService.getById(memberId,getFinalTenantId()); | WxCUserBasicInfo member = userService.getById(memberId,getFinalTenantId()); | ||||
| if(member == null) { | if(member == null) { | ||||
| @@ -34,8 +34,11 @@ public class WxCardInfo extends TenantEntity { | |||||
| protected Integer type; | protected Integer type; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "券ID", name = "couponId") | @io.swagger.annotations.ApiModelProperty(value = "券ID", name = "couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| @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 = "持有用户ID", name = "cUserId") | |||||
| private Long ownerUserId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信订单号-购买类储值卡时的订单号",name="transactionId") | @io.swagger.annotations.ApiModelProperty(value="微信订单号-购买类储值卡时的订单号",name="transactionId") | ||||
| private String transactionId; | private String transactionId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="面额总金额",name="amount") | @io.swagger.annotations.ApiModelProperty(value="面额总金额",name="amount") | ||||
| @@ -8,7 +8,7 @@ import java.util.List; | |||||
| public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> { | public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> { | ||||
| List<WxCardVo> findVoList(WxCardVo wxCardVo); | |||||
| //List<WxCardVo> findVoList(WxCardVo wxCardVo); | |||||
| void updateTransferStatusByCouponId(Long couponId); | void updateTransferStatusByCouponId(Long couponId); | ||||
| @@ -3,22 +3,34 @@ 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.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCardInfo; | import com.iformall.domain.po.WxCardInfo; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCardVo; | import com.iformall.domain.vo.WxCardVo; | ||||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||||
| import com.iformall.enums.EnumCardInfoType; | import com.iformall.enums.EnumCardInfoType; | ||||
| import com.iformall.enums.EnumCouponPasswordStatus; | import com.iformall.enums.EnumCouponPasswordStatus; | ||||
| import com.iformall.enums.EnumCouponPasswordSupport; | import com.iformall.enums.EnumCouponPasswordSupport; | ||||
| import com.iformall.enums.EnumYesOrNo; | |||||
| import com.iformall.mapper.WxCardInfoMapper; | import com.iformall.mapper.WxCardInfoMapper; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | |||||
| import com.iformall.mapper.WxCouponOrderMapper; | |||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxCardInfoService; | import com.iformall.service.WxCardInfoService; | ||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| import org.apache.commons.beanutils.BeanUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -26,8 +38,12 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class WxCardInfoServiceImpl implements WxCardInfoService { | public class WxCardInfoServiceImpl implements WxCardInfoService { | ||||
| @@ -46,11 +62,146 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponPasswordMapper couponPasswordMapper; | WxCouponPasswordMapper couponPasswordMapper; | ||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| @Lazy | |||||
| @Autowired | |||||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | |||||
| WxCouponOrderMapper wxCouponOrderMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { | ||||
| handleCouponOnlineEndDate(record); | handleCouponOnlineEndDate(record); | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findVoList(record)); | |||||
| PageInfo<WxCardInfo> cardInfoPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findList(record)); | |||||
| PageInfo<WxCardVo> pageInfo = new PageInfo<WxCardVo>(); | |||||
| pageInfo.setList(handleToCardVoList(cardInfoPage.getList(),record)); | |||||
| pageInfo.setPageNum(cardInfoPage.getPageNum()); | |||||
| pageInfo.setPageSize(cardInfoPage.getPageSize()); | |||||
| pageInfo.setPages(cardInfoPage.getPages()); | |||||
| pageInfo.setTotal(cardInfoPage.getTotal()); | |||||
| return pageInfo; | |||||
| } | |||||
| private List<WxCardVo> handleToCardVoList(List<WxCardInfo> list,TenantEntity tenantEntity) { | |||||
| if (null != list && list.size() > 0) { | |||||
| List<Long> couponIdList = new ArrayList<Long>(); | |||||
| List<Long> userIdList = new ArrayList<Long>(); | |||||
| List<Long> cardIdList = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++ ) { | |||||
| WxCardInfo bo = list.get(i); | |||||
| if (null != bo.getId() && (!cardIdList.contains(bo.getId()))) { | |||||
| cardIdList.add(bo.getId()); | |||||
| } | |||||
| if (null != bo.getCouponId() && (!couponIdList.contains(bo.getCouponId()))) { | |||||
| couponIdList.add(bo.getCouponId()); | |||||
| } | |||||
| if (null != bo.getCUserId() && (!userIdList.contains(bo.getCUserId()))) { | |||||
| userIdList.add(bo.getCUserId()); | |||||
| } | |||||
| if (null != bo.getOwnerUserId() && (!userIdList.contains(bo.getOwnerUserId()))) { | |||||
| userIdList.add(bo.getOwnerUserId()); | |||||
| } | |||||
| } | |||||
| Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); | |||||
| if (couponIdList.size() > 0 ) { | |||||
| WxCoupon couponQ = new WxCoupon(); | |||||
| couponQ.updateTenantInfo(tenantEntity); | |||||
| couponQ.setIds(couponIdList); | |||||
| List<WxCoupon> couponList = wxCouponMapper.findList(couponQ); | |||||
| if (null != couponList && couponList.size() > 0) { | |||||
| for (int i = 0 ; i < couponList.size(); i++) { | |||||
| WxCoupon ci = couponList.get(i); | |||||
| couponMap.put(ci.getId(), ci); | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
| if (userIdList.size() > 0) { | |||||
| WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); | |||||
| cUserBasicInfoQ.setIds(userIdList); | |||||
| cUserBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||||
| List<WxCUserBasicInfo> cuserList = wxCUserBasicInfoService.listPhoneAndNameByIds(cUserBasicInfoQ); | |||||
| if (null != cuserList) { | |||||
| for (int i = 0 ; i < cuserList.size() ; i++) { | |||||
| WxCUserBasicInfo cbi = cuserList.get(i); | |||||
| cUserMap.put(cbi.getId(), cbi); | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCouponOrder> couponOrderMap = new HashMap<Long,WxCouponOrder>(); | |||||
| if (cardIdList.size() > 0 ) { | |||||
| WxCouponOrder couponOrderQ = new WxCouponOrder(); | |||||
| couponOrderQ.updateTenantInfo(tenantEntity); | |||||
| couponOrderQ.setIds(cardIdList); | |||||
| List<WxCouponOrder> couponOrderList = wxCouponOrderMapper.findList(couponOrderQ); | |||||
| if (null != couponOrderList) { | |||||
| for (int i = 0 ; i < couponOrderList.size(); i ++) { | |||||
| WxCouponOrder co = couponOrderList.get(i); | |||||
| couponOrderMap.put(co.getId(), co); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<WxCardVo> retList = new ArrayList<WxCardVo>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++) { | |||||
| WxCardInfo coo = list.get(i); | |||||
| WxCardVo co = new WxCardVo(); | |||||
| try { | |||||
| BeanUtils.copyProperties(co, coo); | |||||
| //coupon | |||||
| WxCoupon coupon = couponMap.get(coo.getCouponId()); | |||||
| if (null != coupon) { | |||||
| co.setCoverImg(coupon.getCoverImg()); | |||||
| co.setCoverPicture(coupon.getCoverPicture()); | |||||
| co.setDetailPicture(coupon.getDetailPicture()); | |||||
| co.setTitle(coupon.getTitle()); | |||||
| co.setSubTitle(coupon.getSubTitle()); | |||||
| co.setDetail(coupon.getDetail()); | |||||
| co.setUnit(coupon.getUnit()); | |||||
| co.setRemark(coupon.getRemark()); | |||||
| co.setSalePrice(coupon.getSalePrice()); | |||||
| co.setPrice(coupon.getPrice()); | |||||
| co.setSubsidyType(coupon.getSubsidyType()); | |||||
| co.setSubsidyNum(coupon.getSubsidyNum()); | |||||
| } | |||||
| //couponOrder | |||||
| WxCouponOrder couponOrder = couponOrderMap.get(coo.getId()); | |||||
| if (null != couponOrder) { | |||||
| //co.setCuserId(); | |||||
| //co.setOwnerId(); | |||||
| co.setExpiredTime(couponOrder.getExpiredTime()); | |||||
| co.setStatus(couponOrder.getCouponOrderStatus()); | |||||
| } | |||||
| //user | |||||
| WxCUserBasicInfo buyUser = cUserMap.get(coo.getCUserId()); | |||||
| if (null != buyUser) { | |||||
| co.setCnickName(buyUser.getNickName()); | |||||
| } | |||||
| WxCUserBasicInfo owner = cUserMap.get(coo.getCUserId()); | |||||
| if (null != owner) { | |||||
| co.setOnickName(owner.getNickName()); | |||||
| co.setOuPhone(owner.getPhone()); | |||||
| } | |||||
| retList.add(co); | |||||
| }catch(Exception e) { | |||||
| } | |||||
| } | |||||
| return retList; | |||||
| } | |||||
| return new ArrayList<WxCardVo>(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -78,7 +229,8 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| @Override | @Override | ||||
| public void exportData(WxCardVo record, HttpServletRequest request, HttpServletResponse response) { | public void exportData(WxCardVo record, HttpServletRequest request, HttpServletResponse response) { | ||||
| handleCouponOnlineEndDate(record); | handleCouponOnlineEndDate(record); | ||||
| List<WxCardVo> list = wxCardInfoMapper.findVoList(record); | |||||
| List<WxCardInfo> cardInfoList = wxCardInfoMapper.findList(record); | |||||
| List<WxCardVo> list = this.handleToCardVoList(cardInfoList,record); | |||||
| excelService.exportExcel(list, null, "卡订单", WxCardVo.class, "卡订单.xlsx", response, false); | excelService.exportExcel(list, null, "卡订单", WxCardVo.class, "卡订单.xlsx", response, false); | ||||
| } | } | ||||
| @@ -127,6 +279,8 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| updateCPwd.setStatus(EnumCouponPasswordStatus.USED.getCode()); | updateCPwd.setStatus(EnumCouponPasswordStatus.USED.getCode()); | ||||
| couponPasswordMapper.updateById(updateCPwd); | couponPasswordMapper.updateById(updateCPwd); | ||||
| } | } | ||||
| cardInfo.setCUserId(Constant.defaultCUserId); | |||||
| cardInfo.setOwnerUserId(Constant.defaultCUserId); | |||||
| cardInfo.setServiceFeeAmount(0); | cardInfo.setServiceFeeAmount(0); | ||||
| cardInfo.setCreateDate(new Date()); | cardInfo.setCreateDate(new Date()); | ||||
| cardInfo.setUpdateDate(new Date()); | cardInfo.setUpdateDate(new Date()); | ||||
| @@ -7,6 +7,7 @@ | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | ||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | ||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| <result column="owner_user_id" jdbcType="BIGINT" property="ownerUserId" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | ||||
| <result column="amount" jdbcType="INTEGER" property="amount" /> | <result column="amount" jdbcType="INTEGER" property="amount" /> | ||||
| <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" /> | <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" /> | ||||
| @@ -23,7 +24,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`c_user_id`,`coupon_password_id`,`coupon_password`,`transaction_id`, | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`c_user_id`,`owner_user_id`,`coupon_password_id`,`coupon_password`,`transaction_id`, | |||||
| `amount`,`sale_amount`,`remaining_amount`,`service_fee_amount`,`share_fee_amount`,`remaining_share_fee_amount`, | `amount`,`sale_amount`,`remaining_amount`,`service_fee_amount`,`share_fee_amount`,`remaining_share_fee_amount`, | ||||
| `rate_amount`,`create_date`,`update_date`,`support_transfer` | `rate_amount`,`create_date`,`update_date`,`support_transfer` | ||||
| </sql> | </sql> | ||||
| @@ -42,6 +43,9 @@ | |||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and `c_user_id` = #{cUserId} | and `c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| <if test=" null != ownerUserId "> | |||||
| and `owner_user_id` = #{ownerUserId} | |||||
| </if> | |||||
| <if test=" null != transactionId "> | <if test=" null != transactionId "> | ||||
| and `transaction_id` = #{transactionId} | and `transaction_id` = #{transactionId} | ||||
| </if> | </if> | ||||
| @@ -105,144 +109,6 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCardVo"> | |||||
| <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="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | |||||
| <result column="amount" jdbcType="INTEGER" property="amount" /> | |||||
| <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" /> | |||||
| <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" /> | |||||
| <result column="service_fee_amount" jdbcType="INTEGER" property="serviceFeeAmount" /> | |||||
| <result column="share_fee_amount" jdbcType="INTEGER" property="shareFeeAmount" /> | |||||
| <result column="remaining_share_fee_amount" jdbcType="INTEGER" property="remainingShareFeeAmount" /> | |||||
| <result column="rate_amount" jdbcType="INTEGER" property="rateAmount" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture" /> | |||||
| <result column="detail_picture" jdbcType="VARCHAR" property="detailPicture" /> | |||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit" /> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cuserId" /> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||||
| <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="c_nick_name" jdbcType="VARCHAR" property="cnickName"/> | |||||
| <result column="o_nick_name" jdbcType="VARCHAR" property="onickName"/> | |||||
| <result column="ou_phone" jdbcType="VARCHAR" property="ouPhone"/> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| ci.`id`,ci.`tenant_id`,ci.`parent_tenant_id`,ci.`coupon_id`,ci.`transaction_id`, | |||||
| ci.`amount`,ci.`sale_amount`,ci.`remaining_amount`,ci.`service_fee_amount`, | |||||
| ci.`share_fee_amount`,ci.`remaining_share_fee_amount`, ci.`rate_amount`, | |||||
| ci.`create_date`,ci.`update_date`, | |||||
| c.`cover_img`, c.`cover_picture`,c.`detail_picture`,c.`title`, c.`sub_title`, c.`detail`, | |||||
| c.`unit`, c.`remark`, c.`sale_price`, c.`price`, c.`subsidy_type`, c.`subsidy_num`, | |||||
| co.`c_user_id`, co.`owner_id`, co.`expired_time`, co.`coupon_order_status` as status, | |||||
| ou.`nick_name` as c_nick_name, ou.`nick_name` as o_nick_name, ou.`phone` as ou_phone | |||||
| </sql> | |||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and ci.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and ci.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and ci.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and ci.`coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != transactionId "> | |||||
| and ci.`transaction_id` = #{transactionId} | |||||
| </if> | |||||
| <if test=" null != amount "> | |||||
| and ci.`amount` = #{amount} | |||||
| </if> | |||||
| <if test=" null != saleAmount "> | |||||
| and ci.`sale_amount` = #{saleAmount} | |||||
| </if> | |||||
| <if test=" null != remainingAmount "> | |||||
| and ci.`remaining_amount` = #{remainingAmount} | |||||
| </if> | |||||
| <if test=" null != serviceFeeAmount "> | |||||
| and ci.`service_fee_amount` = #{serviceFeeAmount} | |||||
| </if> | |||||
| <if test=" null != shareFeeAmount "> | |||||
| and ci.`share_fee_amount` = #{shareFeeAmount} | |||||
| </if> | |||||
| <if test=" null != remainingShareFeeAmount "> | |||||
| and ci.`remaining_share_fee_amount` = #{remainingShareFeeAmount} | |||||
| </if> | |||||
| <if test=" null != rateAmount "> | |||||
| and ci.`rate_amount` = #{rateAmount} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and ci.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and ci.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and co.`coupon_order_status` = #{status} | |||||
| </if> | |||||
| <if test=" null != ouPhone and '' != ouPhone"> | |||||
| and ou.`phone` = #{ouPhone} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and ci.`create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != onickName and ''!=onickName"> | |||||
| and ou.`nick_name` like concat('%',#{onickName},'%') | |||||
| </if> | |||||
| <if test=" null != statusS "> | |||||
| and co.`coupon_order_status` in | |||||
| <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")"> | |||||
| #{sItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != couponIdList "> | |||||
| and ci.coupon_id in | |||||
| <foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")"> | |||||
| #{cidItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and ci.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| order by ci.id desc | |||||
| </sql> | |||||
| <select id="findVoList" parameterType="com.iformall.domain.vo.WxCardVo" resultMap="VoBaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | |||||
| <!--from (select ci.`id`, ci.`tenant_id`, ci.`coupon_id`, ci.`transaction_id`, ci.`amount`, ci.`sale_amount`, ci.`remaining_amount`, ci.`service_fee_amount`, ci.`share_fee_amount`, ci.`remaining_share_fee_amount`, ci.`rate_amount`, ci.`create_date`, ci.`update_date` from wx_card_info ci where ci.`tenant_id` = #{tenantId}) ci--> | |||||
| from wx_card_info ci | |||||
| left join wx_coupon c on c.id = ci.coupon_id | |||||
| left join wx_coupon_order co on co.id = ci.id | |||||
| left join wx_c_user_basic_info ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| </select> | |||||
| <update id="updateTransferStatusByCouponId" parameterType="Long"> | <update id="updateTransferStatusByCouponId" parameterType="Long"> | ||||
| update wx_card_info set support_transfer=0,update_date=now() where support_transfer=1 and coupon_id=#{couponId} | update wx_card_info set support_transfer=0,update_date=now() where support_transfer=1 and coupon_id=#{couponId} | ||||
| </update> | </update> | ||||