问题修复
parent
d314a20ea9
commit
1d904a0760
|
|
@ -116,7 +116,7 @@ public class CombineAuthenticationFilter extends GenericFilterBean {
|
||||||
context.setAuthentication(authentication);
|
context.setAuthentication(authentication);
|
||||||
SecurityContextHolder.setContext(context);
|
SecurityContextHolder.setContext(context);
|
||||||
|
|
||||||
securityContextRepository.saveContext(context, request, response);
|
// securityContextRepository.saveContext(context, request, response);
|
||||||
|
|
||||||
loginPostHandler.recordLoginHistory(authentication);
|
loginPostHandler.recordLoginHistory(authentication);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class BizCompanyController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站点列表
|
* 站点列表
|
||||||
|
*
|
||||||
* @param lng 经度
|
* @param lng 经度
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
*/
|
*/
|
||||||
|
|
@ -103,4 +104,25 @@ public class BizCompanyController {
|
||||||
public R<List<StationResult>> station(Double lng, Double lat) {
|
public R<List<StationResult>> station(Double lng, Double lat) {
|
||||||
return R.success(bizCompanyService.station(lng, lat));
|
return R.success(bizCompanyService.station(lng, lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁启用
|
||||||
|
*
|
||||||
|
* @param id Id
|
||||||
|
*/
|
||||||
|
@GetMapping("/open")
|
||||||
|
public R<?> open(@RequestParam("id") Long id, @RequestParam("open") Boolean open) {
|
||||||
|
bizCompanyService.open(id, open);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*
|
||||||
|
* @param id Id
|
||||||
|
*/
|
||||||
|
@GetMapping("/is_open")
|
||||||
|
public R<Boolean> isOpen(@RequestParam("id") Long id) {
|
||||||
|
return R.success(bizCompanyService.isOpen(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ public class BizCompanyEntity {
|
||||||
* 是否为站点; 0-->否、1-->是
|
* 是否为站点; 0-->否、1-->是
|
||||||
*/
|
*/
|
||||||
private Boolean station;
|
private Boolean station;
|
||||||
|
/**
|
||||||
|
* 企业是否开启; 0-->否、1-->是
|
||||||
|
*/
|
||||||
|
private Boolean open;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站点名称
|
* 站点名称
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ public class ModifyBizCompanyParam {
|
||||||
* 站点名称
|
* 站点名称
|
||||||
*/
|
*/
|
||||||
private String stationName;
|
private String stationName;
|
||||||
|
/**
|
||||||
|
* 企业是否开启; 0-->否、1-->是
|
||||||
|
*/
|
||||||
|
private Boolean open;
|
||||||
/**
|
/**
|
||||||
* 统一社会信用代码; biz_company.uscc
|
* 统一社会信用代码; biz_company.uscc
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ public class SearchCompanyResult {
|
||||||
* 是否为站点; 0-->否、1-->是
|
* 是否为站点; 0-->否、1-->是
|
||||||
*/
|
*/
|
||||||
private Boolean station;
|
private Boolean station;
|
||||||
|
/**
|
||||||
|
* 企业是否开启; 0-->否、1-->是
|
||||||
|
*/
|
||||||
|
private Boolean open;
|
||||||
/**
|
/**
|
||||||
* 站点名称
|
* 站点名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ public class StationResult {
|
||||||
* 是否为站点; 0-->否、1-->是
|
* 是否为站点; 0-->否、1-->是
|
||||||
*/
|
*/
|
||||||
private Boolean station;
|
private Boolean station;
|
||||||
|
/**
|
||||||
|
* 企业是否开启; 0-->否、1-->是
|
||||||
|
*/
|
||||||
|
private Boolean open;
|
||||||
/**
|
/**
|
||||||
* 统一社会信用代码
|
* 统一社会信用代码
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -227,4 +227,16 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
||||||
public List<StationResult> station(Double lng, Double lat) {
|
public List<StationResult> station(Double lng, Double lat) {
|
||||||
return baseMapper.station(lng, lat);
|
return baseMapper.station(lng, lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void open(Long id, Boolean open) {
|
||||||
|
update(Wrappers.<BizCompanyEntity>lambdaUpdate()
|
||||||
|
.set(BizCompanyEntity::getOpen, open)
|
||||||
|
.eq(BizCompanyEntity::getId, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isOpen(Long id) {
|
||||||
|
BizCompanyEntity company = getById(id);
|
||||||
|
Assert.notNull(company, () -> Exceptions.clierr("数据不存在"));
|
||||||
|
return company.getOpen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ public class SearchCustomerResult {
|
||||||
* 客户名称
|
* 客户名称
|
||||||
*/
|
*/
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.njzscloud.common.core.ex.Exceptions;
|
||||||
import com.njzscloud.common.core.utils.GroupUtil;
|
import com.njzscloud.common.core.utils.GroupUtil;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
||||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||||
import com.njzscloud.supervisory.customer.mapper.CustomerMapper;
|
import com.njzscloud.supervisory.customer.mapper.CustomerMapper;
|
||||||
import com.njzscloud.supervisory.customer.pojo.param.SearchCustomerParam;
|
import com.njzscloud.supervisory.customer.pojo.param.SearchCustomerParam;
|
||||||
|
|
@ -56,24 +57,28 @@ public class CustomerService {
|
||||||
ew.eq("a.biz_obj", bizObj);
|
ew.eq("a.biz_obj", bizObj);
|
||||||
} else if (bizObj == BizObj.ChanFeiDanWei) {
|
} else if (bizObj == BizObj.ChanFeiDanWei) {
|
||||||
ew.in("a.biz_obj", Stream.of(
|
ew.in("a.biz_obj", Stream.of(
|
||||||
BizObj.WuYe,
|
BizObj.WuYe,
|
||||||
BizObj.ShiGongDanWei,
|
BizObj.ShiGongDanWei,
|
||||||
BizObj.ChaiQian,
|
BizObj.ChaiQian,
|
||||||
BizObj.SheQu).map(BizObj::getVal).collect(Collectors.toList()));
|
BizObj.SheQu).map(BizObj::getVal).collect(Collectors.toList()))
|
||||||
|
.eq("c.audit_status", AuditStatus.TongGuo);
|
||||||
|
;
|
||||||
} else if (bizObj == BizObj.QingYunGongSi) {
|
} else if (bizObj == BizObj.QingYunGongSi) {
|
||||||
ew.in("a.biz_obj", Stream.of(
|
ew.in("a.biz_obj", Stream.of(
|
||||||
BizObj.QiYe,
|
BizObj.QiYe,
|
||||||
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()));
|
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()))
|
||||||
|
.eq("c.audit_status", AuditStatus.TongGuo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ew.in("a.biz_obj", Stream.of(
|
ew.in("a.biz_obj", Stream.of(
|
||||||
BizObj.GeRen,
|
BizObj.GeRen,
|
||||||
BizObj.WuYe,
|
BizObj.WuYe,
|
||||||
BizObj.ShiGongDanWei,
|
BizObj.ShiGongDanWei,
|
||||||
BizObj.ChaiQian,
|
BizObj.ChaiQian,
|
||||||
BizObj.SheQu,
|
BizObj.SheQu,
|
||||||
BizObj.QiYe,
|
BizObj.QiYe,
|
||||||
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()));
|
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()))
|
||||||
|
.and(it -> it.eq("c.audit_status", AuditStatus.TongGuo).or().isNull("c.audit_status"));
|
||||||
}
|
}
|
||||||
IPage<SearchCustomerResult> paging = customerMapper.paging(page, ew);
|
IPage<SearchCustomerResult> paging = customerMapper.paging(page, ew);
|
||||||
List<SearchCustomerResult> records = paging.getRecords();
|
List<SearchCustomerResult> records = paging.getRecords();
|
||||||
|
|
|
||||||
|
|
@ -13,56 +13,104 @@ import com.njzscloud.supervisory.sys.auth.pojo.entity.SysTokenEntity;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TokenService implements ITokenService {
|
public class TokenService implements ITokenService {
|
||||||
private static final TimedCache<Long, UserDetail> TOKEN_CACHE = CacheUtil.newTimedCache(1000 * 3600);
|
private static final TimedCache<String, UserDetail> TOKEN_CACHE = CacheUtil.newTimedCache(60 * 1000);
|
||||||
private final SysTokenMapper sysTokenMapper;
|
private final SysTokenMapper sysTokenMapper;
|
||||||
|
|
||||||
|
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
|
ReentrantReadWriteLock.ReadLock readLock = lock.readLock();
|
||||||
|
ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void saveToken(UserDetail userDetail) {
|
public void saveToken(UserDetail userDetail) {
|
||||||
Token token = userDetail.getToken();
|
try {
|
||||||
long userId = token.getUserId();
|
writeLock.lock();
|
||||||
String tid = token.getTid();
|
Token token = userDetail.getToken();
|
||||||
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
long userId = token.getUserId();
|
||||||
Long l = sysTokenMapper.selectCount(Wrappers.<SysTokenEntity>lambdaQuery().eq(SysTokenEntity::getUserId, token.getUserId()));
|
String tid = token.getTid();
|
||||||
if (l > 0) return;
|
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||||
sysTokenMapper.insert(new SysTokenEntity()
|
Long l = sysTokenMapper.selectCount(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||||
.setUserId(userId)
|
.eq(SysTokenEntity::getUserId, userId)
|
||||||
.setTid(tid)
|
.eq(SysTokenEntity::getTid, tid));
|
||||||
.setTkey(key)
|
if (l > 0) return;
|
||||||
.setTval(token.toString())
|
sysTokenMapper.insert(new SysTokenEntity()
|
||||||
.setUserDetail(userDetail.toString())
|
.setUserId(userId)
|
||||||
);
|
.setTid(tid)
|
||||||
|
.setTkey(key)
|
||||||
|
.setTval(token.toString())
|
||||||
|
.setUserDetail(userDetail.toString())
|
||||||
|
);
|
||||||
|
TOKEN_CACHE.put(key, userDetail);
|
||||||
|
} finally {
|
||||||
|
writeLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetail loadUser(String tokenStr) {
|
public UserDetail loadUser(String tokenStr) {
|
||||||
Token token = Token.create(tokenStr);
|
try {
|
||||||
long userId = token.getUserId();
|
readLock.lock();
|
||||||
return Fastjson.toBean(sysTokenMapper
|
Token token = Token.create(tokenStr);
|
||||||
.selectOne(Wrappers.<SysTokenEntity>lambdaQuery()
|
String tid = token.getTid();
|
||||||
.eq(SysTokenEntity::getUserId, userId))
|
long userId = token.getUserId();
|
||||||
.getUserDetail(),
|
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||||
UserDetail.class);
|
UserDetail userDetail = TOKEN_CACHE.get(key);
|
||||||
|
if (userDetail != null) return userDetail;
|
||||||
|
SysTokenEntity sysTokenEntity = sysTokenMapper.selectOne(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||||
|
.eq(SysTokenEntity::getUserId, userId)
|
||||||
|
.eq(SysTokenEntity::getTid, tid));
|
||||||
|
if (sysTokenEntity == null) return null;
|
||||||
|
userDetail = Fastjson.toBean(sysTokenEntity.getUserDetail(),
|
||||||
|
UserDetail.class);
|
||||||
|
TOKEN_CACHE.put(key, userDetail);
|
||||||
|
return userDetail;
|
||||||
|
} finally {
|
||||||
|
readLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeToken(Token token) {
|
public void removeToken(Token token) {
|
||||||
long userId = token.getUserId();
|
try {
|
||||||
// TOKEN_CACHE.remove(userId);
|
writeLock.lock();
|
||||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
long userId = token.getUserId();
|
||||||
.eq(SysTokenEntity::getUserId, userId)
|
String tid = token.getTid();
|
||||||
);
|
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||||
// TOKEN_CACHE.remove(userId);
|
TOKEN_CACHE.remove(key);
|
||||||
|
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||||
|
.eq(SysTokenEntity::getUserId, userId)
|
||||||
|
.eq(SysTokenEntity::getTid, tid)
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
writeLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeToken(Long userId) {
|
public void removeToken(Long userId) {
|
||||||
// TOKEN_CACHE.remove(userId);
|
try {
|
||||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
writeLock.lock();
|
||||||
.eq(SysTokenEntity::getUserId, userId)
|
ArrayList<String> keys = new ArrayList<>();
|
||||||
);
|
for (UserDetail userDetail : TOKEN_CACHE) {
|
||||||
// TOKEN_CACHE.remove(userId);
|
Token token = userDetail.getToken();
|
||||||
|
if (token.getUserId() == userId) {
|
||||||
|
String key = Constants.TOKEN_CACHE_KEY.fill(userId, token.getTid());
|
||||||
|
keys.add(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String key : keys) {
|
||||||
|
TOKEN_CACHE.remove(key);
|
||||||
|
}
|
||||||
|
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||||
|
.eq(SysTokenEntity::getUserId, userId)
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
writeLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://47.115.226.143:3306/njzscloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
# url: jdbc:mysql://47.115.226.143:3306/njzscloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
|
# username: root
|
||||||
|
# password: zsy2022
|
||||||
|
url: jdbc:mysql://localhost:33061/njzscloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: zsy2022
|
password: admin888999
|
||||||
# url: jdbc:mysql://localhost:33061/njzscloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
|
||||||
# username: root
|
|
||||||
# password: admin888999
|
|
||||||
security:
|
security:
|
||||||
auth-ignores:
|
auth-ignores:
|
||||||
- /auth/obtain_code
|
- /auth/obtain_code
|
||||||
|
|
@ -42,16 +42,16 @@ oss:
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
tunnel:
|
tunnel:
|
||||||
enable: false
|
enable: true
|
||||||
# ssh:
|
ssh:
|
||||||
# host: 139.224.54.144
|
host: 139.224.54.144
|
||||||
# port: 22
|
port: 22
|
||||||
# user: root
|
user: root
|
||||||
# credentials: D:/我的/再昇云/服务器秘钥/139.224.54.144_YZS_S1.pem
|
credentials: D:/我的/再昇云/服务器秘钥/139.224.54.144_YZS_S1.pem
|
||||||
# localPort: 33061
|
localPort: 33061
|
||||||
# db:
|
db:
|
||||||
# host: localhost
|
host: localhost
|
||||||
# port: 33061
|
port: 33061
|
||||||
|
|
||||||
wechat:
|
wechat:
|
||||||
app-id: wx3c06d9dd4e56c58d
|
app-id: wx3c06d9dd4e56c58d
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
create_time,
|
create_time,
|
||||||
modify_time,
|
modify_time,
|
||||||
deleted,
|
deleted,
|
||||||
|
open,
|
||||||
<if test="lng != null and lat != null">
|
<if test="lng != null and lat != null">
|
||||||
(6371 *
|
(6371 *
|
||||||
ACOS(COS(RADIANS(lat)) * COS(RADIANS(#{lat})) *
|
ACOS(COS(RADIANS(lat)) * COS(RADIANS(#{lat})) *
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
a.email,
|
a.email,
|
||||||
a.biz_obj,
|
a.biz_obj,
|
||||||
b.regdate,
|
b.regdate,
|
||||||
|
b.username,
|
||||||
c.id company_id,
|
c.id company_id,
|
||||||
c.uscc,
|
c.uscc,
|
||||||
c.company_name,
|
c.company_name,
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
a.station_id,
|
a.station_id,
|
||||||
b.company_name station_name
|
b.company_name station_name
|
||||||
FROM station_manage a
|
FROM station_manage a
|
||||||
INNER JOIN biz_company b ON b.id = a.station_id AND b.station = 1 AND b.deleted = 0
|
INNER JOIN biz_company b ON b.id = a.station_id AND b.station = 1 AND b.deleted = 0 AND b.open = 1
|
||||||
INNER JOIN sys_user c ON c.id = a.user_id AND c.deleted = 0
|
INNER JOIN sys_user c ON c.id = a.user_id AND c.deleted = 0
|
||||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
|
|
@ -114,5 +114,6 @@
|
||||||
INNER JOIN sys_user c ON c.id = 1 AND c.deleted = 0
|
INNER JOIN sys_user c ON c.id = 1 AND c.deleted = 0
|
||||||
WHERE b.station = 1
|
WHERE b.station = 1
|
||||||
AND b.deleted = 0
|
AND b.deleted = 0
|
||||||
|
AND b.open = 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue