问题修复

localizer
lzq 2025-09-23 17:11:44 +08:00
parent d314a20ea9
commit 1d904a0760
14 changed files with 173 additions and 65 deletions

View File

@ -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);

View File

@ -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));
}
}

View File

@ -34,6 +34,10 @@ public class BizCompanyEntity {
* ; 0-->1-->
*/
private Boolean station;
/**
* ; 0-->1-->
*/
private Boolean open;
/**
*

View File

@ -27,7 +27,10 @@ public class ModifyBizCompanyParam {
*
*/
private String stationName;
/**
* ; 0-->1-->
*/
private Boolean open;
/**
* ; biz_company.uscc
*/

View File

@ -29,6 +29,10 @@ public class SearchCompanyResult {
* ; 0-->1-->
*/
private Boolean station;
/**
* ; 0-->1-->
*/
private Boolean open;
/**
*
*/

View File

@ -24,7 +24,10 @@ public class StationResult {
* ; 0-->1-->
*/
private Boolean station;
/**
* ; 0-->1-->
*/
private Boolean open;
/**
*
*/

View File

@ -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();
}
}

View File

@ -22,6 +22,10 @@ public class SearchCustomerResult {
*
*/
private String customerName;
/**
*
*/
private String username;
/**
*
*/

View File

@ -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();

View File

@ -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();
}
}
}

View File

@ -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

View File

@ -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})) *

View File

@ -23,6 +23,7 @@
a.email,
a.biz_obj,
b.regdate,
b.username,
c.id company_id,
c.uscc,
c.company_name,

View File

@ -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>