Browse Source

/、send

release_toaliyun_real
xhxu 4 years ago
parent
commit
25b17001d1
5 changed files with 63 additions and 6 deletions
  1. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java
  2. +5
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  3. +6
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java
  4. +36
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  5. +15
    -0
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java View File

@@ -19,4 +19,5 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L
List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId); List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds);
} }

+ 5
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponService.java View File

@@ -254,4 +254,9 @@ public interface WxCouponService {


boolean validCouponDate(WxCoupon wxCoupon); boolean validCouponDate(WxCoupon wxCoupon);


/**
* 获取券商户map
*
*/
Map<Long,String> getCouponMerchant(List<Long> couponIds,TenantEntity tenantEntity);
} }

+ 6
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java View File

@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;


@Service @Service
public class WxCouponSendServiceImpl implements WxCouponSendService { public class WxCouponSendServiceImpl implements WxCouponSendService {
@@ -105,8 +106,12 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
record.setStatus(EnumCouponSendStatus.VALID.getCode()); record.setStatus(EnumCouponSendStatus.VALID.getCode());
record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); record.setSortColumns(BaseEntity.SortField.CreateDate_DESC);
pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVo(record)); pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVo(record));
for (WxCouponSendVo cs:pageInfo.getList())
List<Long> couponIds = pageInfo.getList().stream().map(cs -> cs.getCouponId()).collect(Collectors.toList());
Map<Long, String> couponMerchantMap = wxCouponService.getCouponMerchant(couponIds,record);
for (WxCouponSendVo cs:pageInfo.getList()){
cs.setMerchantName(couponMerchantMap.get(cs.getCouponId()));
cs.setSendCount(wxCouponActionLogService.getCountByChannelId(record, cs.getSendType(), cs.getId())); cs.setSendCount(wxCouponActionLogService.getCountByChannelId(record, cs.getSendType(), cs.getId()));
}
} }
return pageInfo; return pageInfo;
} }


+ 36
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -14,11 +14,7 @@ import com.iformall.domain.dto.WxCouponMerchantDto;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCUserBasicInfoVo;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import com.iformall.domain.vo.WxCouponStatisVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.domain.vo.*;
import com.iformall.domain.vo.excel.WxCardData; import com.iformall.domain.vo.excel.WxCardData;
import com.iformall.domain.vo.excel.WxCouponData; import com.iformall.domain.vo.excel.WxCouponData;
import com.iformall.domain.vo.excel.WxPressData; import com.iformall.domain.vo.excel.WxPressData;
@@ -967,5 +963,40 @@ public class WxCouponServiceImpl implements WxCouponService {
return wxCoupon.validDate(isShare,true,new Date()); return wxCoupon.validDate(isShare,true,new Date());
} }


@Override
public Map<Long, String> getCouponMerchant(List<Long> couponIds, TenantEntity tenantEntity) {
Map<Long,String> couponMerchantMap = new HashMap<Long,String>();

List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(),couponIds);

WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(tenantEntity);
merchantQ.setIds(merchantIds);
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ);
Map<Long,String> merchantNameMap = new HashMap<Long,String>();
if (null != merchantList) {
for (int i = 0 ; i < merchantList.size() ; i ++) {
WxMerchant m = merchantList.get(i);
merchantNameMap.put(m.getId(), m.getName());
}
}

List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIds);
// Map<Long,String> couponMerchantMap = new HashMap<Long,String>();
if (null != merchantProductVos) {
for (int i = 0 ; i < merchantProductVos.size(); i ++) {
WxMerchantProductVo mp = merchantProductVos.get(i);
if(couponIds.contains(mp.getProductId())){
if (mp.getMc() > 1) {
couponMerchantMap.put(mp.getProductId(), "多商户通用");
}else {
couponMerchantMap.put(mp.getProductId(), merchantNameMap.get(mp.getMerchantId()));
}
}
}
}
return couponMerchantMap;
}



} }

+ 15
- 0
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml View File

@@ -172,5 +172,20 @@
</foreach> </foreach>
</if> </if>
</select> </select>

<select id = "findMerchantByProductIds" parameterType="java.util.Map" resultType="Long">
SELECT distinct wcm.merchant_id
FROM wx_coupon_merchant wcm
WHERE wcm.STATUS = 0
<if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId}
</if>
<if test=" null != productIds">
and wcm.product_id in
<foreach collection="productIds" index="index" item="productIdItem" open="(" separator="," close=")">
#{productIdItem}
</foreach>
</if>
</select>
</mapper> </mapper>

Loading…
Cancel
Save