Просмотр исходного кода

//..circle

release_toaliyun_real
xhxu 2 лет назад
Родитель
Сommit
f1099b7ff8
7 измененных файлов: 112 добавлений и 27 удалений
  1. +2
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/AlipayOrWxStatistics.java
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/mapper/AliBusinessCircleOrderMapper.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBusinessCircleOrderMapper.java
  4. +19
    -7
      mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java
  5. +19
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java
  6. +33
    -6
      mallinkService/src/main/resources/mapper/AliBusinessCircleOrderMapper.xml
  7. +34
    -6
      mallinkService/src/main/resources/mapper/WxBusinessCircleOrderMapper.xml

+ 2
- 1
mallinkService/src/main/java/com/iformall/domain/vo/AlipayOrWxStatistics.java Просмотреть файл

@@ -10,6 +10,7 @@ public class AlipayOrWxStatistics {
private String merchantName;//商户名称 private String merchantName;//商户名称
private Integer payAmount;//支付总金额 private Integer payAmount;//支付总金额
private Integer refundAmount;//退款总金额 private Integer refundAmount;//退款总金额
private Integer increasedPoints;//积分情况
private Integer payPoints;//支付总积分
private Integer refundPoints;//支付总积分
private Long merchantId; private Long merchantId;
} }

+ 3
- 0
mallinkService/src/main/java/com/iformall/mapper/AliBusinessCircleOrderMapper.java Просмотреть файл

@@ -50,4 +50,7 @@ public interface AliBusinessCircleOrderMapper extends CommonMapper<AliBusinessCi
Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); Integer sumCircleRefundAmount(BusinessCircleBase circleOrder);


List<AlipayOrWxStatistics> aliPayList(AliBusinessCircleOrder record); List<AlipayOrWxStatistics> aliPayList(AliBusinessCircleOrder record);

List<AlipayOrWxStatistics> aliRefundList(AliBusinessCircleOrder record);

} }

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBusinessCircleOrderMapper.java Просмотреть файл

@@ -52,4 +52,6 @@ public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCirc


List<AlipayOrWxStatistics> wxPayList(WxBusinessCircleOrder record); List<AlipayOrWxStatistics> wxPayList(WxBusinessCircleOrder record);


List<AlipayOrWxStatistics> wxRefundList(WxBusinessCircleOrder record);

} }

+ 19
- 7
mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java Просмотреть файл

@@ -400,16 +400,28 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder
return pageInfo; return pageInfo;
} }
List<Long> list = pageInfo.getList().parallelStream().map(AlipayOrWxStatistics::getMerchantId).collect(Collectors.toList()); List<Long> list = pageInfo.getList().parallelStream().map(AlipayOrWxStatistics::getMerchantId).collect(Collectors.toList());
record.setMerchantIds(list);
//查询退款数据
List<AlipayOrWxStatistics> alipayOrWxStatistics = aliBusinessCircleOrderMapper.aliRefundList(record);
Map<Long, AlipayOrWxStatistics> statisticsMap = null;
if (CollectionUtils.isNotEmpty(alipayOrWxStatistics)) {
statisticsMap = alipayOrWxStatistics.stream().collect(Collectors.toMap(AlipayOrWxStatistics::getMerchantId, s -> s));
}

WxMerchant wxMerchant = new WxMerchant(); WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setIds(list); wxMerchant.setIds(list);
List<WxMerchant> wxMerchants = wxMerchantService.findList(wxMerchant);
if (CollectionUtils.isEmpty(wxMerchants)) {
return pageInfo;
Map<Long, String> merchantNamesMap = wxMerchantService.getIdAndNamesMap(wxMerchant);

for (AlipayOrWxStatistics statistics:pageInfo.getList()) {
statistics.setMerchantName(merchantNamesMap.get(statistics.getMerchantId()));
if(statisticsMap != null){
AlipayOrWxStatistics refundstatistics = statisticsMap.get(statistics.getMerchantId());
if(refundstatistics != null){
statistics.setRefundAmount(refundstatistics.getRefundAmount());
statistics.setRefundPoints(refundstatistics.getRefundPoints());
}
}
} }
Map<Long, String> map = wxMerchants.parallelStream().collect(Collectors.toMap(WxMerchant::getId, WxMerchant::getName));
pageInfo.getList().forEach(x -> {
x.setMerchantName(map.get(x.getMerchantId()));
});
return pageInfo; return pageInfo;
} }
} }

+ 19
- 7
mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java Просмотреть файл

