修改小程序结算,增加租户条件
This commit is contained in:
parent
423b53624c
commit
af5f674385
2
pom.xml
2
pom.xml
@ -19,7 +19,7 @@
|
|||||||
<spring-boot.version>2.5.1</spring-boot.version>
|
<spring-boot.version>2.5.1</spring-boot.version>
|
||||||
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
||||||
<alibaba.nacos.version>1.1.0</alibaba.nacos.version>
|
<alibaba.nacos.version>2.0.2</alibaba.nacos.version>
|
||||||
<spring-boot-admin.version>2.4.1</spring-boot-admin.version>
|
<spring-boot-admin.version>2.4.1</spring-boot-admin.version>
|
||||||
<spring-boot.mybatis>2.1.4</spring-boot.mybatis>
|
<spring-boot.mybatis>2.1.4</spring-boot.mybatis>
|
||||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public class LoginUser implements Serializable
|
|||||||
*/
|
*/
|
||||||
private Integer userType;
|
private Integer userType;
|
||||||
|
|
||||||
|
|
||||||
|
private String userTypeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
@ -195,5 +198,11 @@ public class LoginUser implements Serializable
|
|||||||
this.openId = openId;
|
this.openId = openId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUserTypeUtil() {
|
||||||
|
return userTypeUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserTypeUtil(String userTypeUtil) {
|
||||||
|
this.userTypeUtil = userTypeUtil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,7 @@ public class TokenService {
|
|||||||
loginUser.setTenantId(loginUser.getTenantId());
|
loginUser.setTenantId(loginUser.getTenantId());
|
||||||
loginUser.setUserType(loginUser.getUserType());
|
loginUser.setUserType(loginUser.getUserType());
|
||||||
loginUser.setOpenId(loginUser.getOpenId());
|
loginUser.setOpenId(loginUser.getOpenId());
|
||||||
|
loginUser.setUserTypeUtil(loginUser.getUserTypeUtil());
|
||||||
refreshToken(loginUser);
|
refreshToken(loginUser);
|
||||||
|
|
||||||
// 保存或更新用户token
|
// 保存或更新用户token
|
||||||
|
|||||||
@ -114,10 +114,6 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -95,7 +95,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.apache.poi</groupId>-->
|
<!-- <groupId>org.apache.poi</groupId>-->
|
||||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||||
<!-- <version>3.9</version>-->
|
<!-- <version>3.9</version>-->
|
||||||
|
|||||||
@ -6,8 +6,11 @@ import com.xhpc.common.api.WebSocketService;
|
|||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
|
import com.xhpc.common.security.service.TokenService;
|
||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -39,26 +42,30 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WebSocketService webSocketService;
|
private WebSocketService webSocketService;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderController.class);
|
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderController.class);
|
||||||
/**
|
/**
|
||||||
* 实时订单(微信)
|
* 实时订单(微信)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getHistotyChargeOrderMessage")
|
@GetMapping("/getHistotyChargeOrderMessage")
|
||||||
public AjaxResult getHistotyChargeOrderMessage(@RequestParam Long userId)
|
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(userId);
|
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异常订单(微信)
|
* 异常订单(微信)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getHistotyChargeOrderStatusList")
|
@GetMapping("/getHistotyChargeOrderStatusList")
|
||||||
public TableDataInfo getHistotyChargeOrderStatusList(@RequestParam Long userId)
|
public TableDataInfo getHistotyChargeOrderStatusList(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(userId);
|
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(request);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,10 +94,10 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/stopUp")
|
@GetMapping("/stopUp")
|
||||||
public AjaxResult stopUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){
|
public AjaxResult stopUp(HttpServletRequest request,@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId);
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId);
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId);
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>chargingOrderId>>>"+chargingOrderId);
|
||||||
return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId);
|
return iXhpcChargeOrderService.stopUp(request,userId, serialNumber, chargingOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,9 +122,9 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/gethistotyOrderMessage")
|
@GetMapping("/gethistotyOrderMessage")
|
||||||
public AjaxResult gethistotyOrderMessage(@RequestParam Long userId,Long historyOrderId,Integer type,Long chargingOrderId)
|
public AjaxResult gethistotyOrderMessage(HttpServletRequest request,@RequestParam Long userId,Long historyOrderId,Integer type,Long chargingOrderId)
|
||||||
{
|
{
|
||||||
return xhpcHistoryOrderService.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId);
|
return xhpcHistoryOrderService.gethistotyOrderMessage(request,userId,historyOrderId,type,chargingOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,16 +134,19 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getOrderMessage")
|
@GetMapping("/getOrderMessage")
|
||||||
public void getOrderMessage(@RequestParam Long userId)
|
public void getOrderMessage(HttpServletRequest request,@RequestParam Long userId)
|
||||||
{
|
{
|
||||||
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>");
|
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>");
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
Map<String, Object> orderMessage = iXhpcChargeOrderService.getOrderMessage(userId);
|
String tenantId = loginUser.getTenantId();
|
||||||
|
String userTypeUtil = loginUser.getUserTypeUtil();
|
||||||
|
String message = tenantId + userTypeUtil + userId;
|
||||||
|
Map<String, Object> cacheMap = redisService.getCacheMap("realTimeTenantId:"+message);
|
||||||
Map<String,Object> map =new HashMap<>();
|
Map<String,Object> map =new HashMap<>();
|
||||||
map.put("code", 200);
|
map.put("code", 200);
|
||||||
map.put("message", "实时数据");
|
map.put("message", "实时数据");
|
||||||
map.put("userId", userId);
|
map.put("userId", userId);
|
||||||
if(orderMessage ==null){
|
if(cacheMap==null){
|
||||||
Map<String, Object> data = new HashMap<>();
|
Map<String, Object> data = new HashMap<>();
|
||||||
BigDecimal decimal = new BigDecimal(0);
|
BigDecimal decimal = new BigDecimal(0);
|
||||||
data.put("amountCharged",decimal);
|
data.put("amountCharged",decimal);
|
||||||
@ -155,19 +165,10 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
data.put("parkingInstructions","充电完成请尽快离场,超时车位占用费10元/小时");
|
data.put("parkingInstructions","充电完成请尽快离场,超时车位占用费10元/小时");
|
||||||
map.put("data", data);
|
map.put("data", data);
|
||||||
}else{
|
}else{
|
||||||
try{
|
map.put("data",cacheMap);
|
||||||
String c = orderMessage.get("electricCurrent").toString();
|
|
||||||
String v = orderMessage.get("voltage").toString();
|
|
||||||
BigDecimal decimal1 = new BigDecimal(v).multiply(new BigDecimal(c)).setScale(2, BigDecimal.ROUND_DOWN);
|
|
||||||
orderMessage.put("power",decimal1.divide(new BigDecimal(1000),2,BigDecimal.ROUND_DOWN));
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
map.put("data",orderMessage);
|
|
||||||
}
|
}
|
||||||
JSONObject json = new JSONObject(map);
|
JSONObject json = new JSONObject(map);
|
||||||
webSocketService.getMessage(""+userId,json.toString());
|
webSocketService.getMessage(message,json.toString());
|
||||||
logger.info("<<<<<<<<<<发送数据<<<<<<<<<<<<<<"+ json.toString()+">>>>>>>>>>>>>>>>>");
|
logger.info("<<<<<<<<<<发送数据<<<<<<<<<<<<<<"+ json.toString()+">>>>>>>>>>>>>>>>>");
|
||||||
logger.info("<<<<<<<<<<发送时间<<<<<<<<<<<<<<"+ DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")+">>>>>>>>>>>>>>>>>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.xhpc.order.api;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
import com.xhpc.common.api.WebSocketService;
|
import com.xhpc.common.api.WebSocketService;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
@ -10,6 +11,7 @@ import com.xhpc.common.data.redis.CacheOrderData;
|
|||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
@ -50,6 +52,9 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class);
|
private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class);
|
||||||
/**
|
/**
|
||||||
@ -203,10 +208,22 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcChargeOrder.setUpdateTime(date);
|
xhpcChargeOrder.setUpdateTime(date);
|
||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
Map<String, Object> map = xhpcRealTimeOrderService.addOrderTime(cacheRealtimeData, xhpcChargeOrder, orderNo, 1);
|
Map<String, Object> map = xhpcRealTimeOrderService.addOrderTime(cacheRealtimeData, xhpcChargeOrder, orderNo, 1);
|
||||||
if(xhpcChargeOrder.getSource()==0){
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
//存入换成
|
||||||
JSONObject json = new JSONObject(map);
|
JSONObject json = new JSONObject(map);
|
||||||
|
String message = tenantId + UserTypeUtil.USER + userId;
|
||||||
|
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||||
|
message = tenantId + UserTypeUtil.USER + userId;
|
||||||
|
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||||
|
message = tenantId + UserTypeUtil.COMMUNIT + userId;
|
||||||
|
}else{
|
||||||
|
message = tenantId + UserTypeUtil.CUSTOMERS + userId;
|
||||||
|
}
|
||||||
|
redisService.setCacheMap("realTimeTenantId:"+message,map);
|
||||||
|
webSocketService.getMessage(message,json.toString());
|
||||||
//消息对了内容
|
//消息对了内容
|
||||||
webSocketService.getMessage(userId+"",json.toString());
|
|
||||||
logger.info("桩实时数据发送WebSocket成功>>>>>orderNo:" + orderNo);
|
logger.info("桩实时数据发送WebSocket成功>>>>>orderNo:" + orderNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,8 +382,12 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
||||||
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
||||||
Map<String, Object> userMessage =new HashMap<>();
|
Map<String, Object> userMessage =new HashMap<>();
|
||||||
if(xhpcChargeOrder.getSource()==0){
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
userMessage = xhpcChargeOrderService.getUserMessage(userId);
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
R user = userTypeService.getUser(null, userId, source, null, tenantId);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
userMessage = (Map<String, Object>)user.getData();
|
||||||
if (userMessage == null || userMessage.get("balance") == null) {
|
if (userMessage == null || userMessage.get("balance") == null) {
|
||||||
//订单异常
|
//订单异常
|
||||||
xhpcChargeOrder.setStatus(2);
|
xhpcChargeOrder.setStatus(2);
|
||||||
@ -375,6 +396,7 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
R.ok();
|
R.ok();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
|
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
|
||||||
xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
|
xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
|
||||||
@ -388,7 +410,18 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
map.put("code", 500);
|
map.put("code", 500);
|
||||||
map.put("userId", userId);
|
map.put("userId", userId);
|
||||||
JSONObject json = new JSONObject(map);
|
JSONObject json = new JSONObject(map);
|
||||||
webSocketService.getMessage(userId+"",json.toString());
|
|
||||||
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
String message ="";
|
||||||
|
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||||
|
message=tenantId+UserTypeUtil.USER+userId;
|
||||||
|
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||||
|
message=tenantId+UserTypeUtil.COMMUNIT+userId;
|
||||||
|
}else{
|
||||||
|
message=tenantId+UserTypeUtil.CUSTOMERS+userId;
|
||||||
|
}
|
||||||
|
webSocketService.getMessage(message,json.toString());
|
||||||
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.fail(500,"添加订单回调失败");
|
return R.fail(500,"添加订单回调失败");
|
||||||
@ -403,9 +436,22 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@PostMapping("/chargeOrder/abnormalOrder")
|
@PostMapping("/chargeOrder/abnormalOrder")
|
||||||
public R abnormalOrder(@RequestParam(value = "orderNo") String orderNo) {
|
public R abnormalOrder(@RequestParam(value = "orderNo") String orderNo) {
|
||||||
xhpcHistoryOrderService.addXhpcChargeOrder(orderNo,1);
|
|
||||||
//获取实时订单
|
//获取实时订单
|
||||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||||
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||||
|
if (userMessage == null || userMessage.get("balance") == null) {
|
||||||
|
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,orderNo,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
xhpcHistoryOrderService.addXhpcChargeOrder(null,orderNo,1);
|
||||||
|
}
|
||||||
Long userId = xhpcChargeOrder.getUserId();
|
Long userId = xhpcChargeOrder.getUserId();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("code", 500);
|
map.put("code", 500);
|
||||||
|
|||||||
@ -3,9 +3,12 @@ package com.xhpc.order.controller;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||||
import com.xhpc.order.domain.XhpcStatisticsStation;
|
import com.xhpc.order.domain.XhpcStatisticsStation;
|
||||||
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
||||||
@ -44,6 +47,8 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IXhpcChargeOrderService chargeOrderService;
|
private IXhpcChargeOrderService chargeOrderService;
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XhpcHistoryOrderController.class);
|
private static final Logger logger = LoggerFactory.getLogger(XhpcHistoryOrderController.class);
|
||||||
@ -872,7 +877,19 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
if(xhpcChargeOrderList !=null && xhpcChargeOrderList.size()>0){
|
if(xhpcChargeOrderList !=null && xhpcChargeOrderList.size()>0){
|
||||||
for (int i = 0; i <xhpcChargeOrderList.size() ; i++) {
|
for (int i = 0; i <xhpcChargeOrderList.size() ; i++) {
|
||||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderList.get(i);
|
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderList.get(i);
|
||||||
xhpcHistoryOrderService.addXhpcChargeOrder(xhpcChargeOrder.getSerialNumber(),2);
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
R user = userTypeService.getUser(null, xhpcChargeOrder.getUserId(), source, null, tenantId);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||||
|
if (userMessage == null || userMessage.get("balance") == null) {
|
||||||
|
xhpcHistoryOrderService.addXhpcChargeOrder(userMessage,xhpcChargeOrder.getSerialNumber(),2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
xhpcHistoryOrderService.addXhpcChargeOrder(null,xhpcChargeOrder.getSerialNumber(),2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,6 +141,11 @@ public class XhpcChargeOrder extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer stopReasonEvcs = 0;
|
private Integer stopReasonEvcs = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
public Integer getStopReasonEvcs() {
|
public Integer getStopReasonEvcs() {
|
||||||
|
|
||||||
return stopReasonEvcs;
|
return stopReasonEvcs;
|
||||||
@ -421,4 +426,13 @@ public class XhpcChargeOrder extends BaseEntity {
|
|||||||
this.chargingTimeNumber = chargingTimeNumber;
|
this.chargingTimeNumber = chargingTimeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,4 +128,8 @@ public class XhpcStatisticsStation extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String chargingMode;
|
private String chargingMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getHistotyChargeOrderMessage(@Param("userId") Long userId);
|
int getHistotyChargeOrderMessage(@Param("userId") Long userId,@Param("tenantId") String tenantId,@Param("userType") Integer userType);
|
||||||
|
|
||||||
|
|
||||||
Map<String,Object> getMessage(@Param("userId") Long userId);
|
Map<String,Object> getMessage(@Param("userId") Long userId);
|
||||||
@ -35,7 +35,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> getHistotyChargeOrderStatusList(@Param("userId")Long userId);
|
List<Map<String,Object>> getHistotyChargeOrderStatusList(@Param("userId")Long userId,@Param("tenantId") String tenantId,@Param("userType") Integer userType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +64,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
/**
|
/**
|
||||||
* 获取终端信息
|
* 获取终端信息
|
||||||
*/
|
*/
|
||||||
XhpcTerminal getXhpcTerminalSerialNumber(@Param("serialNumber")String serialNumber);
|
XhpcTerminal getXhpcTerminalSerialNumber(@Param("serialNumber")String serialNumber,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加充电订单
|
* 添加充电订单
|
||||||
@ -95,7 +95,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getCount(@Param("userId") Long userId,@Param("chargeOrderId")Long chargeOrderId);
|
int getCount(@Param("userId") Long userId,@Param("chargeOrderId")Long chargeOrderId,@Param("source")Integer source,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动
|
* 活动
|
||||||
@ -119,7 +119,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
Map<String,Object> getOperatorMessage(@Param("chargingStationId") Long chargingStationId);
|
Map<String,Object> getOperatorMessage(@Param("chargingStationId") Long chargingStationId);
|
||||||
|
|
||||||
//获取桩信息
|
//获取桩信息
|
||||||
Map<String,Object> getXhpcChargingPileById(@Param("chargingPileid") Long chargingPileid);
|
Map<String,Object> getXhpcChargingPileById(@Param("chargingPileid") Long chargingPileid,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加redis数据到数据库
|
* 添加redis数据到数据库
|
||||||
@ -137,7 +137,7 @@ public interface XhpcChargeOrderMapper {
|
|||||||
* @param date 时间
|
* @param date 时间
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addUserAccountStatement(@Param("userId") Long userId,@Param("amount") BigDecimal amount,@Param("remainingSum") BigDecimal remainingSum,@Param("chargeOrderId") Long chargeOrderId,@Param("type") Integer type,@Param("date") Date date);
|
int insertUserAccountStatement(@Param("userId") Long userId,@Param("amount") BigDecimal amount,@Param("remainingSum") BigDecimal remainingSum,@Param("chargeOrderId") Long chargeOrderId,@Param("type") Integer type,@Param("date") Date date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取费率
|
* 获取费率
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public interface XhpcHistoryOrderMapper {
|
|||||||
* @param historyOrderId
|
* @param historyOrderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId);
|
Map<String, Object> gethistotyOrderMessage(@Param("userId") Long userId, @Param("historyOrderId") Long historyOrderId, @Param("type") Integer type, @Param("chargingOrderId") Long chargingOrderId, @Param("tenantId") String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史订单记录(PC)
|
* 历史订单记录(PC)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public interface XhpcRealTimeOrderMapper {
|
|||||||
* @param xhpcRealTimeOrder
|
* @param xhpcRealTimeOrder
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder);
|
int insertXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,21 +29,21 @@ public interface XhpcRealTimeOrderMapper {
|
|||||||
* @param xhpcChargeOrderSoc
|
* @param xhpcChargeOrderSoc
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc);
|
int insertSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加订单实时电流
|
* 添加订单实时电流
|
||||||
* @param XhpcChargeOrderCurrent
|
* @param XhpcChargeOrderCurrent
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addCurrent(XhpcChargeOrderCurrent XhpcChargeOrderCurrent);
|
int insertCurrent(XhpcChargeOrderCurrent XhpcChargeOrderCurrent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加订单实时电压
|
* 添加订单实时电压
|
||||||
* @param xhpcChargeOrderVoltage
|
* @param xhpcChargeOrderVoltage
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage);
|
int insertVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -22,10 +22,10 @@ public interface IXhpcChargeOrderService {
|
|||||||
/**
|
/**
|
||||||
* 判断实时订单
|
* 判断实时订单
|
||||||
*
|
*
|
||||||
* @param userId
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getHistotyChargeOrderMessage(Long userId);
|
AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,10 +37,10 @@ public interface IXhpcChargeOrderService {
|
|||||||
Map<String, Object> getOrderMessage(Long userId);
|
Map<String, Object> getOrderMessage(Long userId);
|
||||||
/**
|
/**
|
||||||
* 异常订单
|
* 异常订单
|
||||||
* @param userId
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getHistotyChargeOrderStatusList(Long userId);
|
List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动充电
|
* 启动充电
|
||||||
@ -56,7 +56,7 @@ public interface IXhpcChargeOrderService {
|
|||||||
* @param serialNumber 终端编码
|
* @param serialNumber 终端编码
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult stopUp(Long userId,String serialNumber,Long chargingOrderId);
|
AjaxResult stopUp(HttpServletRequest request,Long userId,String serialNumber,Long chargingOrderId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,7 @@ public interface IXhpcChargeOrderService {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getCount(Long userId,Long chargeOrderId);
|
int getCount(Long userId,Long chargeOrderId,Integer source,String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动
|
* 活动
|
||||||
@ -103,7 +103,7 @@ public interface IXhpcChargeOrderService {
|
|||||||
* @param balance
|
* @param balance
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateUserBalance(Long userId, BigDecimal balance);
|
int updateUserBalance(Long userId, BigDecimal balance,Integer source,String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取运营商信息
|
* 获取运营商信息
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
|
|||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -37,7 +38,7 @@ public interface IXhpcHistoryOrderService {
|
|||||||
* @param historyOrderId
|
* @param historyOrderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult gethistotyOrderMessage(Long userId,Long historyOrderId,Integer type,Long chargingOrderId);
|
AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增 历史订单信息
|
* 新增 历史订单信息
|
||||||
@ -98,7 +99,7 @@ public interface IXhpcHistoryOrderService {
|
|||||||
* @param orderNo 订单号
|
* @param orderNo 订单号
|
||||||
* @param type 状态 1.异常 2.解决异常订单
|
* @param type 状态 1.异常 2.解决异常订单
|
||||||
*/
|
*/
|
||||||
void addXhpcChargeOrder(String orderNo,Integer type);
|
void addXhpcChargeOrder(Map<String, Object> userMessage,String orderNo,Integer type);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -67,9 +67,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getHistotyChargeOrderMessage(Long userId) {
|
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request) {
|
||||||
|
|
||||||
int count = xhpcChargeOrderMapper.getHistotyChargeOrderMessage(userId);
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
|
||||||
|
int count = xhpcChargeOrderMapper.getHistotyChargeOrderMessage(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
|
||||||
if(count>0){
|
if(count>0){
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
@ -83,9 +85,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getHistotyChargeOrderStatusList(Long userId) {
|
public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) {
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(userId);
|
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,6 +100,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
Integer userType = loginUser.getUserType();
|
Integer userType = loginUser.getUserType();
|
||||||
Long userid = loginUser.getUserid();
|
Long userid = loginUser.getUserid();
|
||||||
String openId = loginUser.getOpenId();
|
String openId = loginUser.getOpenId();
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
R user = userTypeService.getUser(null, userid, userType, terminalSerialNumber,loginUser.getTenantId());
|
R user = userTypeService.getUser(null, userid, userType, terminalSerialNumber,loginUser.getTenantId());
|
||||||
if(userId !=userid || user ==null || user.getData() ==null){
|
if(userId !=userid || user ==null || user.getData() ==null){
|
||||||
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
|
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
|
||||||
@ -108,8 +111,6 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
|
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String pattern = "^([0-9]{16})";
|
String pattern = "^([0-9]{16})";
|
||||||
Pattern compile = Pattern.compile(pattern);
|
Pattern compile = Pattern.compile(pattern);
|
||||||
Matcher m = compile.matcher(terminalSerialNumber);
|
Matcher m = compile.matcher(terminalSerialNumber);
|
||||||
@ -167,7 +168,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//终端信息
|
//终端信息
|
||||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber);
|
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber,tenantId);
|
||||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||||
return AjaxResult.error(1104, "无效的终端编号");
|
return AjaxResult.error(1104, "无效的终端编号");
|
||||||
}
|
}
|
||||||
@ -175,7 +176,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
|
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
|
||||||
|
|
||||||
//获取桩信息
|
//获取桩信息
|
||||||
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
|
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
|
||||||
|
|
||||||
//启动充电
|
//启动充电
|
||||||
StartChargingData startChargingData = new StartChargingData();
|
StartChargingData startChargingData = new StartChargingData();
|
||||||
@ -268,8 +269,10 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult stopUp(Long userId, String serialNumber,Long chargingOrderId) {
|
public AjaxResult stopUp(HttpServletRequest request,Long userId, String serialNumber,Long chargingOrderId) {
|
||||||
|
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
String pattern = "^([0-9]{16})";
|
String pattern = "^([0-9]{16})";
|
||||||
Pattern compile = Pattern.compile(pattern);
|
Pattern compile = Pattern.compile(pattern);
|
||||||
Matcher m = compile.matcher(serialNumber);
|
Matcher m = compile.matcher(serialNumber);
|
||||||
@ -277,14 +280,14 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
return AjaxResult.error(1104, "无效的终端编号");
|
return AjaxResult.error(1104, "无效的终端编号");
|
||||||
}
|
}
|
||||||
//终端信息
|
//终端信息
|
||||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber);
|
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,tenantId);
|
||||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||||
return AjaxResult.error(1104, "无效的终端编号");
|
return AjaxResult.error(1104, "无效的终端编号");
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取桩信息
|
//获取桩信息
|
||||||
Map<String, Object> xhpcChargingPileById =
|
Map<String, Object> xhpcChargingPileById =
|
||||||
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
|
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
|
||||||
String version ="0A";
|
String version ="0A";
|
||||||
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
|
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
|
||||||
version=xhpcChargingPileById.get("communicationProtocolVersion").toString();
|
version=xhpcChargingPileById.get("communicationProtocolVersion").toString();
|
||||||
@ -320,9 +323,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCount(Long userId,Long chargeOrderId) {
|
public int getCount(Long userId,Long chargeOrderId,Integer source,String tenantId) {
|
||||||
|
|
||||||
return xhpcChargeOrderMapper.getCount(userId,chargeOrderId);
|
return xhpcChargeOrderMapper.getCount(userId,chargeOrderId,source,tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -344,7 +347,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateUserBalance(Long userId, BigDecimal balance) {
|
public int updateUserBalance(Long userId, BigDecimal balance,Integer source,String tenantId) {
|
||||||
|
|
||||||
return xhpcChargeOrderMapper.updateUserBalance(userId, balance);
|
return xhpcChargeOrderMapper.updateUserBalance(userId, balance);
|
||||||
}
|
}
|
||||||
@ -365,7 +368,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
public int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId,
|
public int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId,
|
||||||
Integer type, Date date) {
|
Integer type, Date date) {
|
||||||
|
|
||||||
return xhpcChargeOrderMapper.addUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date);
|
return xhpcChargeOrderMapper.insertUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -464,7 +467,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//终端信息
|
//终端信息
|
||||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(connectorId);
|
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(connectorId,null);
|
||||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||||
r.setCode(1);
|
r.setCode(1);
|
||||||
r.setMsg("无效的终端编号");
|
r.setMsg("无效的终端编号");
|
||||||
@ -473,7 +476,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
|
|
||||||
//获取桩信息
|
//获取桩信息
|
||||||
Map<String, Object> xhpcChargingPileById =
|
Map<String, Object> xhpcChargingPileById =
|
||||||
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
|
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),null);
|
||||||
|
|
||||||
//启动充电
|
//启动充电
|
||||||
//订单流水号 终端号+年月日时分秒+自增4位 共32位
|
//订单流水号 终端号+年月日时分秒+自增4位 共32位
|
||||||
@ -585,7 +588,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getXhpcChargingPileById(Long chargingPileId) {
|
public Map<String, Object> getXhpcChargingPileById(Long chargingPileId) {
|
||||||
return xhpcChargeOrderMapper.getXhpcChargingPileById(chargingPileId);
|
return xhpcChargeOrderMapper.getXhpcChargingPileById(chargingPileId,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidDate(String str) {
|
public static boolean isValidDate(String str) {
|
||||||
|
|||||||
@ -8,11 +8,15 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||||||
import cn.hutool.poi.excel.ExcelWriter;
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import com.xhpc.common.api.RefundOrderService;
|
import com.xhpc.common.api.RefundOrderService;
|
||||||
import com.xhpc.common.api.SmsService;
|
import com.xhpc.common.api.SmsService;
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.utils.SecurityUtils;
|
import com.xhpc.common.core.utils.SecurityUtils;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
|
import com.xhpc.common.security.service.TokenService;
|
||||||
import com.xhpc.common.util.EvcsUtil;
|
import com.xhpc.common.util.EvcsUtil;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
||||||
@ -21,6 +25,7 @@ import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
|
|||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
import com.xhpc.order.service.IXhpcRealTimeOrderService;
|
import com.xhpc.order.service.IXhpcRealTimeOrderService;
|
||||||
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -29,6 +34,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -65,6 +71,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RefundOrderService refundOrderService;
|
private RefundOrderService refundOrderService;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> list(Long userId) {
|
public List<Map<String, Object>> list(Long userId) {
|
||||||
@ -79,9 +89,9 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
|
public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId, historyOrderId, type, chargingOrderId));
|
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, type, chargingOrderId,loginUser.getTenantId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -231,7 +241,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addXhpcChargeOrder(String orderNo, Integer type) {
|
public void addXhpcChargeOrder(Map<String, Object> userMessage,String orderNo, Integer type) {
|
||||||
//(调用时间-启动时间《3分钟 自动结算)
|
//(调用时间-启动时间《3分钟 自动结算)
|
||||||
logger.info("订单异常回调接口>>>>>orderNo:" + orderNo + " type:" + type);
|
logger.info("订单异常回调接口>>>>>orderNo:" + orderNo + " type:" + type);
|
||||||
//获取实时订单
|
//获取实时订单
|
||||||
@ -308,9 +318,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
BigDecimal surplusPowerPrice = powerPrice;
|
BigDecimal surplusPowerPrice = powerPrice;
|
||||||
//剩余的服务费
|
//剩余的服务费
|
||||||
BigDecimal surplusServicePrice = servicePrice;
|
BigDecimal surplusServicePrice = servicePrice;
|
||||||
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
Map<String, Object> userMessage = xhpcChargeOrderService.getUserMessage(userId);
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
|
||||||
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
|
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
|
||||||
xhpcHistoryOrder.setStopReasonEvcs(5);
|
xhpcHistoryOrder.setStopReasonEvcs(5);
|
||||||
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
|
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
|
||||||
@ -345,7 +354,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
|
|
||||||
//判断是C端用户还是流量端用户
|
//判断是C端用户还是流量端用户
|
||||||
//先计算第三方优惠力度
|
//先计算第三方优惠力度
|
||||||
Integer source = xhpcChargeOrder.getSource();
|
|
||||||
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
||||||
if(source==1 && internetSerialNumber!=null){
|
if(source==1 && internetSerialNumber!=null){
|
||||||
String substring = internetSerialNumber.substring(0, 9);
|
String substring = internetSerialNumber.substring(0, 9);
|
||||||
@ -384,9 +393,9 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( source== 0) {
|
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
||||||
//用户第几次充电
|
//用户第几次充电
|
||||||
int count = xhpcChargeOrderService.getCount(userId,xhpcChargeOrder.getChargeOrderId());
|
int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId());
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
//活动折扣
|
//活动折扣
|
||||||
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
||||||
@ -527,7 +536,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||||
}
|
}
|
||||||
Map<String, Object> map =new HashMap<>();
|
Map<String, Object> map =new HashMap<>();
|
||||||
if(source==0){
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
||||||
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
||||||
//增加流水订单号
|
//增加流水订单号
|
||||||
@ -536,12 +545,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//扣除用户实际消费金额,添加消费记录
|
//扣除用户实际消费金额,添加消费记录-余的钱
|
||||||
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
|
BigDecimal balance1 =(BigDecimal) userMessage.get("balance");
|
||||||
//剩余的钱
|
|
||||||
BigDecimal balance1 =(BigDecimal) user.get("balance");
|
|
||||||
BigDecimal subtract = balance1.subtract(actPrice);
|
BigDecimal subtract = balance1.subtract(actPrice);
|
||||||
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract);
|
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,xhpcChargeOrder.getTenantId());
|
||||||
if(i==0){
|
if(i==0){
|
||||||
//扣钱失败
|
//扣钱失败
|
||||||
xhpcChargeOrder.setStatus(2);
|
xhpcChargeOrder.setStatus(2);
|
||||||
@ -564,18 +571,18 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
|
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
|
||||||
if(xhpcChargingPile !=null){
|
if(xhpcChargingPile !=null){
|
||||||
//发送短信
|
//发送短信
|
||||||
if(user.get("phone") !=null){
|
if(userMessage.get("phone") !=null){
|
||||||
if("1".equals(xhpcChargingPile.get("type").toString())){
|
if("1".equals(xhpcChargingPile.get("type").toString())){
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
||||||
paramMap.put("sumMoney", actPrice.toString());
|
paramMap.put("sumMoney", actPrice.toString());
|
||||||
paramMap.put("phone", user.get("phone").toString());
|
paramMap.put("phone", userMessage.get("phone").toString());
|
||||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||||
smsService.sendNotice(paramMap);
|
smsService.sendNotice(paramMap);
|
||||||
}else {
|
}else {
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("sumMoney", actPrice.toString());
|
paramMap.put("sumMoney", actPrice.toString());
|
||||||
paramMap.put("phone", user.get("phone").toString());
|
paramMap.put("phone", userMessage.get("phone").toString());
|
||||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||||
smsService.sendNotice(paramMap);
|
smsService.sendNotice(paramMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.xhpc.common.data.redis.CacheOrderData;
|
|||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.common.util.EvcsUtil;
|
import com.xhpc.common.util.EvcsUtil;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.*;
|
import com.xhpc.order.domain.*;
|
||||||
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
|
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
|
||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
@ -122,22 +123,22 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder) {
|
public int addXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder) {
|
||||||
return xhpcRealTimeOrderMapper.addXhpcRealTimeOrder(xhpcRealTimeOrder);
|
return xhpcRealTimeOrderMapper.insertXhpcRealTimeOrder(xhpcRealTimeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc) {
|
public int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc) {
|
||||||
return xhpcRealTimeOrderMapper.addSOC(xhpcChargeOrderSoc);
|
return xhpcRealTimeOrderMapper.insertSOC(xhpcChargeOrderSoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addCurrent(XhpcChargeOrderCurrent xhpcChargeOrderCurrent) {
|
public int addCurrent(XhpcChargeOrderCurrent xhpcChargeOrderCurrent) {
|
||||||
return xhpcRealTimeOrderMapper.addCurrent(xhpcChargeOrderCurrent);
|
return xhpcRealTimeOrderMapper.insertCurrent(xhpcChargeOrderCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage) {
|
public int addVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage) {
|
||||||
return xhpcRealTimeOrderMapper.addVoltage(xhpcChargeOrderVoltage);
|
return xhpcRealTimeOrderMapper.insertVoltage(xhpcChargeOrderVoltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -397,9 +398,9 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( source== 0) {
|
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
||||||
//用户第几次充电
|
//用户第几次充电
|
||||||
int count = xhpcChargeOrderService.getCount(userId,xhpcChargeOrder.getChargeOrderId());
|
int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId());
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
//活动折扣
|
//活动折扣
|
||||||
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
||||||
@ -538,7 +539,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||||
}
|
}
|
||||||
Map<String, Object> map =new HashMap<>();
|
Map<String, Object> map =new HashMap<>();
|
||||||
if(source==0){
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
|
||||||
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
||||||
//增加流水订单号
|
//增加流水订单号
|
||||||
@ -547,12 +548,10 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//扣除用户实际消费金额,添加消费记录
|
//扣除用户实际消费金额,添加消费记录 剩余的钱
|
||||||
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
|
BigDecimal balance1 =(BigDecimal) userMessage.get("balance");
|
||||||
//剩余的钱
|
|
||||||
BigDecimal balance1 =(BigDecimal) user.get("balance");
|
|
||||||
BigDecimal subtract = balance1.subtract(actPrice);
|
BigDecimal subtract = balance1.subtract(actPrice);
|
||||||
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract);
|
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId());
|
||||||
if(i==0){
|
if(i==0){
|
||||||
//扣钱失败
|
//扣钱失败
|
||||||
xhpcChargeOrder.setStatus(2);
|
xhpcChargeOrder.setStatus(2);
|
||||||
@ -575,18 +574,18 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
|
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
|
||||||
if(xhpcChargingPile !=null){
|
if(xhpcChargingPile !=null){
|
||||||
//发送短信
|
//发送短信
|
||||||
if(user.get("phone") !=null){
|
if(userMessage.get("phone") !=null){
|
||||||
if("1".equals(xhpcChargingPile.get("type").toString())){
|
if("1".equals(xhpcChargingPile.get("type").toString())){
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
||||||
paramMap.put("sumMoney", actPrice.toString());
|
paramMap.put("sumMoney", actPrice.toString());
|
||||||
paramMap.put("phone", user.get("phone").toString());
|
paramMap.put("phone", userMessage.get("phone").toString());
|
||||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||||
smsService.sendNotice(paramMap);
|
smsService.sendNotice(paramMap);
|
||||||
}else {
|
}else {
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("sumMoney", actPrice.toString());
|
paramMap.put("sumMoney", actPrice.toString());
|
||||||
paramMap.put("phone", user.get("phone").toString());
|
paramMap.put("phone", userMessage.get("phone").toString());
|
||||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||||
smsService.sendNotice(paramMap);
|
smsService.sendNotice(paramMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
<result column="amount_charged" property="amountCharged"/>
|
<result column="amount_charged" property="amountCharged"/>
|
||||||
<result column="power" property="power"/>
|
<result column="power" property="power"/>
|
||||||
<result column="charging_time_number" property="chargingTimeNumber"/>
|
<result column="charging_time_number" property="chargingTimeNumber"/>
|
||||||
|
<result column="tenant_id" property="tenantId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
||||||
@ -74,7 +75,13 @@
|
|||||||
select
|
select
|
||||||
count(charge_order_id)
|
count(charge_order_id)
|
||||||
from xhpc_charge_order
|
from xhpc_charge_order
|
||||||
where user_id = #{userId} and status=0 and del_flag =0 and source =0
|
where user_id = #{userId}
|
||||||
|
and status=0
|
||||||
|
and del_flag =0
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
and tenant_id=#{tenantId}
|
||||||
|
</if>
|
||||||
|
and source =#{userType}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMessage" resultType="map">
|
<select id="getMessage" resultType="map">
|
||||||
@ -129,7 +136,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap">
|
<select id="getXhpcTerminalSerialNumber" resultMap="BaseResultMap">
|
||||||
select * from xhpc_terminal where serial_number=#{serialNumber} and del_flag=0 limit 1
|
select * from xhpc_terminal where serial_number=#{serialNumber} and tenant_id=#{tenantId} and del_flag=0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addXhpcChargeOrder" parameterType="com.xhpc.order.domain.XhpcChargeOrder" useGeneratedKeys="true"
|
<insert id="addXhpcChargeOrder" parameterType="com.xhpc.order.domain.XhpcChargeOrder" useGeneratedKeys="true"
|
||||||
@ -303,7 +310,15 @@
|
|||||||
left join xhpc_charging_station as cs on cs.charging_station_id = cor.charging_station_id
|
left join xhpc_charging_station as cs on cs.charging_station_id = cor.charging_station_id
|
||||||
left join xhpc_terminal as ter on ter.terminal_id=cor.terminal_id
|
left join xhpc_terminal as ter on ter.terminal_id=cor.terminal_id
|
||||||
left join xhpc_history_order as ho on ho.charge_order_id = cor.charge_order_id
|
left join xhpc_history_order as ho on ho.charge_order_id = cor.charge_order_id
|
||||||
where cor.status =2 and cor.del_flag =0 and cor.user_id=#{userId}
|
where cor.status =2
|
||||||
|
and cor.del_flag =0
|
||||||
|
and cor.user_id=#{userId}
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
and cor.tenant_id =#{tenantId}
|
||||||
|
</if>
|
||||||
|
<if test="userType !=null">
|
||||||
|
and cor.source =#{userType}
|
||||||
|
</if>
|
||||||
order by cor.update_time desc
|
order by cor.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -319,6 +334,12 @@
|
|||||||
<if test="chargeOrderId !=null">
|
<if test="chargeOrderId !=null">
|
||||||
and charge_order_id=#{chargeOrderId}
|
and charge_order_id=#{chargeOrderId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
and tenant_id=#{tenantId}
|
||||||
|
</if>
|
||||||
|
<if test="source !=null">
|
||||||
|
and source=#{source}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPromotion" resultType="map">
|
<select id="getPromotion" resultType="map">
|
||||||
@ -347,7 +368,11 @@
|
|||||||
charging_pile_id as chargingPileId,
|
charging_pile_id as chargingPileId,
|
||||||
communication_protocol_version as communicationProtocolVersion,
|
communication_protocol_version as communicationProtocolVersion,
|
||||||
power as power
|
power as power
|
||||||
from xhpc_charging_pile where charging_pile_id=#{chargingPileid}
|
from xhpc_charging_pile
|
||||||
|
where charging_pile_id=#{chargingPileid}
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
amd tenant_id=#{tenantId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addXhpcOrderRedisRecord" parameterType="com.xhpc.order.domain.XhpcOrderRedisRecord" useGeneratedKeys="true"
|
<insert id="addXhpcOrderRedisRecord" parameterType="com.xhpc.order.domain.XhpcOrderRedisRecord" useGeneratedKeys="true"
|
||||||
@ -467,7 +492,7 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="addUserAccountStatement">
|
<insert id="insertUserAccountStatement">
|
||||||
INSERT INTO xhpc_user_account_statement(user_id, amount, remaining_sum, charge_order_id, type, create_time)
|
INSERT INTO xhpc_user_account_statement(user_id, amount, remaining_sum, charge_order_id, type, create_time)
|
||||||
values (#{userId}, #{amount}, #{remainingSum}, #{chargeOrderId}, #{type}, #{date})
|
values (#{userId}, #{amount}, #{remainingSum}, #{chargeOrderId}, #{type}, #{date})
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
@ -600,6 +600,9 @@
|
|||||||
<if test="chargingOrderId !=null">
|
<if test="chargingOrderId !=null">
|
||||||
and ho.charge_order_id =#{chargingOrderId}
|
and ho.charge_order_id =#{chargingOrderId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
|
and ho.tenant_id =#{tenantId}
|
||||||
|
</if>
|
||||||
order by ho.create_time desc
|
order by ho.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<result column="charging_station_id" property="chargingStationId"/>
|
<result column="charging_station_id" property="chargingStationId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<insert id="addXhpcRealTimeOrder" parameterType="com.xhpc.order.domain.XhpcRealTimeOrder" useGeneratedKeys="true"
|
<insert id="insertXhpcRealTimeOrder" parameterType="com.xhpc.order.domain.XhpcRealTimeOrder" useGeneratedKeys="true"
|
||||||
keyProperty="realTimeOrderId">
|
keyProperty="realTimeOrderId">
|
||||||
insert into xhpc_real_time_order
|
insert into xhpc_real_time_order
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@ -206,7 +206,7 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="addSOC" parameterType="com.xhpc.order.domain.XhpcChargeOrderSoc" useGeneratedKeys="true"
|
<insert id="insertSOC" parameterType="com.xhpc.order.domain.XhpcChargeOrderSoc" useGeneratedKeys="true"
|
||||||
keyProperty="chargeOrderSocId">
|
keyProperty="chargeOrderSocId">
|
||||||
insert into xhpc_charge_order_soc
|
insert into xhpc_charge_order_soc
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@ -263,7 +263,7 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="addCurrent" parameterType="com.xhpc.order.domain.XhpcChargeOrderCurrent" useGeneratedKeys="true"
|
<insert id="insertCurrent" parameterType="com.xhpc.order.domain.XhpcChargeOrderCurrent" useGeneratedKeys="true"
|
||||||
keyProperty="chargeOrderCurrentId">
|
keyProperty="chargeOrderCurrentId">
|
||||||
insert into xhpc_charge_order_current
|
insert into xhpc_charge_order_current
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@ -320,7 +320,7 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="addVoltage" parameterType="com.xhpc.order.domain.XhpcChargeOrderVoltage" useGeneratedKeys="true"
|
<insert id="insertVoltage" parameterType="com.xhpc.order.domain.XhpcChargeOrderVoltage" useGeneratedKeys="true"
|
||||||
keyProperty="chargeOrderVoltageId">
|
keyProperty="chargeOrderVoltageId">
|
||||||
insert into xhpc_charge_order_voltage
|
insert into xhpc_charge_order_voltage
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|||||||
@ -238,8 +238,10 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
userInfo.setTenantId(map.get("tenantId").toString());
|
userInfo.setTenantId(map.get("tenantId").toString());
|
||||||
if(UserTypeUtil.COMMUNIT.equals(username.substring(0,2))){
|
if(UserTypeUtil.COMMUNIT.equals(username.substring(0,2))){
|
||||||
userInfo.setUserType(UserTypeUtil.COMMUNIT_TYPE);
|
userInfo.setUserType(UserTypeUtil.COMMUNIT_TYPE);
|
||||||
|
userInfo.setUserTypeUtil(UserTypeUtil.COMMUNIT);
|
||||||
}else{
|
}else{
|
||||||
userInfo.setUserType(UserTypeUtil.CUSTOMERS_TYPE);
|
userInfo.setUserType(UserTypeUtil.CUSTOMERS_TYPE);
|
||||||
|
userInfo.setUserTypeUtil(UserTypeUtil.CUSTOMERS);
|
||||||
}
|
}
|
||||||
if(UserTypeUtil.COMMUNIT.equals(sub)){
|
if(UserTypeUtil.COMMUNIT.equals(sub)){
|
||||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
@ -297,6 +299,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
userInfo.setOpenId(openid);
|
userInfo.setOpenId(openid);
|
||||||
userInfo.setUserid(user.getAppUserId());
|
userInfo.setUserid(user.getAppUserId());
|
||||||
userInfo.setTenantId(tenantId);
|
userInfo.setTenantId(tenantId);
|
||||||
|
userInfo.setUserTypeUtil(UserTypeUtil.USER);
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
|
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
<if test="name !=null and name !=''">
|
<if test="name !=null and name !=''">
|
||||||
and name like CONCAT('%',#{name},'%')
|
and name like CONCAT('%',#{name},'%')
|
||||||
</if>
|
</if>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
|
<insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
|
||||||
@ -210,7 +211,7 @@
|
|||||||
xhpc_community_personnel
|
xhpc_community_personnel
|
||||||
where community_id=#{communityId} and del_flag=0
|
where community_id=#{communityId} and del_flag=0
|
||||||
<if test="account !=null and account !=''">
|
<if test="account !=null and account !=''">
|
||||||
and account like concat('%', #{account), '%')
|
and account like concat('%', #{account}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="phone !=null and phone !=''">
|
<if test="phone !=null and phone !=''">
|
||||||
and phone like concat('%', #{phone}, '%')
|
and phone like concat('%', #{phone}, '%')
|
||||||
@ -218,6 +219,7 @@
|
|||||||
<if test="status !=null">
|
<if test="status !=null">
|
||||||
and status=#{status}
|
and status=#{status}
|
||||||
</if>
|
</if>
|
||||||
|
order by create_time desc.
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addCommunityPersonnel" parameterType="com.xhpc.user.domain.XhpcCommunityPersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId">
|
<insert id="addCommunityPersonnel" parameterType="com.xhpc.user.domain.XhpcCommunityPersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId">
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id=#{operatorId}
|
and operator_id=#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addCustomers" parameterType="com.xhpc.user.domain.XhpcCustomers" useGeneratedKeys="true" keyProperty="customersId">
|
<insert id="addCustomers" parameterType="com.xhpc.user.domain.XhpcCustomers" useGeneratedKeys="true" keyProperty="customersId">
|
||||||
@ -212,6 +213,7 @@
|
|||||||
<if test="status !=null">
|
<if test="status !=null">
|
||||||
and status=#{status}
|
and status=#{status}
|
||||||
</if>
|
</if>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addCustomersPersonnel" parameterType="com.xhpc.user.domain.XhpcCustomersPersonnel" useGeneratedKeys="true" keyProperty="customersPersonnelId">
|
<insert id="addCustomersPersonnel" parameterType="com.xhpc.user.domain.XhpcCustomersPersonnel" useGeneratedKeys="true" keyProperty="customersPersonnelId">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user