| @@ -14,6 +14,7 @@ import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.domain.vo.WxCardVo; | |||
| import com.iformall.enums.EnumMerchantSubsidySource; | |||
| import com.iformall.enums.EnumMerchantSubsidyType; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCardInfoService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| @@ -13,14 +13,16 @@ public class WxCardSpendMerchantVo { | |||
| private Long merchantId; | |||
| @Excel(name = "商户名称", width = 20, orderNum = "2") | |||
| private String merchantName; | |||
| @Excel(name = "类型", width = 20, orderNum = "3", replace = {"付款_0", "退款_1"}) | |||
| private Integer payType; | |||
| private BigDecimal total; | |||
| @Excel(name = "交易总金额(元)", width = 20, orderNum = "3") | |||
| @Excel(name = "交易总金额(元)", width = 20, orderNum = "4") | |||
| private String totalStr; | |||
| private BigDecimal fee; | |||
| @Excel(name = "总手续费(元)", width = 20, orderNum = "4") | |||
| @Excel(name = "总手续费(元)", width = 20, orderNum = "5") | |||
| private String feeStr; | |||
| private BigDecimal subsidy; | |||
| @Excel(name = "总补贴(元)", width = 20, orderNum = "5") | |||
| @Excel(name = "总补贴(元)", width = 20, orderNum = "6") | |||
| private String subsidyStr; | |||
| public String getTotalStr() { | |||
| @@ -357,6 +357,7 @@ public class WxCUserTagsServiceHelper{ | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| WxCardSpend wxCardSpend = new WxCardSpend(); | |||
| wxCardSpend.setPayType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| wxCardSpend.setOwnerId(user.getId()); | |||
| wxCardSpend.setStartdate(startC.getTime()); | |||
| wxCardSpend.setEnddate(endC.getTime()); | |||
| @@ -466,6 +467,7 @@ public class WxCUserTagsServiceHelper{ | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| WxCardSpend wxCardSpend = new WxCardSpend(); | |||
| wxCardSpend.setPayType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| wxCardSpend.setOwnerId(user.getId()); | |||
| wxCardSpend.setStartdate(startC.getTime()); | |||
| wxCardSpend.setEnddate(endC.getTime()); | |||
| @@ -585,6 +587,7 @@ public class WxCUserTagsServiceHelper{ | |||
| WxCardSpend wxCardSpend = new WxCardSpend(); | |||
| wxCardSpend.updateTenantInfo(tenantEntity); | |||
| wxCardSpend.setPayType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| wxCardSpend.setOwnerId(user.getId()); | |||
| wxCardSpend.setStartdate(startC.getTime()); | |||
| wxCardSpend.setEnddate(endC.getTime()); | |||
| @@ -723,6 +723,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| for (int i = 0 ; i < list.size(); i++ ) { | |||
| Map<String,Object> m = list.get(i); | |||
| WxCardSpendMerchantVo vo = new WxCardSpendMerchantVo(); | |||
| Integer payType = (Integer)m.get("pay_type"); | |||
| vo.setPayType(payType); | |||
| Long merchantId = (Long)m.get("merchant_id"); | |||
| vo.setMerchantId(merchantId); | |||
| if (null != merchantId && (!merchantIdList.contains(merchantId))) { | |||
| @@ -759,9 +761,17 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| } | |||
| return null; | |||
| } | |||
| /** | |||
| * 默认查询付款记录 | |||
| * @param record | |||
| * @return | |||
| */ | |||
| @Override | |||
| public Map<String, BigDecimal> sumCardSpend(WxCardSpendVo record) { | |||
| if(record.getPayType() == null){ | |||
| record.setPayType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| } | |||
| handleQueryParam(record); | |||
| return wxCardSpendMapper.sumCardSpend(record); | |||
| } | |||
| @@ -1333,6 +1343,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| @Override | |||
| public Integer sumRealPayment(WxCardSpendVo wxCardSpend) { | |||
| if(wxCardSpend.getPayType() == null){ | |||
| wxCardSpend.setPayType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| } | |||
| return wxCardSpendMapper.sumRealPayment(wxCardSpend); | |||
| } | |||
| @@ -158,7 +158,7 @@ | |||
| <select id="updateByCond" parameterType="com.iformall.domain.po.WxCardSpend"> | |||
| update wx_card_spend | |||
| set `pay_status` = #{payStatus}, `update_date` = #{updateDate} | |||
| set `settlement_status` = #{settlementStatus}, `update_date` = #{updateDate} | |||
| <where> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -195,6 +195,9 @@ | |||
| </if> | |||
| </if> | |||
| where 1 = 1 | |||
| <if test=" null != payType "> | |||
| and cs.`pay_type` = #{payType} | |||
| </if> | |||
| <if test=" null != ownerId "> | |||
| and cs.`owner_id` = #{ownerId} | |||
| </if> | |||
| @@ -239,7 +242,11 @@ | |||
| <select id="getMerchantCount" parameterType="com.iformall.domain.po.WxCardSpend" resultType="hashmap"> | |||
| select cs.merchant_id as merchantId, count(1) as count | |||
| from wx_card_spend cs | |||
| where cs.`owner_id` = #{ownerId} and cs.`tenant_id` = #{tenantId} | |||
| where cs.`owner_id` = #{ownerId} | |||
| and cs.`tenant_id` = #{tenantId} | |||
| <if test=" null != payType "> | |||
| and cs.`pay_type` = #{payType} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cs.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -277,14 +284,14 @@ | |||
| </select> | |||
| <select id="sumMerchant" parameterType="com.iformall.domain.po.WxCardSpend" resultType="hashmap"> | |||
| select cs.merchant_id, | |||
| select cs.merchant_id,cs.pay_type, | |||
| 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(cs.`subsidy`),0) as sum_subsidy | |||
| from wx_card_spend cs | |||
| <include refid="dynamicWhereConditions"/> | |||
| group by cs.merchant_id | |||
| group by cs.merchant_id,cs.pay_type | |||
| </select> | |||
| <select id="getMerchantIdList" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="Long"> | |||
| @@ -309,6 +316,9 @@ | |||
| from wx_card_spend cs | |||
| where cs.`tenant_id` = #{tenantId} | |||
| and cs.`merchant_id` = #{merchantId} | |||
| <if test=" null != payType "> | |||
| and cs.`pay_type` = #{payType} | |||
| </if> | |||
| <if test=" null != startdate "> | |||
| AND cs.`create_date` >= #{startdate} | |||
| </if> | |||