|
|
|
@@ -78,6 +78,9 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
@Autowired |
|
|
|
WxCouponActionLogService wxCouponActionLogService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxProfitSharingOrderService wxProfitSharingOrderService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { |
|
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); |
|
|
|
@@ -133,7 +136,7 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
if (pageIndex == null || pageSize == null) { |
|
|
|
List<WxOrder> list; |
|
|
|
list = wxOrderMapper.findListOfMicroPayOrderByDate(dateMap); |
|
|
|
logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); |
|
|
|
logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); |
|
|
|
int total_price = 0; |
|
|
|
for (WxOrder order : list) { |
|
|
|
total_price = total_price + order.getPayment(); |
|
|
|
@@ -815,69 +818,23 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
return wxOrderMapper.selectDetailOfCUser(record); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@Override |
|
|
|
public ResultData microPayListOnDateAsPage(Long bUserId, 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()); |
|
|
|
|
|
|
|
Map resultMap = new HashMap(); |
|
|
|
|
|
|
|
if (pageIndex == null || pageSize == null) { |
|
|
|
List<WxCouponOrder> list; |
|
|
|
list = wxOrderMapper.findListOfOrderedByDate(dateMap); |
|
|
|
logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); |
|
|
|
int total_price = 0; |
|
|
|
for (WxCouponOrder couponOrder : list) { |
|
|
|
total_price = total_price + couponOrder.getCouponPrice(); |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public void shareForMicroPay(Long orderId, Long payOrderId) { |
|
|
|
// 微信分账 |
|
|
|
try { |
|
|
|
WxPayOrder wxPayOrder = new WxPayOrder(); |
|
|
|
wxPayOrder.setId(payOrderId); |
|
|
|
wxPayOrder.setOrderId(orderId); |
|
|
|
wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); |
|
|
|
wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); |
|
|
|
if (wxPayOrder != null && |
|
|
|
wxPayOrder.getShare().equals(EnumPayShare.YES.getCode())) { |
|
|
|
wxProfitSharingOrderService.createSharingOrder(wxPayOrder); |
|
|
|
} |
|
|
|
resultMap.put("amount", total_price); |
|
|
|
} else { |
|
|
|
resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap))); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("微信分账: " + e.getMessage()); |
|
|
|
} |
|
|
|
return new ResultData(resultMap); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
} |