hanfucheng преди 4 месеца
родител
ревизия
bbe482d607

+ 14 - 3
src/main/java/com/sooka/sponest/data/other/breedresources/controller/CenterdataTFarmBreedResourcesController.java

@@ -1,5 +1,7 @@
 package com.sooka.sponest.data.other.breedresources.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.core.constant.DocumentNameConstants;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -8,9 +10,11 @@ import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.sooka.sponest.data.base.domain.ESVo;
 import com.sooka.sponest.data.other.breedresources.domain.CenterdataTFarmBreedResources;
 import com.sooka.sponest.data.other.breedresources.service.ICenterdataTFarmBreedResourcesService;
 import com.sooka.sponest.data.utils.DataConstants;
+import com.sooka.sponest.data.utils.DataProducerUtil;
 import com.sooka.sponest.data.utils.ExcelUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -107,7 +111,9 @@ public class CenterdataTFarmBreedResourcesController extends BaseController {
         if (!centerdataTFarmBreedResourcesService.uniqueCheck(tableName, keys, values)) {
             return AjaxResult.error(DataConstants.ERROR_MSG);
         }
-        return toAjax(centerdataTFarmBreedResourcesService.insertCenterdataTFarmBreedResources(centerdataTFarmBreedResources));
+        int inserted = centerdataTFarmBreedResourcesService.insertCenterdataTFarmBreedResources(centerdataTFarmBreedResources);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_BREED_RESOURCES,BusinessType.INSERT, JSON.toJSONString(centerdataTFarmBreedResources)));
+        return toAjax(inserted);
     }
 
     /**
@@ -124,7 +130,9 @@ public class CenterdataTFarmBreedResourcesController extends BaseController {
         if (!centerdataTFarmBreedResourcesService.uniqueCheck(tableName, keys, values)) {
             return AjaxResult.error(DataConstants.ERROR_MSG);
         }
-        return toAjax(centerdataTFarmBreedResourcesService.updateCenterdataTFarmBreedResources(centerdataTFarmBreedResources));
+        int inserted = centerdataTFarmBreedResourcesService.updateCenterdataTFarmBreedResources(centerdataTFarmBreedResources);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_BREED_RESOURCES,BusinessType.UPDATE, JSON.toJSONString(centerdataTFarmBreedResources)));
+        return toAjax(inserted);
     }
 
     /**
@@ -135,7 +143,10 @@ public class CenterdataTFarmBreedResourcesController extends BaseController {
     @Log(title = "养殖资源信息", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable String[] ids) {
-        return toAjax(centerdataTFarmBreedResourcesService.deleteCenterdataTFarmBreedResourcesByIds(ids));
+        int inserted = centerdataTFarmBreedResourcesService.deleteCenterdataTFarmBreedResourcesByIds(ids);
+        List<String> idList = Arrays.asList(ids);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_BREED_RESOURCES,BusinessType.DELETE, JSON.toJSONString(idList)));
+        return toAjax(inserted);
     }
 
     //远程调用

+ 15 - 3
src/main/java/com/sooka/sponest/data/other/livestockprotectinfo/controller/CenterdataTFarmLivestockProtectInfoController.java

@@ -1,5 +1,7 @@
 package com.sooka.sponest.data.other.livestockprotectinfo.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.core.constant.DocumentNameConstants;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -7,8 +9,10 @@ import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.sooka.sponest.data.base.domain.ESVo;
 import com.sooka.sponest.data.other.livestockprotectinfo.domain.CenterdataTFarmLivestockProtectInfo;
 import com.sooka.sponest.data.other.livestockprotectinfo.service.ICenterdataTFarmLivestockProtectInfoService;
+import com.sooka.sponest.data.utils.DataProducerUtil;
 import com.sooka.sponest.data.utils.ExcelUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -100,7 +105,9 @@ public class CenterdataTFarmLivestockProtectInfoController extends BaseControlle
     @Log(title = "畜保站信息", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody CenterdataTFarmLivestockProtectInfo centerdataTFarmLivestockProtectInfo) {
-        return toAjax(centerdataTFarmLivestockProtectInfoService.insertCenterdataTFarmLivestockProtectInfo(centerdataTFarmLivestockProtectInfo));
+        int inserted = centerdataTFarmLivestockProtectInfoService.insertCenterdataTFarmLivestockProtectInfo(centerdataTFarmLivestockProtectInfo);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_LIVESTOCK_PROTECT_INFO,BusinessType.INSERT, JSON.toJSONString(centerdataTFarmLivestockProtectInfo)));
+        return toAjax(inserted);
     }
 
     /**
@@ -112,7 +119,9 @@ public class CenterdataTFarmLivestockProtectInfoController extends BaseControlle
     @Log(title = "畜保站信息", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody CenterdataTFarmLivestockProtectInfo centerdataTFarmLivestockProtectInfo) {
-        return toAjax(centerdataTFarmLivestockProtectInfoService.updateCenterdataTFarmLivestockProtectInfo(centerdataTFarmLivestockProtectInfo));
+        int inserted = centerdataTFarmLivestockProtectInfoService.updateCenterdataTFarmLivestockProtectInfo(centerdataTFarmLivestockProtectInfo);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_LIVESTOCK_PROTECT_INFO,BusinessType.UPDATE, JSON.toJSONString(centerdataTFarmLivestockProtectInfo)));
+        return toAjax(inserted);
     }
 
     /**
@@ -124,7 +133,10 @@ public class CenterdataTFarmLivestockProtectInfoController extends BaseControlle
     @Log(title = "畜保站信息", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable String[] ids) {
-        return toAjax(centerdataTFarmLivestockProtectInfoService.deleteCenterdataTFarmLivestockProtectInfoByIds(ids));
+        int inserted = centerdataTFarmLivestockProtectInfoService.deleteCenterdataTFarmLivestockProtectInfoByIds(ids);
+        List<String> idList = Arrays.asList(ids);
+        DataProducerUtil.getInstance().publish(new ESVo(DocumentNameConstants.FARM_LIVESTOCK_PROTECT_INFO,BusinessType.DELETE, JSON.toJSONString(idList)));
+        return toAjax(inserted);
     }
 
     //远端调用