| @@ -44,7 +44,7 @@ public class DaliyAmountSchedule { | |||
| @Scheduled(cron = "0 0 1 * * ?") // 每天凌晨1点盘点前一天的数据 | |||
| //@Scheduled(cron = "*/30 * * * * ?") // 测试10秒中一次 | |||
| // @Scheduled(cron = "*/30 * * * * ?") // 测试10秒中一次 | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void daliyAmountSchedule() { | |||
| @@ -68,19 +68,21 @@ public class DaliyAmountSchedule { | |||
| continue; | |||
| } | |||
| for (int j=0; j < merchantList.size(); j++) { | |||
| Calendar cal = Calendar.getInstance(); | |||
| merchant = merchantList.get(j); | |||
| // 时间选择 | |||
| Calendar cal = Calendar.getInstance(); | |||
| cal.setTime(new Date()); | |||
| cal.set(Calendar.HOUR_OF_DAY, 0); | |||
| cal.set(Calendar.MINUTE, 0); | |||
| cal.set(Calendar.SECOND, 0); | |||
| cal.set(Calendar.MILLISECOND, 0); | |||
| cal.setTime(new Date()); | |||
| cal.set(Calendar.HOUR_OF_DAY, 0); | |||
| cal.set(Calendar.MINUTE, 0); | |||
| cal.set(Calendar.SECOND, 0); | |||
| cal.set(Calendar.MILLISECOND, 0); | |||
| cal.add(Calendar.DAY_OF_YEAR, 0); | |||
| Date endDate = cal.getTime(); | |||
| cal.add(Calendar.DAY_OF_YEAR, -1); | |||
| Date startDate = cal.getTime(); | |||
| Date endDate = cal.getTime(); | |||
| cal.add(Calendar.DAY_OF_YEAR, -1); | |||
| Date startDate = cal.getTime(); | |||
| for (int j=0; j < merchantList.size(); j++) { | |||
| merchant = merchantList.get(j); | |||
| Map dateMap = new HashMap(); | |||
| dateMap.put("startDate", startDate); | |||
| @@ -88,12 +90,12 @@ public class DaliyAmountSchedule { | |||
| dateMap.put("merchantId",merchant.getId()); | |||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | |||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | |||
| int total_price = list.stream().mapToInt(p->p.getCouponPrice()).sum(); | |||
| logger.info("\nFound " + list.size() + " coupon orders \n" + | |||
| "for " + merchant.getId() + "\n" + | |||
| "from " + startDate + " to " + new Date() +"\n" + | |||
| "for merchantId:" + merchant.getId() + "\n" + | |||
| "from " + startDate + " to " + endDate +"\n" + | |||
| "TOTAL ORDER=" + total_price); | |||
| WxDateAmountRecord dateAmountRecord = new WxDateAmountRecord(); | |||
| @@ -109,11 +111,11 @@ public class DaliyAmountSchedule { | |||
| wxDateAmountRecordService.saveAmount(dateAmountRecord); | |||
| list= wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | |||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | |||
| logger.info("\nfind " + list.size() + " coupon order from " + startDate + " to " + endDate); | |||
| total_price = list.stream().mapToInt(p->p.getCouponPrice()).sum(); | |||
| logger.info("\nFound " + list.size() + " coupon orders \n" + | |||
| "for " + merchant.getId() + "\n" + | |||
| "from " + startDate + " to " + new Date() +"\n" + | |||
| "for merchantId:" + merchant.getId() + "\n" + | |||
| "from " + startDate + " to " + endDate +"\n" + | |||
| "TOTAL VERIFIED=" + total_price); | |||
| dateAmountRecord.setPayPrice(total_price); | |||
| @@ -123,8 +125,9 @@ public class DaliyAmountSchedule { | |||
| Map microPayMap = wxOrderMapper.dayMicroPayAmountList(dateMap); | |||
| Long countMic = (Long) microPayMap.get("count"); | |||
| BigDecimal totalPriceMic = (BigDecimal) microPayMap.get("total_price"); | |||
| logger.info("find " + countMic + " order " + "\n" + | |||
| "from " + startDate + " to " + new Date() + "\n" + | |||
| logger.info("\nFound " + countMic + " order " + "\n" + | |||
| "for merchantId:" + merchant.getId() + "\n" + | |||
| "from " + startDate + " to " + endDate + "\n" + | |||
| "TOTAL Payment=" + totalPriceMic); | |||
| dateAmountRecord.setPayPrice(totalPriceMic.intValue()); | |||