Commit 1e5753fb authored by fangxinjiang's avatar fangxinjiang

实缴查询优化-fxj

parent 4b880b73
...@@ -87,6 +87,11 @@ public class TPaymentInfoController { ...@@ -87,6 +87,11 @@ public class TPaymentInfoController {
if (Common.isEmpty(user)){ if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL); return R.failed(CommonConstants.USER_FAIL);
} }
//特殊条件如社保户、缴纳地的查询做限制处理,限制到所用用户,因为此部分数据量较大
R<IPage<TPaymentInfo>> res = tPaymentInfoService.specialHandle(page,tPaymentInfo);
if (null != res){
return res;
}
// 获取redis分布式事务锁 // 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_SEARCH_REPEAT + CommonConstants.DOWN_LINE_STRING + user.getId(); String key = CacheConstants.PAYMENT_SEARCH_REPEAT + CommonConstants.DOWN_LINE_STRING + user.getId();
String requestId; String requestId;
...@@ -119,6 +124,12 @@ public class TPaymentInfoController { ...@@ -119,6 +124,12 @@ 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) {
//特殊条件如社保户、缴纳地的查询做限制处理,限制到所用用户,因为此部分数据量较大
R<IPage<TPaymentInfoNewVo>> res = tPaymentInfoService.specialHandleNew(page,tPaymentInfo);
if (null != res){
return res;
}
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){ if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL); return R.failed(CommonConstants.USER_FAIL);
...@@ -153,7 +164,6 @@ public class TPaymentInfoController { ...@@ -153,7 +164,6 @@ public class TPaymentInfoController {
} }
} }
/** /**
* 实缴查询详情 * 实缴查询详情
* *
......
...@@ -264,4 +264,8 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> { ...@@ -264,4 +264,8 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
R<Integer> listSumExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo); R<Integer> listSumExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
R<Integer> sumSearchExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo); R<Integer> sumSearchExportCheck(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
R<IPage<TPaymentInfo>> specialHandle(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo);
R<IPage<TPaymentInfoNewVo>> specialHandleNew(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo);
} }
...@@ -5204,4 +5204,94 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -5204,4 +5204,94 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
return R.ok(baseMapper.selectCountPaymentSearchInfo(searchVo)); return R.ok(baseMapper.selectCountPaymentSearchInfo(searchVo));
} }
private boolean socialFlag(TPaymentInfoSearchVo tPaymentInfo){
return ("安徽皖信人力资源管理有限公司".equals(tPaymentInfo.getSocialHousehold())
|| "安徽皖信人力资源管理有限公司肥东分公司".equals(tPaymentInfo.getSocialHousehold())) && Common.isEmpty(tPaymentInfo.getEmpIdcard())
&& Common.isEmpty(tPaymentInfo.getUnitName())
&& Common.isEmpty(tPaymentInfo.getSettleDomainName())
&& Common.isEmpty(tPaymentInfo.getSocialCreateMonth())
&& Common.isEmpty(tPaymentInfo.getSocialPayMonth())
&& Common.isEmpty(tPaymentInfo.getSocialProvince())
&& Common.isEmpty(tPaymentInfo.getSecondIndicatorBelong())
&& Common.isEmpty(tPaymentInfo.getProvidentHousehold());
}
private boolean cityFlag(TPaymentInfoSearchVo tPaymentInfo){
return "135".equals(tPaymentInfo.getSocialCity())
&& Common.isEmpty(tPaymentInfo.getEmpIdcard())
&& Common.isEmpty(tPaymentInfo.getUnitName())
&& Common.isEmpty(tPaymentInfo.getSettleDomainName())
&& Common.isEmpty(tPaymentInfo.getSocialCreateMonth())
&& Common.isEmpty(tPaymentInfo.getSocialPayMonth())
&& Common.isEmpty(tPaymentInfo.getSecondIndicatorBelong())
&& Common.isEmpty(tPaymentInfo.getProvidentHousehold())
&& Common.isEmpty(tPaymentInfo.getSocialHousehold());
}
@Override
public R<IPage<TPaymentInfo>> specialHandle(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
//判断社保户
if (socialFlag(tPaymentInfo)){
return getLock(page, tPaymentInfo);
}
//判断缴纳地
if (cityFlag(tPaymentInfo)){
return getLock(page, tPaymentInfo);
}
return null;
}
@Override
public R<IPage<TPaymentInfoNewVo>> specialHandleNew(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
//判断社保户
if (socialFlag(tPaymentInfo)){
return getLockNew(page, tPaymentInfo);
}
//判断缴纳地
if (cityFlag(tPaymentInfo)){
return getLockNew(page, tPaymentInfo);
}
return null;
}
private R<IPage<TPaymentInfoNewVo>> getLockNew(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
String keyTemp = CacheConstants.PAYMENT_SEARCH_REPEAT;
String requestId;
try {
requestId = RedisDistributedLock.getLock(keyTemp,"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<>(this.getTPaymentInfoNewPage(page, tPaymentInfo));
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(keyTemp, requestId);
}
}
private R<IPage<TPaymentInfo>> getLock(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
String keyTemp = CacheConstants.PAYMENT_SEARCH_REPEAT;
String requestId;
try {
requestId = RedisDistributedLock.getLock(keyTemp,"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<>(this.getTPaymentInfoPage(page, tPaymentInfo));
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(keyTemp, requestId);
}
}
} }
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