proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
networknt_light-4j | light-4j/rate-limit/src/main/java/com/networknt/limit/key/AkamaiAddressKeyResolver.java | AkamaiAddressKeyResolver | resolve | class AkamaiAddressKeyResolver implements KeyResolver {
@Override
public String resolve(HttpServerExchange exchange) {<FILL_FUNCTION_BODY>}
} |
String key = "127.0.0.1";
HeaderMap headerMap = exchange.getResponseHeaders();
HeaderValues values = headerMap.get("True-Client-IP");
if(values != null) key = values.getFirst();
return key;
| 44 | 72 | 116 | <no_super_class> |
networknt_light-4j | light-4j/rate-limit/src/main/java/com/networknt/limit/key/JwtClientIdKeyResolver.java | JwtClientIdKeyResolver | resolve | class JwtClientIdKeyResolver implements KeyResolver {
@Override
public String resolve(HttpServerExchange exchange) {<FILL_FUNCTION_BODY>}
} |
String key = null;
Map<String, Object> auditInfo = exchange.getAttachment(AttachmentConstants.AUDIT_INFO);
if(auditInfo != null) {
key = (String)auditInfo.get(Constants.CLIENT_ID_STRING);
}
return key;
| 44 | 79 | 123 | <no_super_class> |
networknt_light-4j | light-4j/rate-limit/src/main/java/com/networknt/limit/key/JwtHeaderClientIdKeyResolver.java | JwtHeaderClientIdKeyResolver | resolve | class JwtHeaderClientIdKeyResolver implements KeyResolver {
@Override
public String resolve(HttpServerExchange exchange) {<FILL_FUNCTION_BODY>}
} |
String key = null;
Map<String, Object> auditInfo = exchange.getAttachment(AttachmentConstants.AUDIT_INFO);
if(auditInfo != null) {
key = (String)auditInfo.get(Constants.CLIENT_ID_STRING);
}
if(key == null) {
// try to get the key from the header
... | 45 | 148 | 193 | <no_super_class> |
networknt_light-4j | light-4j/rate-limit/src/main/java/com/networknt/limit/key/JwtUserIdKeyResolver.java | JwtUserIdKeyResolver | resolve | class JwtUserIdKeyResolver implements KeyResolver {
@Override
public String resolve(HttpServerExchange exchange) {<FILL_FUNCTION_BODY>}
} |
String key = null;
Map<String, Object> auditInfo = exchange.getAttachment(AttachmentConstants.AUDIT_INFO);
if(auditInfo != null) {
key = (String)auditInfo.get(Constants.USER_ID_STRING);
}
return key;
| 44 | 78 | 122 | <no_super_class> |
networknt_light-4j | light-4j/registry/src/main/java/com/networknt/registry/support/DirectRegistry.java | DirectRegistry | createSubscribeUrl | class DirectRegistry extends AbstractRegistry {
private final static Logger logger = LoggerFactory.getLogger(DirectRegistry.class);
private final static String PARSE_DIRECT_URL_ERROR = "ERR10019";
private final static String GENERAL_TAG = "*";
private ConcurrentHashMap<URL, Object> subscribeUrls = new C... |
String serviceId = subscribeUrl.getPath();
String tag = subscribeUrl.getParameter(Constants.TAG_ENVIRONMENT);
String key = tag == null ? serviceId : serviceId + "|" + tag;
return directUrls.get(key);
| 1,283 | 67 | 1,350 | <methods>public void <init>(com.networknt.registry.URL) ,public void available(com.networknt.registry.URL) ,public List<com.networknt.registry.URL> discover(com.networknt.registry.URL) ,public Collection<com.networknt.registry.URL> getRegisteredServiceUrls() ,public com.networknt.registry.URL getUrl() ,public void regi... |
networknt_light-4j | light-4j/registry/src/main/java/com/networknt/registry/support/DirectRegistryConfig.java | DirectRegistryConfig | setMap | class DirectRegistryConfig {
private static final Logger logger = LoggerFactory.getLogger(DirectRegistryConfig.class);
public static final String CONFIG_NAME = "direct-registry";
private static final String DIRECT_URLS = "directUrls";
Map<String, List<URL>> directUrls;
private final Config config;
... |
Map<String, String> map = new LinkedHashMap<>();
if(getMappedConfig() != null) {
if (getMappedConfig().get(DIRECT_URLS) instanceof String) {
String s = (String) getMappedConfig().get(DIRECT_URLS);
s = s.trim();
if (logger.isTraceEnabled()) log... | 437 | 433 | 870 | <no_super_class> |
networknt_light-4j | light-4j/reqtrans-config/src/main/java/com/networknt/reqtrans/RequestTransformerConfig.java | RequestTransformerConfig | setConfigData | class RequestTransformerConfig {
public static final String CONFIG_NAME = "request-transformer";
private static final Logger logger = LoggerFactory.getLogger(RequestTransformerConfig.class);
private static final String ENABLED = "enabled";
private static final String REQUIRED_CONTENT = "requiredContent... |
Object object = mappedConfig.get(ENABLED);
if(object != null) {
if(object instanceof String) {
enabled = Boolean.parseBoolean((String)object);
} else if (object instanceof Boolean) {
enabled = (Boolean) object;
} else {
... | 749 | 189 | 938 | <no_super_class> |
networknt_light-4j | light-4j/resource/src/main/java/com/networknt/resource/ResourceHelpers.java | ResourceHelpers | getPredicatedHandlers | class ResourceHelpers {
/**
* Helper to add given PathResourceProviders to a PathHandler.
*
* @param pathResourceProviders List of instances of classes implementing PathResourceProvider.
* @param pathHandler The handler that will have these handlers added to it.
*/
public static void a... |
List<PredicatedHandler> predicatedHandlers = new ArrayList<>();
if (predicatedHandlersProviders != null && predicatedHandlersProviders.length > 0) {
for (PredicatedHandlersProvider predicatedHandlersProvider : predicatedHandlersProviders) {
predicatedHandlers.addAll(predicat... | 587 | 116 | 703 | <no_super_class> |
networknt_light-4j | light-4j/restrans-config/src/main/java/com/networknt/restrans/ResponseTransformerConfig.java | ResponseTransformerConfig | setConfigData | class ResponseTransformerConfig {
public static final String CONFIG_NAME = "response-transformer";
private static final Logger logger = LoggerFactory.getLogger(ResponseTransformerConfig.class);
private static final String ENABLED = "enabled";
private static final String REQUIRED_CONTENT = "requiredCont... |
Object object = mappedConfig.get(ENABLED);
if(object != null) {
if(object instanceof String) {
enabled = Boolean.parseBoolean((String)object);
} else if (object instanceof Boolean) {
enabled = (Boolean) object;
} else {
... | 748 | 189 | 937 | <no_super_class> |
networknt_light-4j | light-4j/rule-loader/src/main/java/com/networknt/rule/FineGrainedAuthAction.java | FineGrainedAuthAction | performAction | class FineGrainedAuthAction implements IAction {
public void performAction(Map<String, Object> objMap, Map<String, Object> resultMap, Collection<RuleActionValue> actionValues) {<FILL_FUNCTION_BODY>}
} |
resultMap.put(RuleConstants.RESULT, false);
// when this action is called, we either have a client credentials token or
// an authorization code token with roles available.
Object allowCcObj = resultMap.get("allow-cc");
Object allowRoleJwt = resultMap.get("allow-role-jwt");
... | 61 | 751 | 812 | <no_super_class> |
networknt_light-4j | light-4j/rule-loader/src/main/java/com/networknt/rule/GroupRoleTransformAction.java | GroupRoleTransformAction | performAction | class GroupRoleTransformAction implements IAction {
private static final Logger logger = LoggerFactory.getLogger(GroupRoleTransformAction.class);
public void performAction(Map<String, Object> objMap, Map<String, Object> resultMap, Collection<RuleActionValue> actionValues) {<FILL_FUNCTION_BODY>}
} |
// need to make sure that the result is true.
boolean result = (Boolean)resultMap.get(RuleConstants.RESULT);
if(result) {
String roles = null;
for (Map.Entry<String,Object> entry : resultMap.entrySet()) {
if(logger.isDebugEnabled()) logger.debug("key = " ... | 82 | 254 | 336 | <no_super_class> |
networknt_light-4j | light-4j/ruleloader-config/src/main/java/com/networknt/rule/RuleLoaderConfig.java | RuleLoaderConfig | setConfigData | class RuleLoaderConfig {
private static final Logger logger = LoggerFactory.getLogger(RuleLoaderConfig.class);
public static final String CONFIG_NAME = "rule-loader";
public static final String RULE_SOURCE_LIGHT_PORTAL = "light-portal";
public static final String RULE_SOURCE_CONFIG_FOLDER = "config-fol... |
Object object = mappedConfig.get(ENABLED);
if(object != null) {
if(object instanceof String) {
enabled = Boolean.parseBoolean((String)object);
} else if (object instanceof Boolean) {
enabled = (Boolean) object;
} else {
... | 776 | 154 | 930 | <no_super_class> |
networknt_light-4j | light-4j/sanitizer-config/src/main/java/org/owasp/encoder/EncoderWrapper.java | EncoderWrapper | encodeList | class EncoderWrapper {
private final Encoder encoder;
private final List<String> attributesToIgnore;
private final List<String> attributesToAppreciate;
public EncoderWrapper(Encoder encoder, List<String> attributesToIgnore, List<String> attributesToAppreciate) {
this.encoder = encoder;
... |
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof String) {
list.set(i, applyEncoding((String) list.get(i)));
} else if (list.get(i) instanceof Map) {
encodeNode((Map<String, Object>)list.get(i));
} else if (list.get(i) instan... | 380 | 124 | 504 | <no_super_class> |
networknt_light-4j | light-4j/sanitizer/src/main/java/com/networknt/sanitizer/SanitizerHandler.java | SanitizerHandler | handleRequest | class SanitizerHandler implements MiddlewareHandler {
static SanitizerConfig config;
EncoderWrapper bodyEncoder;
EncoderWrapper headerEncoder;
private volatile HttpHandler next;
public SanitizerHandler() {
config = SanitizerConfig.load();
bodyEncoder = new EncoderWrapper(Encoders.... |
if (logger.isDebugEnabled()) logger.trace("SanitizerHandler.handleRequest starts.");
String method = exchange.getRequestMethod().toString();
if (config.isHeaderEnabled()) {
HeaderMap headerMap = exchange.getRequestHeaders();
if (headerMap != null) {
for (... | 559 | 709 | 1,268 | <no_super_class> |
networknt_light-4j | light-4j/security-config/src/main/java/com/networknt/security/JwtConfig.java | JwtConfig | setConfigData | class JwtConfig {
private static final Logger logger = LoggerFactory.getLogger(JwtConfig.class);
public static final String CONFIG_NAME = "jwt";
public static final String ISSUER = "issuer";
public static final String AUDIENCE = "audience";
public static final String VERSION = "version";
public ... |
if(getMappedConfig() != null) {
Object object = getMappedConfig().get(ISSUER);
if(object != null) issuer = (String)object;
object = getMappedConfig().get(AUDIENCE);
if(object != null) audience = (String)object;
object = getMappedConfig().get(VERSION);... | 609 | 235 | 844 | <no_super_class> |
networknt_light-4j | light-4j/security/src/main/java/com/networknt/security/JwtIssuer.java | JwtIssuer | getJwt | class JwtIssuer {
private static final Logger logger = LoggerFactory.getLogger(JwtIssuer.class);
private static final JwtConfig jwtConfig = JwtConfig.load();
/**
* A static method that generate JWT token from JWT claims object and a given private key. This private key
* should be from the host_k... |
String jwt;
// A JWT is a JWS and/or a JWE with JSON claims as the payload.
// In this example it is a JWS nested inside a JWE
// So we first create a JsonWebSignature object.
JsonWebSignature jws = new JsonWebSignature();
// The payload of the JWS is JSON content of th... | 889 | 286 | 1,175 | <no_super_class> |
networknt_light-4j | light-4j/security/src/main/java/com/networknt/security/KeyUtil.java | KeyUtil | serializePublicKey | class KeyUtil {
public static final Logger logger = LoggerFactory.getLogger(KeyUtil.class);
public static final String RSA = "RSA";
public static KeyPair generateKeyPair(String algorithm, int keySize) throws Exception {
// Generate a key pair
KeyPairGenerator keyPairGenerator = KeyPairGenera... |
// Serialize the public key
byte[] publicKeyBytes = publicKey.getEncoded();
return Base64.getEncoder().encodeToString(publicKeyBytes);
| 821 | 43 | 864 | <no_super_class> |
networknt_light-4j | light-4j/security/src/main/java/com/networknt/security/SwtVerifier.java | SwtVerifier | getTokenInfoForToken | class SwtVerifier extends TokenVerifier {
static final Logger logger = LoggerFactory.getLogger(SwtVerifier.class);
public static final String OAUTH_INTROSPECTION_ERROR = "ERR10079";
public static final String TOKEN_INFO_ERROR = "ERR10080";
public static final String INTROSPECTED_TOKEN_EXPIRED = "ERR1008... |
if (logger.isTraceEnabled()) {
logger.trace("swt = " + swt + requestPathOrSwtServiceIds instanceof String ? " requestPath = " + requestPathOrSwtServiceIds : " swtServiceIds = " + requestPathOrSwtServiceIds + " clientId = " + clientId + " clientSecret = " + clientSecret);
}
ClientCon... | 1,145 | 895 | 2,040 | <methods>public non-sealed void <init>() ,public boolean checkForH2CRequest(HeaderMap) ,public static java.lang.String getTokenFromAuthorization(java.lang.String) <variables>static final Logger logger |
networknt_light-4j | light-4j/security/src/main/java/com/networknt/security/TokenVerifier.java | TokenVerifier | getJwkConfig | class TokenVerifier {
static final Logger logger = LoggerFactory.getLogger(TokenVerifier.class);
protected Map<String, Object> getJwkConfig(ClientConfig clientConfig, String serviceId) {<FILL_FUNCTION_BODY>}
/**
* Parse the jwt or swt token from Authorization header.
*
* @param authorization... |
if (logger.isTraceEnabled())
logger.trace("serviceId = " + serviceId);
// get the serviceIdAuthServers for key definition
Map<String, Object> tokenConfig = clientConfig.getTokenConfig();
Map<String, Object> keyConfig = (Map<String, Object>) tokenConfig.get(ClientConfig.KEY);... | 430 | 194 | 624 | <no_super_class> |
networknt_light-4j | light-4j/server/src/main/java/com/networknt/server/JsonPathStartupHookProvider.java | JsonPathStartupHookProvider | configJsonPath | class JsonPathStartupHookProvider implements StartupHookProvider {
@Override
public void onStartup() {
configJsonPath();
}
static void configJsonPath() {<FILL_FUNCTION_BODY>}
} |
Configuration.setDefaults(new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
... | 60 | 130 | 190 | <no_super_class> |
networknt_light-4j | light-4j/server/src/main/java/com/networknt/server/handler/ServerShutdownHandler.java | ServerShutdownHandler | handleRequest | class ServerShutdownHandler implements LightHttpHandler {
private static final Logger logger = LoggerFactory.getLogger(ServerShutdownHandler.class);
public ServerShutdownHandler() {
logger.info("ServerShutdownHandler constructed");
}
@Override
public void handleRequest(final HttpServerExchange exchange) throw... |
try {
ServerConfig serverConfig = ServerConfig.getInstance();
ServerShutdownResponse response = new ServerShutdownResponse();
response.setTime(System.currentTimeMillis());
response.setServiceId(serverConfig.getServiceId());
response.setTag(serverConfig.getEnvironment());
exchange.getResponseSender... | 93 | 173 | 266 | <no_super_class> |
networknt_light-4j | light-4j/server/src/main/java/com/networknt/server/model/ServerShutdownResponse.java | ServerShutdownResponse | equals | class ServerShutdownResponse {
private java.lang.Long time;
private String serviceId;
private String tag;
public ServerShutdownResponse() {
}
@JsonProperty("time")
public java.lang.Long getTime() {
return time;
}
public void setTime(java.lang.Long time) {
this.time = time;
}
@JsonProperty("serviceId... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ServerShutdownResponse ServerShutdownResponse = (ServerShutdownResponse) o;
return Objects.equals(time, ServerShutdownResponse.time)
&& Objects.equals(serviceId, ServerShutdownResponse.serviceId)
... | 239 | 123 | 362 | <no_super_class> |
networknt_light-4j | light-4j/service/src/main/java/com/networknt/service/ServiceConfig.java | ServiceConfig | setConfigData | class ServiceConfig {
private static final Logger logger = LoggerFactory.getLogger(ServiceConfig.class);
public static final String CONFIG_NAME = "service";
public static final String SINGLETONS = "singletons";
private List<Map<String, Object>> singletons;
private Config config;
private Map<Str... |
if(mappedConfig.get(SINGLETONS) instanceof String) {
// the json string is supported here.
String s = (String)mappedConfig.get(SINGLETONS);
if(logger.isTraceEnabled()) logger.trace("singletons = " + s);
singletons = JsonMapper.string2List(s);
} else if (m... | 280 | 187 | 467 | <no_super_class> |
networknt_light-4j | light-4j/service/src/main/java/com/networknt/service/ServiceUtil.java | ServiceUtil | construct | class ServiceUtil {
/**
* Instantiates and returns an object out of a given configuration.
* If the configuration is simply a class name, assume default empty constructor.
* If the configuration is a map, assume keyed by class name, with values being one of 2 options:
* - map: keys are field n... |
if (something instanceof String) {
return Class.forName((String)something).getConstructor().newInstance();
} else if (something instanceof Map) {
// keys are the class name, values are the parameters.
for (Map.Entry<String, Object> entry : ((Map<String, Object>) some... | 1,036 | 174 | 1,210 | <no_super_class> |
networknt_light-4j | light-4j/sidecar-config/src/main/java/com/networknt/router/SidecarConfig.java | SidecarConfig | setConfigData | class SidecarConfig {
public static final String CONFIG_NAME = "sidecar";
private static final String EGRESS_INGRESS_INDICATOR = "egressIngressIndicator";
private Map<String, Object> mappedConfig;
private final Config config;
String egressIngressIndicator;
private SidecarConfig(String configName... |
if(getMappedConfig() != null) {
Object object = getMappedConfig().get(EGRESS_INGRESS_INDICATOR);
if(object != null) egressIngressIndicator = (String)object;
}
| 402 | 64 | 466 | <no_super_class> |
networknt_light-4j | light-4j/sidecar/src/main/java/com/networknt/router/SidecarRouterHandler.java | SidecarRouterHandler | handleRequest | class SidecarRouterHandler extends RouterHandler implements MiddlewareHandler{
private static final Logger logger = LoggerFactory.getLogger(SidecarRouterHandler.class);
private volatile HttpHandler next;
public static final String ROUTER_CONFIG_NAME = "router";
public static Map<String, Object> config... |
if(logger.isDebugEnabled()) logger.debug("SidecarRouterHandler.handleRequest starts.");
if (Constants.HEADER.equalsIgnoreCase(sidecarConfig.getEgressIngressIndicator())) {
HeaderValues serviceIdHeader = httpServerExchange.getRequestHeaders().get(SERVICE_ID);
String serviceId = s... | 463 | 486 | 949 | <methods>public void <init>() ,public void handleRequest(HttpServerExchange) throws java.lang.Exception,public void reload() <variables>private static com.networknt.router.RouterConfig config,private static final Logger logger,protected static com.networknt.metrics.AbstractMetricsHandler metricsHandler,protected static... |
networknt_light-4j | light-4j/sidecar/src/main/java/com/networknt/router/middleware/SidecarPathPrefixServiceHandler.java | SidecarPathPrefixServiceHandler | handleRequest | class SidecarPathPrefixServiceHandler extends PathPrefixServiceHandler {
private static final Logger logger = LoggerFactory.getLogger(SidecarPathPrefixServiceHandler.class);
private static SidecarConfig sidecarConfig;
public SidecarPathPrefixServiceHandler() {
logger.info("SidecarPathPrefixService... |
if(logger.isDebugEnabled()) logger.debug("SidecarPathPrefixServiceHandler.handleRequest starts.");
if (Constants.HEADER.equalsIgnoreCase(sidecarConfig.getEgressIngressIndicator())) {
if(logger.isTraceEnabled()) logger.trace("Outgoing request calls PathPrefixServiceHandler with header indica... | 139 | 242 | 381 | <methods>public void <init>() ,public HttpHandler getNext() ,public void handleRequest(HttpServerExchange) throws java.lang.Exception,public boolean isEnabled() ,public void register() ,public void reload() ,public com.networknt.handler.MiddlewareHandler setNext(HttpHandler) <variables>protected static com.networknt.ro... |
networknt_light-4j | light-4j/sidecar/src/main/java/com/networknt/router/middleware/SidecarSAMLTokenHandler.java | SidecarSAMLTokenHandler | handleRequest | class SidecarSAMLTokenHandler extends SAMLTokenHandler {
public static SidecarConfig sidecarConfig;
public SidecarSAMLTokenHandler() {
super();
sidecarConfig = SidecarConfig.load();
if(logger.isDebugEnabled()) logger.debug("SidecarSAMLTokenHandler is constructed");
}
@Override... |
if(logger.isDebugEnabled()) logger.debug("SidecarSAMLTokenHandler.handleRequest starts.");
if (Constants.HEADER.equalsIgnoreCase(sidecarConfig.getEgressIngressIndicator())) {
HeaderValues serviceIdHeader = exchange.getRequestHeaders().get(HttpStringConstants.SERVICE_ID);
String ... | 120 | 332 | 452 | <methods>public void <init>() ,public HttpHandler getNext() ,public void handleRequest(HttpServerExchange) throws java.lang.Exception,public boolean isEnabled() ,public void register() ,public void reload() ,public static void sendStatusToResponse(HttpServerExchange, com.networknt.status.Status) ,public com.networknt.h... |
networknt_light-4j | light-4j/sidecar/src/main/java/com/networknt/router/middleware/SidecarServiceDictHandler.java | SidecarServiceDictHandler | handleRequest | class SidecarServiceDictHandler extends ServiceDictHandler {
private static final Logger logger = LoggerFactory.getLogger(SidecarServiceDictHandler.class);
private static SidecarConfig sidecarConfig;
public SidecarServiceDictHandler() {
logger.info("SidecarServiceDictHandler is constructed");
... |
if(logger.isDebugEnabled()) logger.debug("SidecarServiceDictHandler.handleRequest starts.");
if (Constants.HEADER.equalsIgnoreCase(sidecarConfig.getEgressIngressIndicator())) {
if(logger.isTraceEnabled()) logger.trace("Outgoing request with header indicator");
serviceDict(exchan... | 139 | 231 | 370 | <methods>public void <init>() ,public HttpHandler getNext() ,public void handleRequest(HttpServerExchange) throws java.lang.Exception,public boolean isEnabled() ,public void register() ,public void reload() ,public com.networknt.handler.MiddlewareHandler setNext(HttpHandler) <variables>protected static com.networknt.ro... |
networknt_light-4j | light-4j/sidecar/src/main/java/com/networknt/router/middleware/SidecarTokenHandler.java | SidecarTokenHandler | handleRequest | class SidecarTokenHandler extends TokenHandler{
private static final Logger logger = LoggerFactory.getLogger(SidecarTokenHandler.class);
public static SidecarConfig sidecarConfig;
public SidecarTokenHandler() {
super();
sidecarConfig = SidecarConfig.load();
if(logger.isDebugEnabled... |
if(logger.isTraceEnabled()) logger.trace("SidecarTokenHandler.handleRequest starts with indicator {}.", sidecarConfig.getEgressIngressIndicator());
if (Constants.HEADER.equalsIgnoreCase(sidecarConfig.getEgressIngressIndicator())) {
HeaderValues serviceIdHeader = exchange.getRequestHeaders()... | 131 | 418 | 549 | <methods>public void <init>() ,public static Result<Jwt> getJwtToken(java.lang.String) ,public HttpHandler getNext() ,public void handleRequest(HttpServerExchange) throws java.lang.Exception,public boolean isEnabled() ,public void register() ,public void reload() ,public com.networknt.handler.MiddlewareHandler setNext(... |
networknt_light-4j | light-4j/switcher/src/main/java/com/networknt/switcher/LocalSwitcherService.java | LocalSwitcherService | registerListener | class LocalSwitcherService implements SwitcherService {
private static ConcurrentMap<String, Switcher> switchers = new ConcurrentHashMap<>();
final private Map<String, List<SwitcherListener>> listenerMap = new ConcurrentHashMap();
@Override
public Switcher getSwitcher(String name) {
return sw... |
synchronized (listenerMap) {
if (listenerMap.get(switcherName) == null) {
List listeners = Collections.synchronizedList(new ArrayList());
listenerMap.put(switcherName, listeners);
listeners.add(listener);
} else {
List list... | 630 | 119 | 749 | <no_super_class> |
networknt_light-4j | light-4j/token-config/src/main/java/com/networknt/router/middleware/TokenConfig.java | TokenConfig | setConfigList | class TokenConfig {
private static final Logger logger = LoggerFactory.getLogger(TokenConfig.class);
public static final String CONFIG_NAME = "token";
private static final String ENABLED = "enabled";
private static final String APPLIED_PATH_PREFIXES = "appliedPathPrefixes";
boolean enabled;
Lis... |
if (mappedConfig.get(APPLIED_PATH_PREFIXES) != null) {
Object object = mappedConfig.get(APPLIED_PATH_PREFIXES);
appliedPathPrefixes = new ArrayList<>();
if(object instanceof String) {
String s = (String)object;
s = s.trim();
if... | 464 | 313 | 777 | <no_super_class> |
networknt_light-4j | light-4j/traceability-config/src/main/java/com/networknt/traceability/TraceabilityConfig.java | TraceabilityConfig | setConfigData | class TraceabilityConfig {
public static final String CONFIG_NAME = "traceability";
private static final String ENABLED = "enabled";
private Map<String, Object> mappedConfig;
private final Config config;
boolean enabled;
private TraceabilityConfig(String configName) {
config = Config.ge... |
if(getMappedConfig() != null) {
Object object = getMappedConfig().get(ENABLED);
if(object != null) enabled = Config.loadBooleanValue(ENABLED, object);
}
| 363 | 57 | 420 | <no_super_class> |
networknt_light-4j | light-4j/traceability/src/main/java/com/networknt/traceability/TraceabilityHandler.java | TraceabilityHandler | reload | class TraceabilityHandler implements MiddlewareHandler {
static final Logger logger = LoggerFactory.getLogger(TraceabilityHandler.class);
private static final String TID = "tId";
public static TraceabilityConfig config;
private volatile HttpHandler next;
public TraceabilityHandler() {
con... |
config.reload();
ModuleRegistry.registerModule(TraceabilityConfig.CONFIG_NAME, TraceabilityHandler.class.getName(), Config.getNoneDecryptedInstance().getJsonMapConfigNoCache(TraceabilityConfig.CONFIG_NAME), null);
if(logger.isInfoEnabled()) logger.info("TraceabilityHandler is reloaded.");
| 465 | 81 | 546 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/ByteUtil.java | ByteUtil | randomNumeric | class ByteUtil {
public static byte[] longToBytes(long x) {
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
buffer.putLong(0, x);
return buffer.array();
}
public static long bytesToLong(byte[] bytes) {
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
buffer.... |
int leftLimit = 48; // letter '0'
int rightLimit = 57; // letter '9'
Random random = new Random();
return random.ints(leftLimit, rightLimit + 1)
.limit(length)
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
... | 262 | 89 | 351 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java | CodeVerifierUtil | getCodeVerifierChallengeMethod | class CodeVerifierUtil {
static final Logger logger = LoggerFactory.getLogger(CodeVerifierUtil.class);
/**
* SHA-256 based code verifier challenge method.
*
* @see "Proof Key for Code Exchange by OAuth Public Clients (RFC 7636), Section 4.3
* <https://tools.ietf.org/html/rfc7636#section-4.... |
try {
MessageDigest.getInstance("SHA-256");
// no exception, so SHA-256 is supported
return CODE_CHALLENGE_METHOD_S256;
} catch (NoSuchAlgorithmException e) {
return CODE_CHALLENGE_METHOD_PLAIN;
}
| 1,427 | 90 | 1,517 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/CollectionUtils.java | CollectionUtils | findValueOfType | class CollectionUtils {
/**
* Default load factor for {@link HashMap}/{@link LinkedHashMap} variants.
* @see #newHashMap(int)
* @see #newLinkedHashMap(int)
*/
static final float DEFAULT_LOAD_FACTOR = 0.75f;
/**
* Return {@code true} if the supplied Collection is {@code null} or em... |
if (isEmpty(collection)) {
return null;
}
T value = null;
for (Object element : collection) {
if (type == null || type.isInstance(element)) {
if (value != null) {
// More than one value found... no clear single value.
... | 1,514 | 105 | 1,619 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/ConfigUtils.java | ConfigUtils | normalizeList | class ConfigUtils {
private static final Logger logger = LoggerFactory.getLogger(ConfigUtils.class);
public static final String DELIMITOR = "@";
protected static final String INTERNAL_KEY_FORMAT = "%s %s";
public static String findServiceEntry(String method, String searchKey, Map<String, Object> mapping) ... |
if(list.isEmpty()) {
return list;
}
if(list.get(0) instanceof String) {
// Case 1: List of Strings
List<String> stringList = (List<String>) list;
Collections.sort(stringList);
return stringList;
} else if(list.get(0) instanceof... | 951 | 236 | 1,187 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/DateUtil.java | DateUtil | parseIso8601Date | class DateUtil {
/** Alternate ISO 8601 format without fractional seconds. */
static final DateTimeFormatter ALTERNATE_ISO_8601_DATE_FORMAT =
new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
.toFormatter()
.withZon... |
// For EC2 Spot Fleet.
if (dateString.endsWith("+0000")) {
dateString = dateString
.substring(0, dateString.length() - 5)
.concat("Z");
}
try {
return parseInstant(dateString, ISO_INSTANT);
} catch (DateTimeParseEx... | 361 | 123 | 484 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/FingerPrintUtil.java | FingerPrintUtil | bytesToHex | class FingerPrintUtil {
static final Logger logger = LoggerFactory.getLogger(CodeVerifierUtil.class);
private final static char[] hexArray = "0123456789ABCDEF".toCharArray();
public static String getCertFingerPrint(Certificate cert) {
byte [] digest = null;
try {
byte[] encCert... |
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
| 222 | 114 | 336 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/HashUtil.java | HashUtil | validatePassword | class HashUtil {
private HashUtil() {throw new UnsupportedOperationException("do not instantiate");}
public static String generateUUID() {
UUID id = UUID.randomUUID();
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(id.getMostSignificantBits());
bb.putLong(id.getLeast... |
String[] parts = storedPassword.split(":");
int iterations = Integer.parseInt(parts[0]);
byte[] salt = fromHex(parts[1]);
byte[] hash = fromHex(parts[2]);
PBEKeySpec spec = new PBEKeySpec(originalPassword, salt, iterations, hash.length * 8);
SecretKeyFactory skf = Secre... | 1,013 | 198 | 1,211 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/ModuleRegistry.java | ModuleRegistry | maskNode | class ModuleRegistry {
private static final Map<String, Object> moduleRegistry = new HashMap<>();
private static final Map<String, Object> pluginRegistry = new HashMap<>();
private static final List<Map<String, Object>> plugins = new ArrayList<>();
// cache for the module classes
private static fi... |
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String && key.equals(mask))
map.put(key, "*");
else if (value instanceof Map)
maskNode((Map... | 1,039 | 114 | 1,153 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/TimeUtil.java | TimeUtil | oneTimeUnitMillisecond | class TimeUtil {
/**
* Return the number of milliseconds per time unit.
*
* @param timeUnit TimeUnit
* @return long
*/
public static long oneTimeUnitMillisecond(TimeUnit timeUnit) {<FILL_FUNCTION_BODY>}
/**
* Get the rounded-up timestamp in millisecond by the TimeUnit based on... |
long millisecond = 0;
switch (timeUnit) {
case MILLISECONDS:
millisecond = 1;
break;
case SECONDS:
millisecond = 1000;
break;
case MINUTES:
millisecond = 60000;
break;
... | 397 | 144 | 541 | <no_super_class> |
networknt_light-4j | light-4j/utility/src/main/java/com/networknt/utility/Util.java | Util | parseInteger | class Util {
static final Logger logger = LoggerFactory.getLogger(Util.class);
public static final List<String> METHODS = Arrays.asList("GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH");
/**
* Generate UUID across the entire app and it is used for correlationId.
*
... |
if (intStr == null) {
return Constants.DEFAULT_INT_VALUE;
}
try {
return Integer.parseInt(intStr);
} catch (NumberFormatException e) {
return Constants.DEFAULT_INT_VALUE;
}
| 1,203 | 69 | 1,272 | <no_super_class> |
lilishop_lilishop | lilishop/admin/src/main/java/cn/lili/admin/AdminApplication.java | SecuritySecureConfig | configure | class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final AdminServerProperties adminServer;
public SecuritySecureConfig(AdminServerProperties adminServer) {
this.adminServer = adminServer;
}
@Override
protected void configure(HttpSecurity htt... |
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(this.adminServer.path("/"));
http.authorizeRequests().antMatchers("/... | 89 | 331 | 420 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/distribution/DistributionCashBuyerController.java | DistributionCashBuyerController | cash | class DistributionCashBuyerController {
/**
* 分销佣金
*/
@Autowired
private DistributionCashService distributionCashService;
/**
* 分销员提现
*/
@Autowired
private DistributionCashService distributorCashService;
@PreventDuplicateSubmissions
@ApiOperation(value = "分销员提现")
... |
if (Boolean.TRUE.equals(distributionCashService.cash(price))) {
return ResultUtil.success();
}
throw new ServiceException(ResultCode.ERROR);
| 320 | 47 | 367 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/distribution/DistributionGoodsBuyerController.java | DistributionGoodsBuyerController | distributionCheckGoods | class DistributionGoodsBuyerController {
/**
* 分销商品
*/
@Autowired
private DistributionGoodsService distributionGoodsService;
/**
* 选择分销商品
*/
@Autowired
private DistributionSelectedGoodsService distributionSelectedGoodsService;
@ApiOperation(value = "获取分销商商品列表")
@Ge... |
Boolean result = false;
if (checked) {
result = distributionSelectedGoodsService.add(distributionGoodsId);
} else {
result = distributionSelectedGoodsService.delete(distributionGoodsId);
}
//判断操作结果
if (result) {
return ResultUtil.succe... | 347 | 108 | 455 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java | GoodsBuyerController | getSku | class GoodsBuyerController {
/**
* 商品
*/
@Autowired
private GoodsService goodsService;
/**
* 商品SKU
*/
@Autowired
private GoodsSkuService goodsSkuService;
/**
* ES商品搜索
*/
@Autowired
private EsGoodsSearchService goodsSearchService;
@Autowired
pri... |
try {
// 读取选中的列表
Map<String, Object> map = goodsSkuService.getGoodsSkuDetail(goodsId, skuId);
return ResultUtil.data(map);
} catch (ServiceException se) {
log.info(se.getMsg(), se);
throw se;
} catch (Exception e) {
log.err... | 922 | 134 | 1,056 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/member/PointsHistoryBuyerController.java | PointsHistoryBuyerController | getByPage | class PointsHistoryBuyerController {
@Autowired
private MemberPointsHistoryService memberPointsHistoryService;
@ApiOperation(value = "分页获取")
@GetMapping(value = "/getByPage")
public ResultMessage<IPage<MemberPointsHistory>> getByPage(PageVO page) {<FILL_FUNCTION_BODY>}
@ApiOperation(value = "获... |
LambdaQueryWrapper<MemberPointsHistory> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(MemberPointsHistory::getMemberId, UserContext.getCurrentUser().getId());
queryWrapper.orderByDesc(MemberPointsHistory::getCreateTime);
return ResultUtil.data(memberPointsHistoryService.page(P... | 172 | 92 | 264 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/order/OrderBuyerController.java | OrderBuyerController | receiving | class OrderBuyerController {
/**
* 订单
*/
@Autowired
private OrderService orderService;
@Autowired
private OrderPackageService orderPackageService;
@ApiOperation(value = "查询会员订单列表")
@GetMapping
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderS... |
Order order = orderService.getBySn(orderSn);
if (order == null) {
throw new ServiceException(ResultCode.ORDER_NOT_EXIST);
}
//判定是否是待收货状态
if (!order.getOrderStatus().equals(OrderStatusEnum.DELIVERED.name())) {
throw new ServiceException(ResultCode.ORDER_DE... | 1,550 | 124 | 1,674 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/order/OrderComplaintBuyerController.java | OrderComplaintBuyerController | addCommunication | class OrderComplaintBuyerController {
/**
* 交易投诉
*/
@Autowired
private OrderComplaintService orderComplaintService;
/**
* 交易投诉沟通
*/
@Autowired
private OrderComplaintCommunicationService orderComplaintCommunicationService;
@ApiOperation(value = "通过id获取")
@ApiImplic... |
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.BUYER.name(), currentUser.getNickName(), currentUser.getId());
orderComplaintCommunicationSe... | 675 | 109 | 784 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/other/AppVersionBuyerController.java | AppVersionBuyerController | appVersion | class AppVersionBuyerController {
@Autowired
private AppVersionService appVersionService;
@ApiOperation(value = "获取版本号")
@ApiImplicitParam(name = "appType", value = "app类型", required = true, paramType = "path")
@GetMapping("/{appType}")
public ResultMessage<Object> getAppVersion(@PathVariable... |
IPage<AppVersion> page = appVersionService.page(PageUtil.initPage(pageVO), new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getType, appType));
return ResultUtil.data(page);
| 222 | 60 | 282 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/other/PageBuyerController.java | PageBuyerController | getSpecial | class PageBuyerController {
/**
* 页面管理
*/
@Autowired
private PageDataService pageService;
@ApiOperation(value = "获取首页数据")
@GetMapping("/getIndex")
public ResultMessage<PageDataVO> getIndex(@RequestParam String clientType) {
PageDataDTO pageDataDTO = new PageDataDTO(PageEnum.I... |
String name = "";
if (body.indexOf("』") >= 0 && body.indexOf("『") >= 0) {
name = body.substring(body.indexOf("『") + 1, body.lastIndexOf("』"));
} else if (body.indexOf("〉") >= 0 && body.indexOf("〈") >= 0) {
name = body.substring(body.indexOf("〈") + 1, body.lastIndexOf("〉"... | 540 | 549 | 1,089 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/other/purchase/PurchaseQuotedController.java | PurchaseQuotedController | addPurchaseOrderVO | class PurchaseQuotedController {
/**
* 采购单报价
*/
@Autowired
private PurchaseQuotedService purchaseQuotedService;
/**
* 采购单
*/
@Autowired
private PurchaseOrderService purchaseOrderService;
@ApiOperation(value = "添加采购单报价")
@PostMapping
public ResultMessage<Purchase... |
PurchaseOrder purchaseOrder=purchaseOrderService.getById(purchaseQuotedVO.getPurchaseOrderId());
if(DateUtil.compare(purchaseOrder.getDeadline(),new DateTime())< 0){
ResultUtil.error(ResultCode.PURCHASE_ORDER_DEADLINE_ERROR);
}
return ResultUtil.data(purchaseQuotedService.ad... | 381 | 108 | 489 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java | CashierController | payment | class CashierController {
@Autowired
private CashierSupport cashierSupport;
@ApiImplicitParams({
@ApiImplicitParam(name = "client", value = "客户端类型", paramType = "path", allowableValues = "PC,H5,WECHAT_MP,APP")
})
@GetMapping(value = "/tradeDetail")
@ApiOperation(value = "获取支付详情")
... |
PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(paymentMethod);
PaymentClientEnum paymentClientEnum = PaymentClientEnum.valueOf(paymentClient);
try {
return cashierSupport.payment(paymentMethodEnum, paymentClientEnum, request, response, payParam);
} catch (S... | 655 | 137 | 792 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/promotion/KanjiaGoodsActivityBuyerController.java | KanjiaGoodsActivityBuyerController | getPointsGoodsPage | class KanjiaGoodsActivityBuyerController {
/**
* 砍价活动商品
*/
@Autowired
private KanjiaActivityGoodsService kanJiaActivityGoodsService;
/**
* 帮砍记录
*/
@Autowired
private KanjiaActivityLogService kanJiaActivityLogService;
/**
* 砍价活动
*/
@Autowired
private Kan... |
// 会员端查询到的肯定是已经开始的活动商品
kanjiaActivityQuery.setMemberId(UserContext.getCurrentUser().getId());
IPage<KanjiaActivity> kanjiaActivity = kanJiaActivityService.getForPage(kanjiaActivityQuery, page);
return ResultUtil.data(kanjiaActivity);
| 1,083 | 90 | 1,173 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/promotion/PintuanBuyerController.java | PintuanBuyerController | getPintuanCategory | class PintuanBuyerController {
@Autowired
private PromotionGoodsService promotionGoodsService;
@Autowired
private PintuanService pintuanService;
@ApiOperation(value = "获取拼团商品")
@GetMapping
public ResultMessage<IPage<PromotionGoods>> getPintuanCategory(String goodsName, String categoryPath, ... |
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
searchParams.setGoodsName(goodsName);
searchParams.setPromotionType(PromotionTypeEnum.PINTUAN.name());
searchParams.setPromotionStatus(PromotionsStatusEnum.START.name());
searchParams.setCategoryPath(cat... | 293 | 115 | 408 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/wallet/MemberWalletBuyerController.java | MemberWalletBuyerController | updatePassword | class MemberWalletBuyerController {
/**
* 会员
*/
@Autowired
private MemberService memberService;
/**
* 会员余额
*/
@Autowired
private MemberWalletService memberWalletService;
/**
* 验证码
*/
@Autowired
private VerificationService verificationService;
@Auto... |
AuthUser authUser = UserContext.getCurrentUser();
//校验当前用户是否存在
Member member = memberService.getById(authUser.getId());
if (member == null) {
throw new ServiceException(ResultCode.USER_NOT_EXIST);
}
MemberWallet memberWallet = this.memberWalletService.getOne(... | 1,195 | 233 | 1,428 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/wallet/MemberWithdrawApplyBuyerController.java | MemberWithdrawApplyBuyerController | getByPage | class MemberWithdrawApplyBuyerController {
@Autowired
private MemberWithdrawApplyService memberWithdrawApplyService;
@ApiOperation(value = "分页获取提现记录")
@GetMapping
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {<FILL_F... |
memberWithdrawApplyQueryVO.setMemberId(UserContext.getCurrentUser().getId());
//构建查询 返回数据
IPage<MemberWithdrawApply> memberWithdrawApplyPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
return ResultUtil.data(memberWithdrawApplyPage);
| 104 | 86 | 190 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/wallet/RechargeBuyerController.java | RechargeBuyerController | getByPage | class RechargeBuyerController {
@Autowired
private RechargeService rechargeService;
@ApiOperation(value = "分页获取预存款充值记录")
@GetMapping
public ResultMessage<IPage<Recharge>> getByPage(PageVO page) {<FILL_FUNCTION_BODY>}
} |
//构建查询参数
RechargeQueryVO rechargeQueryVO = new RechargeQueryVO();
rechargeQueryVO.setMemberId(UserContext.getCurrentUser().getId());
//构建查询 返回数据
IPage<Recharge> rechargePage = rechargeService.rechargePage(page, rechargeQueryVO);
return ResultUtil.data(rechargePage);
| 85 | 96 | 181 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/controller/wallet/WalletLogBuyerController.java | WalletLogBuyerController | getByPage | class WalletLogBuyerController {
@Autowired
private WalletLogService walletLogService;
@ApiOperation(value = "分页获取预存款变动日志")
@GetMapping
public ResultMessage<IPage<WalletLog>> getByPage(PageVO page) {<FILL_FUNCTION_BODY>}
} |
//获取当前登录用户
AuthUser authUser = UserContext.getCurrentUser();
//构建查询 返回数据
IPage<WalletLog> depositLogPage = walletLogService.page(PageUtil.initPage(page),
new QueryWrapper<WalletLog>().eq("member_id", authUser.getId()).orderByDesc("create_time"));
return ResultUti... | 88 | 104 | 192 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/init/EsGoodsIndexInitRunner.java | EsGoodsIndexInitRunner | run | class EsGoodsIndexInitRunner implements ApplicationRunner {
@Autowired
private EsGoodsIndexService esGoodsIndexService;
@Override
public void run(ApplicationArguments args) {<FILL_FUNCTION_BODY>}
} |
try {
esGoodsIndexService.initIndex();
} catch (Exception e) {
log.error("检测ES商品索引失败", e);
}
| 64 | 45 | 109 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/security/BuyerAuthenticationFilter.java | BuyerAuthenticationFilter | getAuthentication | class BuyerAuthenticationFilter extends BasicAuthenticationFilter {
/**
* 缓存
*/
@Autowired
private Cache cache;
/**
* 自定义构造器
*
* @param authenticationManager
* @param cache
*/
public BuyerAuthenticationFilter(AuthenticationManager authenticationManager,
... |
try {
Claims claims
= Jwts.parser()
.setSigningKey(SecretKeyUtil.generalKeyByDecoders())
.parseClaimsJws(jwt).getBody();
//获取存储在claims中的用户信息
String json = claims.get(SecurityEnum.USER_CONTEXT.getValue()).toString()... | 379 | 358 | 737 | <no_super_class> |
lilishop_lilishop | lilishop/buyer-api/src/main/java/cn/lili/security/BuyerSecurityConfig.java | BuyerSecurityConfig | configure | class BuyerSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* 忽略验权配置
*/
@Autowired
private IgnoredUrlsProperties ignoredUrlsProperties;
/**
* spring security -》 权限不足处理
*/
@Autowired
private CustomAccessDeniedHandler accessDeniedHandler;
@Autowired
private ... |
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
.authorizeRequests();
//配置的url 不需要授权
for (String url : ignoredUrlsProperties.getUrls()) {
registry.antMatchers(url).permitAll();
}
registry
... | 137 | 320 | 457 | <no_super_class> |
lilishop_lilishop | lilishop/common-api/src/main/java/cn/lili/controller/common/FileController.java | FileController | delete | class FileController {
@Autowired
private FileService fileService;
@Autowired
private Cache cache;
@ApiOperation(value = "获取自己的图片资源")
@GetMapping
@ApiImplicitParam(name = "title", value = "名称模糊匹配")
public ResultMessage<IPage<File>> getFileList(@RequestHeader String accessToken, FileOw... |
AuthUser authUser = UserContext.getAuthUser(cache, accessToken);
fileService.batchDelete(ids, authUser);
return ResultUtil.success();
| 719 | 44 | 763 | <no_super_class> |
lilishop_lilishop | lilishop/common-api/src/main/java/cn/lili/controller/common/IMController.java | IMController | getUrl | class IMController {
@Autowired
private SettingService settingService;
@ApiOperation(value = "获取IM接口前缀")
@GetMapping
public ResultMessage<String> getUrl() {<FILL_FUNCTION_BODY>}
} |
String imUrl;
try {
Setting imSettingVal = settingService.get(SettingEnum.IM_SETTING.name());
ImSetting imSetting = JSONUtil.toBean(imSettingVal.getSettingValue(), ImSetting.class);
imUrl = imSetting.getHttpUrl();
} catch (Exception e) {
throw new... | 70 | 119 | 189 | <no_super_class> |
lilishop_lilishop | lilishop/common-api/src/main/java/cn/lili/controller/common/UploadController.java | UploadController | upload | class UploadController {
@Autowired
private FileService fileService;
@Autowired
private SettingService settingService;
@Autowired
private FilePluginFactory filePluginFactory;
@Autowired
private Cache cache;
@ApiOperation(value = "文件上传")
@PostMapping(value = "/file")
public ... |
AuthUser authUser = UserContext.getAuthUser(cache, accessToken);
//如果用户未登录,则无法上传图片
if (authUser == null) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
if (file == null) {
throw new ServiceException(ResultCode.FILE_NOT_EXIST_ERROR);
... | 141 | 890 | 1,031 | <no_super_class> |
lilishop_lilishop | lilishop/common-api/src/main/java/cn/lili/controller/security/CommonSecurityConfig.java | CommonSecurityConfig | configure | class CommonSecurityConfig extends WebSecurityConfigurerAdapter {
/**
* spring security -》 权限不足处理
*/
@Autowired
private CorsConfigurationSource corsConfigurationSource;
@Override
protected void configure(HttpSecurity http) throws Exception {<FILL_FUNCTION_BODY>}
} |
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = http
.authorizeRequests();
registry
.and()
//禁止网页iframe
.headers().frameOptions().disable()
.and()
.authorizeRequ... | 84 | 143 | 227 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/DistributionOrderExecute.java | DistributionOrderExecute | execute | class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDayExecute, AfterSaleStatusChangeEvent {
/**
* 分销订单
*/
@Autowired
private DistributionOrderService distributionOrderService;
@Autowired
private SettingService settingService;
@Override
public void orderChang... |
log.info("分销订单定时开始执行");
//设置结算天数(解冻日期)
Setting setting = settingService.get(SettingEnum.DISTRIBUTION_SETTING.name());
DistributionSetting distributionSetting = JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class);
//解冻时间
DateTime dateTime = new DateTime(... | 345 | 184 | 529 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/GoodsSkuExecute.java | GoodsSkuExecute | storeSettingChange | class GoodsSkuExecute implements GoodsCommentCompleteEvent, StoreSettingChangeEvent {
/**
* 商品
*/
@Autowired
private GoodsSkuService goodsSkuService;
@Autowired
private GoodsService goodsService;
@Autowired
private Cache cache;
@Override
public void goodsComment(MemberE... |
//修改数据后,清除商品索引
GoodsSearchParams goodsSearchParams = new GoodsSearchParams();
goodsSearchParams.setStoreId(store.getId());
List<String> goodsSkuKeys = new ArrayList<>();
for (GoodsSku goodsSku : goodsSkuService.getGoodsSkuByList(goodsSearchParams)) {
goodsSkuKeys.add... | 162 | 138 | 300 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/ImTalkExecute.java | ImTalkExecute | storeSettingChange | class ImTalkExecute implements MemberInfoChangeEvent, StoreSettingChangeEvent {
@Autowired
private ImTalkService imTalkService;
@Override
public void memberInfoChange(Member member) {
//当与UserId1相等时
List<ImTalk> imTalkList1 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTal... |
//当与UserId1相等时
List<ImTalk> imTalkList1 = imTalkService.list(new LambdaQueryWrapper<ImTalk>().eq(ImTalk::getUserId1, store.getId()));
for (ImTalk imTalk : imTalkList1) {
imTalk.setName1(store.getStoreName());
imTalk.setFace1(store.getStoreLogo());
}
imTal... | 332 | 250 | 582 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/MemberCouponExecute.java | MemberCouponExecute | orderChange | class MemberCouponExecute implements OrderStatusChangeEvent, AfterSaleStatusChangeEvent {
/**
* 订单
*/
@Autowired
private OrderService orderService;
@Autowired
private MemberCouponService memberCouponService;
@Override
public void orderChange(OrderMessage orderMessage) {<FILL_FUN... |
// 订单取消返还优惠券
if (orderMessage.getNewStatus() == OrderStatusEnum.CANCELLED) {
this.refundCoupon(orderMessage.getOrderSn());
}
| 372 | 56 | 428 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/MemberExecute.java | MemberExecute | memberConnectLogin | class MemberExecute implements MemberLoginEvent, MemberConnectLoginEvent {
@Autowired
private MemberService memberService;
@Autowired
private ConnectService connectService;
@Autowired
private SettingService settingService;
@Override
public void memberLogin(Member member) {
membe... |
//保存UnionID
if (StrUtil.isNotBlank(authUser.getToken().getUnionId())) {
connectService.loginBindUser(member.getId(), authUser.getToken().getUnionId(), authUser.getSource().name());
}
//保存OpenID
if (StrUtil.isNotBlank(authUser.getUuid())) {
SourceEnum sour... | 126 | 227 | 353 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/MemberExperienceExecute.java | MemberExperienceExecute | goodsComment | class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent {
/**
* 配置
*/
@Autowired
private SettingService settingService;
/**
* 会员
*/
@Autowired
private MemberService memberService;
/**
* 订单
*/
@Autowire... |
//获取经验值设置
ExperienceSetting experienceSetting = getExperienceSetting();
//赠送会员经验值
memberService.updateMemberPoint(Long.valueOf(experienceSetting.getComment().longValue()), PointTypeEnum.INCREASE.name(), memberEvaluation.getMemberId(), "会员评价,赠送经验值" + experienceSetting.getComment());
| 590 | 88 | 678 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/MemberPointExecute.java | MemberPointExecute | memberRegister | class MemberPointExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent, AfterSaleStatusChangeEvent {
/**
* 配置
*/
@Autowired
private SettingService settingService;
/**
* 会员
*/
@Autowired
private MemberService memberService;
/**
* 订... |
//获取积分设置
PointSetting pointSetting = getPointSetting();
//赠送会员积分
memberService.updateMemberPoint(pointSetting.getRegister().longValue(), PointTypeEnum.INCREASE.name(), member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
| 1,136 | 81 | 1,217 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/MemberWalletExecute.java | MemberWalletExecute | memberWithdrawal | class MemberWalletExecute implements MemberWithdrawalEvent {
@Autowired
private MemberWalletService memberWalletService;
@Override
public void memberWithdrawal(MemberWithdrawalMessage memberWithdrawalMessage) {<FILL_FUNCTION_BODY>}
} |
switch (WithdrawStatusEnum.valueOf(memberWithdrawalMessage.getStatus())) {
case VIA_AUDITING:
memberWalletService.withdrawal(memberWithdrawalMessage.getMemberWithdrawApplyId());
break;
case SUCCESS:
//提现成功扣减冻结金额
memberWalle... | 69 | 365 | 434 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/OrderStatusHandlerExecute.java | OrderStatusHandlerExecute | afterSaleStatusChange | class OrderStatusHandlerExecute implements TradeEvent, AfterSaleStatusChangeEvent {
@Autowired
private TradeService tradeService;
@Autowired
private OrderItemService orderItemService;
@Autowired
private OrderService orderService;
@Override
public void orderCreate(TradeDTO tradeDTO) {
... |
Order order = orderService.getBySn(afterSale.getOrderSn());
OrderItem orderItem = orderItemService.getBySn(afterSale.getOrderItemSn());
if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) {
if (orderItem.getReturnGoodsNumber().equals(orderItem.getNum())) {... | 208 | 354 | 562 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/StoreChangeEvent.java | StoreChangeEvent | storeSettingChange | class StoreChangeEvent implements StoreSettingChangeEvent {
/**
* 优惠券活动表
*/
@Autowired
private CouponActivityService couponActivityService;
/**
* 砍价活动商品
*/
@Autowired
private KanjiaActivityGoodsService kanjiaActivityGoodsService;
/**
* 积分商品
*/
@Autowired
... |
UpdateWrapper updateWrapper = new UpdateWrapper<>()
.eq("store_id", store.getId())
.set("store_name", store.getStoreName());
//修改会员优惠券中店铺名称
memberCouponService.update(updateWrapper);
//修改优惠券活动中店铺名称
couponActivityService.update(updateWrapper);
... | 747 | 564 | 1,311 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/event/impl/VerificationOrderExecute.java | VerificationOrderExecute | orderChange | class VerificationOrderExecute implements OrderStatusChangeEvent {
@Autowired
private OrderService orderService;
@Autowired
private OrderItemService orderItemService;
@Override
public void orderChange(OrderMessage orderMessage) {<FILL_FUNCTION_BODY>}
/**
* 获取随机数
* 判断当前店铺下是否使用验证码,... |
//订单状态为待核验,添加订单添加核验码
if (orderMessage.getNewStatus().equals(OrderStatusEnum.TAKE) || orderMessage.getNewStatus().equals(OrderStatusEnum.STAY_PICKED_UP)) {
//获取订单信息
Order order = orderService.getBySn(orderMessage.getOrderSn());
//获取随机数,判定是否存在
String code =... | 278 | 282 | 560 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/listener/AfterSaleMessageListener.java | AfterSaleMessageListener | onMessage | class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
/**
* 售后订单状态
*/
@Autowired
private List<AfterSaleStatusChangeEvent> afterSaleStatusChangeEvents;
@Override
public void onMessage(MessageExt messageExt) {<FILL_FUNCTION_BODY>}
} |
if (AfterSaleTagsEnum.valueOf(messageExt.getTags()) == AfterSaleTagsEnum.AFTER_SALE_STATUS_CHANGE) {
for (AfterSaleStatusChangeEvent afterSaleStatusChangeEvent : afterSaleStatusChangeEvents) {
try {
AfterSale afterSale = JSONUtil.toBean(new String(messageExt.getB... | 91 | 189 | 280 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/listener/MemberMessageListener.java | MemberMessageListener | onMessage | class MemberMessageListener implements RocketMQListener<MessageExt> {
/**
* 会员签到
*/
@Autowired
private MemberSignService memberSignService;
/**
* 会员积分变化
*/
@Autowired
private List<MemberPointChangeEvent> memberPointChangeEvents;
/**
* 会员提现
*/
@Autowired
... |
switch (MemberTagsEnum.valueOf(messageExt.getTags())) {
//会员注册
case MEMBER_REGISTER:
for (MemberRegisterEvent memberRegisterEvent : memberSignEvents) {
try {
Member member = JSONUtil.toBean(new String(messageExt.getBody()), Mem... | 254 | 1,020 | 1,274 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/listener/NoticeSendMessageListener.java | NoticeSendMessageListener | saveMemberMessage | class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
/**
* 短信
*/
@Autowired
private SmsUtil smsUtil;
/**
* 店铺消息
*/
@Autowired
private StoreMessageService storeMessageService;
/**
* 会员消息
*/
@Autowired
private MemberMessageService mem... |
List<MemberMessage> list = new ArrayList<>();
//如果是给所有会员发送消息
if ("ALL".equals(message.getMessageRange())) {
//查询所有会员总数,因为会员总数比较大 如果一次性查出来会占用数据库资源,所以要分页查询
MemberSearchVO memberSearchVO = new MemberSearchVO();
memberSearchVO.setDisabled(SwitchEnum.OPEN.name());... | 1,008 | 593 | 1,601 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/TimedTaskJobHandler.java | TimedTaskJobHandler | everyMinuteExecute | class TimedTaskJobHandler {
@Autowired(required = false)
private List<EveryMinuteExecute> everyMinuteExecutes;
@Autowired(required = false)
private List<EveryHourExecute> everyHourExecutes;
@Autowired(required = false)
private List<EveryDayExecute> everyDayExecutes;
/**
* 每分钟任务
... |
log.info("每分钟任务执行");
if (everyMinuteExecutes == null || everyMinuteExecutes.size() == 0) {
return ReturnT.SUCCESS;
}
for (int i = 0; i < everyMinuteExecutes.size(); i++) {
try {
everyMinuteExecutes.get(i).execute();
} catch (Exception... | 530 | 131 | 661 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/config/XxlJobConfig.java | XxlJobConfig | xxlJobExecutor | class XxlJobConfig {
private final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses:}")
private String adminAddresses;
@Value("${xxl.job.accessToken:}")
private String accessToken;
@Value("${xxl.job.executor.appname}")
private String appname;
... |
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setAddress(address);
xxlJobSpri... | 481 | 188 | 669 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/bill/BillExecute.java | BillExecute | execute | class BillExecute implements EveryDayExecute {
/**
* 结算单
*/
@Autowired
private BillService billService;
/**
* 店铺详情
*/
@Autowired
private StoreDetailService storeDetailService;
/**
* 1.查询今日待结算的商家
* 2.查询商家上次结算日期,生成本次结算单
* 3.记录商家结算日
*/
@Override
... |
//获取当前天数
int day = DateUtil.date().dayOfMonth();
//获取待结算商家列表
List<StoreSettlementDay> storeList = storeDetailService.getSettlementStore(day);
//获取当前时间
DateTime endTime = DateUtil.date();
//批量商家结算
for (StoreSettlementDay storeSettlementDay : storeList) ... | 149 | 190 | 339 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/coupon/CouponExecute.java | CouponExecute | execute | class CouponExecute implements EveryDayExecute {
/**
* 过期常量,过期后或者使用后一定时间内,删除无效的优惠券,物理删除
*/
static final int EXPIRATION_DAY = 3;
@Autowired
private MemberCouponService memberCouponService;
/**
* 检测优惠券的使用时间,超期未使用则失效
* 此方法用于领取*天后失效优惠券使用
*/
@Override
public void execu... |
//将过期优惠券变更为过期状态
LambdaUpdateWrapper<MemberCoupon> updateWrapper = new LambdaUpdateWrapper<MemberCoupon>()
.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name())
.le(MemberCoupon::getEndTime, new Date())
.set(MemberCoupon::getMemberCou... | 151 | 289 | 440 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/goods/GoodsExecute.java | GoodsExecute | execute | class GoodsExecute implements EveryDayExecute {
/**
* 会员评价
*/
@Autowired
private MemberEvaluationService memberEvaluationService;
/**
* 商品
*/
@Autowired
private GoodsService goodsService;
/**
* 查询已上架的商品的评价数量并赋值
*/
@Override
public void execute() {<FILL_... |
//查询上次统计到本次的评价数量
List<Map<String, Object>> list = memberEvaluationService.memberEvaluationNum(DateUtil.yesterday(), new DateTime());
for (Map<String, Object> map : list) {
goodsService.addGoodsCommentNum(Convert.toInt(map.get("num").toString()), map.get("goods_id").toString());
... | 115 | 103 | 218 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/hotwords/HotWordsEveryDayTaskExecute.java | HotWordsEveryDayTaskExecute | execute | class HotWordsEveryDayTaskExecute implements EveryDayExecute {
@Autowired
private Cache cache;
@Autowired
private HotWordsHistoryService hotWordsHistoryService;
@Autowired
private SettingService settingService;
/**
* 执行每日任务
*/
@Override
public void execute() {<FILL_FUNCT... |
//获取大于0分的热词
Set<DefaultTypedTuple> tuples = cache.zRangeByScore(CachePrefix.HOT_WORD.getPrefix(), 1, Integer.MAX_VALUE);
//如果任务不为空
if (!CollectionUtils.isEmpty(tuples)) {
//因为是第二天统计第一天的数据,所以这里获取昨天凌晨的时间
Calendar calendar = Calendar.getInstance();
cale... | 102 | 546 | 648 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/order/RechargeOrderTaskExecute.java | RechargeOrderTaskExecute | execute | class RechargeOrderTaskExecute implements EveryMinuteExecute {
/**
* 充值
*/
@Autowired
private RechargeService rechargeService;
/**
* 设置
*/
@Autowired
private SettingService settingService;
@Override
public void execute() {<FILL_FUNCTION_BODY>}
} |
Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name());
OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class);
if (orderSetting != null && orderSetting.getAutoCancel() != null) {
//充值订单自动取消时间 = 当前时间 - 自动取消时间分钟数
DateTim... | 93 | 275 | 368 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/promotion/MemberCouponSignEverydayExecute.java | MemberCouponSignEverydayExecute | execute | class MemberCouponSignEverydayExecute implements EveryDayExecute {
@Autowired
private MemberCouponSignService memberCouponSignService;
/**
* 将已过期的促销活动置为结束
*/
@Override
public void execute() {<FILL_FUNCTION_BODY>}
} |
try {
memberCouponSignService.clean();
} catch (Exception e) {
log.error("清除领取优惠券标记异常", e);
}
| 85 | 49 | 134 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/MemberStatisticsExecute.java | MemberStatisticsExecute | execute | class MemberStatisticsExecute implements EveryDayExecute {
/**
* 会员统计
*/
@Autowired
private MemberStatisticsService memberStatisticsService;
@Override
public void execute() {<FILL_FUNCTION_BODY>}
} |
try {
//统计的时间(开始。结束时间)
Date startTime, endTime;
//初始值
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 1);
calendar.set(Calendar.MINUTE, 0);
calendar.... | 68 | 321 | 389 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/statistics/OnlineMemberStatistics.java | OnlineMemberStatistics | execute | class OnlineMemberStatistics implements EveryHourExecute {
/**
* 缓存
*/
@Autowired
private Cache<List<OnlineMemberVO>> cache;
/**
* 统计小时
*/
@Autowired
private StatisticsProperties statisticsProperties;
@Override
public void execute() {<FILL_FUNCTION_BODY>}
/**... |
Calendar calendar = Calendar.getInstance();
List<OnlineMemberVO> onlineMemberVOS = cache.get(CachePrefix.ONLINE_MEMBER.getPrefix());
if (onlineMemberVOS == null) {
onlineMemberVOS = new ArrayList<>();
}
//过滤 有效统计时间
calendar.set(Calendar.HOUR_OF_DAY, calen... | 424 | 462 | 886 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/store/StoreExecute.java | StoreExecute | execute | class StoreExecute implements EveryDayExecute {
/**
* 店铺
*/
@Autowired
private StoreService storeService;
@Autowired
private GoodsSkuService goodsSkuService;
@Override
public void execute() {<FILL_FUNCTION_BODY>}
} |
//获取所有开启的店铺
List<Store> storeList = storeService.list(new LambdaQueryWrapper<Store>().eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name()));
for (Store store : storeList) {
try {
Long num = goodsSkuService.countSkuNum(store.getId());
storeService.... | 81 | 145 | 226 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/store/StoreRatingExecute.java | StoreRatingExecute | execute | class StoreRatingExecute implements EveryDayExecute {
/**
* 店铺
*/
@Autowired
private StoreService storeService;
/**
* 会员评价
*/
@Autowired
private MemberEvaluationService memberEvaluationService;
@Override
public void execute() {<FILL_FUNCTION_BODY>}
} |
//获取所有开启的店铺
List<Store> storeList = storeService.list(new LambdaQueryWrapper<Store>().eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name()));
for (Store store : storeList) {
//店铺所有开启的评价
StoreRatingVO storeRatingVO = memberEvaluationService.getStoreRatingVO(store.getId(... | 94 | 260 | 354 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/timetask/handler/impl/view/PageViewStatisticsExecute.java | PageViewStatisticsExecute | filterKeys | class PageViewStatisticsExecute implements EveryDayExecute {
/**
* 缓存
*/
@Autowired
private Cache cache;
/**
* 平台PV统计
*/
@Autowired
private PlatformViewService platformViewService;
@Override
public void execute() {
//1、缓存keys 模糊匹配
//2、过滤今日的数据,即今天只能统计... |
//只统计一天前的数据
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, -24);
List<String> result = new ArrayList<>();
for (String key : keys) {
PageViewStatistics temp = new PageViewStatistics(key);
//如果需要统计,则将key写入集合
if ... | 1,257 | 131 | 1,388 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/trigger/TimeTriggerConsumer.java | TimeTriggerConsumer | onMessage | class TimeTriggerConsumer implements RocketMQListener<TimeTriggerMsg> {
@Autowired
private Cache<Integer> cache;
@Override
public void onMessage(TimeTriggerMsg timeTriggerMsg) {<FILL_FUNCTION_BODY>}
} |
try {
String key = DelayQueueTools.generateKey(timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getTriggerTime(), timeTriggerMsg.getUniqueKey());
if (cache.get(key) == null) {
log.info("执行器执行被取消:{} | 任务标识:{}", timeTriggerMsg.getTriggerExecutor(), timeTriggerMsg.getUn... | 71 | 252 | 323 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/trigger/executor/BroadcastTimeTriggerExecutor.java | BroadcastTimeTriggerExecutor | execute | class BroadcastTimeTriggerExecutor implements TimeTriggerExecutor {
@Autowired
private StudioService studioService;
@Override
public void execute(Object object) {<FILL_FUNCTION_BODY>}
} |
//直播间订单消息
BroadcastMessage broadcastMessage = JSONUtil.toBean(JSONUtil.parseObj(object), BroadcastMessage.class);
if (broadcastMessage != null && broadcastMessage.getStudioId() != null) {
log.info("直播间消费:{}", broadcastMessage);
//修改直播间状态
studioService.updateS... | 59 | 106 | 165 | <no_super_class> |
lilishop_lilishop | lilishop/consumer/src/main/java/cn/lili/trigger/executor/PromotionTimeTriggerExecutor.java | PromotionTimeTriggerExecutor | execute | class PromotionTimeTriggerExecutor implements TimeTriggerExecutor {
/**
* 订单
*/
@Autowired
private OrderService orderService;
@Autowired
private PintuanService pintuanService;
@Override
public void execute(Object object) {<FILL_FUNCTION_BODY>}
} |
//拼团订单消息
PintuanOrderMessage pintuanOrderMessage = JSONUtil.toBean(JSONUtil.parseObj(object), PintuanOrderMessage.class);
if (pintuanOrderMessage != null && pintuanOrderMessage.getPintuanId() != null) {
log.info("拼团订单信息消费:{}", pintuanOrderMessage);
//拼团订单自动处理
... | 89 | 227 | 316 | <no_super_class> |
lilishop_lilishop | lilishop/framework/src/main/java/cn/lili/cache/config/redis/RedisConfig.java | RedisConfig | errorHandler | class RedisConfig extends CachingConfigurerSupport {
private static final String REDIS_PREFIX = "redis://";
@Value("${lili.cache.timeout:7200}")
private Integer timeout;
/**
* 当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
*
* @param connectionFactory 链接工厂
* @return 缓存
*/
@Be... |
//异常处理,当Redis发生异常时,打印日志,但是程序正常走
log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
return new CacheErrorHandler() {
@Override
public void handleCacheGetError(RuntimeException e, Cache cache, Object key) {
log.error("Redis occur handleCacheGetError:key ->... | 1,587 | 277 | 1,864 | <no_super_class> |
lilishop_lilishop | lilishop/framework/src/main/java/cn/lili/cache/limit/interceptor/LimitInterceptor.java | LimitInterceptor | interceptor | class LimitInterceptor {
private RedisTemplate<String, Serializable> redisTemplate;
private DefaultRedisScript<Long> limitScript;
@Autowired
public void setRedisTemplate(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
@Autowired
public void setLimitScript(Defa... |
LimitTypeEnums limitTypeEnums = limitPointAnnotation.limitType();
String key;
int limitPeriod = limitPointAnnotation.period();
int limitCount = limitPointAnnotation.limit();
if (limitTypeEnums == LimitTypeEnums.CUSTOMER) {
key = limitPointAnnotation.key();
}... | 160 | 360 | 520 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.