| @@ -45,7 +45,13 @@ public class WxDateAmountRecordController extends BaseController { | |||
| return list(EnumDateAmtType.VERIFY_RECORD.getCode()); | |||
| } | |||
| private ResultData list(int status) { | |||
| @ApiOperation("首页查询刷卡金额记录接口") | |||
| @GetMapping("listMicropay") | |||
| public ResultData listMicropay() { | |||
| return list(EnumDateAmtType.MICROPAY_RECORD.getCode()); | |||
| } | |||
| private ResultData list(int dateAmtType) { | |||
| List<AmountRecordVo> list = new ArrayList<>(); | |||
| @@ -53,7 +59,7 @@ public class WxDateAmountRecordController extends BaseController { | |||
| WxMerchantBUser u = getUser(); | |||
| temp.setTenantId(u.getTenantId()); | |||
| temp.setMerchantId(u.getMerchantId()); | |||
| temp.setType(status); | |||
| temp.setType(dateAmtType); | |||
| temp.setSortColumns(WxDateAmountRecord.Field.UpdateDate_DESC); | |||
| SimpleDateFormat fmt = new SimpleDateFormat("MM/dd"); | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.PayProperty; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| @@ -199,12 +200,13 @@ public class WxMicroPayController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("某日期扫码支付总流水") | |||
| @GetMapping("getMicroPayAmountOnDate") | |||
| @ApiOperation("刷卡支付交易流水分页列表接口") | |||
| @GetMapping("listMicroPay") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")}) | |||
| public ResultData getUnverifiedAmountOnDate(String date) { | |||
| //return wxCouponOrderService.listOnDateAsPage(getUser().getId(), date, null, null, false); | |||
| return new ResultData(); | |||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"), | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query",required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query",required = true)}) | |||
| public ResultData listUnverified(String date, Integer pageNum, Integer pageSize) { | |||
| return wxOrderService.microPayListOnDateAsPage(getUser().getId(), EnumOrderType.MICROPAY.getCode(), date, pageNum, pageSize); | |||
| } | |||
| } | |||
| @@ -1,10 +1,7 @@ | |||
| package com.iformall.schedule; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxDateAmountRecord; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumDateAmtType; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.mapper.*; | |||
| @@ -40,6 +37,8 @@ public class DaliyAmountSchedule { | |||
| @Autowired | |||
| private WxDateAmountRecordService wxDateAmountRecordService; | |||
| @Autowired | |||
| private WxOrderMapper wxOrderMapper; | |||
| @@ -125,6 +124,17 @@ public class DaliyAmountSchedule { | |||
| dateAmountRecord.setType(EnumDateAmtType.VERIFY_RECORD.getCode()); | |||
| wxDateAmountRecordService.saveAmount(dateAmountRecord); | |||
| Map microPayMap = wxOrderMapper.dayMicroPayAmountList(dateMap); | |||
| int countMic = (int) microPayMap.get("count"); | |||
| int totalPriceMic = (int) microPayMap.get("totalPrice"); | |||
| logger.info("find " + countMic + " order " + "\n" + | |||
| "from " + startDate + " to " + new Date() + "\n" + | |||
| "TOTAL Payment=" + totalPriceMic); | |||
| dateAmountRecord.setPayPrice(totalPriceMic); | |||
| dateAmountRecord.setType(EnumDateAmtType.MICROPAY_RECORD.getCode()); | |||
| wxDateAmountRecordService.saveAmount(dateAmountRecord); | |||
| } | |||
| } | |||
| } | |||
| @@ -5,9 +5,10 @@ package com.iformall.enums; | |||
| */ | |||
| public enum EnumDateAmtType { | |||
| // 0 交易记录 1.核销记录; | |||
| // 0 交易记录 1.核销记录 2:刷卡支付; | |||
| PAY_RECORD(0, "交易记录"), | |||
| VERIFY_RECORD(1, "核销记录"), | |||
| MICROPAY_RECORD(2, "刷卡支付"), | |||
| ; | |||
| public static EnumDateAmtType getEnum(Integer code) { | |||
| @@ -18,4 +18,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | |||
| WxOrderCVo selectDetailOfCUser(WxOrder wxOrder); | |||
| Map dayMicroPayAmountList(Map dateMap); | |||
| List<WxOrder> findListOfMicroPayOrderByDate(Map dateMap); | |||
| } | |||
| @@ -24,6 +24,15 @@ public interface WxOrderService { | |||
| PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据日期 b用户查刷卡支付list | |||
| * | |||
| * @param bUserId B端用户) | |||
| */ | |||
| ResultData microPayListOnDateAsPage(Long bUserId, Integer type, String date, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 提交订单 | |||
| * @param user | |||
| @@ -83,6 +83,68 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public ResultData microPayListOnDateAsPage(Long bUserId, Integer type, String date, Integer pageIndex, Integer pageSize) { | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId.longValue()); | |||
| if (wxMerchantBUser == null) { | |||
| logger.error("B端用户不存在:" + bUserId); | |||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(wxMerchantBUser.getMerchantId()); | |||
| if (wxMerchant == null) { | |||
| logger.error("商户不存在:" + bUserId); | |||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||
| String dateString; | |||
| Date startDate; | |||
| Date endDate; | |||
| if (date == null) { | |||
| endDate = new Date(); | |||
| dateString = fmt.format(new Date()); | |||
| try { | |||
| startDate = fmt.parse(dateString); | |||
| } catch (ParseException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| } else { | |||
| try { | |||
| startDate = fmt.parse(date); | |||
| } catch (ParseException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| Calendar cal = Calendar.getInstance(); | |||
| cal.setTime(startDate); | |||
| cal.add(Calendar.DATE, 1); | |||
| endDate = cal.getTime(); | |||
| } | |||
| Map dateMap = new HashMap(); | |||
| dateMap.put("startDate", startDate); | |||
| dateMap.put("endDate", endDate); | |||
| dateMap.put("merchantID", wxMerchant.getId()); | |||
| dateMap.put("type", type); | |||
| Map resultMap = new HashMap(); | |||
| if (pageIndex == null || pageSize == null) { | |||
| List<WxOrder> list; | |||
| list = wxOrderMapper.findListOfMicroPayOrderByDate(dateMap); | |||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | |||
| int total_price = 0; | |||
| for (WxOrder order : list) { | |||
| total_price = total_price + order.getPayment(); | |||
| } | |||
| resultMap.put("amount", total_price); | |||
| } else { | |||
| resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfMicroPayOrderByDate(dateMap))); | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| private int getUserCouponOrderCount(WxCUser user, WxCoupon counpon) { | |||
| // 用户购买的券包数量 | |||
| @@ -697,6 +759,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| // 2. get pay order | |||
| WxPayOrder payOrderQ = new WxPayOrder(); | |||
| payOrderQ.setTenantId(order.getTenantId()); | |||
| payOrderQ.setOrderId(order.getId()); | |||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| List<WxPayOrder> payOrders = wxPayOrderMapper.select(payOrderQ); | |||
| @@ -238,22 +238,54 @@ | |||
| </select> | |||
| <select id="dayMicroPayAmountList" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer"> | |||
| select count(*) from wx_order | |||
| where 1=1 | |||
| <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | |||
| select count(*) as count, sum(payment) as total_price | |||
| from wx_order | |||
| where `type` = 1 and `order_status` = 1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and `b_user_id` = #{bUserId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != orderStatus "> | |||
| and `order_status` = #{orderStatus} | |||
| <if test="startDate != null"> | |||
| AND create_date > #{startDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="endDate != null"> | |||
| AND create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| </select> | |||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_order | |||
| where order_status = '1' and `type` = 1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and `b_user_id` = #{bUserId} | |||
| </if> | |||
| <if test="startDate != null"> | |||
| AND create_date > #{startDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="endDate != null"> | |||
| AND create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| and `create_date` between date_sub(now(),interval 1 day) and now() | |||
| </select> | |||