| @@ -78,6 +78,19 @@ public class WxCouponPasswordController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("批次卡密分页列表接口") | |||||
| @GetMapping("/batchVoList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData batchList(@ModelAttribute WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize) { | |||||
| wxCouponPassword.updateTenantInfo(getTenantInfo()); | |||||
| wxCouponPassword.setSortColumns(BaseEntity.SortField.CreateDate_DESC, BaseEntity.SortField.Id_DESC); | |||||
| final PageInfo<WxCouponPassword> page = wxCouponPasswordService.listAsPage(wxCouponPassword, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -1,3 +1,11 @@ | |||||
| 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 '用户编码'; | |||||
| ###待做####### | |||||
| ##coupon_password_id,coupon_password,c_user_id 刷数据 | |||||
| # 转赠验证wx_coupon_order的c_user_id不变 | |||||
| alter table wx_card_info add column status int(1) not null default 0 comment '状态'; | |||||
| @@ -24,14 +24,18 @@ public class WxCardInfo extends TenantEntity { | |||||
| protected Long id; | protected Long id; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡密编码",name="couponPasswordId") | @io.swagger.annotations.ApiModelProperty(value="卡密编码",name="couponPasswordId") | ||||
| protected Long couponPasswordId; | protected Long couponPasswordId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡密",name="couponPassword") | |||||
| protected String couponPassword; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected Long couponPasswordIdLike; | protected Long couponPasswordIdLike; | ||||
| @TableField(exist = false) | |||||
| protected List<Long> couponPasswordIdList; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡密",name="couponPassword") | |||||
| protected String couponPassword; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡类型EnumCardInfoType",name="type") | @io.swagger.annotations.ApiModelProperty(value="卡类型EnumCardInfoType",name="type") | ||||
| 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") | |||||
| private Long cUserId; | |||||
| @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") | ||||
| @@ -63,6 +67,8 @@ public class WxCardInfo extends TenantEntity { | |||||
| private Date updateDate; | private Date updateDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | ||||
| private Integer supportTransfer; | private Integer supportTransfer; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "状态EnumCardInfoStatus", name = "status") | |||||
| private Integer status; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") | @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") | ||||
| protected Date startdate; | protected Date startdate; | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.vo; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||||
| import com.iformall.domain.po.WxCardInfo; | |||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -58,6 +59,8 @@ public class WxCardCVo extends WxCouponOrder { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected String statusStr; | protected String statusStr; | ||||
| private WxCardInfo wxCardInfo; | |||||
| } | } | ||||
| @@ -0,0 +1,59 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.math.BigDecimal; | |||||
| import java.math.RoundingMode; | |||||
| import java.text.DecimalFormat; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @JsonIgnoreProperties(value = {"handler"}) | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxCouponPasswordVo extends TenantEntity { | |||||
| private static final long serialVersionUID = 6687954932922444531L; | |||||
| @Excel(name = "卡号", width = 20, orderNum = "1", prefix = "`") | |||||
| protected Long id; | |||||
| @Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密", name = "couponPassword") | |||||
| private String couponPassword; | |||||
| @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | |||||
| private Date createDate; | |||||
| @Excel(name = "卡密状态", width = 20, orderNum = "4", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密状态", name = "remainPrice") | |||||
| private Integer status; | |||||
| @Excel(name = "卡激活状态", width = 20, orderNum = "5",replace = {"未激活_0", "已激活_1"}, prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡激活状态EnumYesOrNo", name = "used") | |||||
| private Integer used; | |||||
| @Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "6") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "activeDate") | |||||
| private Date activeDate; | |||||
| @Excel(name = "激活手机号", width = 20, orderNum = "7", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "激活手机号", name = "phone") | |||||
| private String phone; | |||||
| @Excel(name = "激活会员", width = 20, orderNum = "8", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "激活会员", name = "userName") | |||||
| private String userName; | |||||
| @Excel(name = "面额(元)", width = 20, orderNum = "9", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "面额(元)", name = "price") | |||||
| private Double price; | |||||
| @Excel(name = "余额(元)", width = 20, orderNum = "10", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "余额(元)", name = "remainPrice") | |||||
| private Double remainPrice; | |||||
| @Excel(name = "激活卡状态", width = 20, orderNum = "11",replace = {"正常_0", "已禁用_1"}, prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "激活卡状态EnumYesOrNo", name = "used") | |||||
| private Integer cardStatus; | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2019/09/17. | |||||
| */ | |||||
| public enum EnumCardInfoStatus { | |||||
| NORMAL(0, "正常"), | |||||
| STOP(1, "已禁用"); | |||||
| public static EnumCardInfoStatus getEnum(Integer code) { | |||||
| for (EnumCardInfoStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumCardInfoStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -10,8 +10,7 @@ public enum EnumCouponPasswordStatus { | |||||
| MSG_SENDING(1, "消息发送中"), | MSG_SENDING(1, "消息发送中"), | ||||
| MSG_SENDED(2, "消息已发送"), | MSG_SENDED(2, "消息已发送"), | ||||
| USED(3, "已兑换"), | USED(3, "已兑换"), | ||||
| CANCEL(4, "已作废"), | |||||
| PAID(5, "已支付过"),; | |||||
| CANCEL(4, "已作废"); | |||||
| public static EnumCouponPasswordStatus getEnum(Integer code) { | public static EnumCouponPasswordStatus getEnum(Integer code) { | ||||
| for (EnumCouponPasswordStatus value : values()) { | for (EnumCouponPasswordStatus value : values()) { | ||||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | ||||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -21,6 +22,8 @@ public interface WxCouponPasswordService { | |||||
| */ | */ | ||||
| PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize); | ||||
| PageInfo<WxCouponPasswordVo> listVoAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| @@ -2482,6 +2482,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| cvo.setRemainingAmount(cardInfo.getRemainingAmount()); | cvo.setRemainingAmount(cardInfo.getRemainingAmount()); | ||||
| cvo.setSupportTransfer(cardInfo.getSupportTransfer()); | cvo.setSupportTransfer(cardInfo.getSupportTransfer()); | ||||
| } | } | ||||
| cvo.setWxCardInfo(cardInfo); | |||||
| return cvo; | return cvo; | ||||
| } catch (IllegalAccessException | InvocationTargetException e) { | } catch (IllegalAccessException | InvocationTargetException e) { | ||||
| logger.error("getCouponOrderCardCVo error.",e); | logger.error("getCouponOrderCardCVo error.",e); | ||||
| @@ -2521,15 +2522,18 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| //卡券是否存在 | //卡券是否存在 | ||||
| WxCardCVo cardCVo = findCardDetailOfCUser(record.getId(),record.getTenantId()); | WxCardCVo cardCVo = findCardDetailOfCUser(record.getId(),record.getTenantId()); | ||||
| if (cardCVo == null) { | if (cardCVo == null) { | ||||
| logger.info("卡券不存在" + record.getId()); | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| } | } | ||||
| WxCardInfo cardInfo = cardCVo.getWxCardInfo(); | |||||
| if (null == cardInfo) { | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL.getCode(),"cardInfo未查询到"); | |||||
| } | |||||
| //转赠人是否存在 | //转赠人是否存在 | ||||
| Long cUserId = record.getCUserId(); | Long cUserId = record.getCUserId(); | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,cardCVo.getFinalTenantId()); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,cardCVo.getFinalTenantId()); | ||||
| if (wxCUserBasicInfo == null) { | if (wxCUserBasicInfo == null) { | ||||
| logger.info("转赠人不存在:" + cUserId); | |||||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(), "转赠人不存在"); | return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(), "转赠人不存在"); | ||||
| } | } | ||||
| @@ -2560,9 +2564,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| //更新卡拥有者 | //更新卡拥有者 | ||||
| try { | try { | ||||
| record.setCUserId(null); | |||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxCouponOrderMapper.updateById(record); | wxCouponOrderMapper.updateById(record); | ||||
| cardInfo.setCUserId(record.getOwnerId()); | |||||
| cardInfo.setUpdateDate(new Date()); | |||||
| wxCardInfoMapper.updateById(cardInfo); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.info("更新卡拥有者信息失败"); | logger.info("更新卡拥有者信息失败"); | ||||
| throw new MallinkException(ErrorCode.CARD_TRANSFER_INVALID); | throw new MallinkException(ErrorCode.CARD_TRANSFER_INVALID); | ||||
| @@ -3,25 +3,49 @@ 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.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumCouponOrderStatus; | |||||
| import com.iformall.enums.EnumCouponPasswordStatus; | import com.iformall.enums.EnumCouponPasswordStatus; | ||||
| import com.iformall.enums.EnumYesOrNo; | |||||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | ||||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||||
| import com.iformall.domain.vo.WxMerchantProductVo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxCardInfoMapper; | |||||
| 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.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import org.apache.commons.beanutils.BeanUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| 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 javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.lang.reflect.InvocationTargetException; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.Iterator; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| import java.util.Random; | import java.util.Random; | ||||
| @Service | @Service | ||||
| @@ -30,6 +54,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponPasswordMapper wxCouponPasswordMapper; | WxCouponPasswordMapper wxCouponPasswordMapper; | ||||
| @Autowired | |||||
| WxCardInfoMapper wxCardInfoMapper; | |||||
| @Lazy | |||||
| @Autowired | |||||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | @Autowired | ||||
| ExcelService excelService; | ExcelService excelService; | ||||
| @@ -38,6 +67,92 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCouponPasswordVo> listVoAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | |||||
| PageInfo<WxCouponPassword> passwordPage = listAsPage(record,pageIndex,pageSize); | |||||
| PageInfo<WxCouponPasswordVo> retPageInfo = new PageInfo(); | |||||
| retPageInfo.setPageNum(pageIndex); | |||||
| retPageInfo.setPageSize(pageSize); | |||||
| retPageInfo.setPages(passwordPage.getPages()); | |||||
| retPageInfo.setTotal(passwordPage.getTotal()); | |||||
| retPageInfo.setList(handleQueryResult(passwordPage.getList(), record)); | |||||
| return retPageInfo; | |||||
| } | |||||
| private List<WxCouponPasswordVo> handleQueryResult(List<WxCouponPassword> list,TenantEntity tenantEntity) { | |||||
| if (null != list && list.size() > 0) { | |||||
| List<Long> couponPasswordIdList = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++ ) { | |||||
| WxCouponPassword bo = list.get(i); | |||||
| if (null != bo.getId() && (!couponPasswordIdList.contains(bo.getId()))) { | |||||
| couponPasswordIdList.add(bo.getId()); | |||||
| } | |||||
| } | |||||
| List<Long> cUserIdList = new ArrayList<Long>(); | |||||
| Map<Long,WxCardInfo> passwordCardInfoMap = new HashMap<Long,WxCardInfo>(); | |||||
| if (couponPasswordIdList.size() > 0 ) { | |||||
| WxCardInfo cardInfoQ = new WxCardInfo(); | |||||
| cardInfoQ.updateTenantInfo(tenantEntity); | |||||
| cardInfoQ.setCouponPasswordIdList(couponPasswordIdList); | |||||
| List<WxCardInfo> cardList = wxCardInfoMapper.findList(cardInfoQ); | |||||
| if (null != cardList && cardList.size() > 0) { | |||||
| for (int i = 0 ; i < cardList.size(); i++) { | |||||
| WxCardInfo ci = cardList.get(i); | |||||
| passwordCardInfoMap.put(ci.getCouponPasswordId(), ci); | |||||
| if (null != ci.getCUserId() && (!cUserIdList.contains(ci.getCUserId()))) { | |||||
| cUserIdList.add(ci.getCUserId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); | |||||
| if (cUserIdList.size() > 0) { | |||||
| WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); | |||||
| cUserBasicInfoQ.setIds(cUserIdList); | |||||
| 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); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<WxCouponPasswordVo> retList = new ArrayList<WxCouponPasswordVo>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++) { | |||||
| WxCouponPassword coo = list.get(i); | |||||
| WxCouponPasswordVo co = new WxCouponPasswordVo(); | |||||
| WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); | |||||
| co.setId(coo.getId()); | |||||
| co.setCouponPassword(coo.getPassword()); | |||||
| if (null != cardInfo) { | |||||
| co.setUsed(EnumYesOrNo.YES.getCode()); | |||||
| co.setPrice(new BigDecimal(cardInfo.getAmount()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); | |||||
| co.setRemainPrice(new BigDecimal(cardInfo.getRateAmount()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); | |||||
| co.setActiveDate(cardInfo.getCreateDate()); | |||||
| WxCUserBasicInfo basicInfo = cUserMap.get(cardInfo.getCUserId()); | |||||
| if (null != basicInfo) { | |||||
| co.setPhone(basicInfo.getPhone()); | |||||
| co.setUserName(basicInfo.getName()); | |||||
| } | |||||
| co.setCardStatus(cardInfo.getStatus()); | |||||
| }else { | |||||
| co.setUsed(EnumYesOrNo.NO.getCode()); | |||||
| } | |||||
| co.setStatus(coo.getStatus()); | |||||
| co.setCreateDate(coo.getCreateDate()); | |||||
| retList.add(co); | |||||
| } | |||||
| return retList; | |||||
| } | |||||
| return new ArrayList<WxCouponPasswordVo>(); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponPassword getById(Long id) { | public WxCouponPassword getById(Long id) { | ||||
| @@ -1456,7 +1456,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| cardInfo.setAmount(coupon.getPrice()); | cardInfo.setAmount(coupon.getPrice()); | ||||
| cardInfo.setSaleAmount(coupon.getSalePrice()); | cardInfo.setSaleAmount(coupon.getSalePrice()); | ||||
| cardInfo.setCouponPasswordId(couponPassWord.getId()); | cardInfo.setCouponPasswordId(couponPassWord.getId()); | ||||
| cardInfo.setCouponPassword(couponPassWord.getPassword()); | |||||
| cardInfo.setCouponPassword(couponPassWord.getPassword()); | |||||
| cardInfo.setCUserId(user.getId()); | |||||
| cardInfo.setRemainingAmount(coupon.getPrice()); | cardInfo.setRemainingAmount(coupon.getPrice()); | ||||
| if (!coupon.checkIsFree()) { | if (!coupon.checkIsFree()) { | ||||
| //判断该transctionId是否已经存在,如果存在,则不添加 | //判断该transctionId是否已经存在,如果存在,则不添加 | ||||
| @@ -1501,7 +1502,6 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| cardInfo.setCreateDate(curr); | cardInfo.setCreateDate(curr); | ||||
| cardInfo.setUpdateDate(curr); | cardInfo.setUpdateDate(curr); | ||||
| cardInfo.setSupportTransfer(coupon.getSupportTransfer()); | cardInfo.setSupportTransfer(coupon.getSupportTransfer()); | ||||
| //检查卡是否下架,如果是,不可转赠 | //检查卡是否下架,如果是,不可转赠 | ||||
| WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectById(order.getCouponChannelId(),order.getTenantId()); | WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectById(order.getCouponChannelId(),order.getTenantId()); | ||||
| if (wxCouponChannel != null && wxCouponChannel.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { | if (wxCouponChannel != null && wxCouponChannel.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { | ||||
| @@ -6,6 +6,7 @@ | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <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="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" /> | ||||
| @@ -22,25 +23,25 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_password_id`,`coupon_password`,`transaction_id`, | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`c_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> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| where `tenant_id` = #{tenantId} | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != couponId "> | <if test=" null != couponId "> | ||||
| and `coupon_id` = #{couponId} | and `coupon_id` = #{couponId} | ||||
| </if> | </if> | ||||
| <if test=" null != cUserId "> | |||||
| and `c_user_id` = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != transactionId "> | <if test=" null != transactionId "> | ||||
| and `transaction_id` = #{transactionId} | and `transaction_id` = #{transactionId} | ||||
| </if> | </if> | ||||
| @@ -83,6 +84,12 @@ | |||||
| <if test=" null != startdate and null!=enddate"> | <if test=" null != startdate and null!=enddate"> | ||||
| and `create_date` between #{startdate} and #{enddate} | and `create_date` between #{startdate} and #{enddate} | ||||
| </if> | </if> | ||||
| <if test=" null != couponPasswordIdList "> | |||||
| and coupon_password_id in | |||||
| <foreach collection="couponPasswordIdList" index="index" item="cpidItem" open="(" separator="," close=")"> | |||||
| #{cpidItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != couponIdList "> | <if test=" null != couponIdList "> | ||||
| and coupon_id in | and coupon_id in | ||||
| <foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")"> | <foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")"> | ||||