Bladeren bron

换刀规则

oyq28 1 jaar geleden
bovenliggende
commit
eefb8d092f

+ 23 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/centralToolMagazine/ToolManagementController.java

@@ -10,6 +10,7 @@ import com.github.zuihou.business.centralToolMagazine.entity.ToolManagement;
 import com.github.zuihou.business.centralToolMagazine.service.ToolManagementService;
 import com.github.zuihou.business.centralToolMagazine.dto.ToolManagementPageDTO;
 import com.github.zuihou.business.centralToolMagazine.dto.ToolManagementSaveDTO;
+import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
@@ -17,6 +18,9 @@ import com.github.zuihou.tenant.entity.Productionresource;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -38,6 +42,8 @@ import java.util.List;
 @Api(value = "ToolManagement", tags = "刀库管理")
 @SysLog(enabled = true)
 public class ToolManagementController extends SuperCacheController<ToolManagementService, Long, ToolManagement, ToolManagementPageDTO, ToolManagementSaveDTO, ToolManagementUpdateDTO> {
+    @Autowired
+    private RedisTemplate redisTemplate;
 
     @Override
     public void query(PageParams<ToolManagementPageDTO> params, IPage<ToolManagement> page, Long defSize) {
@@ -98,4 +104,21 @@ public class ToolManagementController extends SuperCacheController<ToolManagemen
     }
 
 
+    @PostMapping("/setRule")
+    public R setRule(@RequestBody ToolManagement toolManagement) {
+        if(StringUtil.isNotEmpty(toolManagement.getConfig())){
+            redisTemplate.opsForValue().set("CHANGE_TOOL_CONFIG",toolManagement.getConfig());
+        }
+        return success();
+    }
+
+    @PostMapping("/getRule")
+    public R getRule() {
+        Object obj = redisTemplate.opsForValue().get("CHANGE_TOOL_CONFIG");
+        if(obj == null){
+            return fail("");
+        }
+        return success(obj.toString());
+    }
+
 }

+ 3 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/centralToolMagazine/entity/ToolManagement.java

@@ -133,6 +133,9 @@ public class ToolManagement extends Entity<Long> {
     @TableField(exist = false)
     private Long orgId;
 
+    @TableField(exist = false)
+    private String config;
+
     @Builder
     public ToolManagement(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser,
                           String name, String no, String status, Long parentId, String type, Integer weight) {