新增车牌业务
This commit is contained in:
parent
f445cb9c83
commit
b046dacaa2
21
sql/v2.2.sql
21
sql/v2.2.sql
@ -38,8 +38,8 @@ ALTER TABLE `xhpc_charging_station`
|
||||
ADD COLUMN `rated_power` DOUBLE(10,4) NULL DEFAULT NULL COMMENT '站点额定总功率' AFTER `business_expand_type`,
|
||||
ADD COLUMN `period_fee` INT(4) NULL DEFAULT NULL COMMENT '峰谷分时' AFTER `rated_power`,
|
||||
ADD COLUMN `official_run_time` VARCHAR(50) NULL DEFAULT NULL COMMENT '正式投运时间' AFTER `period_fee`,
|
||||
ADD COLUMN `video_monitor` INT(4) NULL DEFAULT NULL COMMENT '视频监控配套情况' AFTER `official_run_time`;
|
||||
|
||||
ADD COLUMN `video_monitor` INT(4) NULL DEFAULT NULL COMMENT '视频监控配套情况' AFTER `official_run_time`,
|
||||
ADD COLUMN `barrier_gate_id` INT(4) NULL DEFAULT NULL COMMENT '道闸' AFTER `video_monitor`;
|
||||
|
||||
ALTER TABLE `xhpc_charging_pile`
|
||||
ADD COLUMN `equipment_product_code` VARCHAR(30) NULL DEFAULT NULL COMMENT '设备出厂编码(由设备生厂商定义的设备出厂唯一编码)' AFTER `tenant_id`,
|
||||
@ -85,3 +85,20 @@ CREATE TABLE `xhpc_equipment_accident` (
|
||||
|
||||
ALTER TABLE `xhpc_charging_station_power`
|
||||
ADD COLUMN `type` int(4) NULL DEFAULT '0' COMMENT '是否推送 0 未推送 1已推送' AFTER `installed_total_power`;
|
||||
|
||||
|
||||
CREATE TABLE `xhpc_user_vehicle` (
|
||||
`vehicle_id` bigint(20) NOT NULL,
|
||||
`app_user_id` bigint(20) DEFAULT NULL,
|
||||
`vehicle_name` varchar(10) DEFAULT NULL COMMENT '车牌',
|
||||
`type` int(4) DEFAULT NULL COMMENT '1.小型纯电车 2.小型混动电车 3.大型纯电车',
|
||||
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`remark` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
|
||||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`vehicle_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='车牌';
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ public class XhpcChargingStationPowerController extends BaseController {
|
||||
private IXhpcChargingStationPowerService xhpcChargingStationPowerService;
|
||||
|
||||
@GetMapping("/test1")
|
||||
@Scheduled(cron = "0 0/5 0/1 * * ? ")
|
||||
@Scheduled(cron = "0 0/3 0/1 * * ? ")
|
||||
public void test1(){
|
||||
xhpcChargingStationPowerService.addChargingStationPower();
|
||||
}
|
||||
|
||||
@ -108,6 +108,14 @@ public class XhpcRealTimeOrder extends BaseEntity {
|
||||
* 场站id
|
||||
*/
|
||||
private Long chargingStationId;
|
||||
/**
|
||||
* 电桩id
|
||||
*/
|
||||
private Long chargingPileId;
|
||||
/**
|
||||
* 终端id
|
||||
*/
|
||||
private Long terminalId;
|
||||
|
||||
/**
|
||||
* 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)
|
||||
@ -363,4 +371,20 @@ public class XhpcRealTimeOrder extends BaseEntity {
|
||||
public void setSource(Integer source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Long getChargingPileId() {
|
||||
return chargingPileId;
|
||||
}
|
||||
|
||||
public void setChargingPileId(Long chargingPileId) {
|
||||
this.chargingPileId = chargingPileId;
|
||||
}
|
||||
|
||||
public Long getTerminalId() {
|
||||
return terminalId;
|
||||
}
|
||||
|
||||
public void setTerminalId(Long terminalId) {
|
||||
this.terminalId = terminalId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,6 +134,8 @@ public interface XhpcChargeOrderMapper {
|
||||
*/
|
||||
Map<String,Object> getOperatorMessage(@Param("chargingStationId") Long chargingStationId);
|
||||
|
||||
Map<String,Object> getXhpcUserVehicleMessage(@Param("userId")Long userId,@Param("source")Integer source);
|
||||
|
||||
//获取桩信息
|
||||
Map<String,Object> getXhpcChargingPileById(@Param("chargingPileid") Long chargingPileid,@Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.order.domain.*;
|
||||
import com.xhpc.order.dto.RateTime;
|
||||
import com.xhpc.order.dto.XhpcActivityDiscountDto;
|
||||
@ -201,4 +202,8 @@ public interface XhpcRealTimeOrderMapper {
|
||||
|
||||
void deleteRealTimeOrderBms(@Param("time")String time);
|
||||
|
||||
|
||||
//获取桩id
|
||||
XhpcChargingPile getSerialNumber(@Param("serialNumber")String serialNumber);
|
||||
|
||||
}
|
||||
|
||||
@ -317,6 +317,12 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
}
|
||||
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
|
||||
xhpcChargeOrder.setType("91");
|
||||
|
||||
//获取车牌
|
||||
Map<String, Object> xhpcUserVehicleMessage = xhpcChargeOrderMapper.getXhpcUserVehicleMessage(xhpcChargeOrder.getUserId(), xhpcChargeOrder.getSource());
|
||||
if(xhpcUserVehicleMessage !=null && xhpcUserVehicleMessage.get("vehicleName") !=null){
|
||||
xhpcChargeOrder.setPlateNum(xhpcUserVehicleMessage.get("vehicleName").toString());
|
||||
}
|
||||
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
|
||||
|
||||
executorService.execute(new Runnable() {
|
||||
|
||||
@ -17,6 +17,7 @@ import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.common.domain.XhpcRate;
|
||||
import com.xhpc.common.enums.StopReasonEnum;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
@ -1552,6 +1553,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
Long chargingStationId = xhpcChargeOrder.getChargingStationId();
|
||||
xhpcRealTimeOrder.setChargingStationId(chargingStationId);
|
||||
xhpcRealTimeOrder.setChargingTimeNumber(cacheRealtimeData.getChargingTime());
|
||||
|
||||
XhpcChargingPile xhpcChargingPiles = xhpcRealTimeOrderMapper.getSerialNumber(xhpcChargeOrder.getSerialNumber().substring(0, 14));
|
||||
|
||||
xhpcRealTimeOrder.setChargingPileId(xhpcChargingPiles.getChargingPileId());
|
||||
xhpcRealTimeOrder.setTerminalId(xhpcChargeOrder.getTerminalId());
|
||||
addXhpcRealTimeOrder(xhpcRealTimeOrder);
|
||||
//实时数据存入MYsql、soc、电流、电压
|
||||
|
||||
|
||||
@ -438,6 +438,13 @@
|
||||
where operator_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</select>
|
||||
|
||||
<select id="getXhpcUserVehicleMessage" resultType="map">
|
||||
select
|
||||
vehicle_id as vehicleId,
|
||||
app_user_id as appUserId,
|
||||
vehicle_name as vehicleName
|
||||
from xhpc_user_vehicle where source =#{source} and app_user_id =#{userId} and del_flag=0
|
||||
</select>
|
||||
<select id="getXhpcChargingPileById" resultType="map">
|
||||
select
|
||||
cp.charging_pile_id as chargingPileId,
|
||||
|
||||
@ -42,18 +42,18 @@
|
||||
xcp.power as installedTotalPower
|
||||
FROM
|
||||
xhpc_real_time_order AS xrto
|
||||
LEFT JOIN xhpc_charge_order AS xco ON xrto.charging_order_id =xco.charge_order_id
|
||||
LEFT JOIN xhpc_terminal as xt on xt.terminal_id = xco.terminal_id
|
||||
LEFT JOIN xhpc_terminal as xt on xt.terminal_id = xrto.terminal_id
|
||||
LEFT JOIN xhpc_charging_pile as xcp on xcp.charging_pile_id = xt.charging_pile_id
|
||||
where xrto.voltage is not null and xrto.electric_current >0 and xrto.voltage >0
|
||||
and xrto.create_time >= #{sterTime} and xrto.create_time <=#{endTime}
|
||||
and xrto.charging_station_id = #{chargingStationId}
|
||||
and xco.terminal_id =#{terminalId}
|
||||
and xrto.terminal_id =#{terminalId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="duplicateStatistics" resultType="int">
|
||||
select count(*) from xhpc_charging_station_power where `status`=#{number} and charging_station_id=#{chargingStationId} and terminal_id =#{terminalId} and create_time like concat(#{subTime}, '%')
|
||||
select count(*) from xhpc_charging_station_power
|
||||
where `status`=#{number} and charging_station_id=#{chargingStationId} and terminal_id =#{terminalId} and create_time like concat(#{subTime}, '%')
|
||||
</select>
|
||||
|
||||
<select id="getXhpcTerminals" resultType="map">
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="charging_station_id" property="chargingStationId"/>
|
||||
<result column="charging_pile_id" property="chargingPileId"/>
|
||||
<result column="terminal_id" property="terminalId"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertXhpcRealTimeOrder" parameterType="com.xhpc.order.domain.XhpcRealTimeOrder" useGeneratedKeys="true"
|
||||
@ -121,7 +123,13 @@
|
||||
charging_time_number,
|
||||
</if>
|
||||
<if test="null != source ">
|
||||
source
|
||||
source,
|
||||
</if>
|
||||
<if test="null != chargingPileId ">
|
||||
charging_pile_id,
|
||||
</if>
|
||||
<if test="null != terminalId ">
|
||||
terminal_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@ -207,7 +215,13 @@
|
||||
#{chargingTimeNumber},
|
||||
</if>
|
||||
<if test="null != source ">
|
||||
#{source}
|
||||
#{source},
|
||||
</if>
|
||||
<if test="null != chargingPileId ">
|
||||
#{chargingPileId},
|
||||
</if>
|
||||
<if test="null != terminalId ">
|
||||
#{terminalId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@ -1038,4 +1052,10 @@
|
||||
delete from xhpc_real_time_order_bms where create_time <=#{time}
|
||||
</delete>
|
||||
|
||||
<select id="getSerialNumber" resultType="com.xhpc.common.domain.XhpcChargingPile">
|
||||
select
|
||||
charging_pile_id as chargingPileId,
|
||||
charging_station_id as chargingStationId
|
||||
from xhpc_charging_pile where serial_number =#{serialNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -40,6 +40,7 @@ public class StationController {
|
||||
public void addNotificationStationInfo(@RequestParam("stationId")Long stationId){
|
||||
CDStationInfo xhpcChargingStation = deviceMessageMapper.getXhpcChargingStation(stationId);
|
||||
if(xhpcChargingStation !=null){
|
||||
System.out.println("=================生成场站推送数据信息===================");
|
||||
//场站信息入缓存
|
||||
String skey = "cdjgpc:station:".concat(stationId.toString())+".notification";
|
||||
REDIS.deleteObject(skey);
|
||||
|
||||
@ -22,6 +22,7 @@ import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.user.service.IXhpcAppUserUserService;
|
||||
import com.xhpc.user.service.IXhpcUserVehicleService;
|
||||
import com.xhpc.user.util.WechatDecryptDataUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
@ -30,6 +31,7 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
@ -61,6 +63,8 @@ public class XhpcAppUserController extends BaseController {
|
||||
private Environment environment;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private IXhpcUserVehicleService xhpcUserVehicleService;
|
||||
|
||||
/**
|
||||
* C端用户详情
|
||||
@ -586,6 +590,10 @@ public class XhpcAppUserController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取用户车牌号
|
||||
@GetMapping("/getXhpcUserVehicleMessage")
|
||||
public R getXhpcUserVehicleMessage(Long userId, Integer source){
|
||||
return xhpcUserVehicleService.getXhpcUserVehicleMessage(userId, source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.xhpc.user.controller;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.user.domain.XhpcUserVehicle;
|
||||
import com.xhpc.user.service.IXhpcUserVehicleService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-19 17:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xhpc/userVehicle")
|
||||
public class XhpcUserVehicleConeroller extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
IXhpcUserVehicleService xhpcUserVehicleService;
|
||||
|
||||
@ApiOperation("添加车牌号")
|
||||
@PostMapping("/addUserVehicle")
|
||||
public R addUserVehicle(@RequestBody XhpcUserVehicle xhpcUserVehicle){
|
||||
return xhpcUserVehicleService.addUserVehicle(xhpcUserVehicle);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HttpServletRequest request, String vehicleName, String phone,String chargingStationName) {
|
||||
List<Map<String, Object>> list = xhpcUserVehicleService.list(request,vehicleName,phone,chargingStationName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xhpc.user.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-19 16:41
|
||||
*/
|
||||
@Data
|
||||
public class XhpcUserVehicle extends BaseEntity {
|
||||
/**
|
||||
* 车辆id
|
||||
*/
|
||||
private Long vehicleId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long appUserId;
|
||||
|
||||
private Long chargingStationId;
|
||||
|
||||
private Integer source;
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
@Length(max = 10, message = "车牌不能超过10位")
|
||||
private String vehicleName;
|
||||
/**
|
||||
* 1.小型纯电车 2.小型混动电车 3.大型纯电车
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xhpc.user.mapper;
|
||||
|
||||
import com.xhpc.user.domain.XhpcUserVehicle;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-19 17:08
|
||||
*/
|
||||
public interface XhpcUserVehicleMapper {
|
||||
|
||||
|
||||
void deleteUserVehicle(@Param("userId") Long userId,@Param("vehicleId") Long vehicleId);
|
||||
|
||||
void addUserVehicle(XhpcUserVehicle xhpcUserVehicle);
|
||||
|
||||
void updateUserVehicle(XhpcUserVehicle xhpcUserVehicle);
|
||||
|
||||
List<Map<String, Object>> list(@Param("vehicleName") String vehicleName,@Param("phone") String phone,@Param("chargingStationName")String chargingStationName,@Param("logOperatorId")Long logOperatorId,@Param("type")Integer type,@Param("tenantId")String tenantId);
|
||||
|
||||
Map<String, Object> getXhpcUserVehicleMessage(@Param("userId") Long userId,@Param("source") Integer source);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xhpc.user.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.user.domain.XhpcUserVehicle;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-19 17:05
|
||||
*/
|
||||
public interface IXhpcUserVehicleService {
|
||||
|
||||
R addUserVehicle(XhpcUserVehicle xhpcUserVehicle);
|
||||
|
||||
List<Map<String, Object>> list(HttpServletRequest request,String vehicleName,String phone,String chargingStationName);
|
||||
|
||||
R getXhpcUserVehicleMessage(Long userId,Integer source);
|
||||
}
|
||||
@ -483,6 +483,11 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
R user = xhpcCommonController.getMechanism(null, userid, userType, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
if(map.get("vehicleName") !=null){
|
||||
map.put("vehicleType",1);
|
||||
}else{
|
||||
map.put("vehicleType",0);
|
||||
}
|
||||
//发票、留言板、版本、客服电话
|
||||
// Long invoice =null;
|
||||
// String globalInvoice="global:invoice:"+ tenantId +":";
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
package com.xhpc.user.service.impl;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import com.xhpc.user.domain.XhpcUserVehicle;
|
||||
import com.xhpc.user.mapper.XhpcUserVehicleMapper;
|
||||
import com.xhpc.user.service.IXhpcUserVehicleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-19 17:06
|
||||
*/
|
||||
@Service
|
||||
public class XhpcUserVehicleServiceImpl extends BaseService implements IXhpcUserVehicleService {
|
||||
|
||||
@Resource
|
||||
XhpcUserVehicleMapper xhpcUserVehicleMapper;
|
||||
@Resource
|
||||
TokenService tokenService;
|
||||
|
||||
@Override
|
||||
public R addUserVehicle(XhpcUserVehicle xhpcUserVehicle) {
|
||||
//标记该用户其他车牌号为空
|
||||
xhpcUserVehicleMapper.deleteUserVehicle(xhpcUserVehicle.getAppUserId(),xhpcUserVehicle.getVehicleId());
|
||||
if(xhpcUserVehicle.getVehicleId() !=null){
|
||||
xhpcUserVehicleMapper.addUserVehicle(xhpcUserVehicle);
|
||||
}else{
|
||||
xhpcUserVehicleMapper.updateUserVehicle(xhpcUserVehicle);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> list(HttpServletRequest request, String vehicleName,String phone,String chargingStationName) {
|
||||
|
||||
//获取登陆用户
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Long sysUserId = sysUser.getUserId();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
//桩的统计、该时段金额
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
list = xhpcUserVehicleMapper.list(vehicleName,phone,chargingStationName,logOperatorId,1,tenantId);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcUserVehicleMapper.list(vehicleName,phone,chargingStationName,sysUserId,2,tenantId);
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list = xhpcUserVehicleMapper.list(vehicleName,phone,chargingStationName,sysUserId,0,tenantId);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getXhpcUserVehicleMessage(Long userId, Integer source) {
|
||||
return R.ok(xhpcUserVehicleMapper.getXhpcUserVehicleMessage(userId,source));
|
||||
}
|
||||
}
|
||||
@ -28,9 +28,11 @@
|
||||
xau.tenant_id tenantId,
|
||||
xau.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
xuv.vehicle_name as vehicleName,
|
||||
xau.create_time as createTime
|
||||
from xhpc_app_user xau
|
||||
left join xhpc_tenant ten on ten.tenant_id = xau.tenant_id and ten.is_deleted =0
|
||||
left join xhpc_user_vehicle xuv on xuv.app_user_id = xau.app_user_id and xuv.source=0 and xuv.del_flag=0
|
||||
where xau.del_flag=0
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xau.phone =#{phone}
|
||||
@ -64,12 +66,14 @@
|
||||
xcp.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
concat("ST") as userTypeName,
|
||||
xuv.vehicle_name as vehicleName,
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
(select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||
</if>
|
||||
xcp.create_time as createTime
|
||||
from xhpc_community_personnel xcp
|
||||
left join xhpc_tenant ten on ten.tenant_id = xcp.tenant_id and ten.is_deleted =0
|
||||
left join xhpc_user_vehicle xuv on xuv.app_user_id = xcp.community_personnel_id and xuv.source=2 and xuv.del_flag=0
|
||||
where xcp.del_flag=0
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcp.account =#{phone}
|
||||
@ -103,12 +107,14 @@
|
||||
xcp.soc_protect socProtect,
|
||||
ten.status tenantStatus,
|
||||
concat("BE") as userTypeName,
|
||||
xuv.vehicle_name as vehicleName,
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
(select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||
</if>
|
||||
xcp.create_time as createTime
|
||||
from xhpc_customers_personnel xcp
|
||||
left join xhpc_tenant ten on ten.tenant_id = xcp.tenant_id and ten.is_deleted =0
|
||||
left join xhpc_user_vehicle xuv on xuv.app_user_id = xcp.customers_personnel_id and xuv.source=3 and xuv.del_flag=0
|
||||
where xcp.del_flag=0
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcp.account =#{phone}
|
||||
|
||||
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.user.mapper.XhpcUserVehicleMapper">
|
||||
|
||||
<resultMap type="com.xhpc.user.domain.XhpcUserVehicle" id="XhpcUserVehicleResult">
|
||||
<result column="vehicle_id" property="vehicleId"/>
|
||||
<result column="app_user_id" property="appUserId"/>
|
||||
<result column="vehicle_name" property="vehicleName"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="charging_station_id" property="chargingStationId"/>
|
||||
<result column="source" property="source"/>
|
||||
</resultMap>
|
||||
|
||||
<update id="deleteUserVehicle">
|
||||
update xhpc_user_vehicle set del_flag =1 where app_user_id=#{userId}
|
||||
<if test="vehicleId !=null">
|
||||
and vehicle_id !=#{vehicleId}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="map">
|
||||
select
|
||||
xuv.vehicle_id as vehicleId,
|
||||
xuv.app_user_id as appUserId,
|
||||
xuv.vehicle_name as vehicleName,
|
||||
xau.phone as phone,
|
||||
xcop.phone as communityPhone,
|
||||
xcup.phone as customersPhone,
|
||||
xuv.type as type
|
||||
from xhpc_user_vehicle as xuv
|
||||
left join xhpc_app_user as xau on xau.app_user_id = xuv.app_user_id and xuv.source=0
|
||||
left join xhpc_community_personnel as xcop on xcop.community_personnel_id = xuv.app_user_id and xuv.source=2
|
||||
left join xhpc_customers_personnel as xcup on xcup.customers_personnel_id = xuv.app_user_id and xuv.source=3
|
||||
left join xhpc_charging_station as xcs on xcs.charging_station_id = xuv.charging_station_id
|
||||
where xuv.del_flag =0
|
||||
<if test="vehicleName !=null and vehicleName !=''">
|
||||
and xuv.vehicle_name like CONCAT('%',#{vehicleName},'%')
|
||||
</if>
|
||||
<if test="chargingStationName !=null and chargingStationName !=''">
|
||||
and xuv.vehicle_name like CONCAT('%',#{chargingStationName},'%')
|
||||
</if>
|
||||
<if test="phone !=null and phone !=''">
|
||||
and (xau.phone like CONCAT('%',#{phone},'%') or
|
||||
xcop.phone like CONCAT('%',#{phone},'%') or
|
||||
xcup.phone like CONCAT('%',#{phone},'%') or
|
||||
)
|
||||
</if>
|
||||
<if test="type ==1">
|
||||
and xuv.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="type ==2">
|
||||
and xuv.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and xuv.tenant_id=#{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateUserVehicle" parameterType="com.xhpc.user.domain.XhpcUserVehicle">
|
||||
UPDATE xhpc_user_vehicle
|
||||
<set>
|
||||
<if test="null != appUserId ">vehicle_id = #{appUserId},</if>
|
||||
<if test="null != vehicleName and '' != vehicleName">vehicle_name = #{vehicleName},</if>
|
||||
<if test="null != type ">type = #{type},</if>
|
||||
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
|
||||
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
|
||||
<if test="null != createTime ">create_time = #{createTime},</if>
|
||||
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
|
||||
<if test="null != updateTime ">update_time = #{updateTime},</if>
|
||||
<if test="null != remark and '' != remark">remark = #{remark}</if>
|
||||
</set>
|
||||
WHERE vehicle_id = #{vehicleId}
|
||||
</update>
|
||||
|
||||
<insert id="addUserVehicle" parameterType="com.xhpc.user.domain.XhpcUserVehicle" useGeneratedKeys="true"
|
||||
keyProperty="vehicleId">
|
||||
insert into xhpc_user_vehicle(
|
||||
<if test="appUserId != null ">app_user_id,</if>
|
||||
<if test="vehicleName != null and vehicleName != ''">vehicle_name,</if>
|
||||
<if test="type != null ">type,</if>
|
||||
<if test="delFlag != null ">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null ">update_by,</if>
|
||||
<if test="updateTime != null ">update_time,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="tenantId != null ">tenant_id,</if>
|
||||
)values(
|
||||
<if test="appUserId != null ">#{appUserId},</if>
|
||||
<if test="vehicleName != null and vehicleName != ''">#{vehicleName},</if>
|
||||
<if test="type != null ">#{type},</if>
|
||||
<if test="delFlag != null ">#{delFlag},</if>
|
||||
<if test="createBy != null ">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null ">#{updateTime},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="tenantId != null ">#{tenantId},</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getXhpcUserVehicleMessage" resultType="map">
|
||||
select
|
||||
vehicle_id as vehicleId,
|
||||
app_user_id as appUserId,
|
||||
vehicle_name as vehicleName
|
||||
from xhpc_user_vehicle where source =#{source} and app_user_id =#{userId} and del_flag=0
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user