diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java index 9d60bb8f..c2a3deba 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java @@ -200,8 +200,11 @@ public class HighGasController { @RequestParam(name = "storeId", required = false) Long storeId, @RequestParam(name = "staffId", required = false) Long staffId, @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "oilNo", required = false) Integer oilNo, @RequestParam(name = "createTimeS", required = false) Long createTimeS, @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { @@ -250,8 +253,11 @@ public class HighGasController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); } param.put("orderNo", orderNo); + param.put("gasOilNo", oilNo); param.put("createTimeS", createTimeS); param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); if (status == null) { param.put("status", "2,3,4,6,7"); @@ -268,6 +274,85 @@ public class HighGasController { } } + @RequestMapping(value="/countGasOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "统计加油订单") + public ResponseData countGasOrder(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "storeId", required = false) Long storeId, + @RequestParam(name = "staffId", required = false) Long staffId, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "oilNo", required = false) Integer oilNo, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + log.error("HighGasController -> disabledOil() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map param = new HashMap<>(); + // 用户来源 0:超级管理员 1:公司 2:商户 3:门店 4. 代理商 5.充值后台工商 6.团油代理商 7.团油业务员 8. 加油站员工 + if (userInfoModel.getSecUser().getObjectType().equals(2)) { + if (storeId != null) { + param.put("storeId", storeId); + } else { + String storeIdStr = ""; + List storeList = merchantStoreService.getStoreListByMer(userInfoModel.getMerchant().getId()); + for (HighMerchantStore store : storeList) { + if (StringUtils.isBlank(storeIdStr)) { + storeIdStr += store.getId().toString(); + } else { + storeIdStr += "," + store.getId().toString(); + } + } + + if (StringUtils.isNotBlank(storeIdStr)) { + param.put("storeId", storeIdStr); + } else { + param.put("storeId", 0); + } + } + param.put("gasStaffId", staffId); + + } else if (userInfoModel.getSecUser().getObjectType().equals(3)) { + param.put("storeId", userInfoModel.getMerchantStore().getId()); + param.put("gasStaffId", staffId); + + } else if (userInfoModel.getSecUser().getObjectType().equals(8)) { + if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status1.getStatus())) { + param.put("storeId", userInfoModel.getMerchantStore().getId()); + } + if (userInfoModel.getGasStaff().getPositionType().equals(GasPositionType.status2.getStatus())) { + param.put("gasStaffId", userInfoModel.getGasStaff().getId()); + } + } else { + log.error("HighGasController -> disabledOil() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + param.put("orderNo", orderNo); + param.put("gasOilNo", oilNo); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + + if (status == null) { + param.put("status", "2,3,4,6,7"); + } else { + param.put("status", status); + } + return ResponseMsgUtil.success(highOrderService.countGasOrder(param)); + + } catch (Exception e) { + log.error("HighGasController -> countGasOrder() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getGasOrderCount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询油站订单列表") @@ -684,7 +769,7 @@ public class HighGasController { if (store.getSourceType().equals(1)) { if (order.getPayType() == 2) { - OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice()); + OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getAccountMerchantNum(), order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { order.setOrderStatus(4); order.setRefundTime(new Date()); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 8c58f974..b39edebd 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1185,12 +1185,38 @@ public interface HighOrderMapperExt { " and goods_type = 3 " + " and goods_id in (${param.storeId}) " + " and a.gas_staff_id = #{param.gasStaffId}" + + " and a.gas_oil_no = #{param.gasOilNo}" + " and b.order_status in (${param.status})" + " = #{param.createTimeS} ]]> ", " ", + " = #{param.payTimeS} ]]> ", + " ", " and b.order_no LIKE concat('%', #{param.orderNo}, '%')" + " ORDER BY create_time desc" + "" }) List selectGasStoreOrderList(@Param("param") Map param); + + @Select({ + "" + }) + Map countGasStoreOrder(@Param("param") Map param); } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index fd34be09..fe415ec0 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -457,6 +457,14 @@ public interface HighOrderService { */ List getGasOrderList(Map param) throws Exception; + /** + * 统计加油站订单 + * @param param + * @return + * @throws Exception + */ + Map countGasOrder(Map param) throws Exception; + /** * 查询加油站订单列表 * @param orderNo diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 03a3e42b..18eb196b 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1698,9 +1698,32 @@ public class HighOrderServiceImpl implements HighOrderService { if (MapUtils.getLong(param, "createTimeE") != null) { param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), "yyyy-MM-dd HH:mm:ss")); } + if (MapUtils.getLong(param, "payTimeS") != null) { + param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + if (MapUtils.getLong(param, "payTimeE") != null) { + param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), "yyyy-MM-dd HH:mm:ss")); + } return highOrderMapperExt.selectGasStoreOrderList(param); } + @Override + public Map countGasOrder(Map param) throws Exception { + if (MapUtils.getLong(param, "createTimeS") != null) { + param.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + if (MapUtils.getLong(param, "createTimeE") != null) { + param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), "yyyy-MM-dd HH:mm:ss")); + } + if (MapUtils.getLong(param, "payTimeS") != null) { + param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + if (MapUtils.getLong(param, "payTimeE") != null) { + param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), "yyyy-MM-dd HH:mm:ss")); + } + return highOrderMapperExt.countGasStoreOrder(param); + } + @Override public GasOrderModel getGasOrderDetail(String orderNo) { Map param = new HashMap<>();