Commit 3e602888 authored by fangxinjiang's avatar fangxinjiang

登记保单保费及登记保单发票好功能限制

parent 1663dc0e
......@@ -154,6 +154,8 @@ public interface CacheConstants {
String PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT = "payment_pre_dispatch_batch_add_import";
String INSURANCE_BATCH_UPDATE_IMPORT = "insurance_batch_update_import";
String DISPATCH_BATCH_AUDIT = "dispatch_batch_audit";
String DISPATCH_BATCH_HANDLED = "dispatch_batch_handled";
......
......@@ -2,7 +2,10 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -310,7 +313,30 @@ public class TInsuranceDetailController {
@PostMapping("/registeredPolicyPremium")
@PreAuthorize("@pms.hasPermission('handle_insure_cost')")
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterParam> paramList){
return tInsuranceDetailService.registeredPolicyPremium(paramList);
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.INSURANCE_BATCH_UPDATE_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 tInsuranceDetailService.registeredPolicyPremium(paramList);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......@@ -324,7 +350,30 @@ public class TInsuranceDetailController {
@PostMapping("/registeredInvoiceNo")
@PreAuthorize("@pms.hasPermission('handle_insure_invoice')")
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterInvoiceNoParam> paramList){
return tInsuranceDetailService.registeredInvoiceNo(paramList);
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.INSURANCE_BATCH_UPDATE_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 tInsuranceDetailService.registeredInvoiceNo(paramList);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, 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