| @@ -61,7 +61,8 @@ public class WxCardPayController extends BaseController { | |||||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | ||||
| WxMerchantBUser user = getUser(); | WxMerchantBUser user = getUser(); | ||||
| wxCardSpend.setTenantId(user.getTenantId()); | wxCardSpend.setTenantId(user.getTenantId()); | ||||
| final Map map = wxCardSpendService.sumCardSpend(wxCardSpend); | |||||
| wxCardSpend.setMerchantId(user.getMerchantId()); | |||||
| final Map map = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend); | |||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| } | } | ||||
| @@ -148,6 +148,7 @@ public class WxCardPayController extends BaseController { | |||||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| wxCardSpend.setTenantId(user.getTenantId()); | wxCardSpend.setTenantId(user.getTenantId()); | ||||
| wxCardSpend.setOwnerId(user.getId()); | |||||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize); | final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -160,7 +161,8 @@ public class WxCardPayController extends BaseController { | |||||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| wxCardSpend.setTenantId(user.getTenantId()); | wxCardSpend.setTenantId(user.getTenantId()); | ||||
| final Map map = wxCardSpendService.sumCardSpend(wxCardSpend); | |||||
| wxCardSpend.setOwnerId(user.getId()); | |||||
| final Map map = wxCardSpendService.sumCardSpendForOwner(wxCardSpend); | |||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| } | } | ||||
| @@ -13,7 +13,9 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> { | |||||
| List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | ||||
| Map sumCardSpendVo(WxCardSpend wxCardSpend); | |||||
| Map sumCardSpendVoForMerchant(WxCardSpend wxCardSpend); | |||||
| Map sumCardSpendVoForOwner(WxCardSpend wxCardSpend); | |||||
| @@ -42,7 +42,15 @@ public interface WxCardSpendService { | |||||
| * @param record | * @param record | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| Map<String, Object> sumCardSpend(WxCardSpendVo record); | |||||
| Map<String, Object> sumCardSpendForMerchant(WxCardSpendVo record); | |||||
| /** | |||||
| * 根据实体SUM | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| Map<String, Object> sumCardSpendForOwner(WxCardSpendVo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -247,8 +247,13 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<String, Object> sumCardSpend(WxCardSpendVo record) { | |||||
| return wxCardSpendMapper.sumCardSpendVo(record); | |||||
| public Map<String, Object> sumCardSpendForMerchant(WxCardSpendVo record) { | |||||
| return wxCardSpendMapper.sumCardSpendVoForMerchant(record); | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> sumCardSpendForOwner(WxCardSpendVo record) { | |||||
| return wxCardSpendMapper.sumCardSpendVoForOwner(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -224,8 +224,8 @@ | |||||
| <include refid="dynamicVoWhereConditions" /> | <include refid="dynamicVoWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="sumCardSpendVo" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.merchant_id, m.name as merchantName | |||||
| <select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.merchant_id, m.name as merchantName, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | ||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | IFNULL(SUM(cs.`payment`),0) as sum_payment, | ||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | ||||
| @@ -240,6 +240,23 @@ | |||||
| <include refid="dynamicVoWhereConditions" /> | <include refid="dynamicVoWhereConditions" /> | ||||
| group by cs.merchant_id | group by cs.merchant_id | ||||
| </select> | </select> | ||||
| <select id="sumCardSpendVoForOwner" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.owner_id, | |||||
| IFNULL(SUM(cs.`deduction_amount`),0) as sum_deduction_amount, | |||||
| IFNULL(SUM(cs.`payment`),0) as sum_payment, | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment, | |||||
| IFNULL(SUM(ms.`subsidy`), 0) as sum_subsidy, | |||||
| IFNULL(SUM(ms.`real_subsidy`), 0) as sum_real_subsidy | |||||
| from wx_card_spend cs | |||||
| left join wx_coupon_order co on co.id = cs.card_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = cs.merchant_id | |||||
| left join wx_merchant_subsidy ms on ms.order_id = cs.order_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| group by cs.owner_id | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||