diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 394e9167..a5d71914 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -87,7 +87,7 @@ public class XhpcHistoryOrderController extends BaseController { * 终端统计 */ @GetMapping("/test3") - @Scheduled(cron = "0 0/8 * * * ?") + //@Scheduled(cron = "0 0/8 * * * ?") public void test3(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>"); logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>"); @@ -98,7 +98,7 @@ public class XhpcHistoryOrderController extends BaseController { * 场站统计 */ @GetMapping("/test2") - @Scheduled(cron = "0 0/7 * * * ?") + //@Scheduled(cron = "0 0/7 * * * ?") public void test2(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>"); logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>"); @@ -110,7 +110,7 @@ public class XhpcHistoryOrderController extends BaseController { * 日期统计 */ @GetMapping("/test1") - @Scheduled(cron = "0 0/6 * * * ?") + //@Scheduled(cron = "0 0/6 * * * ?") public void test1(){ logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>"); logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>"); @@ -138,11 +138,11 @@ public class XhpcHistoryOrderController extends BaseController { continue; } //每分钟多少度电 - BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,RoundingMode.HALF_UP); + BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN); if(decimal.compareTo(new BigDecimal(0)) !=1){ continue; } - BigDecimal divide = xhpc.getChargingDegree().divide(decimal,2,RoundingMode.HALF_UP); + BigDecimal divide = xhpc.getChargingDegree().divide(decimal,2,BigDecimal.ROUND_DOWN); if(betweenDay==0){ XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); @@ -179,12 +179,12 @@ public class XhpcHistoryOrderController extends BaseController { }else{ //跨天 Date updateTime2= DateUtil.endOfDay(startTime); - BigDecimal time5 = new BigDecimal((updateTime2.getTime()-startTime.getTime())).divide(new BigDecimal(60000),2, RoundingMode.HALF_UP); + BigDecimal time5 = new BigDecimal((updateTime2.getTime()-startTime.getTime())).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN); addStation(xhpc, time5,type,DateUtil.formatTime(startTime),"23:59:59",divide); DateTime tomorrow = DateUtil.offsetDay(startTime,1); Date startTime3 =DateUtil.beginOfDay(tomorrow); - BigDecimal tim = new BigDecimal(DateUtil.between(DateUtil.beginOfDay(tomorrow), DateUtil.endOfDay(endTime), DateUnit.MINUTE)/ 60).setScale(2, RoundingMode.HALF_UP); + BigDecimal tim = new BigDecimal(DateUtil.between(DateUtil.beginOfDay(tomorrow), DateUtil.endOfDay(endTime), DateUnit.MINUTE)/ 60).setScale(2, BigDecimal.ROUND_DOWN); //明天 addStation(xhpc, tim,type, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime),divide); } @@ -206,7 +206,7 @@ public class XhpcHistoryOrderController extends BaseController { //跨时段,跨费率,计费模型 try{ //小时统计 - List list = xhpcHistoryOrderService.getStatistisList(50,0); + List list = xhpcHistoryOrderService.getStatistisList(500,0); if(list !=null && list.size()>0){ for (XhpcChargeHistoryOrder xhpc:list) { //开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间 @@ -225,12 +225,10 @@ public class XhpcHistoryOrderController extends BaseController { continue; } //每分钟多少度电 - BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,RoundingMode.HALF_UP); + BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN); if(v.compareTo(new BigDecimal(0)) !=1){ continue; } - BigDecimal multiply = xhpc.getChargingDegree().divide(v,2,RoundingMode.HALF_UP); - //1时间没有跨天 DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd"); DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd"); @@ -245,7 +243,7 @@ public class XhpcHistoryOrderController extends BaseController { XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval(); xhpcSt.setStatus(endHour+1); xhpcSt.setChargingDegree(xhpc.getChargingDegree()); - xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, RoundingMode.HALF_UP)); + xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN)); xhpcSt.setChargingNumber(1); xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); xhpcSt.setServicePrice(xhpc.getServicePriceTotal()); @@ -277,27 +275,26 @@ public class XhpcHistoryOrderController extends BaseController { xhpcStatisticsService.addStatisticsTime(xhpcSt); //修改历史订单表状态 xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1); - }else { - //跨时段 - //总共时段 endHour+1-startHour - String yyyyMMdd = DateUtil.format(startTime, "yyyy-MM-dd"); - addStatisTime(xhpc, startTime, endTime, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, startHour, endHour,yyyyMMdd,multiply); + //总共多少时段 + int number=endHour + 1 - startHour; + addStatisticsTime(new HashMap(),xhpc, startTime, endTime, rateModelId, startHour, endHour,1,number); } }else{ //跨天 Date updateTime2= DateUtil.endOfDay(startTime); int startHour = DateUtil.hour(startTime, true); int endHour = DateUtil.hour(updateTime2, true); - String yyyyMMdd = DateUtil.format(startTime, "yyyy-MM-dd"); - addInterval(xhpc, startTime, updateTime2, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, startHour, endHour,yyyyMMdd,multiply); + int number=endHour + 1 - startHour; + //明天 DateTime tomorrow = DateUtil.offsetDay(startTime,1); Date startTime3 =DateUtil.beginOfDay(tomorrow); int startHour1 = DateUtil.hour(startTime3, true); int endHour1 = DateUtil.hour(endTime, true); - String yyyyMMdd1 = DateUtil.format(startTime3, "yyyy-MM-dd"); - addInterval(xhpc, startTime3, endTime, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, startHour1, endHour1,yyyyMMdd1,multiply); + int number1=endHour1 + 1 - startHour1; + Map map = addStatisticsTime(new HashMap(),xhpc, startTime, updateTime2, rateModelId, startHour, endHour, 2, number + number1); + addStatisticsTime(map,xhpc, startTime3, endTime, rateModelId, startHour1, endHour1,3,number+number1); } } @@ -309,6 +306,253 @@ public class XhpcHistoryOrderController extends BaseController { } } + /** + * + * @param xhpc + * @param startTime + * @param endTime + * @param rateModelId + * @param startHour + * @param endHour + * @param type 1 需要减去之前统计的值 2 不需要 + */ + private Map addStatisticsTime(Map map1,XhpcChargeHistoryOrder xhpc, Date startTime, Date endTime, Long rateModelId, int startHour, int endHour,int type,int number) { + + //跨时段 + //总共时段 endHour+1-startHour + String yyyyMMdd = DateUtil.format(startTime, "yyyy-MM-dd"); + + + //总金额 + BigDecimal totalPrice =new BigDecimal(0); + //总电费 + BigDecimal powerPriceTotal =new BigDecimal(0); + //总服务费 + BigDecimal servicePriceTotal =new BigDecimal(0); + //实收电费 + BigDecimal actPowerPrice =new BigDecimal(0); + //实收服务费 + BigDecimal actServicePrice =new BigDecimal(0); + //总充电电量 + BigDecimal chargingDegree =new BigDecimal(0); + //电站活动抵扣--抵扣的总金额 + BigDecimal promotionDiscount =new BigDecimal(0); + //实际价格-用户支付的钱 + BigDecimal actPrice =new BigDecimal(0); + if(type==3){ + totalPrice =map1.get("totalPrice"); + powerPriceTotal =map1.get("powerPriceTotal"); + servicePriceTotal =map1.get("servicePriceTotal"); + actPowerPrice =map1.get("actPowerPrice"); + actServicePrice =map1.get("actServicePrice"); + chargingDegree =map1.get("chargingDegree"); + promotionDiscount =map1.get("promotionDiscount"); + actPrice =map1.get("actPrice"); + }else{ + totalPrice = xhpc.getTotalPrice(); + powerPriceTotal =xhpc.getPowerPriceTotal(); + servicePriceTotal =xhpc.getServicePriceTotal(); + actPowerPrice =xhpc.getActPowerPrice(); + actServicePrice =xhpc.getActServicePrice(); + chargingDegree =xhpc.getChargingDegree(); + promotionDiscount = xhpc.getPromotionDiscount(); + actPrice = xhpc.getActPrice(); + } + //总时长 + BigDecimal time = new BigDecimal((xhpc.getEndTime().getTime()-xhpc.getStartTime().getTime())).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN); + //每分钟多少度电 + BigDecimal decimal = chargingDegree.divide(time,2,BigDecimal.ROUND_DOWN); + BigDecimal powerFee =new BigDecimal(0); + BigDecimal serviceFee =new BigDecimal(0); + BigDecimal timeInterval = new BigDecimal(0); + String srt =""; + String endt =""; + for (int i = startHour; i < endHour + 1; i++) { + String end = String.format("%02d", i); + //获取费率 + if (i == startHour) { + srt = DateUtil.formatTime(startTime); + endt = end + ":59:59"; + Map map =getReatTimeList(srt,endt,rateModelId); + powerFee =new BigDecimal(map.get("powerFee").toString()); + serviceFee =new BigDecimal(map.get("serviceFee").toString()); + timeInterval =new BigDecimal((DateUtil.parse(endt).getTime()-DateUtil.parse(srt).getTime())).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN); + } else if (i != endHour) { + srt = end + ":00:00"; + endt = end + ":59:59"; + Map map =getReatTimeList(srt,endt,rateModelId); + powerFee =new BigDecimal(map.get("powerFee").toString()); + serviceFee =new BigDecimal(map.get("serviceFee").toString()); + } else { + srt = end + ":00:00"; + endt = DateUtil.formatTime(endTime); + Map map =getReatTimeList(srt,endt,rateModelId); + powerFee =new BigDecimal(map.get("powerFee").toString()); + serviceFee =new BigDecimal(map.get("serviceFee").toString()); + } + XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval(); + xhpcSt.setStatus(i+1); + xhpcSt.setChargingTime(timeInterval); + //电量 + BigDecimal decimal1 = timeInterval.multiply(decimal).setScale(2, BigDecimal.ROUND_DOWN); + xhpcSt.setChargingDegree(decimal1); + xhpcSt.setChargingNumber(1); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(new BigDecimal(number),2,BigDecimal.ROUND_DOWN)); + if(i!=endHour || type==2){ + + xhpcSt.setPowerPrice(powerFee.multiply(decimal1).setScale(2, BigDecimal.ROUND_DOWN)); + xhpcSt.setServicePrice(serviceFee.multiply(decimal1).setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal powerPrice =xhpcSt.getPowerPrice(); + BigDecimal servicePrice =xhpcSt.getServicePrice(); + xhpcSt.setTotalPrice(powerPrice.add(servicePrice)); + + BigDecimal internetCommission = xhpcSt.getInternetCommission(); + + BigDecimal actPrice2 = powerPrice.add(servicePrice); + + if(internetCommission.compareTo(new BigDecimal(0))!=0){ + powerPrice =powerPrice.multiply(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + servicePrice=servicePrice.multiply(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + actPrice2 = actPrice2.subtract(internetCommission); + }else{ + servicePrice=servicePrice.multiply(xhpcSt.getInternetSvcCommission()); + actPrice2 =actPrice2.subtract(xhpcSt.getInternetSvcCommission()); + } + BigDecimal platformCommission = xhpcSt.getPlatformCommission(); + if(platformCommission.compareTo(new BigDecimal(0))!=0){ + powerPrice =powerPrice.multiply(platformCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + servicePrice=servicePrice.multiply(platformCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + }else{ + servicePrice=servicePrice.multiply(xhpcSt.getPlatformSvcCommisssion()); + } + + BigDecimal operationCommission = xhpcSt.getOperationCommission(); + if(operationCommission.compareTo(new BigDecimal(0))!=0){ + powerPrice =powerPrice.multiply(operationCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + servicePrice=servicePrice.multiply(operationCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + }else{ + servicePrice=servicePrice.multiply(xhpcSt.getOperationSvcCommission()); + } + + xhpcSt.setActPowerPrice(powerPrice); + xhpcSt.setActServicePrice(servicePrice); + + xhpcSt.setElecPriceEvcs(powerFee); + xhpcSt.setServicePriceEvcs(serviceFee); + //电站活动抵扣--抵扣的总金额 + BigDecimal promotionDiscount1 = xhpcSt.getPromotionDiscount(); + if(promotionDiscount.compareTo(promotionDiscount1)==1){ + promotionDiscount=promotionDiscount.subtract(promotionDiscount1); + actPrice2 = actPrice2.subtract(promotionDiscount1); + }else{ + xhpcSt.setPromotionDiscount(promotionDiscount); + actPrice2 = actPrice2.subtract(promotionDiscount); + } + xhpcSt.setActPrice(actPrice2); + //总金额 + BigDecimal totalPrice1 = xhpcSt.getTotalPrice(); + if(totalPrice.compareTo(totalPrice1)==1){ + totalPrice=totalPrice.subtract(totalPrice1); + }else{ + xhpcSt.setTotalPrice(totalPrice); + } + //总电费 + BigDecimal powerPrice1 = xhpcSt.getPowerPrice(); + if(powerPriceTotal.compareTo(powerPrice1)==1){ + powerPriceTotal=powerPriceTotal.subtract(powerPrice1); + }else{ + xhpcSt.setPowerPrice(powerPriceTotal); + } + //总服务费 + BigDecimal servicePrice1 = xhpcSt.getServicePrice(); + if(servicePriceTotal.compareTo(servicePrice1)==1){ + servicePriceTotal=servicePriceTotal.subtract(servicePrice1); + }else{ + xhpcSt.setServicePrice(servicePriceTotal); + } + //实收电费 + BigDecimal actPowerPrice1 = xhpcSt.getActPowerPrice(); + if(actPowerPrice.compareTo(actPowerPrice1)==1){ + actPowerPrice=actPowerPrice.subtract(actPowerPrice1); + }else{ + xhpcSt.setActPowerPrice(actPowerPrice); + } + //实收服务费 + BigDecimal actServicePrice1 = xhpcSt.getActServicePrice(); + if(actServicePrice.compareTo(actServicePrice1)==1){ + actServicePrice=actServicePrice.subtract(actServicePrice1); + }else{ + xhpcSt.setActServicePrice(actServicePrice); + } + //总充电电量 + BigDecimal chargingDegree1 = xhpcSt.getChargingDegree(); + if(chargingDegree.compareTo(chargingDegree1)==1){ + chargingDegree=chargingDegree.subtract(chargingDegree1); + }else{ + xhpcSt.setChargingDegree(chargingDegree); + } + + //实际价格-用户支付的钱 + BigDecimal actPrice1 = xhpcSt.getActPrice(); + if(actPrice.compareTo(actPrice1)==1){ + actPrice=actPrice.subtract(actPrice1); + }else{ + xhpcSt.setActPrice(actPrice); + } + }else{ + xhpcSt.setPowerPrice(powerPriceTotal); + xhpcSt.setServicePrice(servicePriceTotal); + xhpcSt.setTotalPrice(totalPrice); + xhpcSt.setPromotionDiscount(promotionDiscount); + xhpcSt.setActPrice(actPrice); + xhpcSt.setActPowerPrice(actPowerPrice); + xhpcSt.setActServicePrice(actServicePrice); + xhpcSt.setChargingDegree(chargingDegree); + } + xhpcSt.setActPrice(xhpcSt.getTotalPrice().subtract(xhpcSt.getPromotionDiscount())); + if(xhpc.getSource()==1){ + xhpcSt.setInternetUserId(xhpc.getUserId()); + } + xhpcSt.setOperatorId(xhpc.getOperatorId()); + xhpcSt.setChargingStationId(xhpc.getChargingStationId()); + xhpcSt.setDelFlag(0); + xhpcSt.setCreateTime(Calendar.getInstance().getTime()); + xhpcSt.setTerminalId(xhpc.getTerminalId()); + xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcSt.setStartTimeEvcs(yyyyMMdd+" "+srt); + xhpcSt.setEndTimeEvcs(yyyyMMdd+" "+endt); + xhpcStatisticsService.addStatisticsTime(xhpcSt); + //修改历史订单表状态 + xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1); + } + Map map2 =new HashMap<>(); + map2.put("totalPrice",totalPrice); + map2.put("powerPriceTotal",powerPriceTotal); + map2.put("servicePriceTotal",servicePriceTotal); + map2.put("actPowerPrice",actPowerPrice); + map2.put("actServicePrice",actServicePrice); + map2.put("chargingDegree",chargingDegree); + map2.put("promotionDiscount",promotionDiscount); + map2.put("actPrice",actPrice); + return map2; + } + + private Map getReatTimeList(String startTime,String endTime,Long rateModelId) { + Map map =new HashMap<>(); + List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime,endTime, rateModelId); + for (int j = 0; j < reatTimeList.size(); j++) { + Map map1 = reatTimeList.get(j); + return map1; + } + + return map; + } /** * 24小时异常订单自动结算 @@ -345,6 +589,7 @@ public class XhpcHistoryOrderController extends BaseController { + public void add(int number,int type){ //获取500条待统计历史订单 List list = xhpcHistoryOrderService.getStatistisList(number,type); @@ -353,7 +598,7 @@ public class XhpcHistoryOrderController extends BaseController { for (XhpcChargeHistoryOrder xhpc:list) { XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); xhpcSt.setChargingDegree(xhpc.getChargingDegree()); - BigDecimal decimal = new BigDecimal(xhpc.getChargingTimeNumber() / 3600).setScale(2, RoundingMode.HALF_UP); + BigDecimal decimal = new BigDecimal(xhpc.getChargingTimeNumber() / 3600).setScale(2, BigDecimal.ROUND_DOWN); xhpcSt.setChargingTime(decimal); xhpcSt.setChargingNumber(1); xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); @@ -405,10 +650,10 @@ public class XhpcHistoryOrderController extends BaseController { endTime1="23:59:59"; } //总度数 - BigDecimal chargingDegree2 = new BigDecimal((DateUtil.parse(endTime1).getTime() - DateUtil.parse(startTime1).getTime())/60000).multiply(divide).setScale(2, RoundingMode.HALF_UP); + BigDecimal chargingDegree2 = new BigDecimal((DateUtil.parse(endTime1).getTime() - DateUtil.parse(startTime1).getTime())/60000).multiply(divide).setScale(2, BigDecimal.ROUND_DOWN); chargingDegree1 =chargingDegree1.add(chargingDegree2); - powerPrice1 =powerPrice1.add(powerPrice.multiply(chargingDegree2).setScale(2, RoundingMode.HALF_UP)); - servicePrice1 =servicePrice1.add(servicePrice.multiply(chargingDegree2).setScale(2, RoundingMode.HALF_UP)); + powerPrice1 =powerPrice1.add(powerPrice.multiply(chargingDegree2).setScale(2, BigDecimal.ROUND_DOWN)); + servicePrice1 =servicePrice1.add(servicePrice.multiply(chargingDegree2).setScale(2, BigDecimal.ROUND_DOWN)); } } @@ -420,14 +665,14 @@ public class XhpcHistoryOrderController extends BaseController { xhpcSt.setServicePrice(servicePrice1); xhpcSt.setTotalPrice(powerPrice1.add(servicePrice1)); BigDecimal promotion =new BigDecimal(2); - xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(promotion,2, BigDecimal.ROUND_DOWN)); xhpcSt.setActPrice(xhpcSt.getTotalPrice().subtract(xhpcSt.getPromotionDiscount())); - xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(promotion,2, RoundingMode.HALF_UP)); - xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(promotion,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(promotion,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(promotion,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(promotion,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(promotion,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(promotion,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(promotion,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(promotion,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN)); //抽成费用 BigDecimal money = xhpcSt.getPlatformCommission().add(xhpcSt.getPlatformSvcCommisssion()) @@ -476,22 +721,22 @@ public class XhpcHistoryOrderController extends BaseController { XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval(); xhpcSt.setStatus(endHour+1); xhpcSt.setChargingDegree(xhpc.getChargingDegree()); - xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()/3600).setScale(2, RoundingMode.HALF_UP)); + xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()/3600).setScale(2, BigDecimal.ROUND_DOWN)); xhpcSt.setChargingNumber(1); BigDecimal number = new BigDecimal(2); - xhpcSt.setPowerPrice(xhpc.getActPowerPrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setServicePrice(xhpc.getActServicePrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setTotalPrice(xhpc.getTotalPrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setActPrice(xhpc.getActPrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2,RoundingMode.HALF_UP)); - xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2,RoundingMode.HALF_UP)); + xhpcSt.setPowerPrice(xhpc.getActPowerPrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setServicePrice(xhpc.getActServicePrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setTotalPrice(xhpc.getTotalPrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setActPrice(xhpc.getActPrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2,BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2,BigDecimal.ROUND_DOWN)); xhpcSt.setOperatorId(operatorId); xhpcSt.setChargingStationId(chargingStationId); xhpcSt.setCreateTime(data); @@ -563,9 +808,9 @@ public class XhpcHistoryOrderController extends BaseController { xhpcSt.setStartTimeEvcs(yyyyMMdd+" "+map.get("startTime").toString()); xhpcSt.setEndTimeEvcs(yyyyMMdd+" "+end); } - BigDecimal time5 = new BigDecimal((time3-time4)).divide(new BigDecimal(60000),2, RoundingMode.HALF_UP); + BigDecimal time5 = new BigDecimal((time3-time4)).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN); //每分钟多少度电 - BigDecimal decimal = multiply.multiply(time5).setScale(2,RoundingMode.HALF_UP); + BigDecimal decimal = multiply.multiply(time5).setScale(2,BigDecimal.ROUND_DOWN); BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString()); BigDecimal serviceFee =new BigDecimal(map.get("serviceFee").toString()); xhpcSt.setElecPriceEvcs(powerFee); @@ -574,33 +819,33 @@ public class XhpcHistoryOrderController extends BaseController { xhpcSt.setChargingDegree(decimal); xhpcSt.setChargingTime(time5); xhpcSt.setChargingNumber(1); - BigDecimal powerFee1 = powerFee.multiply(decimal).setScale(2, RoundingMode.HALF_UP); - BigDecimal serviceFee1 = serviceFee.multiply(decimal).setScale(2, RoundingMode.HALF_UP); + BigDecimal powerFee1 = powerFee.multiply(decimal).setScale(2, BigDecimal.ROUND_DOWN); + BigDecimal serviceFee1 = serviceFee.multiply(decimal).setScale(2, BigDecimal.ROUND_DOWN); xhpcSt.setPowerPrice(powerFee1); xhpcSt.setServicePrice(serviceFee1); xhpcSt.setTotalPrice(powerFee1.add(serviceFee1)); if(type==1){ - xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2, RoundingMode.HALF_UP)); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2, BigDecimal.ROUND_DOWN)); xhpcSt.setActPrice(powerFee1.add(serviceFee1).subtract(xhpcSt.getPromotionDiscount())); - xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2, RoundingMode.HALF_UP)); + xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2, BigDecimal.ROUND_DOWN)); }else{ - xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); xhpcSt.setActPrice(powerFee1.add(serviceFee1).subtract(xhpcSt.getPromotionDiscount())); - xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); - xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2, RoundingMode.HALF_UP).divide(size,2, RoundingMode.HALF_UP)); + xhpcSt.setActPowerPrice(xhpc.getActPowerPrice().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setActServicePrice(xhpc.getActServicePrice().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(number,2, BigDecimal.ROUND_DOWN).divide(size,2, BigDecimal.ROUND_DOWN)); } xhpcSt.setOperatorId(operatorId); xhpcSt.setChargingStationId(chargingStationId); @@ -619,20 +864,6 @@ public class XhpcHistoryOrderController extends BaseController { public static void main(String[] args) { - String dateStr1 = "02:00:00"; - Date date1 = DateUtil.parse(dateStr1); - String dateStr2 = "05:00:00"; - Date date2 = DateUtil.parse(dateStr2); - - System.out.println(date2.getTime()-date1.getTime()); - - - int i =4; - int i1 =04; - - - String end = String.format("%02d", i); - System.out.println(end); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index f8429686..76f470db 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -513,7 +513,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { private Map getRateTimeList(String startTime,String endTime,BigDecimal degree,BigDecimal powerPrice,BigDecimal servicePrice){ Map map =new HashMap<>(); BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).multiply(degree); - BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, RoundingMode.HALF_UP); + BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, BigDecimal.ROUND_DOWN); map.put("time",startTime+"-"+endTime); map.put("powerPrice",powerPrice); map.put("servicePrice",servicePrice); @@ -544,7 +544,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { int size = reatTimeList.size(); if(size==1){ BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()); - powerPriceTotal = powerPriceTotal.add(powerFee.multiply(degree).setScale(2, RoundingMode.HALF_UP)); + powerPriceTotal = powerPriceTotal.add(powerFee.multiply(degree).setScale(2, BigDecimal.ROUND_DOWN)); }else{ for (int i = 0; i objectMap = reatTimeList.get(i); @@ -574,7 +574,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { private BigDecimal getRateTimeList(String startTime,String endTime,BigDecimal degree,BigDecimal powerPrice){ BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).multiply(degree); - BigDecimal multiply = powerPrice.multiply(v).setScale(2, RoundingMode.HALF_UP); + BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN); return multiply; } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 742621b9..42a04ff4 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -244,9 +244,12 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { if("0".equals(operatorIdEvcs.get("commissionType").toString())){ internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); actPrice = actPrice.multiply(internetCommission); + surplusPowerPrice = surplusPowerPrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); + surplusServicePrice =surplusServicePrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); }else{ internetSvcCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); actPrice = actPrice.multiply(internetSvcCommission); + surplusServicePrice =surplusServicePrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN)); } } } @@ -483,7 +486,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { } private BigDecimal getRateTimeList(String startTime,String endTime,BigDecimal s,BigDecimal powerFee,BigDecimal powerPriceTotal){ - BigDecimal decimal = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).setScale(2, RoundingMode.HALF_UP); + BigDecimal decimal = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).setScale(2, BigDecimal.ROUND_DOWN); powerPriceTotal = powerPriceTotal.add(decimal.multiply(powerFee).multiply(s)); return powerPriceTotal.setScale(2, BigDecimal.ROUND_DOWN); } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java index a8fd096c..e493224f 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRechargeOrderController.java @@ -50,13 +50,22 @@ public class XhpcRechargeOrderController extends BaseController { */ //@PreAuthorize(hasPermi = "refund:order:page") @GetMapping("/page") - public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd) { + public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { startPage(); - List> list = iXhpcRechargeOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd); + List> list = iXhpcRechargeOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type); return getDataTable(list); } + /** + * 统计 + */ + @GetMapping("/sumMoney") + @ApiOperation(value = "充值统计订单") + public AjaxResult sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + return AjaxResult.success(iXhpcRechargeOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type)); + } + /** * 每隔30分钟,清理一次未支付的订单 */ diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java index 659a395e..2a8e8ccb 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/XhpcRefundOrderController.java @@ -101,9 +101,18 @@ public class XhpcRefundOrderController extends BaseController { */ //@PreAuthorize(hasPermi = "refund:order:page") @GetMapping("/page") - public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd) { + public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { startPage(); - List> list = iXhpcRefundOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd); + List> list = iXhpcRefundOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type); return getDataTable(list); } + + /** + * 统计 + */ + @GetMapping("/sumMoney") + @ApiOperation(value = "退款统计订单") + public AjaxResult sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + return AjaxResult.success(iXhpcRefundOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type)); + } } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java index b1b61e20..a61d756b 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRechargeOrderMapper.java @@ -47,7 +47,20 @@ public interface XhpcRechargeOrderMapper { * @param createTimeEnd * @return */ - public List> page(@Param("phone") String phone, @Param("rechargeOrderNumber") String rechargeOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd); + public List> page(@Param("phone") String phone, @Param("rechargeOrderNumber") String rechargeOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + + /** + * 统计 + * + * @param phone + * @param rechargeOrderNumber + * @param status + * @param createTimeStart + * @param createTimeEnd + * @return + */ + public String sumMoney(@Param("phone")String phone,@Param("rechargeOrderNumber") String rechargeOrderNumber,@Param("status") String status,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + /** * 查询充值订单详情 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java index f124ef79..f5bea4c7 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/mapper/XhpcRefundOrderMapper.java @@ -63,7 +63,22 @@ public interface XhpcRefundOrderMapper { * @param createTimeEnd * @return */ - public List> page(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd); + public List> page(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + + + /** + * 统计订单列表 + * + * @param phone + * @param refundOrderNumber + * @param status + * @param createTimeStart + * @param createTimeEnd + * @return + */ + public String sumMoney(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type); + + /** * 通过用户id查询未完成充电订单 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java index 68751705..7c855f94 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRechargeOrderService.java @@ -38,7 +38,19 @@ public interface IXhpcRechargeOrderService { * @param createTimeEnd * @return */ - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); + + /** + * 统计 + * + * @param phone + * @param rechargeOrderNumber + * @param status + * @param createTimeStart + * @param createTimeEnd + * @return + */ + public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); /** * 新增 充值订单 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java index 732abd5b..ecfd9169 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/IXhpcRefundOrderService.java @@ -40,7 +40,20 @@ public interface IXhpcRefundOrderService { * @param createTimeEnd * @return */ - public List> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd); + public List> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); + + + /** + * 退款订单分页列表 + * + * @param phone + * @param refundOrderNumber + * @param status + * @param createTimeStart + * @param createTimeEnd + * @return + */ + public String sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type); /** * 新增 退款订单 diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java index b3df929a..f3c03799 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRechargeOrderServiceImpl.java @@ -61,8 +61,14 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService { * @return */ @Override - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd) { - return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + } + + @Override + public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) { + + return xhpcRechargeOrderMapper.sumMoney(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd, type); } /** diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java index 6a33e7d7..370ad085 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/service/impl/XhpcRefundOrderServiceImpl.java @@ -64,8 +64,14 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService { * @return */ @Override - public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd) { - return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd); + public List> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) { + return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type); + } + + @Override + public String sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) { + + return xhpcRefundOrderMapper.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd, type); } /** diff --git a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml index c11bca2b..e32c9a90 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml +++ b/xhpc-modules/xhpc-payment/src/main/resources/mapper/XhpcRechargeOrderMapper.xml @@ -163,9 +163,41 @@ AND xro.create_time <= #{createTimeEnd} + + AND xro.type = #{type} + ORDER BY xro.create_time DESC + + + + + + diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcOperatorMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcOperatorMapper.xml index 4683ef7c..a4c0219a 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcOperatorMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcOperatorMapper.xml @@ -242,10 +242,10 @@ latitude = #{latitude}, email = #{email}, commission_type = #{commissionType}, - platform_commission_rate = + platform_commission_rate = #{platformCommissionRate}, - maintenance_commission_rate + maintenance_commission_rate = #{maintenanceCommissionRate}, business_license_id =