修改小程序结算,增加租户条件

This commit is contained in:
yuyang 2022-01-04 18:48:54 +08:00
parent 423b53624c
commit af5f674385
24 changed files with 263 additions and 126 deletions

View File

@ -19,7 +19,7 @@
<spring-boot.version>2.5.1</spring-boot.version>
<spring-cloud.version>2020.0.3</spring-cloud.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.mybatis>2.1.4</spring-boot.mybatis>
<swagger.fox.version>3.0.0</swagger.fox.version>

View File

@ -34,6 +34,9 @@ public class LoginUser implements Serializable
*/
private Integer userType;
private String userTypeUtil;
/**
* 租户id
*/
@ -195,5 +198,11 @@ public class LoginUser implements Serializable
this.openId = openId;
}
public String getUserTypeUtil() {
return userTypeUtil;
}
public void setUserTypeUtil(String userTypeUtil) {
this.userTypeUtil = userTypeUtil;
}
}

View File

@ -46,6 +46,7 @@ public class TokenService {
loginUser.setTenantId(loginUser.getTenantId());
loginUser.setUserType(loginUser.getUserType());
loginUser.setOpenId(loginUser.getOpenId());
loginUser.setUserTypeUtil(loginUser.getUserTypeUtil());
refreshToken(loginUser);
// 保存或更新用户token

View File

@ -114,10 +114,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -95,7 +95,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- <dependency>-->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>-->
<!-- <version>3.9</version>-->

View File

@ -6,8 +6,11 @@ import com.xhpc.common.api.WebSocketService;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
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.IXhpcHistoryOrderService;
import com.xhpc.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -39,26 +42,30 @@ public class XhpcChargeOrderController extends BaseController {
private IXhpcHistoryOrderService xhpcHistoryOrderService;
@Autowired
private WebSocketService webSocketService;
@Autowired
private RedisService redisService;
@Autowired
private TokenService tokenService;
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderController.class);
/**
* 实时订单(微信)
*/
@GetMapping("/getHistotyChargeOrderMessage")
public AjaxResult getHistotyChargeOrderMessage(@RequestParam Long userId)
public AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request)
{
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(userId);
return iXhpcChargeOrderService.getHistotyChargeOrderMessage(request);
}
/**
* 异常订单(微信)
*/
@GetMapping("/getHistotyChargeOrderStatusList")
public TableDataInfo getHistotyChargeOrderStatusList(@RequestParam Long userId)
public TableDataInfo getHistotyChargeOrderStatusList(HttpServletRequest request)
{
startPage();
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(userId);
List<Map<String, Object>> list = iXhpcChargeOrderService.getHistotyChargeOrderStatusList(request);
return getDataTable(list);
}
@ -87,10 +94,10 @@ public class XhpcChargeOrderController extends BaseController {
* @return
*/
@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);
return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId);
return iXhpcChargeOrderService.stopUp(request,userId, serialNumber, chargingOrderId);
}
@ -115,9 +122,9 @@ public class XhpcChargeOrderController extends BaseController {
* @return
*/
@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
*/
@GetMapping("/getOrderMessage")
public void getOrderMessage(@RequestParam Long userId)
public void getOrderMessage(HttpServletRequest request,@RequestParam Long userId)
{
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>");
Map<String, Object> orderMessage = iXhpcChargeOrderService.getOrderMessage(userId);
LoginUser loginUser = tokenService.getLoginUser(request);
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.put("code", 200);
map.put("message", "实时数据");
map.put("userId", userId);
if(orderMessage ==null){
if(cacheMap==null){
Map<String, Object> data = new HashMap<>();
BigDecimal decimal = new BigDecimal(0);
data.put("amountCharged",decimal);
@ -155,19 +165,10 @@ public class XhpcChargeOrderController extends BaseController {
data.put("parkingInstructions","充电完成请尽快离场,超时车位占用费10元/小时");
map.put("data", data);
}else{
try{
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);
map.put("data",cacheMap);
}
JSONObject json = new JSONObject(map);
webSocketService.getMessage(""+userId,json.toString());
webSocketService.getMessage(message,json.toString());
logger.info("<<<<<<<<<<发送数据<<<<<<<<<<<<<<"+ json.toString()+">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<发送时间<<<<<<<<<<<<<<"+ DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")+">>>>>>>>>>>>>>>>>");
}
}

View File

@ -3,6 +3,7 @@ package com.xhpc.order.api;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.api.WebSocketService;
import com.xhpc.common.core.domain.R;
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.domain.XhpcRate;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.service.IXhpcChargeOrderService;
@ -50,6 +52,9 @@ public class XhpcPileOrderController extends BaseController {
@Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService;
@Autowired
private UserTypeService userTypeService;
private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class);
/**
@ -203,10 +208,22 @@ public class XhpcPileOrderController extends BaseController {
xhpcChargeOrder.setUpdateTime(date);
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
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);
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);
}
@ -365,15 +382,20 @@ public class XhpcPileOrderController extends BaseController {
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
Map<String, Object> userMessage =new HashMap<>();
if(xhpcChargeOrder.getSource()==0){
userMessage = xhpcChargeOrderService.getUserMessage(userId);
if (userMessage == null || userMessage.get("balance") == null) {
//订单异常
xhpcChargeOrder.setStatus(2);
//异常原因
xhpcChargeOrder.setErroRemark("桩异常:" + stopReason + ">>>>用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
R.ok();
Integer source = xhpcChargeOrder.getSource();
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) {
//订单异常
xhpcChargeOrder.setStatus(2);
//异常原因
xhpcChargeOrder.setErroRemark("桩异常:" + stopReason + ">>>>用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
R.ok();
}
}
}else{
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
@ -388,7 +410,18 @@ public class XhpcPileOrderController extends BaseController {
map.put("code", 500);
map.put("userId", userId);
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){
e.printStackTrace();
return R.fail(500,"添加订单回调失败");
@ -403,9 +436,22 @@ public class XhpcPileOrderController extends BaseController {
@Transactional
@PostMapping("/chargeOrder/abnormalOrder")
public R abnormalOrder(@RequestParam(value = "orderNo") String orderNo) {
xhpcHistoryOrderService.addXhpcChargeOrder(orderNo,1);
//获取实时订单
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();
Map<String, Object> map = new HashMap<>();
map.put("code", 500);

View File

@ -3,9 +3,12 @@ package com.xhpc.order.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
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.domain.AjaxResult;
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.XhpcStatisticsStation;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
@ -44,6 +47,8 @@ public class XhpcHistoryOrderController extends BaseController {
@Autowired
private IXhpcChargeOrderService chargeOrderService;
@Autowired
private UserTypeService userTypeService;
private static final Logger logger = LoggerFactory.getLogger(XhpcHistoryOrderController.class);
@ -872,7 +877,19 @@ public class XhpcHistoryOrderController extends BaseController {
if(xhpcChargeOrderList !=null && xhpcChargeOrderList.size()>0){
for (int i = 0; i <xhpcChargeOrderList.size() ; 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);
}
}
}
}

View File

@ -141,6 +141,11 @@ public class XhpcChargeOrder extends BaseEntity {
*/
private Integer stopReasonEvcs = 0;
/**
* 租户id
*/
private String tenantId;
public Integer getStopReasonEvcs() {
return stopReasonEvcs;
@ -421,4 +426,13 @@ public class XhpcChargeOrder extends BaseEntity {
this.chargingTimeNumber = chargingTimeNumber;
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
}

View File

@ -128,4 +128,8 @@ public class XhpcStatisticsStation extends BaseEntity {
*/
private String chargingMode;
/**
* 租户id
*/
private String tenantId;
}

View File

@ -26,7 +26,7 @@ public interface XhpcChargeOrderMapper {
* @param userId
* @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);
@ -35,7 +35,7 @@ public interface XhpcChargeOrderMapper {
* @param userId
* @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
* @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> getXhpcChargingPileById(@Param("chargingPileid") Long chargingPileid);
Map<String,Object> getXhpcChargingPileById(@Param("chargingPileid") Long chargingPileid,@Param("tenantId")String tenantId);
/**
* 添加redis数据到数据库
@ -137,7 +137,7 @@ public interface XhpcChargeOrderMapper {
* @param date 时间
* @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);
/**
* 获取费率

View File

@ -69,7 +69,7 @@ public interface XhpcHistoryOrderMapper {
* @param historyOrderId
* @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

View File

@ -21,7 +21,7 @@ public interface XhpcRealTimeOrderMapper {
* @param xhpcRealTimeOrder
* @return
*/
int addXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder);
int insertXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder);
/**
@ -29,21 +29,21 @@ public interface XhpcRealTimeOrderMapper {
* @param xhpcChargeOrderSoc
* @return
*/
int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc);
int insertSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc);
/**
* 添加订单实时电流
* @param XhpcChargeOrderCurrent
* @return
*/
int addCurrent(XhpcChargeOrderCurrent XhpcChargeOrderCurrent);
int insertCurrent(XhpcChargeOrderCurrent XhpcChargeOrderCurrent);
/**
* 添加订单实时电压
* @param xhpcChargeOrderVoltage
* @return
*/
int addVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage);
int insertVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage);
/**

View File

@ -22,10 +22,10 @@ public interface IXhpcChargeOrderService {
/**
* 判断实时订单
*
* @param userId
* @param
* @return
*/
AjaxResult getHistotyChargeOrderMessage(Long userId);
AjaxResult getHistotyChargeOrderMessage(HttpServletRequest request);
/**
@ -37,10 +37,10 @@ public interface IXhpcChargeOrderService {
Map<String, Object> getOrderMessage(Long userId);
/**
* 异常订单
* @param userId
* @param
* @return
*/
List<Map<String, Object>> getHistotyChargeOrderStatusList(Long userId);
List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request);
/**
* 启动充电
@ -56,7 +56,7 @@ public interface IXhpcChargeOrderService {
* @param serialNumber 终端编码
* @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
* @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
* @return
*/
int updateUserBalance(Long userId, BigDecimal balance);
int updateUserBalance(Long userId, BigDecimal balance,Integer source,String tenantId);
/**
* 获取运营商信息

View File

@ -4,6 +4,7 @@ import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@ -37,7 +38,7 @@ public interface IXhpcHistoryOrderService {
* @param historyOrderId
* @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 type 状态 1.异常 2.解决异常订单
*/
void addXhpcChargeOrder(String orderNo,Integer type);
void addXhpcChargeOrder(Map<String, Object> userMessage,String orderNo,Integer type);
/**

View File

@ -67,9 +67,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
@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){
return AjaxResult.success();
}
@ -83,9 +85,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
@Override
public List<Map<String, Object>> getHistotyChargeOrderStatusList(Long userId) {
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(userId);
public List<Map<String, Object>> getHistotyChargeOrderStatusList(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(request);
return xhpcChargeOrderMapper.getHistotyChargeOrderStatusList(loginUser.getUserid(),loginUser.getTenantId(),loginUser.getUserType());
}
@Override
@ -98,6 +100,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
Integer userType = loginUser.getUserType();
Long userid = loginUser.getUserid();
String openId = loginUser.getOpenId();
String tenantId = loginUser.getTenantId();
R user = userTypeService.getUser(null, userid, userType, terminalSerialNumber,loginUser.getTenantId());
if(userId !=userid || user ==null || user.getData() ==null){
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
@ -108,8 +111,6 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
}
}
String pattern = "^([0-9]{16})";
Pattern compile = Pattern.compile(pattern);
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) {
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();
//获取桩信息
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
//启动充电
StartChargingData startChargingData = new StartChargingData();
@ -268,8 +269,10 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
@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})";
Pattern compile = Pattern.compile(pattern);
Matcher m = compile.matcher(serialNumber);
@ -277,14 +280,14 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
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) {
return AjaxResult.error(1104, "无效的终端编号");
}
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
String version ="0A";
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
version=xhpcChargingPileById.get("communicationProtocolVersion").toString();
@ -320,9 +323,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
@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
@ -344,7 +347,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
@Override
public int updateUserBalance(Long userId, BigDecimal balance) {
public int updateUserBalance(Long userId, BigDecimal balance,Integer source,String tenantId) {
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,
Integer type, Date date) {
return xhpcChargeOrderMapper.addUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date);
return xhpcChargeOrderMapper.insertUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date);
}
@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) {
r.setCode(1);
r.setMsg("无效的终端编号");
@ -473,7 +476,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),null);
//启动充电
//订单流水号 终端号+年月日时分秒+自增4位 共32位
@ -585,7 +588,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
@Override
public Map<String, Object> getXhpcChargingPileById(Long chargingPileId) {
return xhpcChargeOrderMapper.getXhpcChargingPileById(chargingPileId);
return xhpcChargeOrderMapper.getXhpcChargingPileById(chargingPileId,null);
}
public static boolean isValidDate(String str) {

View File

@ -8,11 +8,15 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.api.RefundOrderService;
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.web.domain.AjaxResult;
import com.xhpc.common.data.redis.CacheRealtimeData;
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.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcHistoryOrder;
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.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import com.xhpc.system.api.model.LoginUser;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -29,6 +34,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
@ -65,6 +71,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
@Autowired
private RefundOrderService refundOrderService;
@Autowired
private TokenService tokenService;
@Autowired
private UserTypeService userTypeService;
@Override
public List<Map<String, Object>> list(Long userId) {
@ -79,9 +89,9 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
}
@Override
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId, historyOrderId, type, chargingOrderId));
public AjaxResult gethistotyOrderMessage(HttpServletRequest request, Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
LoginUser loginUser = tokenService.getLoginUser(request);
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(loginUser.getUserid(), historyOrderId, type, chargingOrderId,loginUser.getTenantId()));
}
@Override
@ -231,7 +241,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
}
@Override
public void addXhpcChargeOrder(String orderNo, Integer type) {
public void addXhpcChargeOrder(Map<String, Object> userMessage,String orderNo, Integer type) {
//(调用时间-启动时间3分钟 自动结算)
logger.info("订单异常回调接口>>>>>orderNo" + orderNo + " type:" + type);
//获取实时订单
@ -308,9 +318,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
BigDecimal surplusPowerPrice = powerPrice;
//剩余的服务费
BigDecimal surplusServicePrice = servicePrice;
Map<String, Object> userMessage = xhpcChargeOrderService.getUserMessage(userId);
Integer source = xhpcChargeOrder.getSource();
String tenantId = xhpcChargeOrder.getTenantId();
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
xhpcHistoryOrder.setStopReasonEvcs(5);
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
@ -345,7 +354,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
//判断是C端用户还是流量端用户
//先计算第三方优惠力度
Integer source = xhpcChargeOrder.getSource();
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
if(source==1 && internetSerialNumber!=null){
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) {
//活动折扣
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
@ -527,7 +536,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
}
Map<String, Object> map =new HashMap<>();
if(source==0){
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
//增加流水订单号
@ -536,12 +545,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
xhpcHistoryOrder.setEvcsOrderNo(evcs);
}
//扣除用户实际消费金额添加消费记录
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
//剩余的钱
BigDecimal balance1 =(BigDecimal) user.get("balance");
//扣除用户实际消费金额添加消费记录-余的钱
BigDecimal balance1 =(BigDecimal) userMessage.get("balance");
BigDecimal subtract = balance1.subtract(actPrice);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,source,xhpcChargeOrder.getTenantId());
if(i==0){
//扣钱失败
xhpcChargeOrder.setStatus(2);
@ -564,18 +571,18 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
if(xhpcChargingPile !=null){
//发送短信
if(user.get("phone") !=null){
if(userMessage.get("phone") !=null){
if("1".equals(xhpcChargingPile.get("type").toString())){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
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 + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}else {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("sumMoney", actPrice.toString());
paramMap.put("phone", user.get("phone").toString());
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}

View File

@ -11,6 +11,7 @@ import com.xhpc.common.data.redis.CacheOrderData;
import com.xhpc.common.data.redis.CacheRealtimeData;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.util.EvcsUtil;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.*;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
@ -122,22 +123,22 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
@Override
public int addXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder) {
return xhpcRealTimeOrderMapper.addXhpcRealTimeOrder(xhpcRealTimeOrder);
return xhpcRealTimeOrderMapper.insertXhpcRealTimeOrder(xhpcRealTimeOrder);
}
@Override
public int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc) {
return xhpcRealTimeOrderMapper.addSOC(xhpcChargeOrderSoc);
return xhpcRealTimeOrderMapper.insertSOC(xhpcChargeOrderSoc);
}
@Override
public int addCurrent(XhpcChargeOrderCurrent xhpcChargeOrderCurrent) {
return xhpcRealTimeOrderMapper.addCurrent(xhpcChargeOrderCurrent);
return xhpcRealTimeOrderMapper.insertCurrent(xhpcChargeOrderCurrent);
}
@Override
public int addVoltage(XhpcChargeOrderVoltage xhpcChargeOrderVoltage) {
return xhpcRealTimeOrderMapper.addVoltage(xhpcChargeOrderVoltage);
return xhpcRealTimeOrderMapper.insertVoltage(xhpcChargeOrderVoltage);
}
@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) {
//活动折扣
Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
@ -538,7 +539,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
}
Map<String, Object> map =new HashMap<>();
if(source==0){
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
//增加流水订单号
@ -547,12 +548,10 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcHistoryOrder.setEvcsOrderNo(evcs);
}
//扣除用户实际消费金额添加消费记录
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
//剩余的钱
BigDecimal balance1 =(BigDecimal) user.get("balance");
//扣除用户实际消费金额添加消费记录 剩余的钱
BigDecimal balance1 =(BigDecimal) userMessage.get("balance");
BigDecimal subtract = balance1.subtract(actPrice);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract);
int i = xhpcChargeOrderService.updateUserBalance(userId, subtract,xhpcChargeOrder.getSource(),xhpcChargeOrder.getTenantId());
if(i==0){
//扣钱失败
xhpcChargeOrder.setStatus(2);
@ -575,18 +574,18 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
if(xhpcChargingPile !=null){
//发送短信
if(user.get("phone") !=null){
if(userMessage.get("phone") !=null){
if("1".equals(xhpcChargingPile.get("type").toString())){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
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 + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}else {
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("sumMoney", actPrice.toString());
paramMap.put("phone", user.get("phone").toString());
paramMap.put("phone", userMessage.get("phone").toString());
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。");
smsService.sendNotice(paramMap);
}

View File

@ -32,6 +32,7 @@
<result column="amount_charged" property="amountCharged"/>
<result column="power" property="power"/>
<result column="charging_time_number" property="chargingTimeNumber"/>
<result column="tenant_id" property="tenantId"/>
</resultMap>
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
@ -74,7 +75,13 @@
select
count(charge_order_id)
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 id="getMessage" resultType="map">
@ -129,7 +136,7 @@
</select>
<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>
<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_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
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
</select>
@ -319,6 +334,12 @@
<if test="chargeOrderId !=null">
and charge_order_id=#{chargeOrderId}
</if>
<if test="tenantId !=null and tenantId !=''">
and tenant_id=#{tenantId}
</if>
<if test="source !=null">
and source=#{source}
</if>
</select>
<select id="getPromotion" resultType="map">
@ -347,7 +368,11 @@
charging_pile_id as chargingPileId,
communication_protocol_version as communicationProtocolVersion,
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>
<insert id="addXhpcOrderRedisRecord" parameterType="com.xhpc.order.domain.XhpcOrderRedisRecord" useGeneratedKeys="true"
@ -467,7 +492,7 @@
</trim>
</insert>
<insert id="addUserAccountStatement">
<insert id="insertUserAccountStatement">
INSERT INTO xhpc_user_account_statement(user_id, amount, remaining_sum, charge_order_id, type, create_time)
values (#{userId}, #{amount}, #{remainingSum}, #{chargeOrderId}, #{type}, #{date})
</insert>

View File

@ -600,6 +600,9 @@
<if test="chargingOrderId !=null">
and ho.charge_order_id =#{chargingOrderId}
</if>
<if test="tenantId !=null and tenantId !=''">
and ho.tenant_id =#{tenantId}
</if>
order by ho.create_time desc
</select>

View File

@ -35,7 +35,7 @@
<result column="charging_station_id" property="chargingStationId"/>
</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">
insert into xhpc_real_time_order
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -206,7 +206,7 @@
</trim>
</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">
insert into xhpc_charge_order_soc
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -263,7 +263,7 @@
</trim>
</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">
insert into xhpc_charge_order_current
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -320,7 +320,7 @@
</trim>
</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">
insert into xhpc_charge_order_voltage
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -238,8 +238,10 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
userInfo.setTenantId(map.get("tenantId").toString());
if(UserTypeUtil.COMMUNIT.equals(username.substring(0,2))){
userInfo.setUserType(UserTypeUtil.COMMUNIT_TYPE);
userInfo.setUserTypeUtil(UserTypeUtil.COMMUNIT);
}else{
userInfo.setUserType(UserTypeUtil.CUSTOMERS_TYPE);
userInfo.setUserTypeUtil(UserTypeUtil.CUSTOMERS);
}
if(UserTypeUtil.COMMUNIT.equals(sub)){
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
@ -297,6 +299,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
userInfo.setOpenId(openid);
userInfo.setUserid(user.getAppUserId());
userInfo.setTenantId(tenantId);
userInfo.setUserTypeUtil(UserTypeUtil.USER);
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
}

View File

@ -37,6 +37,7 @@
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
order by create_time desc
</select>
<insert id="addCommunity" parameterType="com.xhpc.user.domain.XhpcCommunity" useGeneratedKeys="true" keyProperty="communityId">
@ -210,7 +211,7 @@
xhpc_community_personnel
where community_id=#{communityId} and del_flag=0
<if test="account !=null and account !=''">
and account like concat('%', #{account), '%')
and account like concat('%', #{account}, '%')
</if>
<if test="phone !=null and phone !=''">
and phone like concat('%', #{phone}, '%')
@ -218,6 +219,7 @@
<if test="status !=null">
and status=#{status}
</if>
order by create_time desc.
</select>
<insert id="addCommunityPersonnel" parameterType="com.xhpc.user.domain.XhpcCommunityPersonnel" useGeneratedKeys="true" keyProperty="communityPersonnelId">

View File

@ -39,6 +39,7 @@
<if test="operatorId !=null">
and operator_id=#{operatorId}
</if>
order by create_time desc
</select>
<insert id="addCustomers" parameterType="com.xhpc.user.domain.XhpcCustomers" useGeneratedKeys="true" keyProperty="customersId">
@ -212,6 +213,7 @@
<if test="status !=null">
and status=#{status}
</if>
order by create_time desc
</select>
<insert id="addCustomersPersonnel" parameterType="com.xhpc.user.domain.XhpcCustomersPersonnel" useGeneratedKeys="true" keyProperty="customersPersonnelId">