| @@ -127,4 +127,19 @@ public class AliBusinessCircleOrderController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("统计接口2") | |||||
| @GetMapping("aliStatistics") | |||||
| @ApiImplicitParams({ | |||||
| }) | |||||
| @SystemControllerLog(description = "-统计") | |||||
| public ResultData aliStatistics(@ModelAttribute AliBusinessCircleOrder circleOrder) { | |||||
| logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::aliStatistics"); | |||||
| if (null == circleOrder) { | |||||
| circleOrder = new AliBusinessCircleOrder(); | |||||
| } | |||||
| circleOrder.updateTenantInfo(getTenantInfo()); | |||||
| AlipayOrWxStatistics aliStatistics = aliBusinessCircleOrderService.aliStatistics(circleOrder); | |||||
| return new ResultData(aliStatistics); | |||||
| } | |||||
| } | } | ||||
| @@ -123,4 +123,19 @@ public class WxBusinessCircleOrderController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("统计接口2") | |||||
| @GetMapping("wxStatistics") | |||||
| @ApiImplicitParams({ | |||||
| }) | |||||
| @SystemControllerLog(description = "-统计") | |||||
| public ResultData wxStatistics(@ModelAttribute WxBusinessCircleOrder circleOrder) { | |||||
| logger.debug("[" + getIpAddr() + "] WxBusinessCircleOrderController::wxPayList"); | |||||
| if (null == circleOrder) { | |||||
| circleOrder = new WxBusinessCircleOrder(); | |||||
| } | |||||
| circleOrder.updateTenantInfo(getTenantInfo()); | |||||
| AlipayOrWxStatistics aliStatistics = wxBusinessCircleOrderService.aliStatistics(circleOrder); | |||||
| return new ResultData(aliStatistics); | |||||
| } | |||||
| } | } | ||||
| @@ -53,4 +53,8 @@ public interface AliBusinessCircleOrderMapper extends CommonMapper<AliBusinessCi | |||||
| List<AlipayOrWxStatistics> aliRefundList(AliBusinessCircleOrder record); | List<AlipayOrWxStatistics> aliRefundList(AliBusinessCircleOrder record); | ||||
| AlipayOrWxStatistics aliPayStatistics(AliBusinessCircleOrder record); | |||||
| AlipayOrWxStatistics aliRefundStatistics(AliBusinessCircleOrder record); | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||||
| import com.iformall.domain.po.BusinessCircleBase; | import com.iformall.domain.po.BusinessCircleBase; | ||||
| import com.iformall.domain.po.WxBusinessCircleOrder; | import com.iformall.domain.po.WxBusinessCircleOrder; | ||||
| import com.iformall.domain.vo.AlipayOrWxStatistics; | import com.iformall.domain.vo.AlipayOrWxStatistics; | ||||
| @@ -54,4 +55,8 @@ public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCirc | |||||
| List<AlipayOrWxStatistics> wxRefundList(WxBusinessCircleOrder record); | List<AlipayOrWxStatistics> wxRefundList(WxBusinessCircleOrder record); | ||||
| AlipayOrWxStatistics aliPayStatistics(WxBusinessCircleOrder record); | |||||
| AlipayOrWxStatistics aliRefundStatistics(WxBusinessCircleOrder record); | |||||
| } | } | ||||
| @@ -60,4 +60,6 @@ public interface AliBusinessCircleOrderService { | |||||
| Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); | ||||
| PageInfo<AlipayOrWxStatistics> aliPayList(AliBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize); | PageInfo<AlipayOrWxStatistics> aliPayList(AliBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize); | ||||
| AlipayOrWxStatistics aliStatistics(AliBusinessCircleOrder circleOrder); | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||||
| import com.iformall.domain.po.BusinessCircleBase; | import com.iformall.domain.po.BusinessCircleBase; | ||||
| import com.iformall.domain.po.WxBusinessCircleOrder; | import com.iformall.domain.po.WxBusinessCircleOrder; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| @@ -92,4 +93,6 @@ public interface WxBusinessCircleOrderService { | |||||
| PageInfo<AlipayOrWxStatistics> wxPayList(WxBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize); | PageInfo<AlipayOrWxStatistics> wxPayList(WxBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize); | ||||
| AlipayOrWxStatistics aliStatistics(WxBusinessCircleOrder circleOrder); | |||||
| } | } | ||||
| @@ -424,4 +424,25 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||||
| } | } | ||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| @Override | |||||
| public AlipayOrWxStatistics aliStatistics(AliBusinessCircleOrder record) { | |||||
| if (StringUtils.isNotEmpty(record.getMerchantName())) { | |||||
| List<Long> ids = wxMerchantService.selectByMerchantIds(record.getMerchantName()); | |||||
| if (!CollectionUtils.isEmpty(ids)) { | |||||
| record.setMerchantIds(ids); | |||||
| }else{ | |||||
| ids.add(-999l); | |||||
| record.setMerchantIds(ids); | |||||
| } | |||||
| } | |||||
| AlipayOrWxStatistics aliStatistics = aliBusinessCircleOrderMapper.aliPayStatistics(record); | |||||
| if(aliStatistics.getPayAmount() > 0){ | |||||
| AlipayOrWxStatistics aliRefundStatistics = aliBusinessCircleOrderMapper.aliRefundStatistics(record); | |||||
| aliStatistics.setRefundAmount(aliRefundStatistics.getRefundAmount()); | |||||
| aliStatistics.setRefundPoints(aliRefundStatistics.getRefundPoints()); | |||||
| } | |||||
| return aliStatistics; | |||||
| } | |||||
| } | } | ||||
| @@ -600,5 +600,26 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| @Override | |||||
| public AlipayOrWxStatistics aliStatistics(WxBusinessCircleOrder record) { | |||||
| if (StringUtils.isNotEmpty(record.getMerchantName())) { | |||||
| List<Long> ids = wxMerchantService.selectByMerchantIds(record.getMerchantName()); | |||||
| if (!CollectionUtils.isEmpty(ids)) { | |||||
| record.setMerchantIds(ids); | |||||
| }else{ | |||||
| ids.add(-999l); | |||||
| record.setMerchantIds(ids); | |||||
| } | |||||
| } | |||||
| AlipayOrWxStatistics aliStatistics = wxBusinessCircleOrderMapper.aliPayStatistics(record); | |||||
| if(aliStatistics.getPayAmount() > 0){ | |||||
| AlipayOrWxStatistics aliRefundStatistics = wxBusinessCircleOrderMapper.aliRefundStatistics(record); | |||||
| aliStatistics.setRefundAmount(aliRefundStatistics.getRefundAmount()); | |||||
| aliStatistics.setRefundPoints(aliRefundStatistics.getRefundPoints()); | |||||
| } | |||||
| return aliStatistics; | |||||
| } | |||||
| } | } | ||||
| @@ -272,4 +272,45 @@ | |||||
| GROUP BY merchant_id | GROUP BY merchant_id | ||||
| </select> | </select> | ||||
| <select id="aliPayStatistics" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> | |||||
| SELECT | |||||
| IFNULL(SUM(`pay_amount`),0) as 'payAmount', | |||||
| IFNULL(SUM(`increased_points`),0) as 'payPoints' | |||||
| 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 "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")"> | |||||
| #{id} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| <select id="aliRefundStatistics" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> | |||||
| SELECT | |||||
| 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> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -283,7 +283,7 @@ | |||||
| 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 id="wxRefundList" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> | |||||
| SELECT merchant_id as 'merchantId', | SELECT merchant_id as 'merchantId', | ||||
| IFNULL(SUM(`refund_amount`),0) as 'refundAmount', | IFNULL(SUM(`refund_amount`),0) as 'refundAmount', | ||||
| IFNULL(SUM(`increased_points`),0) as 'refundPoints' | IFNULL(SUM(`increased_points`),0) as 'refundPoints' | ||||
| @@ -304,4 +304,44 @@ | |||||
| GROUP BY merchant_id | GROUP BY merchant_id | ||||
| </select> | </select> | ||||
| <select id="wxPayStatistics" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> | |||||
| SELECT | |||||
| IFNULL(SUM(`pay_amount`),0) as 'payAmount', | |||||
| IFNULL(SUM(`increased_points`),0) as 'payPoints' | |||||
| 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 "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIds" index="index" item="id" open="(" separator="," close=")"> | |||||
| #{id} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| <select id="wxRefundStatistics" parameterType="com.iformall.domain.po.AliBusinessCircleOrder" resultType="com.iformall.domain.vo.AlipayOrWxStatistics"> | |||||
| SELECT | |||||
| 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> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||