问题修复
parent
d314a20ea9
commit
1d904a0760
|
|
@ -116,7 +116,7 @@ public class CombineAuthenticationFilter extends GenericFilterBean {
|
|||
context.setAuthentication(authentication);
|
||||
SecurityContextHolder.setContext(context);
|
||||
|
||||
securityContextRepository.saveContext(context, request, response);
|
||||
// securityContextRepository.saveContext(context, request, response);
|
||||
|
||||
loginPostHandler.recordLoginHistory(authentication);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ public class BizCompanyController {
|
|||
|
||||
/**
|
||||
* 站点列表
|
||||
*
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
*/
|
||||
|
|
@ -103,4 +104,25 @@ public class BizCompanyController {
|
|||
public R<List<StationResult>> station(Double lng, Double 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-->是
|
||||
*/
|
||||
private Boolean station;
|
||||
/**
|
||||
* 企业是否开启; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean open;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ public class ModifyBizCompanyParam {
|
|||
* 站点名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 企业是否开启; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean open;
|
||||
/**
|
||||
* 统一社会信用代码; biz_company.uscc
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public class SearchCompanyResult {
|
|||
* 是否为站点; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean station;
|
||||
/**
|
||||
* 企业是否开启; 0-->否、1-->是
|
||||
*/
|
||||
private Boolean open;
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ public class StationResult {
|
|||
* 是否为站点; 0-->否、1-->是
|
||||
*/
|
||||
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) {
|
||||
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 username;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.njzscloud.common.core.ex.Exceptions;
|
|||
import com.njzscloud.common.core.utils.GroupUtil;
|
||||
import com.njzscloud.common.mp.support.PageParam;
|
||||
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.customer.mapper.CustomerMapper;
|
||||
import com.njzscloud.supervisory.customer.pojo.param.SearchCustomerParam;
|
||||
|
|
@ -56,24 +57,28 @@ public class CustomerService {
|
|||
ew.eq("a.biz_obj", bizObj);
|
||||
} else if (bizObj == BizObj.ChanFeiDanWei) {
|
||||
ew.in("a.biz_obj", Stream.of(
|
||||
BizObj.WuYe,
|
||||
BizObj.ShiGongDanWei,
|
||||
BizObj.ChaiQian,
|
||||
BizObj.SheQu).map(BizObj::getVal).collect(Collectors.toList()));
|
||||
BizObj.WuYe,
|
||||
BizObj.ShiGongDanWei,
|
||||
BizObj.ChaiQian,
|
||||
BizObj.SheQu).map(BizObj::getVal).collect(Collectors.toList()))
|
||||
.eq("c.audit_status", AuditStatus.TongGuo);
|
||||
;
|
||||
} else if (bizObj == BizObj.QingYunGongSi) {
|
||||
ew.in("a.biz_obj", Stream.of(
|
||||
BizObj.QiYe,
|
||||
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()));
|
||||
BizObj.QiYe,
|
||||
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()))
|
||||
.eq("c.audit_status", AuditStatus.TongGuo);
|
||||
}
|
||||
} else {
|
||||
ew.in("a.biz_obj", Stream.of(
|
||||
BizObj.GeRen,
|
||||
BizObj.WuYe,
|
||||
BizObj.ShiGongDanWei,
|
||||
BizObj.ChaiQian,
|
||||
BizObj.SheQu,
|
||||
BizObj.QiYe,
|
||||
BizObj.GeTi).map(BizObj::getVal).collect(Collectors.toList()));
|
||||
BizObj.GeRen,
|
||||
BizObj.WuYe,
|
||||
BizObj.ShiGongDanWei,
|
||||
BizObj.ChaiQian,
|
||||
BizObj.SheQu,
|
||||
BizObj.QiYe,
|
||||
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);
|
||||
List<SearchCustomerResult> records = paging.getRecords();
|
||||
|
|
|
|||
|
|
@ -13,56 +13,104 @@ import com.njzscloud.supervisory.sys.auth.pojo.entity.SysTokenEntity;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
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 ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
ReentrantReadWriteLock.ReadLock readLock = lock.readLock();
|
||||
ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
|
||||
|
||||
@Override
|
||||
public synchronized void saveToken(UserDetail userDetail) {
|
||||
Token token = userDetail.getToken();
|
||||
long userId = token.getUserId();
|
||||
String tid = token.getTid();
|
||||
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||
Long l = sysTokenMapper.selectCount(Wrappers.<SysTokenEntity>lambdaQuery().eq(SysTokenEntity::getUserId, token.getUserId()));
|
||||
if (l > 0) return;
|
||||
sysTokenMapper.insert(new SysTokenEntity()
|
||||
.setUserId(userId)
|
||||
.setTid(tid)
|
||||
.setTkey(key)
|
||||
.setTval(token.toString())
|
||||
.setUserDetail(userDetail.toString())
|
||||
);
|
||||
public void saveToken(UserDetail userDetail) {
|
||||
try {
|
||||
writeLock.lock();
|
||||
Token token = userDetail.getToken();
|
||||
long userId = token.getUserId();
|
||||
String tid = token.getTid();
|
||||
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||
Long l = sysTokenMapper.selectCount(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
.eq(SysTokenEntity::getTid, tid));
|
||||
if (l > 0) return;
|
||||
sysTokenMapper.insert(new SysTokenEntity()
|
||||
.setUserId(userId)
|
||||
.setTid(tid)
|
||||
.setTkey(key)
|
||||
.setTval(token.toString())
|
||||
.setUserDetail(userDetail.toString())
|
||||
);
|
||||
TOKEN_CACHE.put(key, userDetail);
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetail loadUser(String tokenStr) {
|
||||
Token token = Token.create(tokenStr);
|
||||
long userId = token.getUserId();
|
||||
return Fastjson.toBean(sysTokenMapper
|
||||
.selectOne(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId))
|
||||
.getUserDetail(),
|
||||
UserDetail.class);
|
||||
try {
|
||||
readLock.lock();
|
||||
Token token = Token.create(tokenStr);
|
||||
String tid = token.getTid();
|
||||
long userId = token.getUserId();
|
||||
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||
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
|
||||
public void removeToken(Token token) {
|
||||
long userId = token.getUserId();
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
try {
|
||||
writeLock.lock();
|
||||
long userId = token.getUserId();
|
||||
String tid = token.getTid();
|
||||
String key = Constants.TOKEN_CACHE_KEY.fill(userId, tid);
|
||||
TOKEN_CACHE.remove(key);
|
||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
.eq(SysTokenEntity::getTid, tid)
|
||||
);
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeToken(Long userId) {
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
sysTokenMapper.delete(Wrappers.<SysTokenEntity>lambdaQuery()
|
||||
.eq(SysTokenEntity::getUserId, userId)
|
||||
);
|
||||
// TOKEN_CACHE.remove(userId);
|
||||
try {
|
||||
writeLock.lock();
|
||||
ArrayList<String> keys = new ArrayList<>();
|
||||
for (UserDetail userDetail : TOKEN_CACHE) {
|
||||
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:
|
||||
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
|
||||
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
|
||||
# password: admin888999
|
||||
password: admin888999
|
||||
security:
|
||||
auth-ignores:
|
||||
- /auth/obtain_code
|
||||
|
|
@ -42,16 +42,16 @@ oss:
|
|||
|
||||
mybatis-plus:
|
||||
tunnel:
|
||||
enable: false
|
||||
# ssh:
|
||||
# host: 139.224.54.144
|
||||
# port: 22
|
||||
# user: root
|
||||
# credentials: D:/我的/再昇云/服务器秘钥/139.224.54.144_YZS_S1.pem
|
||||
# localPort: 33061
|
||||
# db:
|
||||
# host: localhost
|
||||
# port: 33061
|
||||
enable: true
|
||||
ssh:
|
||||
host: 139.224.54.144
|
||||
port: 22
|
||||
user: root
|
||||
credentials: D:/我的/再昇云/服务器秘钥/139.224.54.144_YZS_S1.pem
|
||||
localPort: 33061
|
||||
db:
|
||||
host: localhost
|
||||
port: 33061
|
||||
|
||||
wechat:
|
||||
app-id: wx3c06d9dd4e56c58d
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
create_time,
|
||||
modify_time,
|
||||
deleted,
|
||||
open,
|
||||
<if test="lng != null and lat != null">
|
||||
(6371 *
|
||||
ACOS(COS(RADIANS(lat)) * COS(RADIANS(#{lat})) *
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
a.email,
|
||||
a.biz_obj,
|
||||
b.regdate,
|
||||
b.username,
|
||||
c.id company_id,
|
||||
c.uscc,
|
||||
c.company_name,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
a.station_id,
|
||||
b.company_name station_name
|
||||
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
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
|
|
@ -114,5 +114,6 @@
|
|||
INNER JOIN sys_user c ON c.id = 1 AND c.deleted = 0
|
||||
WHERE b.station = 1
|
||||
AND b.deleted = 0
|
||||
AND b.open = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue