From 693c96cf64d726da67fbc3210339abc154c749ad Mon Sep 17 00:00:00 2001 From: lin <642018748@qq.com> Date: Thu, 23 Feb 2023 15:59:26 +0800 Subject: [PATCH] fix card --- .../com/iformall/domain/po/WxCardInfo.java | 5 ++- .../com/iformall/domain/po/WxCouponOrder.java | 2 + .../iformall/mapper/WxCouponOrderMapper.java | 1 + .../service/WxCUserBasicInfoService.java | 1 + .../impl/WxCUserBasicInfoServiceImpl.java | 5 +++ .../service/impl/WxCardInfoServiceImpl.java | 43 ++++++++++++++++--- .../mapper/WxCUserBasicInfoMapper.xml | 5 +++ .../resources/mapper/WxCardInfoMapper.xml | 19 +++++++- .../resources/mapper/WxCouponOrderMapper.xml | 12 ++++++ 9 files changed, 83 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java index 894c33230..7d1bef413 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java @@ -36,9 +36,12 @@ public class WxCardInfo extends TenantEntity { private Long couponId; @io.swagger.annotations.ApiModelProperty(value = "购买用户ID", name = "cUserId") private Long cUserId; + @TableField(exist = false) + private List cUserIdList; @io.swagger.annotations.ApiModelProperty(value = "持有用户ID", name = "cUserId") private Long ownerUserId; - + @TableField(exist = false) + private List ownerUserIdList; @io.swagger.annotations.ApiModelProperty(value="微信订单号-购买类储值卡时的订单号",name="transactionId") private String transactionId; @io.swagger.annotations.ApiModelProperty(value="面额总金额",name="amount") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java index 310022023..03211c35d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java @@ -54,6 +54,8 @@ public class WxCouponOrder extends TenantEntity { private Date expiredTime; @io.swagger.annotations.ApiModelProperty(value = "状态:0-待使用 1-已核销 2-已过期 3-已作废 4-卡使用中 5-卡已过期 6-卡已用完 7-卡已线下退款 100-预核销", name = "couponOrderStatus") private Integer couponOrderStatus; + @TableField(exist = false) + private List couponOrderStatusList; @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") private Date createDate; @io.swagger.annotations.ApiModelProperty(value = "创建时间数值,供查询优化用", name = "createDateTimes") diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index c613127dc..1f3d162c3 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -17,6 +17,7 @@ public interface WxCouponOrderMapper extends CommonMapper { WxCouponOrder selectById(@Param("id")Long id,@Param("tenantId")String tenantId); List findList(WxCouponOrder wxCouponOrder); + List findIdList(WxCouponOrder wxCouponOrder); List findListOfOrderedByDate(Map dateMap); List findListOfVerifiedByDate(Map dateMap); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java index b54f7127c..2dbc57002 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java @@ -46,6 +46,7 @@ public interface WxCUserBasicInfoService { PageInfo listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); List listPhoneAndNameByIds(WxCUserBasicInfo record); + List findIdList(WxCUserBasicInfo record); Map getUserMap(TenantEntity tenantEntity, List cUserIdList); /** diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index 267004304..5b87c23e6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -1333,5 +1333,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc } return null; } + + @Override + public List findIdList(WxCUserBasicInfo record) { + return wxCUserBasicInfoMapper.findIdList(record); + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java index e19e07cd4..71f406e35 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.IdWorker; @@ -16,6 +17,7 @@ import com.iformall.domain.vo.WxCouponPasswordVo; import com.iformall.enums.EnumCardInfoType; import com.iformall.enums.EnumCouponPasswordStatus; import com.iformall.enums.EnumCouponPasswordSupport; +import com.iformall.enums.EnumCouponType; import com.iformall.enums.EnumYesOrNo; import com.iformall.mapper.WxCardInfoMapper; import com.iformall.mapper.WxCouponChannelMapper; @@ -77,7 +79,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { @Override public PageInfo listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { - handleCouponOnlineEndDate(record); + handleQueryParam(record); PageInfo cardInfoPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findList(record)); PageInfo pageInfo = new PageInfo(); pageInfo.setList(handleToCardVoList(cardInfoPage.getList(),record)); @@ -88,7 +90,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { return pageInfo; } - private List handleToCardVoList(List list,TenantEntity tenantEntity) { + private List handleToCardVoList(List list,WxCardVo record) { if (null != list && list.size() > 0) { List couponIdList = new ArrayList(); List userIdList = new ArrayList(); @@ -112,7 +114,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { Map couponMap = new HashMap(); if (couponIdList.size() > 0 ) { WxCoupon couponQ = new WxCoupon(); - couponQ.updateTenantInfo(tenantEntity); + couponQ.updateTenantInfo(record); couponQ.setIds(couponIdList); List couponList = wxCouponMapper.findList(couponQ); if (null != couponList && couponList.size() > 0) { @@ -127,7 +129,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { if (userIdList.size() > 0) { WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); cUserBasicInfoQ.setIds(userIdList); - cUserBasicInfoQ.setFinalTenantId(tenantEntity.getFinalTenantId()); + cUserBasicInfoQ.setFinalTenantId(record.getFinalTenantId()); List cuserList = wxCUserBasicInfoService.listPhoneAndNameByIds(cUserBasicInfoQ); if (null != cuserList) { for (int i = 0 ; i < cuserList.size() ; i++) { @@ -140,7 +142,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { Map couponOrderMap = new HashMap(); if (cardIdList.size() > 0 ) { WxCouponOrder couponOrderQ = new WxCouponOrder(); - couponOrderQ.updateTenantInfo(tenantEntity); + couponOrderQ.updateTenantInfo(record); couponOrderQ.setIds(cardIdList); List couponOrderList = wxCouponOrderMapper.findList(couponOrderQ); if (null != couponOrderList) { @@ -228,14 +230,14 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { @Override public void exportData(WxCardVo record, HttpServletRequest request, HttpServletResponse response) { - handleCouponOnlineEndDate(record); + handleQueryParam(record); List cardInfoList = wxCardInfoMapper.findList(record); List list = this.handleToCardVoList(cardInfoList,record); excelService.exportExcel(list, null, "卡订单", WxCardVo.class, "卡订单.xlsx", response, false); } - private void handleCouponOnlineEndDate(WxCardVo record){ + private void handleQueryParam(WxCardVo record){ if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) { WxCouponChannel wxCouponChannelQ = new WxCouponChannel(); wxCouponChannelQ.updateTenantInfo(record); @@ -248,6 +250,33 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { record.setCouponIdList(ccIds); } } + + if ((null != record.getStatusS() && record.getStatusS().size() > 0 ) || null != record.getStatus()) { + WxCouponOrder couponOrderQ = new WxCouponOrder(); + couponOrderQ.updateTenantInfo(record); + couponOrderQ.setCouponOrderStatusList(record.getStatusS()); + couponOrderQ.setCouponOrderStatus(record.getStatus()); + couponOrderQ.setCouponType(EnumCouponType.CARD_MULTIMCH.getCode()); + List orderIdList = wxCouponOrderMapper.findIdList(couponOrderQ); + if (null != orderIdList && orderIdList.size() > 0 ) { + record.setIds(orderIdList); + }else { + record.setId(-999L); + } + } + if (StringUtils.isNotBlank(record.getOuPhone()) || StringUtils.isNotBlank(record.getOnickName())) { + WxCUserBasicInfo userQ = new WxCUserBasicInfo(); + userQ.setFinalTenantId(record.getFinalTenantId()); + userQ.setPhone(StringUtils.trimToNull(record.getOuPhone())); + userQ.setNickName(StringUtils.trimToNull(record.getOnickName())); + List userIdList = wxCUserBasicInfoService.findIdList(userQ); + if (null != userIdList && userIdList.size() > 0 ) { + record.setOwnerUserIdList(userIdList); + }else { + record.setId(-999L); + } + } + } @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index d81f7ac92..da88c1ac8 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -101,6 +101,11 @@ and wcubi.`name` like concat('%', #{name},'%') + + + and wcubi.`nick_name` like concat('%', #{nickName},'%') + + and wcubi.`create_date` between #{startTime} and #{endTime} diff --git a/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml index 993efa2e7..274c22ed9 100644 --- a/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml @@ -85,8 +85,11 @@ and `coupon_password` like concat('%',#{couponPassword},'%') - - and `create_date` between #{startdate} and #{enddate} + + and `create_date` >= #{startdate} + + + and `create_date` <= #{enddate} and coupon_password_id in @@ -100,6 +103,18 @@ #{cidItem} + + and c_user_id in + + #{cuidItem} + + + + and owner_user_id in + + #{ouidItem} + + and id in diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 1e7ffa831..9ed845877 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -151,6 +151,13 @@ and `shipping_status` = #{shippingStatus} + + and coupon_order_status in + + #{cosidItem} + + + and id in @@ -169,6 +176,11 @@ + +