| @@ -17,6 +17,8 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author Stormeye Wu wuguoqiang@iformall.com | * @author Stormeye Wu wuguoqiang@iformall.com | ||||
| */ | */ | ||||
| @@ -50,4 +52,16 @@ public class WxCardPayController extends BaseController { | |||||
| 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); | ||||
| } | } | ||||
| @ApiOperation("C端扫B端储值卡交易流水SUM") | |||||
| @GetMapping("sum") | |||||
| public ResultData sumCardOrderList(@ModelAttribute WxCardSpendVo wxCardSpend) { | |||||
| String ipStr = getIpAddr(); | |||||
| logger.info("sumCardOrderList: " + ipStr + " :" + wxCardSpend.toString()); | |||||
| if (wxCardSpend == null) wxCardSpend = new WxCardSpendVo(); | |||||
| WxMerchantBUser user = getUser(); | |||||
| wxCardSpend.setTenantId(user.getTenantId()); | |||||
| final Map map = wxCardSpendService.sumCardSpend(wxCardSpend); | |||||
| return new ResultData(map); | |||||
| } | |||||
| } | } | ||||
| @@ -10,8 +10,8 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> { | |||||
| List<WxCardSpend> findList(WxCardSpend wxCardSpend); | List<WxCardSpend> findList(WxCardSpend wxCardSpend); | ||||
| List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | List<WxCardSpendVo> findCardSpendVoList(WxCardSpend wxCardSpend); | ||||
| Map sumCardSpendVo(WxCardSpend wxCardSpend); | |||||
| @@ -5,6 +5,8 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCardSpendVo; | import com.iformall.domain.vo.WxCardSpendVo; | ||||
| import java.util.Map; | |||||
| public interface WxCardSpendService { | public interface WxCardSpendService { | ||||
| /** | /** | ||||
| @@ -29,6 +31,14 @@ public interface WxCardSpendService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCardSpendVo> listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize); | PageInfo<WxCardSpendVo> listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体SUM | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| Map<String, Object> sumCardSpend(WxCardSpendVo record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class WxCardSpendServiceImpl implements WxCardSpendService { | public class WxCardSpendServiceImpl implements WxCardSpendService { | ||||
| @@ -218,6 +219,11 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Object> sumCardSpend(WxCardSpendVo record) { | |||||
| return wxCardSpendMapper.sumCardSpendVo(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCardSpend getById(Long id) { | public WxCardSpend getById(Long id) { | ||||
| return wxCardSpendMapper.selectByPrimaryKey(id); | return wxCardSpendMapper.selectByPrimaryKey(id); | ||||
| @@ -198,7 +198,20 @@ | |||||
| left join wx_c_user ou on ou.id = co.owner_id | left join wx_c_user ou on ou.id = co.owner_id | ||||
| <include refid="dynamicVoWhereConditions" /> | <include refid="dynamicVoWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="sumCardSpendVo" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="hashmap"> | |||||
| select | |||||
| 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 | |||||
| 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" /> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||