diff --git a/mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql b/mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql index 0a2966558..81642c761 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V2023030300001__card.sql @@ -1,6 +1,6 @@ alter table wx_coupon_password add column price int(11) not null default 0 comment '面额'; -update wx_coupon_password cp , wx_coupon_89 c on cp.coupon_id = c.id set cp.price = c.price where cp.price = 0 and c.price > 0 ; +update wx_coupon_password cp inner join wx_coupon_89 c on cp.coupon_id = c.id set cp.price = c.price where cp.price = 0 and c.price > 0 ; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java index bed469f21..ea62ddfaf 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordVo.java @@ -25,43 +25,45 @@ public class WxCouponPasswordVo extends TenantEntity { @Excel(name = "卡号", width = 20, orderNum = "1", prefix = "`") protected Long id; - @Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`") + @Excel(name = "卡名称", width = 20, orderNum = "2", prefix = "`") + protected String couponTitile; + @Excel(name = "卡密", width = 20, orderNum = "3", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "卡密", name = "couponPassword") private String couponPassword; - @Excel(name = "卡密面额", width = 20, orderNum = "2", prefix = "`") + @Excel(name = "卡密面额(分)", width = 20, orderNum = "4", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "卡密面额", name = "couponPasswordPrice") private Integer couponPasswordPrice; - @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3") + @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "5") @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") private Date createDate; - @Excel(name = "卡密状态", width = 20, orderNum = "4", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`") + @Excel(name = "卡密状态", width = 20, orderNum = "6", 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 = "`") + @Excel(name = "卡密是否停用", width = 20, orderNum = "7", replace = {"否_0", "是_1"},prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "卡密是否停用", name = "isStop") private Integer isStop; - @Excel(name = "卡激活状态", width = 20, orderNum = "6",replace = {"未激活_0", "已激活_1"}, prefix = "`") + @Excel(name = "卡激活状态", width = 20, orderNum = "8",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 = "7") + @Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9") @io.swagger.annotations.ApiModelProperty(value = "", name = "activeDate") private Date activeDate; - @Excel(name = "激活手机号", width = 20, orderNum = "8", prefix = "`") + @Excel(name = "激活手机号", width = 20, orderNum = "10", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "激活手机号", name = "phone") private String phone; - @Excel(name = "激活会员", width = 20, orderNum = "9", prefix = "`") + @Excel(name = "激活会员", width = 20, orderNum = "11", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "激活会员", name = "userName") private String userName; - @Excel(name = "电子卡卡号", width = 20, orderNum = "10", prefix = "`") + @Excel(name = "电子卡卡号", width = 20, orderNum = "12", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "电子卡卡号", name = "cardId") private Long cardId; - @Excel(name = "面额(元)", width = 20, orderNum = "11", prefix = "`") + @Excel(name = "面额(元)", width = 20, orderNum = "13", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "面额(元)", name = "price") private Double price; - @Excel(name = "余额(元)", width = 20, orderNum = "12", prefix = "`") + @Excel(name = "余额(元)", width = 20, orderNum = "14", prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "余额(元)", name = "remainPrice") private Double remainPrice; - @Excel(name = "电子卡状态", width = 20, orderNum = "13",replace = {"正常_0", "已禁用_1"}, prefix = "`") + @Excel(name = "电子卡状态", width = 20, orderNum = "15",replace = {"正常_0", "已禁用_1"}, prefix = "`") @io.swagger.annotations.ApiModelProperty(value = "电子卡状态EnumYesOrNo", name = "cardStatus") private Integer cardStatus; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java index 46fb4aef0..c815e4a5c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java @@ -22,6 +22,7 @@ import com.iformall.domain.vo.WxMerchantProductVo; import com.iformall.common.ErrorCode; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCardInfoMapper; +import com.iformall.mapper.WxCouponMapper; import com.iformall.mapper.WxCouponPasswordMapper; import com.iformall.service.ExcelService; import com.iformall.service.WxCUserBasicInfoService; @@ -59,6 +60,8 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { @Lazy @Autowired WxCUserBasicInfoService wxCUserBasicInfoService; + @Autowired + WxCouponMapper wxCouponMapper; @Autowired ExcelService excelService; @@ -83,13 +86,31 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { private List handleQueryResult(List list,TenantEntity tenantEntity) { if (null != list && list.size() > 0) { List couponPasswordIdList = new ArrayList(); + List couponIdList = new ArrayList(); 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()); } + if (null != bo.getCouponId() && (!couponIdList.contains(bo.getCouponId()))) { + couponIdList.add(bo.getCouponId()); + } } - + + Map couponMap = new HashMap(); + if (couponIdList.size() > 0 ) { + WxCoupon cQ = new WxCoupon(); + cQ.updateTenantInfo(tenantEntity); + cQ.setIds(couponIdList); + List cList = wxCouponMapper.findList(cQ); + if (null != cList && cList.size() > 0) { + for (int i = 0 ; i < cList.size(); i++) { + WxCoupon c = cList.get(i); + couponMap.put(c.getId(), c); + } + } + } + List cUserIdList = new ArrayList(); Map passwordCardInfoMap = new HashMap(); if (couponPasswordIdList.size() > 0 ) { @@ -129,6 +150,12 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { WxCouponPasswordVo co = new WxCouponPasswordVo(); WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); co.setId(coo.getId()); + if (null != coo.getCouponId()) { + WxCoupon coupon = couponMap.get(coo.getCouponId()); + if (null != coupon) { + co.setCouponTitile(coupon.getTitle()); + } + } co.setCouponPassword(coo.getPassword()); co.setCouponPasswordPrice(coo.getPrice()); if (null != cardInfo) {