parent
e41dc018a1
commit
92c06e34d3
51 changed files with 922 additions and 184 deletions
@ -0,0 +1,39 @@ |
||||
package org.springblade.desk.basic.cache; |
||||
|
||||
import org.springblade.common.cache.CacheNames; |
||||
import org.springblade.core.cache.utils.CacheUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.SpringUtil; |
||||
import org.springblade.desk.basic.feign.IWorkCenterClient; |
||||
import org.springblade.desk.basic.pojo.entity.WorkCenter; |
||||
|
||||
/** |
||||
* 系统缓存 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
public class WorkCenterCache { |
||||
private static final String WORK_CENTER_CACHE_ID = "workCenter:id:"; |
||||
|
||||
private static IWorkCenterClient workCenterClient; |
||||
|
||||
private static IWorkCenterClient getWorkCenterClient() { |
||||
if (workCenterClient == null) { |
||||
workCenterClient = SpringUtil.getBean(IWorkCenterClient.class); |
||||
} |
||||
return workCenterClient; |
||||
} |
||||
|
||||
/** |
||||
* 获取用户 |
||||
* |
||||
* @param workCenterId 作业中心id |
||||
* @return |
||||
*/ |
||||
public static WorkCenter getById(Long workCenterId) { |
||||
return CacheUtil.get(CacheNames.BASIC, WORK_CENTER_CACHE_ID, workCenterId, () -> { |
||||
R<WorkCenter> result = getWorkCenterClient().getById(workCenterId); |
||||
return result.getData(); |
||||
}); |
||||
} |
||||
} |
||||
@ -0,0 +1,57 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.basic.feign; |
||||
|
||||
|
||||
import org.springblade.core.launch.constant.AppConstant; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.basic.pojo.entity.WorkCenter; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
/** |
||||
* 作业中心 Feign接口类 |
||||
* |
||||
* @author lqk |
||||
*/ |
||||
@FeignClient( |
||||
value = AppConstant.APPLICATION_DESK_NAME |
||||
) |
||||
public interface IWorkCenterClient { |
||||
|
||||
String API_PREFIX = "/feign/workCenter"; |
||||
String GET_BY_ID = API_PREFIX + "/getById"; |
||||
|
||||
/** |
||||
* 根据id获取作业中心 |
||||
* |
||||
* @param workCenterId 作业中心id |
||||
* @return |
||||
*/ |
||||
@GetMapping(GET_BY_ID) |
||||
R<WorkCenter> getById(@RequestParam("id") Long workCenterId); |
||||
} |
||||
@ -0,0 +1,58 @@ |
||||
package org.springblade.desk.order.pojo.enums; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springblade.core.tool.utils.StringPool; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* 镀层物料需求枚举 |
||||
* |
||||
* @author lqk |
||||
* @date 2025-12-19 9:25 |
||||
*/ |
||||
@Getter |
||||
@AllArgsConstructor |
||||
public enum AssayContentEnum { |
||||
EMPTY(StringPool.EMPTY, -1), |
||||
|
||||
/** |
||||
* 状态, 10000:未使用, 10001:已使用, 10002:已过期 |
||||
*/ |
||||
STATUS_UNUSED("未使用", 10000), |
||||
STATUS_USED("已使用", 10001), |
||||
STATUS_OUTDATE("已过期", 10002), |
||||
; |
||||
final String name; |
||||
final int code; |
||||
|
||||
/** |
||||
* 匹配枚举值 |
||||
* |
||||
* @param name 名称 |
||||
* @return BladeUserEnum |
||||
*/ |
||||
public static AssayContentEnum of(String name) { |
||||
return Arrays.stream(AssayContentEnum.values()) |
||||
.filter(userEnum -> userEnum.getName().equalsIgnoreCase(name != null ? name : "web")) |
||||
.findFirst() |
||||
// 在没有找到匹配项时返回默认值
|
||||
.orElse(AssayContentEnum.EMPTY); |
||||
} |
||||
|
||||
/** |
||||
* 根据值获取名称 |
||||
* |
||||
* @param category |
||||
* @return |
||||
*/ |
||||
public static String getName(int category) { |
||||
AssayContentEnum item = Arrays.stream(AssayContentEnum.values()) |
||||
.filter(enumItem -> enumItem.getCode() == category) |
||||
.findFirst() |
||||
.orElse(null); |
||||
return ObjectUtil.isEmpty(item) ? StringPool.EMPTY : item.getName(); |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
package org.springblade.desk.basic.feign; |
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springblade.core.tenant.annotation.NonDS; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.desk.basic.pojo.entity.WorkCenter; |
||||
import org.springblade.desk.basic.service.IWorkCenterService; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* 作业中心 Feign接口类 |
||||
* |
||||
* @author lqk |
||||
*/ |
||||
@NonDS |
||||
@Hidden() |
||||
@RestController |
||||
@RequiredArgsConstructor |
||||
public class WorkCenterClient implements IWorkCenterClient { |
||||
|
||||
private final IWorkCenterService workCenterService; |
||||
|
||||
@Override |
||||
public R<WorkCenter> getById(Long workCenterId) { |
||||
WorkCenter workCenter = workCenterService.getById(workCenterId); |
||||
return R.data(workCenter); |
||||
} |
||||
} |
||||
@ -0,0 +1,56 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration debug="false" scan="true" scanPeriod="1 seconds"> |
||||
|
||||
<contextName>logback</contextName> |
||||
<property name="log.path" value="../applogs/desk.log"/> |
||||
|
||||
<!-- 彩色日志依赖的渲染类 --> |
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
||||
<conversionRule conversionWord="wex" |
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
||||
<conversionRule conversionWord="wEx" |
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
||||
<!-- 彩色日志格式 --> |
||||
<property name="CONSOLE_LOG_PATTERN" |
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
|
||||
<!-- 控制台输出 --> |
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
<level>WARN</level> |
||||
<onMatch>ACCEPT</onMatch> |
||||
<onMismatch>DENY</onMismatch> |
||||
</filter> |
||||
<encoder> |
||||
<pattern> |
||||
%-4relative [%thread] %-5level %logger{30} - %msg%n |
||||
</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n |
||||
</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<!-- 引入异步日志 appender --> |
||||
<appender name="asyncAppender" class="ch.qos.logback.classic.AsyncAppender"> |
||||
<appender-ref ref="console"/> |
||||
<appender-ref ref="file"/> |
||||
</appender> |
||||
|
||||
<root level="error"> |
||||
<appender-ref ref="console"/> |
||||
</root> |
||||
|
||||
<root level="info"> |
||||
<appender-ref ref="file"/> |
||||
</root> |
||||
|
||||
</configuration> |
||||
Loading…
Reference in new issue