ly 10 месяцев назад
Родитель
Сommit
ebd639e4f0

+ 5 - 2
src/main/java/cn/ezhizao/project/business/company/controller/BizCompanyController.java

@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import cn.ezhizao.common.utils.StringUtils;
 import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.aspectj.lang.annotation.distributedLock;
 import cn.ezhizao.project.business.channel.domain.BizChannel;
 import cn.ezhizao.project.business.channel.service.IBizChannelService;
 import cn.ezhizao.project.business.company.domain.BizCompanyImport;
@@ -98,8 +99,8 @@ public class BizCompanyController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:company:export')")
     @Log(title = "company", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
-    {
+    @distributedLock(prefix = "crmComExport",key = "@tenantId")
+    public void export(HttpServletResponse response, BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException, InterruptedException {
         setTenantId(bizCompany);
         List<BizCompany> list = bizCompanyService.getList(bizCompany);
         ExcelUtil<BizCompany> util = new ExcelUtil<BizCompany>(BizCompany.class);
@@ -113,6 +114,7 @@ public class BizCompanyController extends BaseController
     @Log(title = "客户管理", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('business:company:add')")
     @PostMapping("/importData")
+    @distributedLock(prefix = "crmComImport",key = "@tenantId")
     public AjaxResult importData(MultipartFile file) throws Exception
     {
         ExcelUtil<BizCompany> util = new ExcelUtil<>(BizCompany.class);
@@ -210,6 +212,7 @@ public class BizCompanyController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:company:edit')")
     @Log(title = "company", businessType = BusinessType.UPDATE)
+    @distributedLock(prefix = "crmComImport",key = "#bizCompany.id")
     @PutMapping
     public AjaxResult edit(@RequestBody BizCompany bizCompany) throws NoSuchFieldException, IllegalAccessException
     {

+ 5 - 0
src/main/java/cn/ezhizao/project/business/order/controller/BizArchiveInputController.java

@@ -5,6 +5,7 @@ import cn.ezhizao.common.utils.SecurityUtils;
 import cn.ezhizao.common.utils.poi.ExcelUtil;
 import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
 import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.annotation.distributedLock;
 import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
 import cn.ezhizao.framework.web.controller.BaseController;
 import cn.ezhizao.framework.web.domain.AjaxResult;
@@ -193,6 +194,7 @@ public class BizArchiveInputController extends BaseController {
     @Log(title = "档案入库", businessType = BusinessType.UPDATE)
     @PutMapping
     @Transactional(rollbackFor = Exception.class)
+    @distributedLock(prefix = "crmInputAdd",key = "@tenantId")
     public AjaxResult edit(@RequestBody BizArchiveInput bizArchiveInput) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizArchiveInput);
         return toAjax(bizArchiveInputService.updateById(bizArchiveInput));
@@ -227,6 +229,7 @@ public class BizArchiveInputController extends BaseController {
     @PostMapping("/verify")
     @Log(title = "档案审核", businessType = BusinessType.UPDATE)
     @Transactional(rollbackFor = Exception.class)
+    @distributedLock(prefix = "crmInputVerify",key = "#bizArchiveInput.id")
     public AjaxResult verify(@RequestBody BizArchiveInput bizArchiveInput) {
         boolean flag = bizArchiveInputService.verify(bizArchiveInput);
         bizArchiveInputService.saveDetailMonth(bizArchiveInput);
@@ -237,6 +240,7 @@ public class BizArchiveInputController extends BaseController {
     @PostMapping("/alter")
     @Log(title = "合同变更", businessType = BusinessType.UPDATE)
     @Transactional(rollbackFor = Exception.class)
+    @distributedLock(prefix = "crmInputAlter",key = "#bizArchiveInput.id")
     public AjaxResult alter(@RequestBody BizArchiveInput bizArchiveInput) {
         Long userId = SecurityUtils.getUserId();
         //防止前端没传明细id
@@ -485,6 +489,7 @@ public class BizArchiveInputController extends BaseController {
     @PreAuthorize("@ss.hasPermi('business:archive:order:import')")
     @PostMapping("/importLoop")
     @Transactional
+    @distributedLock(prefix = "crmImportLoop",key = "@tenantId")
     public AjaxResult importLoop(MultipartFile file) throws Exception {
         ExcelUtil<OrderExcelImportLoopModel> util = new ExcelUtil<>(OrderExcelImportLoopModel.class);
         List<OrderExcelImportLoopModel> orderList = util.importExcel(file.getInputStream());