浏览代码

/。 卷订单商户

release_toaliyun_real
xhxu 4 年前
父节点
当前提交
325989ce27
共有 4 个文件被更改,包括 54 次插入29 次删除
  1. +2
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java
  2. +43
    -25
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  4. +8
    -2
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml

+ 2
- 1
mallinkService/src/main/java/com/iformall/mapper/WxCouponMerchantMapper.java 查看文件

@@ -17,7 +17,8 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L
List<WxCouponMerchant> findList(WxCouponMerchant wxCouponMerchant); List<WxCouponMerchant> findList(WxCouponMerchant wxCouponMerchant);
List<WxCouponMerchant> findMerchantListByProduct(@Param("productId")Long productId,@Param("tenantId")String tenantId); List<WxCouponMerchant> findMerchantListByProduct(@Param("productId")Long productId,@Param("tenantId")String tenantId);
List<Long> findMerchantIdListByProduct(@Param("productId")Long productId,@Param("tenantId")String tenantId); List<Long> findMerchantIdListByProduct(@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<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds);
List<WxMerchantProductVo> findOnlyMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); List<WxMerchantProductVo> findOnlyMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList);
List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList,@Param("status")Integer status); List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList,@Param("status")Integer status);
List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds);


+ 43
- 25
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java 查看文件

@@ -865,7 +865,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
if (null != merchantIdList && merchantIdList.size() > 0 ) { if (null != merchantIdList && merchantIdList.size() > 0 ) {
WxMerchant merchantQ = new WxMerchant(); WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(tenantEntity); merchantQ.updateTenantInfo(tenantEntity);
merchantQ.setIds(merchantIdList);;
// merchantQ.setIds(merchantIdList);
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ);
if (null != merchantList) { if (null != merchantList) {
for (int i = 0 ; i < merchantList.size() ; i ++) { for (int i = 0 ; i < merchantList.size() ; i ++) {
@@ -876,6 +876,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
} }
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>();
Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>();
if (null != couponIdList && couponIdList.size() > 0 ) { if (null != couponIdList && couponIdList.size() > 0 ) {
WxCoupon couponQ = new WxCoupon(); WxCoupon couponQ = new WxCoupon();
couponQ.updateTenantInfo(tenantEntity); couponQ.updateTenantInfo(tenantEntity);
@@ -887,22 +888,34 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
couponMap.put(c.getId(), c); couponMap.put(c.getId(), c);
} }
} }

List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), couponIdList);
if (null != merchantProductVos) {
for (int i = 0 ; i < merchantProductVos.size(); i ++) {
WxMerchantProductVo mp = merchantProductVos.get(i);
if (mp.getMc() > 1) {
merchantProductIdMap.put(mp.getProductId(), -999L);
}else {
merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId());
}
}
}
} }
Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>();
if (null != merchantIdList && merchantIdList.size() > 0 ) {
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIdList);
if (null != merchantProductVos) {
for (int i = 0 ; i < merchantProductVos.size(); i ++) {
WxMerchantProductVo mp = merchantProductVos.get(i);
if (mp.getMc() > 1) {
merchantProductIdMap.put(mp.getProductId(), -999L);
}else {
merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId());
}
}
}
}
// Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>();
// if (null != merchantIdList && merchantIdList.size() > 0 ) {
// List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), couponIdList);
// if (null != merchantProductVos) {
// for (int i = 0 ; i < merchantProductVos.size(); i ++) {
// WxMerchantProductVo mp = merchantProductVos.get(i);
// if (mp.getMc() > 1) {
// merchantProductIdMap.put(mp.getProductId(), -999L);
// }else {
// merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId());
// }
// }
// }
// }
Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>(); Map<Long,WxCUserBasicInfo> cUserMap = new HashMap<Long,WxCUserBasicInfo>();
@@ -948,17 +961,22 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
} }
co.setSubsidyNum(co.getSubsidy()); co.setSubsidyNum(co.getSubsidy());
Long merchanId = merchantProductIdMap.get(co.getCouponId());
if (null != merchanId) {
if (merchanId == -999L) {
co.setMerchantName("多商户通用");
co.setMerchantId(0L);
}else {
co.setMerchantName(merchantNameMap.get(merchanId));
co.setMerchantId(merchanId);
}

if(co.getMerchantId() == null){
Long merchanId = merchantProductIdMap.get(co.getCouponId());
if (null != merchanId) {
if (merchanId == -999L) {
co.setMerchantName("多商户通用");
co.setMerchantId(0L);
}else {
co.setMerchantName(merchantNameMap.get(merchanId));
co.setMerchantId(merchanId);
}
}
}else{
co.setMerchantName(merchantNameMap.get(co.getMerchantId()));
} }

WxCUserBasicInfo basicInfo = cUserMap.get(co.getCUserId()); WxCUserBasicInfo basicInfo = cUserMap.get(co.getCUserId());
if (null != basicInfo) { if (null != basicInfo) {


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java 查看文件

@@ -1016,7 +1016,7 @@ public class WxCouponServiceImpl implements WxCouponService {
if (onlyOneMerchantCoupons) { if (onlyOneMerchantCoupons) {
merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(tenantEntity.getTenantId(), merchantIds); merchantProductVos = wxCouponMerchantMapper.findOnlyMerchantProduct(tenantEntity.getTenantId(), merchantIds);
}else { }else {
merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIds);
merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), couponIds);
} }
if (null != merchantProductVos && merchantProductVos.size() > 0 ) { if (null != merchantProductVos && merchantProductVos.size() > 0 ) {
for (int i = 0 ; i < merchantProductVos.size(); i ++) { for (int i = 0 ; i < merchantProductVos.size(); i ++) {


+ 8
- 2
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml 查看文件

@@ -112,12 +112,18 @@
<if test=" null != tenantId and '' != tenantId"> <if test=" null != tenantId and '' != tenantId">
and wcm.`tenant_id` = #{tenantId} and wcm.`tenant_id` = #{tenantId}
</if> </if>
<if test=" null != merchantIdList">
<if test=" null != productIds">
and wcm.product_id in
<foreach collection="productIds" index="index" item="productIdItem" open="(" separator="," close=")">
#{productIdItem}
</foreach>
</if>
<!--<if test=" null != merchantIdList">
and wcm.merchant_id in and wcm.merchant_id in
<foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")"> <foreach collection="merchantIdList" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem} #{merchantIdItem}
</foreach> </foreach>
</if>
</if>-->
GROUP BY product_id GROUP BY product_id
</select> </select>


正在加载...
取消
保存