共享钥匙
This commit is contained in:
parent
7ddf6ebd1e
commit
cc11bdac13
|
@ -833,12 +833,16 @@ public class AppVerifyController extends BaseController
|
|||
{
|
||||
logger.info("【根据token查询车辆列表(商家)】:keywords= {}", keywords);
|
||||
EUserVO userVO = userService.selectUserById(getUserId());
|
||||
String userType = userVO.getUserType();
|
||||
ServiceUtil.assertion(!(userType.equals(USER_TYPE_MERCHANT) || userType.equals(USER_TYPE_INDIVIDUAL)), "您没有权限访问");
|
||||
// String userType = userVO.getUserType();
|
||||
// ServiceUtil.assertion(!(userType.equals(USER_TYPE_MERCHANT) || userType.equals(USER_TYPE_INDIVIDUAL)), "您没有权限访问");
|
||||
EDeviceQuery deviceQuery = new EDeviceQuery();
|
||||
deviceQuery.setUserId(getUserId());
|
||||
deviceQuery.setKeywords(keywords);
|
||||
List<EDeviceVO> list = deviceService.selectEDeviceListWithIsolate(deviceQuery);
|
||||
// list添加type等于1
|
||||
list.forEach(device -> {
|
||||
device.setType("1");
|
||||
});
|
||||
// 拼接分享的车辆
|
||||
if(list.isEmpty()){
|
||||
list = new ArrayList<>();
|
||||
|
@ -848,9 +852,15 @@ public class AppVerifyController extends BaseController
|
|||
}
|
||||
|
||||
private void assembleShareDevice(List<EDeviceVO> list,EUserVO userVO) {
|
||||
List<String> sns = shareKeyService.selectEShareSnListByShareUserId(userVO.getUserId());
|
||||
List<EShareKey> sns = shareKeyService.selectEShareSnListByShareUserId(userVO.getUserId());
|
||||
ArrayList<EDeviceVO> devices = new ArrayList<>();
|
||||
if(!sns.isEmpty()){
|
||||
List<EDeviceVO> devices = deviceService.selectBySns(sns);
|
||||
sns.forEach(key -> {
|
||||
EDeviceVO deviceVO = deviceService.selectEDeviceBySn(key.getSn());
|
||||
deviceVO.setType("2");
|
||||
deviceVO.setExpirationTime(key.getExpirationTime());
|
||||
devices.add(deviceVO);
|
||||
});
|
||||
list.addAll(devices);
|
||||
}
|
||||
}
|
||||
|
@ -1087,21 +1097,20 @@ public class AppVerifyController extends BaseController
|
|||
public AjaxResult claimKey(Long keyId)
|
||||
{
|
||||
logger.info("扫码领取钥匙:keyId=【{}】", keyId);
|
||||
EShareKey eShareKey = shareKeyService.selectEShareKeyByKeyId(keyId);
|
||||
if(!ServiceConstants.KEY_STATUS_NEW.equals(eShareKey.getStatus())){
|
||||
EShareKey shareKey = shareKeyService.selectEShareKeyByKeyId(keyId);
|
||||
if(!ServiceConstants.KEY_STATUS_NEW.equals(shareKey.getStatus())){
|
||||
return AjaxResult.error("【扫码领取钥匙】失败,非待领取状态");
|
||||
}
|
||||
if(!shareKey.getShareId().equals(getUserId())){
|
||||
return AjaxResult.error("不是被分享人不能领取");
|
||||
}
|
||||
EShareKey bandKey = geteShareKey(keyId);
|
||||
return success(shareKeyService.updateEShareKey(bandKey));
|
||||
}
|
||||
|
||||
private @NotNull EShareKey geteShareKey(Long keyId) {
|
||||
EUserVO userVO = userService.selectUserById(getUserId());
|
||||
EShareKey bandKey = new EShareKey();
|
||||
bandKey.setKeyId(keyId);
|
||||
bandKey.setShareId(getUserId());
|
||||
bandKey.setShareUserName(userVO.getUserName());
|
||||
bandKey.setSharePhone(userVO.getPhonenumber());
|
||||
bandKey.setStatus(ServiceConstants.KEY_STATUS_RECEIVED);
|
||||
return bandKey;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/eride?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://47.120.68.19:3306/eride?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
password: d0dbe100b71c1d09
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.ruoyi.system.domain.device;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.system.domain.EFunction;
|
||||
import com.ruoyi.system.domain.accessory.EAccessoryVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -39,4 +41,11 @@ public class EDeviceVO extends EDevice{
|
|||
@Excel(name = "正在进行中的订单号")
|
||||
private String inProgressOrderNo;
|
||||
|
||||
@Excel(name = "车辆来源类型:1-自己的车;2-分享的车")
|
||||
private String type;
|
||||
|
||||
/** 有效时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date expirationTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public interface EShareKeyMapper
|
|||
/**
|
||||
* 根据分享用户id查询未过期车辆sn
|
||||
*/
|
||||
List<String> selectEShareSnListByShareUserId(Long shareUserId);
|
||||
List<EShareKey> selectEShareSnListByShareUserId(Long shareUserId);
|
||||
|
||||
/**
|
||||
* 查询已过期但改变状态的共享钥匙列表
|
||||
|
|
|
@ -41,7 +41,7 @@ public interface IEShareKeyService
|
|||
* @param ownerId 归属用户id
|
||||
* @return 共享钥匙集合
|
||||
*/
|
||||
public List<String> selectEShareSnListByShareUserId(Long ownerId);
|
||||
public List<EShareKey> selectEShareSnListByShareUserId(Long ownerId);
|
||||
|
||||
/**
|
||||
* 根据归属用户id查询共享钥匙列表(已失效)
|
||||
|
|
|
@ -69,7 +69,7 @@ public class EShareKeyServiceImpl implements IEShareKeyService
|
|||
* @return 共享钥匙集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> selectEShareSnListByShareUserId(Long shareUserId){
|
||||
public List<EShareKey> selectEShareSnListByShareUserId(Long shareUserId){
|
||||
return eShareKeyMapper.selectEShareSnListByShareUserId(shareUserId);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class RlTask {
|
|||
* 分享key过期状态处理
|
||||
*/
|
||||
public void expiredKeyHandler(){
|
||||
log.info("-------------------【定时任务】分享key过期状态处理---开始----------------");
|
||||
// log.info("-------------------【定时任务】分享key过期状态处理---开始----------------");
|
||||
List<EShareKey> eShareKeys = shareKeyService.selectExpiredShareKeyList();
|
||||
for (EShareKey eShareKey:eShareKeys) {
|
||||
EShareKey updateKey = new EShareKey();
|
||||
|
@ -141,7 +141,7 @@ public class RlTask {
|
|||
updateKey.setStatus(ServiceConstants.KEY_STATUS_EXPIRED);
|
||||
int i = shareKeyService.updateEShareKey(updateKey);
|
||||
}
|
||||
log.info("-------------------【定时任务】分享key过期状态处理---结束----------------");
|
||||
// log.info("-------------------【定时任务】分享key过期状态处理---结束----------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,9 +61,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where k.share_id = #{shareUserId} and k.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEShareSnListByShareUserId" parameterType="Long" resultType="java.lang.String">
|
||||
<select id="selectEShareSnListByShareUserId" parameterType="Long" resultMap="EShareKeyResult">
|
||||
SELECT
|
||||
k.sn
|
||||
k.sn,
|
||||
k.expiration_time
|
||||
FROM
|
||||
e_share_key k
|
||||
WHERE
|
||||
|
|
Loading…
Reference in New Issue
Block a user