From be15ff8b846b94cd8ef2c1967b3a4417e4567532 Mon Sep 17 00:00:00 2001 From: yuyang Date: Thu, 9 Jun 2022 15:46:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=82=E5=B8=B8=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=AE=A1=E6=A0=B8=E3=80=81=E5=88=B7=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WorkOrderServiceImpl.java | 1 - .../xhpc/card/domain/SearchCardResponse.java | 6 +++ .../domain/SearchCardUserQueryCondition.java | 4 ++ .../service/impl/XhpcCardServiceImpl.java | 4 ++ .../resources/mapper/XhpcAppUserMapper.xml | 15 +++--- .../mapper/XhpcCommunityPersonnelMapper.xml | 7 +++ .../mapper/XhpcCustomersPersonnelMapper.xml | 6 +++ .../XhpcChargingPileController.java | 4 ++ .../order/api/XhpcPileOrderController.java | 25 +++++++++- .../impl/XhpcRealTimeOrderServiceImpl.java | 47 +++++++++++++------ .../mapper/XhpcHistoryOrderMapper.xml | 4 +- .../resources/mapper/XhpcStatisticsMapper.xml | 19 ++++++++ .../service/impl/XhpcInvoiceServiceImpl.java | 15 +++--- .../resources/mapper/XhpcInvoiceMapper.xml | 1 + 14 files changed, 123 insertions(+), 35 deletions(-) diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java index 0a350796..096b8019 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/WorkOrderServiceImpl.java @@ -222,7 +222,6 @@ public class WorkOrderServiceImpl implements WorkOrderService { @Override public R workOrderMessage(Integer type, String time) { int i = orderMapper.workOrderMessage(type, time); - System.out.println("------------iiiiii--------"+i); if(i>0){ return R.fail(); } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardResponse.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardResponse.java index 00ec01e3..e6551ddc 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardResponse.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardResponse.java @@ -47,6 +47,12 @@ public class SearchCardResponse { @JsonProperty("userType") private Integer userType; + @JsonProperty("phone") + private String phone; + + @JsonProperty("name") + private String name; + } } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardUserQueryCondition.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardUserQueryCondition.java index 0d49fb03..cf869a55 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardUserQueryCondition.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/SearchCardUserQueryCondition.java @@ -25,6 +25,10 @@ public class SearchCardUserQueryCondition { @JsonProperty("userType") @NotNull(message = "userType的参数名不正确或者userType的值为空,请检查传入参数") private Integer userType; + + private String name; + + private String phone; /** * cardClassification */ diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java index 03a3eaa0..8571b2d4 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java @@ -308,6 +308,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService { SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO(); dataDTO.setUserAccount(xhpcCommunityPersonnel.getAccount()); dataDTO.setUserType(2); + dataDTO.setPhone(xhpcCommunityPersonnel.getPhone()); + dataDTO.setName(xhpcCommunityPersonnel.getName()); searchCardResponse.getData().add(dataDTO); } return R.ok(searchCardResponse); @@ -320,6 +322,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService { SearchCardResponse.DataDTO dataDTO = new SearchCardResponse.DataDTO(); dataDTO.setUserAccount(xhpcCustomersPersonnel.getAccount()); dataDTO.setUserType(3); + dataDTO.setPhone(xhpcCustomersPersonnel.getPhone()); + dataDTO.setName(xhpcCustomersPersonnel.getName()); searchCardResponse.getData().add(dataDTO); } return R.ok(searchCardResponse); diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcAppUserMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcAppUserMapper.xml index 36431e95..c96c6796 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcAppUserMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcAppUserMapper.xml @@ -328,14 +328,13 @@ (phone) FROM xhpc_app_user - - - and find_in_set(tenant_id, #{tenantIdsStr}) - - - and create_time =]]> DATE_ADD(#{currentTime},INTERVAL -3 MONTH) - - + where del_flag =0 + + and find_in_set(tenant_id, #{tenantIdsStr}) + + + and create_time =]]> DATE_ADD(#{currentTime},INTERVAL -3 MONTH) + ) AS a \ No newline at end of file diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCommunityPersonnelMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCommunityPersonnelMapper.xml index c32c8689..18bbbec8 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCommunityPersonnelMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCommunityPersonnelMapper.xml @@ -63,6 +63,13 @@ #{userId} + + and name like concat('%',#{queryCondition.name},'%') + + + and phone like concat('%',#{queryCondition.phone},'%') + + limit #{queryCondition.currentPage},#{queryCondition.items} diff --git a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCustomersPersonnelMapper.xml b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCustomersPersonnelMapper.xml index 970f922f..a08842dc 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCustomersPersonnelMapper.xml +++ b/xhpc-modules/xhpc-card/src/main/resources/mapper/XhpcCustomersPersonnelMapper.xml @@ -63,6 +63,12 @@ #{userId} + + and name like concat('%',#{queryCondition.name},'%') + + + and phone like concat('%',#{queryCondition.phone},'%') + limit #{queryCondition.currentPage},#{queryCondition.items} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java index a8acec1a..abfd0ed0 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java @@ -174,6 +174,10 @@ public class XhpcChargingPileController extends BaseController { if(configRateReply==null || "".equals(configRateReply)){ return AjaxResult.success("未下发"); } + String configTimeReply = redisService.getCacheObject("pile:" + serialNumber + ".configTimeReply"); + if(configTimeReply !=null && !"".equals(configTimeReply)){ + return AjaxResult.success(configRateReply+"--"+configTimeReply); + } return AjaxResult.success(configRateReply); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 94a31ed1..528bb293 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -65,7 +65,7 @@ public class XhpcPileOrderController extends BaseController { @GetMapping("/chargeOrder/pileStartup") public R pileStartup(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) { logger.info("桩启动回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo); - + XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo); //解析订单编号 Long userId =0L; Integer code =200; @@ -74,6 +74,12 @@ public class XhpcPileOrderController extends BaseController { logger.info("桩启动回调接口--无效订单号>>>>>orderNo:" + orderNo); return R.fail(500,"无效订单号"); } + + if(historyOrder !=null){ + logger.info(">>>>>订单已结算不在改变订单状态>>>>>>>>>"); + return R.ok(); + } + if (status == 1) { userId = update(0, remark, orderNo, 0); } else { @@ -115,6 +121,12 @@ public class XhpcPileOrderController extends BaseController { public R pileStop(@RequestParam(value = "orderNo")String orderNo, @RequestParam(value = "status")Integer status,@RequestParam(value = "remark") String remark) { logger.info("桩停止回调接口>>>>>状态:"+status+"备注++"+remark+"订单号"+orderNo); + XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo); + //解析订单编号 + if(historyOrder !=null){ + logger.info(">>>>>订单已结算不在改变订单状态>>>>>>>>>"); + return R.ok(); + } //解析订单编号 Integer code = 500; Long userId=0L; @@ -279,6 +291,11 @@ public class XhpcPileOrderController extends BaseController { public R pileEndOrder(@RequestParam(value = "orderNo") String orderNo) { logger.info("桩订单结束回调>>>>>orderNo:"+orderNo); try{ + XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo); + if(historyOrder !=null){ + logger.info("订单已结束不能重复结算>>>>>orderNo:"+orderNo); + return R.ok(); + } //获取实时订单 Map cacheMap = redisService.getCacheMap("order:"+orderNo); if(cacheMap==null || cacheMap.get("orderData")==null ){ @@ -368,7 +385,6 @@ public class XhpcPileOrderController extends BaseController { } return R.ok(); } - if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){ logger.info("订单已结束不能重复结算>>>>>orderNo:"+orderNo+">>>chargeOrderId:"+xhpcChargeOrder.getChargeOrderId()); return R.ok(); @@ -590,6 +606,11 @@ public class XhpcPileOrderController extends BaseController { logger.info("订单异常回调接口--无效订单号>>>>>orderNo:" + orderNo); return R.fail(500,"无效订单号"); } + XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(null, orderNo); + if(historyOrder !=null){ + logger.info("订单已结束不能重复结算>>>>>orderNo:"+orderNo); + return R.ok(); + } if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){ logger.info("订单异常回调接口--已结算订单>>>>>orderNo:" + orderNo); return R.ok(); 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 b56add96..37ed5a0f 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 @@ -353,8 +353,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe try{ Map cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber()); - if(cacheMap.get("stopReason") !=null && !"".equals(cacheMap.get("stopReason").toString())){ - xhpcChargeOrder.setType(cacheMap.get("stopReason").toString()); + if(cacheMap.get("stopReasonHex") !=null && !"".equals(cacheMap.get("stopReasonHex").toString())){ + xhpcChargeOrder.setType(cacheMap.get("stopReasonHex").toString()); }else{ xhpcChargeOrder.setType("91"); xhpcChargeOrder.setStopReasonEvcs(45); @@ -366,7 +366,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe Map userMessage =new HashMap<>(); XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder(); - if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null){ + if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null || xhpcChargeOrder.getChargingDegree()==null){ //获取实时数据 Map cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber()); if(cacheMap !=null){ @@ -385,21 +385,22 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe BigDecimal bigDecimal = new BigDecimal(10000); BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP); xhpcChargeOrder.setChargingDegree(divide); - } - - if(cacheMap.get("realtimeDataList") !=null){ - List list = (List) cacheMap.get("realtimeDataList"); - if(list !=null && list.size()>0){ - xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss")); - xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss")); - } }else{ - if(cacheMap.get("startTime") !=null) { - xhpcChargeOrder.setEndTime(DateUtil.parse(cacheMap.get("startTime").toString(), "yyyy-MM-dd HH:mm:ss")); + if(cacheMap.get("realtimeDataList") !=null){ + List list = (List) cacheMap.get("realtimeDataList"); + if(list !=null && list.size()>0){ + xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss")); + xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss")); + BigDecimal bigDecimal = new BigDecimal(10000); + BigDecimal divide = new BigDecimal(list.get(list.size()-1).getChargingDegree()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP); + xhpcChargeOrder.setChargingDegree(divide); + } + }else{ + if(cacheMap.get("startTime") !=null) { + xhpcChargeOrder.setEndTime(DateUtil.parse(cacheMap.get("startTime").toString(), "yyyy-MM-dd HH:mm:ss")); + } } } - - } } @@ -430,6 +431,22 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe } } //生成一条历史订单 + if(UserTypeUtil.INTERNET_TYPE ==xhpcChargeOrder.getSource()){ + xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+""); + }else{ + if("微信".equals(xhpcChargeOrder.getChargingMode())){ + xhpcHistoryOrder.setChargingMode("微信"); + } + if("支付宝".equals(xhpcChargeOrder.getChargingMode())){ + xhpcHistoryOrder.setChargingMode("支付宝"); + } + if("刷卡".equals(xhpcChargeOrder.getChargingMode())){ + xhpcHistoryOrder.setChargingMode("刷卡"); + } + } + + + xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime()); if(xhpcChargeOrder.getEndTime()==null ){ diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 9d15631d..46c6c834 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -835,12 +835,12 @@ left join xhpc_rate ra on rt.rate_id =ra.rate_id WHERE rt.rate_time_id in ( - SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time <= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') >= #{startTime} AND del_flag=0 + SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time <= #{startTime} AND replace(end_time, '00:00:00', '23:59:59') >= #{startTime} ) or rt.rate_time_id in ( - SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time <= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') >= #{endTime} AND del_flag=0 + SELECT rate_time_id FROM xhpc_rate_time WHERE rate_model_id = #{rateModelId} AND start_time <= #{endTime} AND replace(end_time, '00:00:00', '23:59:59') >= #{endTime} ) diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 07c06372..c0dca6d6 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -117,6 +117,9 @@ and tenant_id = #{tenantId} + + and operator_id =#{operatorId} + group by status order by status @@ -177,6 +180,9 @@ and tenant_id = #{tenantId} + + and operator_id =#{operatorId} + group by DATE_FORMAT(create_time,'%Y-%m-%d') order by DATE_FORMAT(create_time,'%Y-%m-%d') desc @@ -244,6 +250,10 @@ #{operatorId} + + + and ss.operator_id =#{operatorId} + and ss.tenant_id = #{tenantId} @@ -308,6 +318,9 @@ and ss.tenant_id = #{tenantId} + + and operator_id =#{operatorId} + group by ss.operator_id @@ -356,6 +369,9 @@ and ss.tenant_id = #{tenantId} + + and operator_id =#{operatorId} + group by ss.internet_user_id @@ -410,6 +426,9 @@ and ss.tenant_id = #{tenantId} + + and operator_id =#{operatorId} + group by ss.terminal_id diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java index ff8caaee..cef2f9c4 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcInvoiceServiceImpl.java @@ -210,13 +210,14 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService { XhpcInvoice xhpcInvoice = xhpcInvoiceMapper.selectByPrimaryKey(requestData.getInvoiceId()); String redisKey = generateRedisKey(xhpcInvoice); - if (redisService.getCacheObject(redisKey) == null) { - redisService.setCacheObject(redisKey, 1); - } else { - Long noReadCount = redisService.getCacheObject(redisKey); - noReadCount = noReadCount + 1; - redisService.setCacheObject(redisKey, noReadCount); - } + redisService.setCacheObject(redisKey, 1L); +// if (redisService.getCacheObject(redisKey) == null) { +// redisService.setCacheObject(redisKey, 1L); +// } else { +// Long noReadCount = redisService.getCacheObject(redisKey); +// noReadCount = noReadCount + 1; +// redisService.setCacheObject(redisKey, noReadCount); +// } } @Override diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInvoiceMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInvoiceMapper.xml index f1460d69..cef7c618 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInvoiceMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcInvoiceMapper.xml @@ -62,6 +62,7 @@ `updator`, `update_time`, `is_read`, + tenant_id, `del_flag`