问题修复

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,10 @@ public class StationResult {
* ; 0-->1--> * ; 0-->1-->
*/ */
private Boolean station; 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) { 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();
}
} }

View File

@ -22,6 +22,10 @@ public class SearchCustomerResult {
* *
*/ */
private String customerName; 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.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();

View File

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

View File

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

View File

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

View File

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

View File

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