| @@ -30,6 +30,8 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -108,10 +110,10 @@ public class WxCardPayController extends BaseController { | |||||
| wxCardSpendVo.setPayStatusS(tmpList); | wxCardSpendVo.setPayStatusS(tmpList); | ||||
| } | } | ||||
| } | } | ||||
| List<Integer> sources = new ArrayList<Integer>(); | |||||
| sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| wxCardSpendVo.setSources(sources); | |||||
| wxCardSpendVo.setCardSpendListShow(1); | |||||
| //List<Integer> sources = new ArrayList<Integer>(); | |||||
| //sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| //wxCardSpendVo.setSources(sources); | |||||
| // wxCardSpendVo.setCardSpendListShow(1); | |||||
| wxCardSpendVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | wxCardSpendVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | ||||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -125,11 +127,11 @@ public class WxCardPayController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "过滤条件为空"); | ||||
| } | } | ||||
| wxCardSpend.updateTenantInfo(getTenantInfo()); | wxCardSpend.updateTenantInfo(getTenantInfo()); | ||||
| List<Integer> sources = new ArrayList<Integer>(); | |||||
| sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| wxCardSpend.setSources(sources); | |||||
| wxCardSpend.setCardSpendListShow(1); | |||||
| final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend); | |||||
| // List<Integer> sources = new ArrayList<Integer>(); | |||||
| // sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| // wxCardSpend.setSources(sources); | |||||
| // wxCardSpend.setCardSpendListShow(1); | |||||
| final Map<String, BigDecimal> mapList = wxCardSpendService.sumCardSpend(wxCardSpend); | |||||
| return new ResultData(mapList); | return new ResultData(mapList); | ||||
| } | } | ||||
| @@ -89,10 +89,10 @@ public class WxCardPayController extends BaseController { | |||||
| WxMerchantBUser user = getLoginBUser(); | WxMerchantBUser user = getLoginBUser(); | ||||
| wxCardSpendVo.updateTenantInfo(user); | wxCardSpendVo.updateTenantInfo(user); | ||||
| wxCardSpendVo.setMerchantId(user.getMerchantId()); | wxCardSpendVo.setMerchantId(user.getMerchantId()); | ||||
| List<Integer> sources = new ArrayList<Integer>(); | |||||
| sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| wxCardSpendVo.setSources(sources); | |||||
| wxCardSpendVo.setCardSpendListShow(1); | |||||
| // List<Integer> sources = new ArrayList<Integer>(); | |||||
| // sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| // wxCardSpendVo.setSources(sources); | |||||
| // wxCardSpendVo.setCardSpendListShow(1); | |||||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -106,11 +106,11 @@ public class WxCardPayController extends BaseController { | |||||
| WxMerchantBUser user = getLoginBUser(); | WxMerchantBUser user = getLoginBUser(); | ||||
| wxCardSpend.updateTenantInfo(user); | wxCardSpend.updateTenantInfo(user); | ||||
| wxCardSpend.setMerchantId(user.getMerchantId()); | wxCardSpend.setMerchantId(user.getMerchantId()); | ||||
| List<Integer> sources = new ArrayList<Integer>(); | |||||
| sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| wxCardSpend.setSources(sources); | |||||
| wxCardSpend.setCardSpendListShow(1); | |||||
| final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend); | |||||
| // List<Integer> sources = new ArrayList<Integer>(); | |||||
| // sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| // wxCardSpend.setSources(sources); | |||||
| // wxCardSpend.setCardSpendListShow(1); | |||||
| final Map<String, BigDecimal> mapList = wxCardSpendService.sumCardSpend(wxCardSpend); | |||||
| return new ResultData(mapList); | return new ResultData(mapList); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCardSpend; | import com.iformall.domain.po.WxCardSpend; | ||||
| @@ -17,9 +18,7 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> { | |||||
| List<Long> getMerchantIdList(WxCardSpend wxCardSpend); | List<Long> getMerchantIdList(WxCardSpend wxCardSpend); | ||||
| List<Map<String,Object>> sumCardSpendVoForMerchant(WxCardSpendVo wxCardSpend); | |||||
| List<Map<String,Object>> sumCardSpendVoForOwner(WxCardSpendVo wxCardSpend); | |||||
| Map<String,BigDecimal> sumCardSpend(WxCardSpendVo wxCardSpend); | |||||
| /** | /** | ||||
| * POS | * POS | ||||
| @@ -11,6 +11,8 @@ import com.iformall.exception.MallinkException; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -46,15 +48,7 @@ public interface WxCardSpendService { | |||||
| * @param record | * @param record | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<Map<String, Object>> sumCardSpendForMerchant(WxCardSpendVo record); | |||||
| /** | |||||
| * 根据实体SUM | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<Map<String, Object>> sumCardSpendForOwner(WxCardSpendVo record); | |||||
| Map<String, BigDecimal> sumCardSpend(WxCardSpendVo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -607,19 +607,19 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (null != record.getStatus() || null != record.getSources() || null != record.getCardSpendListShow()) { | |||||
| WxMerchantSubsidy subq = new WxMerchantSubsidy(); | |||||
| subq.updateTenantInfo(record); | |||||
| subq.setStatus(record.getStatus()); | |||||
| subq.setSourceList(record.getSources()); | |||||
| subq.setCardSpendListShow(record.getCardSpendListShow()); | |||||
| List<Long> orderList = wxMerchantSubsidyMapper.findOrderIdList(subq); | |||||
| if (null == orderList || orderList.size() <=0 ){ | |||||
| record.setId(-999L); | |||||
| }else { | |||||
| record.setOrderIdList(orderList); | |||||
| } | |||||
| } | |||||
| // if (null != record.getStatus() || null != record.getSources() || null != record.getCardSpendListShow()) { | |||||
| // WxMerchantSubsidy subq = new WxMerchantSubsidy(); | |||||
| // subq.updateTenantInfo(record); | |||||
| // subq.setStatus(record.getStatus()); | |||||
| // subq.setSourceList(record.getSources()); | |||||
| // subq.setCardSpendListShow(record.getCardSpendListShow()); | |||||
| // List<Long> orderList = wxMerchantSubsidyMapper.findOrderIdList(subq); | |||||
| // if (null == orderList || orderList.size() <=0 ){ | |||||
| // record.setId(-999L); | |||||
| // }else { | |||||
| // record.setOrderIdList(orderList); | |||||
| // } | |||||
| // } | |||||
| if (StringUtils.isNotBlank(record.getOuPhone())) { | if (StringUtils.isNotBlank(record.getOuPhone())) { | ||||
| WxCUserBasicInfo uq = new WxCUserBasicInfo(); | WxCUserBasicInfo uq = new WxCUserBasicInfo(); | ||||
| @@ -635,46 +635,25 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<Map<String, Object>> sumCardSpendForMerchant(WxCardSpendVo record) { | |||||
| public Map<String, BigDecimal> sumCardSpend(WxCardSpendVo record) { | |||||
| handleQueryParam(record); | handleQueryParam(record); | ||||
| List<Long> merchantIdList = wxCardSpendMapper.getMerchantIdList(record); | |||||
| Map<Long,WxMerchant> merchantMap = this.getMerchantMap(merchantIdList, record); | |||||
| WxMerchantSubsidy sq = getWxMerchantSubsidyQuery(record,merchantIdList); | |||||
| List<Map<String,Object>> merchantSubsidyMap = wxMerchantSubsidyMapper.sumByMerchantId(sq); | |||||
| Map<Long,Map<String,BigDecimal>> msmap = new HashMap<Long,Map<String,BigDecimal>>(); | |||||
| if (null != merchantSubsidyMap && merchantSubsidyMap.size() > 0 ) { | |||||
| for (int i = 0 ; i < merchantSubsidyMap.size(); i++) { | |||||
| Map<String,Object> result = merchantSubsidyMap.get(i) ; | |||||
| Map<String,BigDecimal> submap = new HashMap<String,BigDecimal>(); | |||||
| submap.put("sum_subsidy", (BigDecimal)result.get("sum_subsidy")); | |||||
| submap.put("sum_real_subsidy", (BigDecimal)result.get("sum_real_subsidy")); | |||||
| msmap.put((Long)result.get("merchant_id"), submap) ; | |||||
| } | |||||
| } | |||||
| //补贴暂时不算 | |||||
| // List<Long> merchantIdList = wxCardSpendMapper.getMerchantIdList(record); | |||||
| // Map<Long,WxMerchant> merchantMap = this.getMerchantMap(merchantIdList, record); | |||||
| // WxMerchantSubsidy sq = getWxMerchantSubsidyQuery(record,merchantIdList); | |||||
| // List<Map<String,Object>> merchantSubsidyMap = wxMerchantSubsidyMapper.sumByMerchantId(sq); | |||||
| // Map<Long,Map<String,BigDecimal>> msmap = new HashMap<Long,Map<String,BigDecimal>>(); | |||||
| // if (null != merchantSubsidyMap && merchantSubsidyMap.size() > 0 ) { | |||||
| // for (int i = 0 ; i < merchantSubsidyMap.size(); i++) { | |||||
| // Map<String,Object> result = merchantSubsidyMap.get(i) ; | |||||
| // Map<String,BigDecimal> submap = new HashMap<String,BigDecimal>(); | |||||
| // submap.put("sum_subsidy", (BigDecimal)result.get("sum_subsidy")); | |||||
| // submap.put("sum_real_subsidy", (BigDecimal)result.get("sum_real_subsidy")); | |||||
| // msmap.put((Long)result.get("merchant_id"), submap) ; | |||||
| // } | |||||
| // } | |||||
| List<Map<String, Object>> resultList = wxCardSpendMapper.sumCardSpendVoForMerchant(record); | |||||
| if (null != resultList && resultList.size() > 0 ) { | |||||
| for (int i = 0 ; i < resultList.size(); i++) { | |||||
| Map<String,Object> result = resultList.get(i); | |||||
| Long merchantId = (Long)result.get("merchant_id") ; | |||||
| if (null != merchantId) { | |||||
| WxMerchant merchant = merchantMap.get(merchantId); | |||||
| if (null != merchant) { | |||||
| result.put("merchantName", merchant.getName()); | |||||
| } | |||||
| Map<String,BigDecimal> busmap = msmap.get(merchantId); | |||||
| if (null != busmap) { | |||||
| result.put("sum_subsidy", (null == busmap.get("sum_subsidy"))?0:busmap.get("sum_subsidy")); | |||||
| result.put("sum_real_subsidy", (null == busmap.get("sum_real_subsidy")?0:busmap.get("sum_real_subsidy"))); | |||||
| }else { | |||||
| result.put("sum_subsidy", 0); | |||||
| result.put("sum_real_subsidy", 0); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return resultList; | |||||
| return wxCardSpendMapper.sumCardSpend(record); | |||||
| } | } | ||||
| private WxMerchantSubsidy getWxMerchantSubsidyQuery(WxCardSpendVo record,List<Long> merchantIdList) { | private WxMerchantSubsidy getWxMerchantSubsidyQuery(WxCardSpendVo record,List<Long> merchantIdList) { | ||||
| @@ -689,28 +668,6 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| return sq; | return sq; | ||||
| } | } | ||||
| @Override | |||||
| public List<Map<String, Object>> sumCardSpendForOwner(WxCardSpendVo record) { | |||||
| handleQueryParam(record); | |||||
| List<Long> merchantIdList = wxCardSpendMapper.getMerchantIdList(record); | |||||
| WxMerchantSubsidy sq = getWxMerchantSubsidyQuery(record,merchantIdList); | |||||
| Map<String,BigDecimal> submap = wxMerchantSubsidyMapper.sum(sq); | |||||
| List<Map<String, Object>> resultList = wxCardSpendMapper.sumCardSpendVoForOwner(record); | |||||
| if (null != resultList && resultList.size() > 0 ) { | |||||
| for (int i = 0 ; i < resultList.size(); i++) { | |||||
| Map<String,Object> result = resultList.get(i); | |||||
| if (null != submap) { | |||||
| result.put("sum_subsidy", (null == submap.get("sum_subsidy"))?0:submap.get("sum_subsidy")); | |||||
| result.put("sum_real_subsidy", (null == submap.get("sum_real_subsidy")?0:submap.get("sum_real_subsidy"))); | |||||
| }else { | |||||
| result.put("sum_subsidy", 0); | |||||
| result.put("sum_real_subsidy", 0); | |||||
| } | |||||
| } | |||||
| } | |||||
| return resultList; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCardSpend getById(Long id) { | public WxCardSpend getById(Long id) { | ||||
| return wxCardSpendMapper.selectById(id); | return wxCardSpendMapper.selectById(id); | ||||
| @@ -263,32 +263,15 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="sumCardSpendVoForMerchant" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select cs.merchant_id, | |||||
| <select id="sumCardSpend" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select | |||||
| 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 | ||||
| from wx_card_spend cs | from wx_card_spend cs | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| 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 | |||||
| from wx_card_spend cs | |||||
| where cs.owner_id = #{ownerId} | |||||
| <if test=" null != startdate"> | |||||
| and `create_date` >= #{startdate} | |||||
| </if> | |||||
| <if test="null != enddate"> | |||||
| and `create_date` <= and #{enddate} | |||||
| </if> | |||||
| order by cs.create_date desc | |||||
| </select> | |||||
| <select id="sumRealPayment" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="Integer"> | <select id="sumRealPayment" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="Integer"> | ||||
| select | select | ||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment | IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment | ||||