Commit 0dff6e7b authored by fangxinjiang's avatar fangxinjiang

实缴查询优化-fxj

parent 72e97794
...@@ -59,7 +59,7 @@ spec: # 资源规范字段 ...@@ -59,7 +59,7 @@ spec: # 资源规范字段
value: Asia/Shanghai value: Asia/Shanghai
resources: #资源配置限制 resources: #资源配置限制
limits: # 最大使用 limits: # 最大使用
memory: "4096Mi" memory: "8096Mi"
#cpu: 300m # CPU,1核心 = 1000m #cpu: 300m # CPU,1核心 = 1000m
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行 requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m #cpu: 100m
......
...@@ -150,6 +150,10 @@ public interface CacheConstants { ...@@ -150,6 +150,10 @@ public interface CacheConstants {
String PAYMENT_DISPATCH_BATCH_ADD_IMPORT = "payment_dispatch_batch_add_import"; String PAYMENT_DISPATCH_BATCH_ADD_IMPORT = "payment_dispatch_batch_add_import";
String PAYMENT_SEARCH_REPEAT = "payment_search_repeat";
String PAYMENT_EXPORT_REPEAT = "payment_export_repeat";
String PAYMENT_DISPATCH_BATCH_REDUCE_IMPORT = "payment_dispatch_batch_reduce_import"; String PAYMENT_DISPATCH_BATCH_REDUCE_IMPORT = "payment_dispatch_batch_reduce_import";
String PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT = "payment_pre_dispatch_batch_add_import"; String PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT = "payment_pre_dispatch_batch_add_import";
......
...@@ -83,7 +83,26 @@ public class TPaymentInfoController { ...@@ -83,7 +83,26 @@ public class TPaymentInfoController {
@Operation(description = "简单分页查询") @Operation(description = "简单分页查询")
@GetMapping("/page") @GetMapping("/page")
public R<IPage<TPaymentInfo>> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) { public R<IPage<TPaymentInfo>> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
return new R<>(tPaymentInfoService.getTPaymentInfoPage(page, tPaymentInfo)); // 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_SEARCH_REPEAT + CommonConstants.DOWN_LINE_STRING;
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
try {
if (Common.isNotNull(requestId)) {
//查询数据
return new R<>(tPaymentInfoService.getTPaymentInfoPage(page, tPaymentInfo));
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -96,17 +115,36 @@ public class TPaymentInfoController { ...@@ -96,17 +115,36 @@ public class TPaymentInfoController {
@Operation(description = "简单分页查询") @Operation(description = "简单分页查询")
@GetMapping("/newPage") @GetMapping("/newPage")
public R<IPage<TPaymentInfoNewVo>> getTPaymentInfoNewPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) { public R<IPage<TPaymentInfoNewVo>> getTPaymentInfoNewPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
YifuUser user = SecurityUtils.getUser(); // 获取redis分布式事务锁
menuUtil.setAuthSql(user, tPaymentInfo); String key = CacheConstants.PAYMENT_SEARCH_REPEAT + CommonConstants.DOWN_LINE_STRING;
if (Common.isNotNull(tPaymentInfo.getAuthSql())) { String requestId;
if (tPaymentInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) { try {
tPaymentInfo.setAuthSql(tPaymentInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN_ID")); requestId = RedisDistributedLock.getLock(key,"10");
} } catch (Exception e) {
if (tPaymentInfo.getAuthSql().contains("1=2 EXISTS")) { throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
tPaymentInfo.setAuthSql(tPaymentInfo.getAuthSql().replace("1=2 EXISTS", "EXISTS")); }
try {
if (Common.isNotNull(requestId)) {
//查询数据
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, tPaymentInfo);
if (Common.isNotNull(tPaymentInfo.getAuthSql())) {
if (tPaymentInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
tPaymentInfo.setAuthSql(tPaymentInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN_ID"));
}
if (tPaymentInfo.getAuthSql().contains("1=2 EXISTS")) {
tPaymentInfo.setAuthSql(tPaymentInfo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
return new R<>(tPaymentInfoService.getTPaymentInfoNewPage(page, tPaymentInfo));
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
} }
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
} }
return new R<>(tPaymentInfoService.getTPaymentInfoNewPage(page, tPaymentInfo));
} }
/** /**
...@@ -329,7 +367,26 @@ public class TPaymentInfoController { ...@@ -329,7 +367,26 @@ public class TPaymentInfoController {
@Operation(description = "导出缴费库检测 ") @Operation(description = "导出缴费库检测 ")
@PostMapping("/exportCheck") @PostMapping("/exportCheck")
public R<Integer> exportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) { public R<Integer> exportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
return tPaymentInfoService.listExportCheck(response, searchVo); // 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_EXPORT_REPEAT + CommonConstants.DOWN_LINE_STRING;
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
try {
if (Common.isNotNull(requestId)) {
//查询数据
return tPaymentInfoService.listExportCheck(response, searchVo);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -357,7 +414,26 @@ public class TPaymentInfoController { ...@@ -357,7 +414,26 @@ public class TPaymentInfoController {
@Operation(description = "合并导出缴费库检测") @Operation(description = "合并导出缴费库检测")
@PostMapping("/sumExportCheck") @PostMapping("/sumExportCheck")
public R<Integer> sumExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) { public R<Integer> sumExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
return tPaymentInfoService.listSumExportCheck(response, searchVo); // 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_EXPORT_REPEAT + CommonConstants.DOWN_LINE_STRING;
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
try {
if (Common.isNotNull(requestId)) {
//查询数据
return tPaymentInfoService.listSumExportCheck(response, searchVo);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -395,17 +471,36 @@ public class TPaymentInfoController { ...@@ -395,17 +471,36 @@ public class TPaymentInfoController {
@PostMapping("/sumSearchExportCheck") @PostMapping("/sumSearchExportCheck")
@SysLog("实缴查询列表合并导出检测") @SysLog("实缴查询列表合并导出检测")
public R<Integer> sumSearchExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) { public R<Integer> sumSearchExportCheck(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser(); // 获取redis分布式事务锁
menuUtil.setAuthSql(user, searchVo); String key = CacheConstants.PAYMENT_EXPORT_REPEAT + CommonConstants.DOWN_LINE_STRING;
if (Common.isNotNull(searchVo.getAuthSql())) { String requestId;
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) { try {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN_ID")); requestId = RedisDistributedLock.getLock(key,"10");
} } catch (Exception e) {
if (searchVo.getAuthSql().contains("1=2 EXISTS")) { throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS")); }
try {
if (Common.isNotNull(requestId)) {
//查询数据
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql())) {
if (searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN_ID"));
}
if (searchVo.getAuthSql().contains("1=2 EXISTS")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("1=2 EXISTS", "EXISTS"));
}
}
return tPaymentInfoService.sumSearchExportCheck(response, searchVo);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
} }
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
} }
return tPaymentInfoService.sumSearchExportCheck(response, searchVo);
} }
/** /**
......
...@@ -26,7 +26,7 @@ mybatis-plus: ...@@ -26,7 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0 logic-not-delete-value: 0
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置 # spring security 配置
security: security:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment