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..60579f26 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,83 @@ 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) { + 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 +767,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-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java index 71aa8de2..b3db9988 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentOilStationController.java @@ -293,7 +293,7 @@ public class HighTyAgentOilStationController { param.put("regionName", regionName); param.put("storeName", storeName); - if (userModel.getBsCompany() != null && userModel.getSecUser().getAdminFlag().equals(1)) { + if (userModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { param.put("isAssignOrgId", isAssignOrgId); param.put("organizationName", organizationName); param.put("isAssignTyAgent", isAssignTyAgent); @@ -301,7 +301,16 @@ public class HighTyAgentOilStationController { param.put("isAssignTySalesman", isAssignTySalesman); param.put("tySalesmanName", tySalesmanName); - } else if (userModel.getBsCompany() != null && userModel.getSecUser().getAdminFlag().equals(0)) { + } else if (userModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType()) && userModel.getSecUser().getAdminFlag().equals(1)) { + param.put("regionId", userModel.getBsCompany().getRegionId()); + param.put("isAssignOrgId", isAssignOrgId); + param.put("organizationName", organizationName); + param.put("isAssignTyAgent", isAssignTyAgent); + param.put("tyAgentName", tyAgentName); + param.put("isAssignTySalesman", isAssignTySalesman); + param.put("tySalesmanName", tySalesmanName); + + } else if (userModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType()) && userModel.getSecUser().getAdminFlag().equals(0)) { param.put("organizationId", userModel.getBsOrganization().getId()); param.put("isAssignTyAgent", isAssignTyAgent); param.put("tyAgentName", tyAgentName); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java index d0a1c2a1..eb7fc769 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java @@ -25,21 +25,29 @@ public interface HighCouponAgentRelMapperExt { " and a.status in (2,3) and a.coupon_code_id = b.id and a.sales_time >= #{consumeTimeS} and a.sales_time <= #{consumeTimeE}") AgentSalesModel getAgentSales(@Param("agentId") Long agentId, @Param("consumeTimeS")String consumeTimeS, @Param("consumeTimeE")String consumeTimeE); - @Select(" select a.* from high_coupon_agent_code a,high_coupon_code b,high_coupon_agent_rel c " + - " where c.id = a.coupon_agent_id and c.agent_id = #{agentId} and a.status in (2,3) and a.coupon_code_id = b.id " + + @Select(" select a.* from high_coupon_agent_code a" + + " LEFT JOIN high_coupon_agent_rel c on c.id = a.coupon_agent_id " + + " where c.id = a.coupon_agent_id and c.agent_id = #{agentId} and a.status in (2,3) " + " and a.sales_time >= #{consumeTimeS} and a.sales_time <= #{consumeTimeE} ORDER BY a.sales_time desc") @Results({ - @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="coupon_agent_id", property="couponAgentId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), - @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_agent_record_id", property="couponAgentRecordId", jdbcType=JdbcType.BIGINT), + @Result(column="convert_user_phone", property="convertUserPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="convert_code", property="convertCode", jdbcType=JdbcType.VARCHAR), + @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code", property="couponCode", jdbcType=JdbcType.VARCHAR), @Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="assign_coupon_agent_id", property="assignCouponAgentId", jdbcType=JdbcType.BIGINT), + @Result(column="assign_agent_id", property="assignAgentId", jdbcType=JdbcType.BIGINT), + @Result(column="assign_agent_name", property="assignAgentName", jdbcType=JdbcType.VARCHAR), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="sales_time", property="salesTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), 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..6b59df8d 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/dao/HighTyAgentOilStationMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationMapperExt.java index e5a6ecfd..85ef6f8d 100644 --- a/hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationMapperExt.java @@ -34,6 +34,7 @@ public interface HighTyAgentOilStationMapperExt { " from high_merchant_store a" + " LEFT JOIN high_ty_agent_oil_station b on a.id = b.oil_station_id and b.`status` = 1" + " where a.type = 1 and a.`status` = 1" + + " and a.region_id = #{param.regionId} " + " and a.region_name like concat('%',#{param.regionName},'%') " + " and a.store_name like concat('%',#{param.storeName},'%') " + " and b.organization_id is not null " + 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<>();