diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index 60345469..00b9c708 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -296,14 +296,10 @@ public class OutRechargeOrderController { if (finishTimeS != null){ map.put("finishTimeS", finishTimeS.toString()); - } else { - map.put("finishTimeS", null); } if (finishTimeE != null){ map.put("finishTimeE", finishTimeE.toString()); - } else { - map.put("finishTimeE", null); } PageHelper.startPage(pageNum,pageSize); diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 76a789a8..a83af85f 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -26,8 +26,7 @@ public interface OutRechargeOrderMapperExt { "sum(order_price) as order_price", "from out_recharge_order", "where status = 3", - " = '${map.finishTimeS}' ]]> " , - " " , + " and finish_time between #{finishTimeS} and #{finishTimeE} " , "GROUP BY day", "" }) @@ -37,7 +36,7 @@ public interface OutRechargeOrderMapperExt { @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL), }) - List getListOrderCount(@Param("map") Map map); + List getListOrderCount(String finishTimeS , String finishTimeE); @Select({ "SELECT" + diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index e84fd03f..cfc31f46 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -96,6 +96,6 @@ public interface OutRechargeOrderService { * @Param [map] * @return java.util.List **/ - List getListOrderCount(Map map); + List getListOrderCount(Map map) throws Exception; } diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 193edd34..e99b3e95 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.hai.common.utils.DateUtil; import com.hai.dao.OutRechargeOrderMapper; import com.hai.dao.OutRechargeOrderMapperExt; import com.hai.entity.*; @@ -7,12 +8,15 @@ import com.hai.model.OutOrderModel; import com.hai.model.OutRechargeOrderModel; import com.hai.service.OutRechargeOrderService; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; @@ -122,7 +126,38 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - public List getListOrderCount(Map map) { - return outRechargeOrderMapperExt.getListOrderCount(map); + public List getListOrderCount(Map map) throws Exception { + String finishTimeS = map.get("finishTimeS"); + String finishTimeE = map.get("finishTimeE"); + String fTimeS; + String fTimeE; + if (StringUtils.isNotBlank(finishTimeS)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date(Long.parseLong(finishTimeS))); + //时 + calendar.set(Calendar.HOUR_OF_DAY, 00); + //分 + calendar.set(Calendar.MINUTE, 00); + //秒 + calendar.set(Calendar.SECOND, 00); + fTimeS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()); + + } else { + fTimeS = "2010-09-13 22:36:01"; + } + if (StringUtils.isNotBlank(finishTimeE)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date(Long.parseLong(finishTimeE))); + //时 + calendar.set(Calendar.HOUR_OF_DAY, 00); + //分 + calendar.set(Calendar.MINUTE, 00); + //秒 + calendar.set(Calendar.SECOND, 00); + fTimeE = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()); + } else { + fTimeE = DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + return outRechargeOrderMapperExt.getListOrderCount(fTimeS , fTimeE); } }