@@ -575,16 +575,28 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe
return pageInfo; return pageInfo;
} }
List<Long> list = pageInfo.getList().parallelStream().map(AlipayOrWxStatistics::getMerchantId).collect(Collectors.toList()); List<Long> list = pageInfo.getList().parallelStream().map(AlipayOrWxStatistics::getMerchantId).collect(Collectors.toList());
record.setMerchantIds(list);
//查询退款数据
List<AlipayOrWxStatistics> alipayOrWxStatistics = wxBusinessCircleOrderMapper.wxRefundList(record);
Map<Long, AlipayOrWxStatistics> statisticsMap = null;
if (CollectionUtils.isNotEmpty(alipayOrWxStatistics)) {
statisticsMap = alipayOrWxStatistics.stream().collect(Collectors.toMap(AlipayOrWxStatistics::getMerchantId, s -> s));
}

WxMerchant wxMerchant = new WxMerchant(); WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setIds(list); wxMerchant.setIds(list);
List<WxMerchant> wxMerchants = wxMerchantService.findList(wxMerchant);
if (CollectionUtils.isEmpty(wxMerchants)) {
return pageInfo;
Map<Long, String> merchantNamesMap = wxMerchantService.getIdAndNamesMap(wxMerchant);

for (AlipayOrWxStatistics statistics:pageInfo.getList()) {
statistics.setMerchantName(merchantNamesMap.get(statistics.getMerchantId()));
if(statisticsMap != null){
AlipayOrWxStatistics refundstatistics = statisticsMap.get(statistics.getMerchantId());
if(refundstatistics != null){
statistics.setRefundAmount(refundstatistics.getRefundAmount());
statistics.setRefundPoints(refundstatistics.getRefundPoints());
}
}
} }
Map<Long, String> map = wxMerchants.parallelStream().collect(Collectors.toMap(WxMerchant::getId, WxMerchant::getName));
pageInfo.getList().forEach(x -> {
x.setMerchantName(map.get(x.getMerchantId()));
});
return pageInfo; return pageInfo;
} }




+ 33
- 6
mallinkService/src/main/resources/mapper/AliBusinessCircleOrderMapper.xml Просмотреть файл

@@ -230,19 +230,46 @@
</select> </select>


<select id="aliPayList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> <select id="aliPayList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics">
SELECT SUM(pay_amount) as 'payAmount',
SUM(refund_amount) as 'refundAmount',
merchant_id as 'merchantId',
SUM(increased_points) as 'increasedPoints'
SELECT merchant_id as 'merchantId',
IFNULL(SUM(`pay_amount`),0) as 'payAmount',
IFNULL(SUM(`increased_points`),0) as 'payPoints'
FROM ali_business_circle_order FROM ali_business_circle_order
where is_refund = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantIds and merchantIds.size > 0 "> <if test=" null != merchantIds and merchantIds.size > 0 ">
where merchant_id in
and merchant_id in
<foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")"> <foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</if> </if>
GROUP BY merchant_id,is_refund
GROUP BY merchant_id
order by payAmount desc; order by payAmount desc;
</select> </select>


<select id="aliRefundList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics">
SELECT merchant_id as 'merchantId',
IFNULL(SUM(`refund_amount`),0) as 'refundAmount',
IFNULL(SUM(`increased_points`),0) as 'refundPoints'
FROM ali_business_circle_order
where is_refund = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantIds and merchantIds.size > 0 ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
GROUP BY merchant_id
</select>

</mapper> </mapper>

+ 34
- 6
mallinkService/src/main/resources/mapper/WxBusinessCircleOrderMapper.xml Просмотреть файл

@@ -262,18 +262,46 @@
</select> </select>


<select id="wxPayList" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> <select id="wxPayList" parameterType="com.iformall.domain.po.WxBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics">
SELECT SUM(pay_amount) as 'payAmount',
SUM(refund_amount) as 'refundAmount',
merchant_id as 'merchantId',
SUM(increased_points) as 'increasedPoints'
SELECT merchant_id as 'merchantId',
IFNULL(SUM(`pay_amount`),0) as 'payAmount',
IFNULL(SUM(`increased_points`),0) as 'payPoints'
FROM wx_business_circle_order FROM wx_business_circle_order
where is_refund = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantIds and merchantIds.size > 0 "> <if test=" null != merchantIds and merchantIds.size > 0 ">
where merchant_id in
and merchant_id in
<foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")"> <foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</if> </if>
GROUP BY merchant_id,is_refund
GROUP BY merchant_id
order by payAmount desc; order by payAmount desc;
</select> </select>

<select id="aliRefundList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics">
SELECT merchant_id as 'merchantId',
IFNULL(SUM(`refund_amount`),0) as 'refundAmount',
IFNULL(SUM(`increased_points`),0) as 'refundPoints'
FROM wx_business_circle_order
where is_refund = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantIds and merchantIds.size > 0 ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
GROUP BY merchant_id
</select>

</mapper> </mapper>

Загрузка…
Отмена
Сохранить