blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
93046a29b65902f405c36f319f531e114a0b1f24 | 11,269,994,215,929 | 5a2116bb2b86176de0b5a522db74a94c3ddc911d | /app/src/main/java/com/example/randomwordgenerator/SpeechPart.java | 0aa86b9a36e4af7d033373266ad73964ea1cb887 | []
| no_license | Bayohazard/Random_Word_Generator | https://github.com/Bayohazard/Random_Word_Generator | a8f79120905ecda0cc3b0490b82aad737ceb1761 | 77bfbd3e91060eb12f48648671b0a2b975856605 | refs/heads/master | 2020-08-22T17:08:38.079000 | 2019-10-21T00:01:46 | 2019-10-21T00:01:46 | 216,444,156 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.randomwordgenerator;
public enum SpeechPart { NOUN, VERB, ADJECTIVE, ADVERB }
| UTF-8 | Java | 99 | java | SpeechPart.java | Java | []
| null | []
| package com.example.randomwordgenerator;
public enum SpeechPart { NOUN, VERB, ADJECTIVE, ADVERB }
| 99 | 0.79798 | 0.79798 | 3 | 32 | 23.551363 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 0 |
aafb32aff8b982d31a9df4a0eff60626c85b365b | 14,886,356,699,382 | 197a30e9de19a54ff8ec0e5904fc63d9f8e21ef4 | /thrift0.13/src/main/java/com/linecorp/armeria/internal/server/thrift/ThriftDocServicePlugin.java | 5052fa06e15a09a03e4fd0392eda5b626d0fb6bb | [
"Apache-2.0",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"EPL-1.0",
"Classpath-exception-2.0",
"LGPL-2.1-only",
"BSD-3-Clause",
"WTFPL",
"GPL-2.0-only",
"CDDL-1.0",
"MIT",
"CC0-1.0",
"JSON"
]
| permissive | hyangtack/armeria | https://github.com/hyangtack/armeria | c6a6c5559d89e5a29d4b188617f68b3eeae3248b | b74ea1be5c0f837124bab993a9218dccf5345eb3 | refs/heads/master | 2022-02-07T18:24:55.147000 | 2021-09-23T09:34:07 | 2021-09-23T09:34:07 | 48,430,251 | 2 | 1 | Apache-2.0 | true | 2018-11-12T01:09:24 | 2015-12-22T12:16:46 | 2018-11-10T01:20:41 | 2018-11-12T01:09:24 | 52,929 | 1 | 1 | 0 | Java | false | null | /*
* Copyright 2017 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.linecorp.armeria.internal.server.thrift;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.util.Objects.requireNonNull;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.thrift.TBase;
import org.apache.thrift.TEnum;
import org.apache.thrift.TException;
import org.apache.thrift.TFieldIdEnum;
import org.apache.thrift.TFieldRequirementType;
import org.apache.thrift.TSerializer;
import org.apache.thrift.meta_data.EnumMetaData;
import org.apache.thrift.meta_data.FieldMetaData;
import org.apache.thrift.meta_data.FieldValueMetaData;
import org.apache.thrift.meta_data.ListMetaData;
import org.apache.thrift.meta_data.MapMetaData;
import org.apache.thrift.meta_data.SetMetaData;
import org.apache.thrift.meta_data.StructMetaData;
import org.apache.thrift.protocol.TType;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.annotation.Nullable;
import com.linecorp.armeria.common.thrift.ThriftProtocolFactories;
import com.linecorp.armeria.server.Route;
import com.linecorp.armeria.server.RoutePathType;
import com.linecorp.armeria.server.Service;
import com.linecorp.armeria.server.ServiceConfig;
import com.linecorp.armeria.server.docs.DocServiceFilter;
import com.linecorp.armeria.server.docs.DocServicePlugin;
import com.linecorp.armeria.server.docs.EndpointInfo;
import com.linecorp.armeria.server.docs.EnumInfo;
import com.linecorp.armeria.server.docs.EnumValueInfo;
import com.linecorp.armeria.server.docs.ExceptionInfo;
import com.linecorp.armeria.server.docs.FieldInfo;
import com.linecorp.armeria.server.docs.FieldRequirement;
import com.linecorp.armeria.server.docs.MethodInfo;
import com.linecorp.armeria.server.docs.NamedTypeInfo;
import com.linecorp.armeria.server.docs.ServiceInfo;
import com.linecorp.armeria.server.docs.ServiceSpecification;
import com.linecorp.armeria.server.docs.StructInfo;
import com.linecorp.armeria.server.docs.TypeSignature;
import com.linecorp.armeria.server.thrift.THttpService;
/**
* {@link DocServicePlugin} implementation that supports {@link THttpService}s.
*/
public final class ThriftDocServicePlugin implements DocServicePlugin {
private static final String REQUEST_STRUCT_SUFFIX = "_args";
private static final TypeSignature VOID = TypeSignature.ofBase("void");
private static final TypeSignature BOOL = TypeSignature.ofBase("bool");
private static final TypeSignature I8 = TypeSignature.ofBase("i8");
private static final TypeSignature I16 = TypeSignature.ofBase("i16");
private static final TypeSignature I32 = TypeSignature.ofBase("i32");
private static final TypeSignature I64 = TypeSignature.ofBase("i64");
private static final TypeSignature DOUBLE = TypeSignature.ofBase("double");
private static final TypeSignature STRING = TypeSignature.ofBase("string");
private static final TypeSignature BINARY = TypeSignature.ofBase("binary");
@Nullable
private static final MethodHandle legacyTSerializerToString;
static {
MethodHandle methodHandle = null;
try {
methodHandle =
MethodHandles.publicLookup()
.findVirtual(TSerializer.class, "toString",
MethodType.methodType(String.class, TBase.class, String.class));
} catch (NoSuchMethodException | IllegalAccessException e) {
// Use TSerializer.toString(TBase) instead.
}
legacyTSerializerToString = methodHandle;
}
private final ThriftDocStringExtractor docstringExtractor = new ThriftDocStringExtractor();
// Methods related with generating a service specification.
@Override
public String name() {
return "thrift";
}
@Override
public Set<Class<? extends Service<?, ?>>> supportedServiceTypes() {
return ImmutableSet.of(THttpService.class);
}
@Override
public ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConfigs,
DocServiceFilter filter) {
requireNonNull(serviceConfigs, "serviceConfigs");
requireNonNull(filter, "filter");
final Map<Class<?>, EntryBuilder> map = new LinkedHashMap<>();
for (ServiceConfig c : serviceConfigs) {
final THttpService service = c.service().as(THttpService.class);
assert service != null;
service.entries().forEach((serviceName, entry) -> {
for (Class<?> iface : entry.interfaces()) {
final Class<?> serviceClass = iface.getEnclosingClass();
final EntryBuilder builder =
map.computeIfAbsent(serviceClass, cls -> new EntryBuilder(serviceClass));
// Add all available endpoints. Accept only the services with exact and prefix path
// mappings, whose endpoint path can be determined.
final Route route = c.route();
final RoutePathType pathType = route.pathType();
if (pathType == RoutePathType.EXACT || pathType == RoutePathType.PREFIX) {
builder.endpoint(
EndpointInfo.builder(c.virtualHost().hostnamePattern(), route.paths().get(0))
.fragment(serviceName)
.defaultFormat(service.defaultSerializationFormat())
.availableFormats(service.supportedSerializationFormats())
.build());
}
}
});
}
final List<Entry> entries = map.values().stream()
.map(EntryBuilder::build)
.collect(Collectors.toList());
return generate(entries, filter);
}
@VisibleForTesting
public ServiceSpecification generate(List<Entry> entries, DocServiceFilter filter) {
final List<ServiceInfo> services =
entries.stream()
.map(e -> newServiceInfo(e.serviceType, e.endpointInfos, filter))
.filter(Objects::nonNull)
.collect(toImmutableList());
return ServiceSpecification.generate(services, ThriftDocServicePlugin::newNamedTypeInfo);
}
@VisibleForTesting
@Nullable
ServiceInfo newServiceInfo(Class<?> serviceClass, Iterable<EndpointInfo> endpoints,
DocServiceFilter filter) {
requireNonNull(serviceClass, "serviceClass");
final String name = serviceClass.getName();
final ClassLoader serviceClassLoader = serviceClass.getClassLoader();
final String interfaceClassName = name + "$Iface";
final Class<?> interfaceClass;
try {
interfaceClass = Class.forName(interfaceClassName, false, serviceClassLoader);
} catch (ClassNotFoundException e) {
throw new IllegalStateException("failed to find a class: " + interfaceClassName, e);
}
final Method[] methods = interfaceClass.getDeclaredMethods();
final List<MethodInfo> methodInfos = Arrays.stream(methods)
.map(m -> newMethodInfo(m, endpoints, filter))
.filter(Objects::nonNull)
.collect(toImmutableList());
if (methodInfos.isEmpty()) {
return null;
}
return new ServiceInfo(name, methodInfos);
}
@Nullable
private MethodInfo newMethodInfo(Method method, Iterable<EndpointInfo> endpoints,
DocServiceFilter filter) {
final String methodName = method.getName();
final Class<?> serviceClass = method.getDeclaringClass().getDeclaringClass();
final String serviceName = serviceClass.getName();
if (!filter.test(name(), serviceName, methodName)) {
return null;
}
final ClassLoader classLoader = serviceClass.getClassLoader();
final String argsClassName = serviceName + '$' + methodName + "_args";
final Class<? extends TBase<?, ?>> argsClass;
try {
@SuppressWarnings("unchecked")
final Class<? extends TBase<?, ?>> argsClass0 =
(Class<? extends TBase<?, ?>>) Class.forName(argsClassName, false, classLoader);
argsClass = argsClass0;
} catch (ClassNotFoundException e) {
throw new IllegalStateException("failed to find a class: " + argsClassName, e);
}
Class<?> resultClass;
try {
resultClass = Class.forName(serviceName + '$' + methodName + "_result", false, classLoader);
} catch (ClassNotFoundException ignored) {
// Oneway function does not have a result type.
resultClass = null;
}
@SuppressWarnings("unchecked")
final MethodInfo methodInfo =
newMethodInfo(methodName, argsClass,
(Class<? extends TBase<?, ?>>) resultClass,
(Class<? extends TException>[]) method.getExceptionTypes(),
endpoints);
return methodInfo;
}
private static MethodInfo newMethodInfo(String name,
Class<? extends TBase<?, ?>> argsClass,
@Nullable Class<? extends TBase<?, ?>> resultClass,
Class<? extends TException>[] exceptionClasses,
Iterable<EndpointInfo> endpoints) {
requireNonNull(name, "name");
requireNonNull(argsClass, "argsClass");
requireNonNull(exceptionClasses, "exceptionClasses");
requireNonNull(endpoints, "endpoints");
final List<FieldInfo> parameters =
FieldMetaData.getStructMetaDataMap(argsClass).values().stream()
.map(fieldMetaData -> newFieldInfo(argsClass, fieldMetaData))
.collect(toImmutableList());
// Find the 'success' field.
FieldInfo fieldInfo = null;
if (resultClass != null) { // Function isn't "oneway" function
final Map<? extends TFieldIdEnum, FieldMetaData> resultMetaData =
FieldMetaData.getStructMetaDataMap(resultClass);
for (FieldMetaData fieldMetaData : resultMetaData.values()) {
if ("success".equals(fieldMetaData.fieldName)) {
fieldInfo = newFieldInfo(resultClass, fieldMetaData);
break;
}
}
}
final TypeSignature returnTypeSignature;
if (fieldInfo == null) {
returnTypeSignature = VOID;
} else {
returnTypeSignature = fieldInfo.typeSignature();
}
final List<TypeSignature> exceptionTypeSignatures =
Arrays.stream(exceptionClasses)
.filter(e -> e != TException.class)
.map(TypeSignature::ofNamed)
.collect(toImmutableList());
return new MethodInfo(name, returnTypeSignature, parameters, exceptionTypeSignatures, endpoints,
ImmutableList.of(),
ImmutableList.of(),
ImmutableList.of(),
ImmutableList.of(),
HttpMethod.POST, null);
}
private static NamedTypeInfo newNamedTypeInfo(TypeSignature typeSignature) {
final Class<?> type = (Class<?>) typeSignature.namedTypeDescriptor();
if (type == null) {
throw new IllegalArgumentException("cannot create a named type from: " + typeSignature);
}
if (type.isEnum()) {
@SuppressWarnings("unchecked")
final Class<? extends Enum<? extends TEnum>> enumType =
(Class<? extends Enum<? extends TEnum>>) type;
return newEnumInfo(enumType);
}
if (TException.class.isAssignableFrom(type)) {
@SuppressWarnings("unchecked")
final Class<? extends TException> castType = (Class<? extends TException>) type;
return newExceptionInfo(castType);
}
assert TBase.class.isAssignableFrom(type);
@SuppressWarnings("unchecked")
final Class<? extends TBase<?, ?>> castType = (Class<? extends TBase<?, ?>>) type;
return newStructInfo(castType);
}
@VisibleForTesting
static StructInfo newStructInfo(Class<? extends TBase<?, ?>> structClass) {
final String name = structClass.getName();
final Map<?, FieldMetaData> metaDataMap = FieldMetaData.getStructMetaDataMap(structClass);
final List<FieldInfo> fields =
metaDataMap.values().stream()
.map(fieldMetaData -> newFieldInfo(structClass, fieldMetaData))
.collect(Collectors.toList());
return new StructInfo(name, fields);
}
@VisibleForTesting
static ExceptionInfo newExceptionInfo(Class<? extends TException> exceptionClass) {
requireNonNull(exceptionClass, "exceptionClass");
final String name = exceptionClass.getName();
List<FieldInfo> fields;
try {
@SuppressWarnings("unchecked")
final Map<?, FieldMetaData> metaDataMap =
(Map<?, FieldMetaData>) exceptionClass.getDeclaredField("metaDataMap").get(null);
fields = metaDataMap.values().stream()
.map(fieldMetaData -> newFieldInfo(exceptionClass, fieldMetaData))
.collect(toImmutableList());
} catch (IllegalAccessException e) {
throw new AssertionError("will not happen", e);
} catch (NoSuchFieldException ignored) {
fields = Collections.emptyList();
}
return new ExceptionInfo(name, fields);
}
@VisibleForTesting
static FieldInfo newFieldInfo(Class<?> parentType, FieldMetaData fieldMetaData) {
requireNonNull(fieldMetaData, "fieldMetaData");
final FieldValueMetaData fieldValueMetaData = fieldMetaData.valueMetaData;
final TypeSignature typeSignature;
if (fieldValueMetaData.isStruct() && fieldValueMetaData.isTypedef() &&
parentType.getSimpleName().equals(fieldValueMetaData.getTypedefName())) {
// Handle the special case where a struct field refers to itself,
// where the Thrift compiler handles it as a typedef.
typeSignature = TypeSignature.ofNamed(parentType);
} else {
typeSignature = toTypeSignature(fieldValueMetaData);
}
return FieldInfo.builder(fieldMetaData.fieldName, typeSignature)
.requirement(convertRequirement(fieldMetaData.requirementType)).build();
}
@VisibleForTesting
static TypeSignature toTypeSignature(FieldValueMetaData fieldValueMetaData) {
if (fieldValueMetaData instanceof StructMetaData) {
return TypeSignature.ofNamed(((StructMetaData) fieldValueMetaData).structClass);
}
if (fieldValueMetaData instanceof EnumMetaData) {
return TypeSignature.ofNamed(((EnumMetaData) fieldValueMetaData).enumClass);
}
if (fieldValueMetaData instanceof ListMetaData) {
return TypeSignature.ofList(toTypeSignature(((ListMetaData) fieldValueMetaData).elemMetaData));
}
if (fieldValueMetaData instanceof SetMetaData) {
return TypeSignature.ofSet(toTypeSignature(((SetMetaData) fieldValueMetaData).elemMetaData));
}
if (fieldValueMetaData instanceof MapMetaData) {
return TypeSignature.ofMap(toTypeSignature(((MapMetaData) fieldValueMetaData).keyMetaData),
toTypeSignature(((MapMetaData) fieldValueMetaData).valueMetaData));
}
if (fieldValueMetaData.isBinary()) {
return BINARY;
}
switch (fieldValueMetaData.type) {
case TType.VOID:
return VOID;
case TType.BOOL:
return BOOL;
case TType.BYTE:
return I8;
case TType.DOUBLE:
return DOUBLE;
case TType.I16:
return I16;
case TType.I32:
return I32;
case TType.I64:
return I64;
case TType.STRING:
return STRING;
}
final String unresolvedName;
if (fieldValueMetaData.isTypedef()) {
unresolvedName = fieldValueMetaData.getTypedefName();
} else {
unresolvedName = null;
}
return TypeSignature.ofUnresolved(firstNonNull(unresolvedName, "unknown"));
}
@VisibleForTesting
static EnumInfo newEnumInfo(Class<? extends Enum<? extends TEnum>> enumType) {
final List<EnumValueInfo> values = Arrays.stream(enumType.getEnumConstants())
.map(e -> new EnumValueInfo(e.name(), ((TEnum) e).getValue()))
.collect(toImmutableList());
return new EnumInfo(enumType.getTypeName(), values);
}
private static FieldRequirement convertRequirement(byte value) {
switch (value) {
case TFieldRequirementType.REQUIRED:
return FieldRequirement.REQUIRED;
case TFieldRequirementType.OPTIONAL:
return FieldRequirement.OPTIONAL;
case TFieldRequirementType.DEFAULT:
// Convert to unspecified for consistency with gRPC and AnnotatedService.
return FieldRequirement.UNSPECIFIED;
default:
throw new IllegalArgumentException("unknown requirement type: " + value);
}
}
@VisibleForTesting
public static final class Entry {
final Class<?> serviceType;
final List<EndpointInfo> endpointInfos;
Entry(Class<?> serviceType, List<EndpointInfo> endpointInfos) {
this.serviceType = serviceType;
this.endpointInfos = ImmutableList.copyOf(endpointInfos);
}
}
@VisibleForTesting
public static final class EntryBuilder {
private final Class<?> serviceType;
private final List<EndpointInfo> endpointInfos = new ArrayList<>();
public EntryBuilder(Class<?> serviceType) {
this.serviceType = requireNonNull(serviceType, "serviceType");
}
public EntryBuilder endpoint(EndpointInfo endpointInfo) {
endpointInfos.add(requireNonNull(endpointInfo, "endpointInfo"));
return this;
}
public Entry build() {
return new Entry(serviceType, endpointInfos);
}
}
// Methods related with extracting documentation strings.
@Override
public Map<String, String> loadDocStrings(Set<ServiceConfig> serviceConfigs) {
return serviceConfigs.stream()
.flatMap(c -> {
final THttpService service = c.service().as(THttpService.class);
assert service != null;
return service.entries().values().stream();
})
.flatMap(entry -> entry.interfaces().stream().map(Class::getClassLoader))
.flatMap(loader -> docstringExtractor.getAllDocStrings(loader)
.entrySet().stream())
.collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a));
}
// Methods related with serializing example requests.
@Override
public Set<Class<?>> supportedExampleRequestTypes() {
return ImmutableSet.of(TBase.class);
}
@Override
public String guessServiceName(Object exampleRequest) {
final TBase<?, ?> exampleTBase = asTBase(exampleRequest);
if (exampleTBase == null) {
return null;
}
return exampleTBase.getClass().getEnclosingClass().getName();
}
@Override
public String guessServiceMethodName(Object exampleRequest) {
final TBase<?, ?> exampleTBase = asTBase(exampleRequest);
if (exampleTBase == null) {
return null;
}
final String typeName = exampleTBase.getClass().getName();
return typeName.substring(typeName.lastIndexOf('$') + 1,
typeName.length() - REQUEST_STRUCT_SUFFIX.length());
}
@Override
public String serializeExampleRequest(String serviceName, String methodName,
Object exampleRequest) {
if (!(exampleRequest instanceof TBase)) {
return null;
}
final TBase<?, ?> exampleTBase = (TBase<?, ?>) exampleRequest;
try {
final TSerializer serializer = new TSerializer(ThriftProtocolFactories.TEXT);
if (legacyTSerializerToString != null) {
try {
return (String) legacyTSerializerToString.invoke(serializer, exampleTBase,
StandardCharsets.UTF_8.name());
} catch (Throwable ex) {
throw new IllegalStateException(
"Unexpected exception while serializing " + exampleTBase, ex);
}
} else {
// TSerializer.toString(TBase, charset) was removed in Thrift 0.14.0
return serializer.toString(exampleTBase);
}
} catch (TException e) {
throw new Error("should never reach here", e);
}
}
@Nullable
private static TBase<?, ?> asTBase(Object exampleRequest) {
final TBase<?, ?> exampleTBase = (TBase<?, ?>) exampleRequest;
final Class<?> type = exampleTBase.getClass();
if (!type.getName().endsWith(REQUEST_STRUCT_SUFFIX)) {
return null;
}
final Class<?> serviceType = type.getEnclosingClass();
if (serviceType == null) {
return null;
}
if (serviceType.getEnclosingClass() != null) {
return null;
}
return exampleTBase;
}
@Override
public String toString() {
return ThriftDocServicePlugin.class.getSimpleName();
}
}
| UTF-8 | Java | 24,177 | java | ThriftDocServicePlugin.java | Java | []
| null | []
| /*
* Copyright 2017 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.linecorp.armeria.internal.server.thrift;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.util.Objects.requireNonNull;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.thrift.TBase;
import org.apache.thrift.TEnum;
import org.apache.thrift.TException;
import org.apache.thrift.TFieldIdEnum;
import org.apache.thrift.TFieldRequirementType;
import org.apache.thrift.TSerializer;
import org.apache.thrift.meta_data.EnumMetaData;
import org.apache.thrift.meta_data.FieldMetaData;
import org.apache.thrift.meta_data.FieldValueMetaData;
import org.apache.thrift.meta_data.ListMetaData;
import org.apache.thrift.meta_data.MapMetaData;
import org.apache.thrift.meta_data.SetMetaData;
import org.apache.thrift.meta_data.StructMetaData;
import org.apache.thrift.protocol.TType;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.annotation.Nullable;
import com.linecorp.armeria.common.thrift.ThriftProtocolFactories;
import com.linecorp.armeria.server.Route;
import com.linecorp.armeria.server.RoutePathType;
import com.linecorp.armeria.server.Service;
import com.linecorp.armeria.server.ServiceConfig;
import com.linecorp.armeria.server.docs.DocServiceFilter;
import com.linecorp.armeria.server.docs.DocServicePlugin;
import com.linecorp.armeria.server.docs.EndpointInfo;
import com.linecorp.armeria.server.docs.EnumInfo;
import com.linecorp.armeria.server.docs.EnumValueInfo;
import com.linecorp.armeria.server.docs.ExceptionInfo;
import com.linecorp.armeria.server.docs.FieldInfo;
import com.linecorp.armeria.server.docs.FieldRequirement;
import com.linecorp.armeria.server.docs.MethodInfo;
import com.linecorp.armeria.server.docs.NamedTypeInfo;
import com.linecorp.armeria.server.docs.ServiceInfo;
import com.linecorp.armeria.server.docs.ServiceSpecification;
import com.linecorp.armeria.server.docs.StructInfo;
import com.linecorp.armeria.server.docs.TypeSignature;
import com.linecorp.armeria.server.thrift.THttpService;
/**
* {@link DocServicePlugin} implementation that supports {@link THttpService}s.
*/
public final class ThriftDocServicePlugin implements DocServicePlugin {
private static final String REQUEST_STRUCT_SUFFIX = "_args";
private static final TypeSignature VOID = TypeSignature.ofBase("void");
private static final TypeSignature BOOL = TypeSignature.ofBase("bool");
private static final TypeSignature I8 = TypeSignature.ofBase("i8");
private static final TypeSignature I16 = TypeSignature.ofBase("i16");
private static final TypeSignature I32 = TypeSignature.ofBase("i32");
private static final TypeSignature I64 = TypeSignature.ofBase("i64");
private static final TypeSignature DOUBLE = TypeSignature.ofBase("double");
private static final TypeSignature STRING = TypeSignature.ofBase("string");
private static final TypeSignature BINARY = TypeSignature.ofBase("binary");
@Nullable
private static final MethodHandle legacyTSerializerToString;
static {
MethodHandle methodHandle = null;
try {
methodHandle =
MethodHandles.publicLookup()
.findVirtual(TSerializer.class, "toString",
MethodType.methodType(String.class, TBase.class, String.class));
} catch (NoSuchMethodException | IllegalAccessException e) {
// Use TSerializer.toString(TBase) instead.
}
legacyTSerializerToString = methodHandle;
}
private final ThriftDocStringExtractor docstringExtractor = new ThriftDocStringExtractor();
// Methods related with generating a service specification.
@Override
public String name() {
return "thrift";
}
@Override
public Set<Class<? extends Service<?, ?>>> supportedServiceTypes() {
return ImmutableSet.of(THttpService.class);
}
@Override
public ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConfigs,
DocServiceFilter filter) {
requireNonNull(serviceConfigs, "serviceConfigs");
requireNonNull(filter, "filter");
final Map<Class<?>, EntryBuilder> map = new LinkedHashMap<>();
for (ServiceConfig c : serviceConfigs) {
final THttpService service = c.service().as(THttpService.class);
assert service != null;
service.entries().forEach((serviceName, entry) -> {
for (Class<?> iface : entry.interfaces()) {
final Class<?> serviceClass = iface.getEnclosingClass();
final EntryBuilder builder =
map.computeIfAbsent(serviceClass, cls -> new EntryBuilder(serviceClass));
// Add all available endpoints. Accept only the services with exact and prefix path
// mappings, whose endpoint path can be determined.
final Route route = c.route();
final RoutePathType pathType = route.pathType();
if (pathType == RoutePathType.EXACT || pathType == RoutePathType.PREFIX) {
builder.endpoint(
EndpointInfo.builder(c.virtualHost().hostnamePattern(), route.paths().get(0))
.fragment(serviceName)
.defaultFormat(service.defaultSerializationFormat())
.availableFormats(service.supportedSerializationFormats())
.build());
}
}
});
}
final List<Entry> entries = map.values().stream()
.map(EntryBuilder::build)
.collect(Collectors.toList());
return generate(entries, filter);
}
@VisibleForTesting
public ServiceSpecification generate(List<Entry> entries, DocServiceFilter filter) {
final List<ServiceInfo> services =
entries.stream()
.map(e -> newServiceInfo(e.serviceType, e.endpointInfos, filter))
.filter(Objects::nonNull)
.collect(toImmutableList());
return ServiceSpecification.generate(services, ThriftDocServicePlugin::newNamedTypeInfo);
}
@VisibleForTesting
@Nullable
ServiceInfo newServiceInfo(Class<?> serviceClass, Iterable<EndpointInfo> endpoints,
DocServiceFilter filter) {
requireNonNull(serviceClass, "serviceClass");
final String name = serviceClass.getName();
final ClassLoader serviceClassLoader = serviceClass.getClassLoader();
final String interfaceClassName = name + "$Iface";
final Class<?> interfaceClass;
try {
interfaceClass = Class.forName(interfaceClassName, false, serviceClassLoader);
} catch (ClassNotFoundException e) {
throw new IllegalStateException("failed to find a class: " + interfaceClassName, e);
}
final Method[] methods = interfaceClass.getDeclaredMethods();
final List<MethodInfo> methodInfos = Arrays.stream(methods)
.map(m -> newMethodInfo(m, endpoints, filter))
.filter(Objects::nonNull)
.collect(toImmutableList());
if (methodInfos.isEmpty()) {
return null;
}
return new ServiceInfo(name, methodInfos);
}
@Nullable
private MethodInfo newMethodInfo(Method method, Iterable<EndpointInfo> endpoints,
DocServiceFilter filter) {
final String methodName = method.getName();
final Class<?> serviceClass = method.getDeclaringClass().getDeclaringClass();
final String serviceName = serviceClass.getName();
if (!filter.test(name(), serviceName, methodName)) {
return null;
}
final ClassLoader classLoader = serviceClass.getClassLoader();
final String argsClassName = serviceName + '$' + methodName + "_args";
final Class<? extends TBase<?, ?>> argsClass;
try {
@SuppressWarnings("unchecked")
final Class<? extends TBase<?, ?>> argsClass0 =
(Class<? extends TBase<?, ?>>) Class.forName(argsClassName, false, classLoader);
argsClass = argsClass0;
} catch (ClassNotFoundException e) {
throw new IllegalStateException("failed to find a class: " + argsClassName, e);
}
Class<?> resultClass;
try {
resultClass = Class.forName(serviceName + '$' + methodName + "_result", false, classLoader);
} catch (ClassNotFoundException ignored) {
// Oneway function does not have a result type.
resultClass = null;
}
@SuppressWarnings("unchecked")
final MethodInfo methodInfo =
newMethodInfo(methodName, argsClass,
(Class<? extends TBase<?, ?>>) resultClass,
(Class<? extends TException>[]) method.getExceptionTypes(),
endpoints);
return methodInfo;
}
private static MethodInfo newMethodInfo(String name,
Class<? extends TBase<?, ?>> argsClass,
@Nullable Class<? extends TBase<?, ?>> resultClass,
Class<? extends TException>[] exceptionClasses,
Iterable<EndpointInfo> endpoints) {
requireNonNull(name, "name");
requireNonNull(argsClass, "argsClass");
requireNonNull(exceptionClasses, "exceptionClasses");
requireNonNull(endpoints, "endpoints");
final List<FieldInfo> parameters =
FieldMetaData.getStructMetaDataMap(argsClass).values().stream()
.map(fieldMetaData -> newFieldInfo(argsClass, fieldMetaData))
.collect(toImmutableList());
// Find the 'success' field.
FieldInfo fieldInfo = null;
if (resultClass != null) { // Function isn't "oneway" function
final Map<? extends TFieldIdEnum, FieldMetaData> resultMetaData =
FieldMetaData.getStructMetaDataMap(resultClass);
for (FieldMetaData fieldMetaData : resultMetaData.values()) {
if ("success".equals(fieldMetaData.fieldName)) {
fieldInfo = newFieldInfo(resultClass, fieldMetaData);
break;
}
}
}
final TypeSignature returnTypeSignature;
if (fieldInfo == null) {
returnTypeSignature = VOID;
} else {
returnTypeSignature = fieldInfo.typeSignature();
}
final List<TypeSignature> exceptionTypeSignatures =
Arrays.stream(exceptionClasses)
.filter(e -> e != TException.class)
.map(TypeSignature::ofNamed)
.collect(toImmutableList());
return new MethodInfo(name, returnTypeSignature, parameters, exceptionTypeSignatures, endpoints,
ImmutableList.of(),
ImmutableList.of(),
ImmutableList.of(),
ImmutableList.of(),
HttpMethod.POST, null);
}
private static NamedTypeInfo newNamedTypeInfo(TypeSignature typeSignature) {
final Class<?> type = (Class<?>) typeSignature.namedTypeDescriptor();
if (type == null) {
throw new IllegalArgumentException("cannot create a named type from: " + typeSignature);
}
if (type.isEnum()) {
@SuppressWarnings("unchecked")
final Class<? extends Enum<? extends TEnum>> enumType =
(Class<? extends Enum<? extends TEnum>>) type;
return newEnumInfo(enumType);
}
if (TException.class.isAssignableFrom(type)) {
@SuppressWarnings("unchecked")
final Class<? extends TException> castType = (Class<? extends TException>) type;
return newExceptionInfo(castType);
}
assert TBase.class.isAssignableFrom(type);
@SuppressWarnings("unchecked")
final Class<? extends TBase<?, ?>> castType = (Class<? extends TBase<?, ?>>) type;
return newStructInfo(castType);
}
@VisibleForTesting
static StructInfo newStructInfo(Class<? extends TBase<?, ?>> structClass) {
final String name = structClass.getName();
final Map<?, FieldMetaData> metaDataMap = FieldMetaData.getStructMetaDataMap(structClass);
final List<FieldInfo> fields =
metaDataMap.values().stream()
.map(fieldMetaData -> newFieldInfo(structClass, fieldMetaData))
.collect(Collectors.toList());
return new StructInfo(name, fields);
}
@VisibleForTesting
static ExceptionInfo newExceptionInfo(Class<? extends TException> exceptionClass) {
requireNonNull(exceptionClass, "exceptionClass");
final String name = exceptionClass.getName();
List<FieldInfo> fields;
try {
@SuppressWarnings("unchecked")
final Map<?, FieldMetaData> metaDataMap =
(Map<?, FieldMetaData>) exceptionClass.getDeclaredField("metaDataMap").get(null);
fields = metaDataMap.values().stream()
.map(fieldMetaData -> newFieldInfo(exceptionClass, fieldMetaData))
.collect(toImmutableList());
} catch (IllegalAccessException e) {
throw new AssertionError("will not happen", e);
} catch (NoSuchFieldException ignored) {
fields = Collections.emptyList();
}
return new ExceptionInfo(name, fields);
}
@VisibleForTesting
static FieldInfo newFieldInfo(Class<?> parentType, FieldMetaData fieldMetaData) {
requireNonNull(fieldMetaData, "fieldMetaData");
final FieldValueMetaData fieldValueMetaData = fieldMetaData.valueMetaData;
final TypeSignature typeSignature;
if (fieldValueMetaData.isStruct() && fieldValueMetaData.isTypedef() &&
parentType.getSimpleName().equals(fieldValueMetaData.getTypedefName())) {
// Handle the special case where a struct field refers to itself,
// where the Thrift compiler handles it as a typedef.
typeSignature = TypeSignature.ofNamed(parentType);
} else {
typeSignature = toTypeSignature(fieldValueMetaData);
}
return FieldInfo.builder(fieldMetaData.fieldName, typeSignature)
.requirement(convertRequirement(fieldMetaData.requirementType)).build();
}
@VisibleForTesting
static TypeSignature toTypeSignature(FieldValueMetaData fieldValueMetaData) {
if (fieldValueMetaData instanceof StructMetaData) {
return TypeSignature.ofNamed(((StructMetaData) fieldValueMetaData).structClass);
}
if (fieldValueMetaData instanceof EnumMetaData) {
return TypeSignature.ofNamed(((EnumMetaData) fieldValueMetaData).enumClass);
}
if (fieldValueMetaData instanceof ListMetaData) {
return TypeSignature.ofList(toTypeSignature(((ListMetaData) fieldValueMetaData).elemMetaData));
}
if (fieldValueMetaData instanceof SetMetaData) {
return TypeSignature.ofSet(toTypeSignature(((SetMetaData) fieldValueMetaData).elemMetaData));
}
if (fieldValueMetaData instanceof MapMetaData) {
return TypeSignature.ofMap(toTypeSignature(((MapMetaData) fieldValueMetaData).keyMetaData),
toTypeSignature(((MapMetaData) fieldValueMetaData).valueMetaData));
}
if (fieldValueMetaData.isBinary()) {
return BINARY;
}
switch (fieldValueMetaData.type) {
case TType.VOID:
return VOID;
case TType.BOOL:
return BOOL;
case TType.BYTE:
return I8;
case TType.DOUBLE:
return DOUBLE;
case TType.I16:
return I16;
case TType.I32:
return I32;
case TType.I64:
return I64;
case TType.STRING:
return STRING;
}
final String unresolvedName;
if (fieldValueMetaData.isTypedef()) {
unresolvedName = fieldValueMetaData.getTypedefName();
} else {
unresolvedName = null;
}
return TypeSignature.ofUnresolved(firstNonNull(unresolvedName, "unknown"));
}
@VisibleForTesting
static EnumInfo newEnumInfo(Class<? extends Enum<? extends TEnum>> enumType) {
final List<EnumValueInfo> values = Arrays.stream(enumType.getEnumConstants())
.map(e -> new EnumValueInfo(e.name(), ((TEnum) e).getValue()))
.collect(toImmutableList());
return new EnumInfo(enumType.getTypeName(), values);
}
private static FieldRequirement convertRequirement(byte value) {
switch (value) {
case TFieldRequirementType.REQUIRED:
return FieldRequirement.REQUIRED;
case TFieldRequirementType.OPTIONAL:
return FieldRequirement.OPTIONAL;
case TFieldRequirementType.DEFAULT:
// Convert to unspecified for consistency with gRPC and AnnotatedService.
return FieldRequirement.UNSPECIFIED;
default:
throw new IllegalArgumentException("unknown requirement type: " + value);
}
}
@VisibleForTesting
public static final class Entry {
final Class<?> serviceType;
final List<EndpointInfo> endpointInfos;
Entry(Class<?> serviceType, List<EndpointInfo> endpointInfos) {
this.serviceType = serviceType;
this.endpointInfos = ImmutableList.copyOf(endpointInfos);
}
}
@VisibleForTesting
public static final class EntryBuilder {
private final Class<?> serviceType;
private final List<EndpointInfo> endpointInfos = new ArrayList<>();
public EntryBuilder(Class<?> serviceType) {
this.serviceType = requireNonNull(serviceType, "serviceType");
}
public EntryBuilder endpoint(EndpointInfo endpointInfo) {
endpointInfos.add(requireNonNull(endpointInfo, "endpointInfo"));
return this;
}
public Entry build() {
return new Entry(serviceType, endpointInfos);
}
}
// Methods related with extracting documentation strings.
@Override
public Map<String, String> loadDocStrings(Set<ServiceConfig> serviceConfigs) {
return serviceConfigs.stream()
.flatMap(c -> {
final THttpService service = c.service().as(THttpService.class);
assert service != null;
return service.entries().values().stream();
})
.flatMap(entry -> entry.interfaces().stream().map(Class::getClassLoader))
.flatMap(loader -> docstringExtractor.getAllDocStrings(loader)
.entrySet().stream())
.collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a));
}
// Methods related with serializing example requests.
@Override
public Set<Class<?>> supportedExampleRequestTypes() {
return ImmutableSet.of(TBase.class);
}
@Override
public String guessServiceName(Object exampleRequest) {
final TBase<?, ?> exampleTBase = asTBase(exampleRequest);
if (exampleTBase == null) {
return null;
}
return exampleTBase.getClass().getEnclosingClass().getName();
}
@Override
public String guessServiceMethodName(Object exampleRequest) {
final TBase<?, ?> exampleTBase = asTBase(exampleRequest);
if (exampleTBase == null) {
return null;
}
final String typeName = exampleTBase.getClass().getName();
return typeName.substring(typeName.lastIndexOf('$') + 1,
typeName.length() - REQUEST_STRUCT_SUFFIX.length());
}
@Override
public String serializeExampleRequest(String serviceName, String methodName,
Object exampleRequest) {
if (!(exampleRequest instanceof TBase)) {
return null;
}
final TBase<?, ?> exampleTBase = (TBase<?, ?>) exampleRequest;
try {
final TSerializer serializer = new TSerializer(ThriftProtocolFactories.TEXT);
if (legacyTSerializerToString != null) {
try {
return (String) legacyTSerializerToString.invoke(serializer, exampleTBase,
StandardCharsets.UTF_8.name());
} catch (Throwable ex) {
throw new IllegalStateException(
"Unexpected exception while serializing " + exampleTBase, ex);
}
} else {
// TSerializer.toString(TBase, charset) was removed in Thrift 0.14.0
return serializer.toString(exampleTBase);
}
} catch (TException e) {
throw new Error("should never reach here", e);
}
}
@Nullable
private static TBase<?, ?> asTBase(Object exampleRequest) {
final TBase<?, ?> exampleTBase = (TBase<?, ?>) exampleRequest;
final Class<?> type = exampleTBase.getClass();
if (!type.getName().endsWith(REQUEST_STRUCT_SUFFIX)) {
return null;
}
final Class<?> serviceType = type.getEnclosingClass();
if (serviceType == null) {
return null;
}
if (serviceType.getEnclosingClass() != null) {
return null;
}
return exampleTBase;
}
@Override
public String toString() {
return ThriftDocServicePlugin.class.getSimpleName();
}
}
| 24,177 | 0.614716 | 0.612897 | 581 | 40.612736 | 30.546764 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578313 | false | false | 0 |
d3d942b188dbf2917eac74f94c68f10a76d20825 | 17,428,977,333,369 | 1abfd8d6436f5e0841c5c8e85e6c8430735dac93 | /trunk/app/src/main/java/com/m2team/xna/utils/Constant.java | c5e97bd53fc8a04454dcd586a9f98371dbb21368 | []
| no_license | BGCX262/zua-xna-new-svn-to-git | https://github.com/BGCX262/zua-xna-new-svn-to-git | 42e5561cf586199e1ad0fadf76386d040074a656 | a3159721b0696c66540361cc3818f70c6aef7dd0 | refs/heads/master | 2020-04-06T04:59:19.273000 | 2015-08-23T06:57:16 | 2015-08-23T06:57:16 | 41,254,907 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.m2team.xna.utils;
/**
* Created by Admin on 9/30/2014.
*/
public class Constant {
public static final String SHARE_PREF_FILE_NAME = "xna_pref";
public static final String SHARE_PREF_KEY_LANGUAGE = "key_pref_lang";
public static final String SHARE_PREF_KEY_THEME_COLOR = "key_pref_theme_color";
//----------CONSTANT OF EXIF TABLE-----------
public static final String BRAND_EXIF = "Make";
public static final String EXPOSURE_EXIF = "ExposureTime";
public static final String FLASH_EXIF = "Flash";
public static final String FNUM_EXIF = "FNumber";
public static final String FOCAL_EXIF = "FocalLength";
public static final String HEIGHT_EXIF = "height";
public static final String ISO_EXIF = "Iso";
public static final String MODEL_EXIF = "Model";
public static final String RGB_EXIF = "rgb";
public static final String SOFTWARE_EXIF = "Software";
public static final String AUTHOR_NAME_KEY = "authorName";
public static final String FOLDER_APPS = "XomNhiepAnh";
public static final String NUDE_FILTER_KEY = "nude";
public static final String COLOR_ATTR_STRING_SPLIT = "color:";
public static final int ITEM_PER_PAGE = 35;
public static final String TOKEN_SPACE = " ";
public static final String TOKEN_LINE = "-";
public static final String TOKEN_DUAL_DOT = ":";
public static final String TIME_ADDED_STRING_SPLIT = "ngày";
public static final String WIDTH_EXIF = "width";
public static final String KEY_INTENT_URL = "KEY_INTENT_URL";
public static final String KEY_INTENT_AUTHOR = "KEY_INTENT_AUTHOR";
public static final String KEY_INTENT_TITLE = "KEY_INTENT_TITLE";
public static final String KEY_INTENT_HREF = "KEY_INTENT_HREF";
public static final String KEY_INTENT_PHOTO_OBJECT = "KEY_INTENT_PHOTO_OBJECT";
//-----------CONSTANT FOR KEY OF JSOUP TO RAW
//key for main page
public static final String CSS_CLASS_IMAGE_HTML = ".padcol-left a";
public static final String CSS_PROPERTY_LINK_IMAGE_HTML = "rel";
public static final String CSS_PROPERTY_TITLE_IMAGE_HTML = "title";
public static final String CSS_PROPERTY_HREF_IMAGE_HTML = "href";
//key for image page
public static final String CSS_PROPERTY_EXIF_TABLE_IMG = "#tborder tr";
public static final String CSS_PROPERTY_VIEW_COUNT_IMG = "span#viewCount";
public static final String CSS_PROPERTY_COMMENT_COUNT_IMG = "span#commentCount";
public static final String CSS_PROPERTY_FAVOR_COUNT_IMG = "span#faveCount";
public static final String CSS_PROPERTY_TIME_TAKEN_IMG = "div.takenTime";
public static final String CSS_PROPERTY_URL_USER_AVATAR_IMG = ".userInfo .avatar a[href]";
public static final String CSS_PROPERTY_URL_USER_COLOR_IMG = ".userInfo .fl span";
public static final String CSS_PROPERTY_CATEGORY_IMG = ".cate a";
//key for author page
public static final String CSS_PROPERTY_GET_NAME_AUTHOR = ".genTitle";
public static final String CSS_PROPERTY_GET_INFO_AUTHOR = ".user_info .row";
public static final String CSS_PROPERTY_GET_CHOOSE_PHOTO_INFO_AUTHOR = "Ảnh chọn";
public static final String CSS_PROPERTY_GET_SINGLE_PHOTO_INFO_AUTHOR = "Ảnh đơn";
public static final String CSS_PROPERTY_GET_COMMENT_PHOTO_INFO_AUTHOR = "Bình luận";
public static final String CSS_PROPERTY_GET_JOIN_DATE_INFO_AUTHOR = "Tham gia";
public static final String CSS_PROPERTY_GET_LATEST_ACTIVITY_INFO_AUTHOR = "Hoạt động cuối";
public static final String CSS_PROPERTY_GET_YAHOO_INFO_AUTHOR = "";
public static final String CSS_PROPERTY_GET_SKYPE_INFO_AUTHOR = "";
//-----------CONSTANT FOR URL-----------------
public static final String BASE_URL = "http://xomnhiepanh.com";
public static final String SUFFIX_OTHER = "&page=";
public static final String SUFFIX_STAFF_CHOICE = "&sort=&dir=&page=";
public static final String ANIMAL = "/?mod=gallery&act=categories&catid=7&t=dong-vat-animal";
public static final String ARCHITECTURE = "/?mod=gallery&act=categories&catid=21&t=kien-truc-architecture";
public static final String Abstract = "/?mod=gallery&act=categories&catid=1&t=truu-tuong-abstract";
public static final String Advertisement = "/?mod=gallery&act=categories&catid=15&t=quang-cao-advetisment";
public static final String BW = "/?mod=gallery&act=categories&catid=8&t=den-trang-bw";
public static final String Conceptual = "/?mod=gallery&act=categories&catid=19&t=y-niem-conceptual";
public static final String Experimental = "/?mod=gallery&act=categories&catid=20&t=anh-do-hoa-experimental";
public static final String Fashion = "/?mod=gallery&act=categories&catid=10&t=thoi-trang-fashion";
public static final String Journalism = "/?mod=gallery&act=categories&catid=16&t=bao-chi-journalism";
public static final String LANDSCAPE = "/?mod=gallery&act=categories&catid=6&t=phong-canh-landscape";
public static final String MACRO = "/?mod=gallery&act=categories&catid=5&t=macro-macro";
public static final String NATURE = "/?mod=gallery&act=categories&catid=3&t=thien-nhien-nature";
public static final String Nude = "/?mod=gallery&act=categories&catid=14&t=khoa-than-nude";
public static final String Other = "/?mod=gallery&act=categories&catid=13&t=khong-xac-dinh-other";
public static final String PORTRAIT = "/?mod=gallery&act=categories&catid=2&t=chan-dung-portrait";
public static final String Panorama = "/?mod=gallery&act=categories&catid=23&t=panorama";
public static final String Product = "/?mod=gallery&act=categories&catid=18&t=san-pham-product";
public static final String STAFF_CHOICE = "/?mod=gallery&act=staffchoice";
public static final String STREET_LIFE = "/?mod=gallery&act=categories&catid=4&t=doi-thuong-streetlife";
public static final String Sport = "/?mod=gallery&act=categories&catid=9&t=the-thao-sport";
public static final String Stage = "/?mod=gallery&act=categories&catid=17&t=san-khau-stage";
public static final String Still_Life = "/?mod=gallery&act=categories&catid=12&t=tinh-vat-still-life";
public static final String TRAVEL = "/?mod=gallery&act=categories&catid=22&t=du-lich-travel";
public static final String Wedding = "/?mod=gallery&act=categories&catid=11&t=anh-cuoi-wedding";
}
| UTF-8 | Java | 6,439 | java | Constant.java | Java | [
{
"context": "ackage com.m2team.xna.utils;\r\n\r\n/**\r\n * Created by Admin on 9/30/2014.\r\n */\r\npublic class Constant {\r\n\r\n ",
"end": 57,
"score": 0.8768301606178284,
"start": 52,
"tag": "USERNAME",
"value": "Admin"
},
{
"context": " public static final String NUDE_FILTER_KEY = \"nude\";\r\n public static final String COLOR_ATTR_STRI",
"end": 1120,
"score": 0.5953872203826904,
"start": 1116,
"tag": "KEY",
"value": "nude"
},
{
"context": "ring CSS_PROPERTY_GET_CHOOSE_PHOTO_INFO_AUTHOR = \"Ảnh chọn\";\r\n public static final String CSS_PROPERTY_GE",
"end": 3199,
"score": 0.9990682601928711,
"start": 3191,
"tag": "NAME",
"value": "Ảnh chọn"
},
{
"context": "ring CSS_PROPERTY_GET_SINGLE_PHOTO_INFO_AUTHOR = \"Ảnh đơn\";\r\n public static final String CSS_PROPERTY_GE",
"end": 3286,
"score": 0.9993282556533813,
"start": 3279,
"tag": "NAME",
"value": "Ảnh đơn"
},
{
"context": "ing CSS_PROPERTY_GET_COMMENT_PHOTO_INFO_AUTHOR = \"Bình luận\";\r\n public static final String CSS_PROPERTY_GE",
"end": 3376,
"score": 0.9995545148849487,
"start": 3367,
"tag": "NAME",
"value": "Bình luận"
},
{
"context": " String CSS_PROPERTY_GET_JOIN_DATE_INFO_AUTHOR = \"Tham gia\";\r\n public static final String CSS_PROPERTY_GE",
"end": 3461,
"score": 0.9994270205497742,
"start": 3453,
"tag": "NAME",
"value": "Tham gia"
},
{
"context": "g CSS_PROPERTY_GET_LATEST_ACTIVITY_INFO_AUTHOR = \"Hoạt động cuối\";\r\n public static final String CSS_PROPERTY_GE",
"end": 3558,
"score": 0.9908006191253662,
"start": 3544,
"tag": "NAME",
"value": "Hoạt động cuối"
}
]
| null | []
| package com.m2team.xna.utils;
/**
* Created by Admin on 9/30/2014.
*/
public class Constant {
public static final String SHARE_PREF_FILE_NAME = "xna_pref";
public static final String SHARE_PREF_KEY_LANGUAGE = "key_pref_lang";
public static final String SHARE_PREF_KEY_THEME_COLOR = "key_pref_theme_color";
//----------CONSTANT OF EXIF TABLE-----------
public static final String BRAND_EXIF = "Make";
public static final String EXPOSURE_EXIF = "ExposureTime";
public static final String FLASH_EXIF = "Flash";
public static final String FNUM_EXIF = "FNumber";
public static final String FOCAL_EXIF = "FocalLength";
public static final String HEIGHT_EXIF = "height";
public static final String ISO_EXIF = "Iso";
public static final String MODEL_EXIF = "Model";
public static final String RGB_EXIF = "rgb";
public static final String SOFTWARE_EXIF = "Software";
public static final String AUTHOR_NAME_KEY = "authorName";
public static final String FOLDER_APPS = "XomNhiepAnh";
public static final String NUDE_FILTER_KEY = "nude";
public static final String COLOR_ATTR_STRING_SPLIT = "color:";
public static final int ITEM_PER_PAGE = 35;
public static final String TOKEN_SPACE = " ";
public static final String TOKEN_LINE = "-";
public static final String TOKEN_DUAL_DOT = ":";
public static final String TIME_ADDED_STRING_SPLIT = "ngày";
public static final String WIDTH_EXIF = "width";
public static final String KEY_INTENT_URL = "KEY_INTENT_URL";
public static final String KEY_INTENT_AUTHOR = "KEY_INTENT_AUTHOR";
public static final String KEY_INTENT_TITLE = "KEY_INTENT_TITLE";
public static final String KEY_INTENT_HREF = "KEY_INTENT_HREF";
public static final String KEY_INTENT_PHOTO_OBJECT = "KEY_INTENT_PHOTO_OBJECT";
//-----------CONSTANT FOR KEY OF JSOUP TO RAW
//key for main page
public static final String CSS_CLASS_IMAGE_HTML = ".padcol-left a";
public static final String CSS_PROPERTY_LINK_IMAGE_HTML = "rel";
public static final String CSS_PROPERTY_TITLE_IMAGE_HTML = "title";
public static final String CSS_PROPERTY_HREF_IMAGE_HTML = "href";
//key for image page
public static final String CSS_PROPERTY_EXIF_TABLE_IMG = "#tborder tr";
public static final String CSS_PROPERTY_VIEW_COUNT_IMG = "span#viewCount";
public static final String CSS_PROPERTY_COMMENT_COUNT_IMG = "span#commentCount";
public static final String CSS_PROPERTY_FAVOR_COUNT_IMG = "span#faveCount";
public static final String CSS_PROPERTY_TIME_TAKEN_IMG = "div.takenTime";
public static final String CSS_PROPERTY_URL_USER_AVATAR_IMG = ".userInfo .avatar a[href]";
public static final String CSS_PROPERTY_URL_USER_COLOR_IMG = ".userInfo .fl span";
public static final String CSS_PROPERTY_CATEGORY_IMG = ".cate a";
//key for author page
public static final String CSS_PROPERTY_GET_NAME_AUTHOR = ".genTitle";
public static final String CSS_PROPERTY_GET_INFO_AUTHOR = ".user_info .row";
public static final String CSS_PROPERTY_GET_CHOOSE_PHOTO_INFO_AUTHOR = "<NAME>";
public static final String CSS_PROPERTY_GET_SINGLE_PHOTO_INFO_AUTHOR = "<NAME>";
public static final String CSS_PROPERTY_GET_COMMENT_PHOTO_INFO_AUTHOR = "<NAME>";
public static final String CSS_PROPERTY_GET_JOIN_DATE_INFO_AUTHOR = "<NAME>";
public static final String CSS_PROPERTY_GET_LATEST_ACTIVITY_INFO_AUTHOR = "<NAME>";
public static final String CSS_PROPERTY_GET_YAHOO_INFO_AUTHOR = "";
public static final String CSS_PROPERTY_GET_SKYPE_INFO_AUTHOR = "";
//-----------CONSTANT FOR URL-----------------
public static final String BASE_URL = "http://xomnhiepanh.com";
public static final String SUFFIX_OTHER = "&page=";
public static final String SUFFIX_STAFF_CHOICE = "&sort=&dir=&page=";
public static final String ANIMAL = "/?mod=gallery&act=categories&catid=7&t=dong-vat-animal";
public static final String ARCHITECTURE = "/?mod=gallery&act=categories&catid=21&t=kien-truc-architecture";
public static final String Abstract = "/?mod=gallery&act=categories&catid=1&t=truu-tuong-abstract";
public static final String Advertisement = "/?mod=gallery&act=categories&catid=15&t=quang-cao-advetisment";
public static final String BW = "/?mod=gallery&act=categories&catid=8&t=den-trang-bw";
public static final String Conceptual = "/?mod=gallery&act=categories&catid=19&t=y-niem-conceptual";
public static final String Experimental = "/?mod=gallery&act=categories&catid=20&t=anh-do-hoa-experimental";
public static final String Fashion = "/?mod=gallery&act=categories&catid=10&t=thoi-trang-fashion";
public static final String Journalism = "/?mod=gallery&act=categories&catid=16&t=bao-chi-journalism";
public static final String LANDSCAPE = "/?mod=gallery&act=categories&catid=6&t=phong-canh-landscape";
public static final String MACRO = "/?mod=gallery&act=categories&catid=5&t=macro-macro";
public static final String NATURE = "/?mod=gallery&act=categories&catid=3&t=thien-nhien-nature";
public static final String Nude = "/?mod=gallery&act=categories&catid=14&t=khoa-than-nude";
public static final String Other = "/?mod=gallery&act=categories&catid=13&t=khong-xac-dinh-other";
public static final String PORTRAIT = "/?mod=gallery&act=categories&catid=2&t=chan-dung-portrait";
public static final String Panorama = "/?mod=gallery&act=categories&catid=23&t=panorama";
public static final String Product = "/?mod=gallery&act=categories&catid=18&t=san-pham-product";
public static final String STAFF_CHOICE = "/?mod=gallery&act=staffchoice";
public static final String STREET_LIFE = "/?mod=gallery&act=categories&catid=4&t=doi-thuong-streetlife";
public static final String Sport = "/?mod=gallery&act=categories&catid=9&t=the-thao-sport";
public static final String Stage = "/?mod=gallery&act=categories&catid=17&t=san-khau-stage";
public static final String Still_Life = "/?mod=gallery&act=categories&catid=12&t=tinh-vat-still-life";
public static final String TRAVEL = "/?mod=gallery&act=categories&catid=22&t=du-lich-travel";
public static final String Wedding = "/?mod=gallery&act=categories&catid=11&t=anh-cuoi-wedding";
}
| 6,405 | 0.70919 | 0.701869 | 94 | 66.297874 | 30.416901 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.819149 | false | false | 0 |
a1ada653b222deb5fc0253e7ede34404fa5d1fc9 | 24,902,220,427,356 | b1235aa270789e139173b2f81d14aaff532a6e9e | /fabric/fabric-camel/src/test/java/io/fabric8/camel/FabricPublisherEndpointOpenShiftTest.java | 7ab4e88537395f0da8d6ab28c79d411dd7cc26ea | [
"Apache-2.0"
]
| permissive | valdar/fabric8 | https://github.com/valdar/fabric8 | 8e52559671520c0303db10747e3c22224acc15e3 | d4b5b0708a4b9d13a715eda78ad9b49f48920237 | refs/heads/1.2.0.redhat-6-3-x | 2020-08-21T07:10:13.895000 | 2019-10-17T04:46:10 | 2019-10-17T04:46:10 | 216,109,079 | 0 | 0 | NOASSERTION | true | 2019-10-18T21:25:19 | 2019-10-18T21:25:18 | 2019-10-18T15:41:24 | 2019-10-18T19:30:05 | 192,899 | 0 | 0 | 0 | null | false | false | /**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.fabric8.camel;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import io.fabric8.groups.Group;
import io.fabric8.groups.GroupListener;
import org.apache.curator.framework.CuratorFramework;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class FabricPublisherEndpointOpenShiftTest {
private FabricPublisherEndpoint endpoint;
private String karafName;
@Before
public void init() throws Exception {
karafName = System.setProperty("karaf.name", "root");
FabricComponent component = new FabricComponent() {
@Override
public CuratorFramework getCurator() {
return null;
}
@Override
public Group<CamelNodeState> createGroup(String path) {
return new Group<CamelNodeState>() {
@Override
public boolean isConnected() {
return false;
}
@Override
public void start() {
}
@Override
public void close() throws IOException {
}
@Override
public void add(GroupListener<CamelNodeState> listener) {
}
@Override
public void remove(GroupListener<CamelNodeState> listener) {
}
@Override
public void update(CamelNodeState state) {
}
@Override
public Map<String, CamelNodeState> members() {
return null;
}
@Override
public boolean isMaster() {
return false;
}
@Override
public CamelNodeState master() {
return null;
}
@Override
public List<CamelNodeState> slaves() {
return null;
}
@Override
public CamelNodeState getLastState() {
return null;
}
};
}
};
endpoint = new FabricPublisherEndpoint("http://localhost", component, null, "child") {
@Override
protected int publicPort(URI uri) {
return uri.getPort() + 42;
}
};
}
@After
public void cleanup() {
if (karafName != null) {
System.setProperty("karaf.name", karafName);
}
}
@Test
public void testPortMapping() throws Exception {
assertThat(endpoint.toPublicAddress("http:jetty://localhost:1/x/y?a=b&c=d"), equalTo("http:jetty://localhost:43/x/y?a=b&c=d"));
assertThat(endpoint.toPublicAddress("http:jetty:a:b://localhost:1/x/y?a=b"), equalTo("http:jetty:a:b://localhost:43/x/y?a=b"));
assertThat(endpoint.toPublicAddress("http://localhost:1"), equalTo("http://localhost:43"));
}
}
| UTF-8 | Java | 3,961 | java | FabricPublisherEndpointOpenShiftTest.java | Java | []
| null | []
| /**
* Copyright 2005-2016 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.fabric8.camel;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import io.fabric8.groups.Group;
import io.fabric8.groups.GroupListener;
import org.apache.curator.framework.CuratorFramework;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class FabricPublisherEndpointOpenShiftTest {
private FabricPublisherEndpoint endpoint;
private String karafName;
@Before
public void init() throws Exception {
karafName = System.setProperty("karaf.name", "root");
FabricComponent component = new FabricComponent() {
@Override
public CuratorFramework getCurator() {
return null;
}
@Override
public Group<CamelNodeState> createGroup(String path) {
return new Group<CamelNodeState>() {
@Override
public boolean isConnected() {
return false;
}
@Override
public void start() {
}
@Override
public void close() throws IOException {
}
@Override
public void add(GroupListener<CamelNodeState> listener) {
}
@Override
public void remove(GroupListener<CamelNodeState> listener) {
}
@Override
public void update(CamelNodeState state) {
}
@Override
public Map<String, CamelNodeState> members() {
return null;
}
@Override
public boolean isMaster() {
return false;
}
@Override
public CamelNodeState master() {
return null;
}
@Override
public List<CamelNodeState> slaves() {
return null;
}
@Override
public CamelNodeState getLastState() {
return null;
}
};
}
};
endpoint = new FabricPublisherEndpoint("http://localhost", component, null, "child") {
@Override
protected int publicPort(URI uri) {
return uri.getPort() + 42;
}
};
}
@After
public void cleanup() {
if (karafName != null) {
System.setProperty("karaf.name", karafName);
}
}
@Test
public void testPortMapping() throws Exception {
assertThat(endpoint.toPublicAddress("http:jetty://localhost:1/x/y?a=b&c=d"), equalTo("http:jetty://localhost:43/x/y?a=b&c=d"));
assertThat(endpoint.toPublicAddress("http:jetty:a:b://localhost:1/x/y?a=b"), equalTo("http:jetty:a:b://localhost:43/x/y?a=b"));
assertThat(endpoint.toPublicAddress("http://localhost:1"), equalTo("http://localhost:43"));
}
}
| 3,961 | 0.540015 | 0.533451 | 124 | 30.943548 | 26.926813 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.370968 | false | false | 0 |
434adfba7c58083995438dcb04cd6d2943e369aa | 17,875,653,891,614 | a8c27091412a0155497bb975825d08e490fc8111 | /algo-study/src/main/java/com/junhua/algorithm/leetcode/datastructure/array/ReshapeTheMatrix.java | 8e3f0cf6d70b72af93dc28820aed7ce76d0ff1d3 | [
"MIT"
]
| permissive | Junhua91/tornesol | https://github.com/Junhua91/tornesol | 4cd7f6cf14245a03ff36a2e79a34aa6782d02b01 | 42bde375149654a9f2e902ce182b6a30426f22d8 | refs/heads/master | 2022-12-21T15:55:09.458000 | 2019-10-30T07:00:46 | 2019-10-30T07:00:46 | 153,586,630 | 4 | 0 | MIT | false | 2022-12-16T08:31:48 | 2018-10-18T08:05:32 | 2019-11-04T03:40:00 | 2022-12-16T08:31:45 | 1,989 | 3 | 0 | 16 | Java | false | false | package com.junhua.algorithm.leetcode.datastructure.array;
public class ReshapeTheMatrix {
static public int[][] matrixReshape(int[][] nums, int r, int c) {
if (nums == null || nums.length == 0) return null;
int rowLen = nums.length;
int colLen = nums[0].length;
if (rowLen * colLen < r * c) return nums;
int[][] matrix = new int[r][c];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
int totalIndex = (i * c) + j;
int rowIndex = (totalIndex) / colLen;
int colIndex = (totalIndex) % colLen;
matrix[i][j] = nums[rowIndex][colIndex];
}
}
return matrix;
}
public static void main(String[] args) {
int[][] nums = {{1, 2}, {3, 4}};
int[][] matrix = matrixReshape(nums, 1, 4);
return;
}
}
| UTF-8 | Java | 896 | java | ReshapeTheMatrix.java | Java | []
| null | []
| package com.junhua.algorithm.leetcode.datastructure.array;
public class ReshapeTheMatrix {
static public int[][] matrixReshape(int[][] nums, int r, int c) {
if (nums == null || nums.length == 0) return null;
int rowLen = nums.length;
int colLen = nums[0].length;
if (rowLen * colLen < r * c) return nums;
int[][] matrix = new int[r][c];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
int totalIndex = (i * c) + j;
int rowIndex = (totalIndex) / colLen;
int colIndex = (totalIndex) % colLen;
matrix[i][j] = nums[rowIndex][colIndex];
}
}
return matrix;
}
public static void main(String[] args) {
int[][] nums = {{1, 2}, {3, 4}};
int[][] matrix = matrixReshape(nums, 1, 4);
return;
}
}
| 896 | 0.492188 | 0.481027 | 33 | 26.151516 | 22.806328 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 0 |
255d820b11d60dd38cfbe72844033ee79af84f71 | 13,099,650,275,725 | bae95133246e3239df32872f46ce06e6d1cad22a | /URLValidatorInCorrect/src/test/java/finalprojectB/UrlValidatorTest.java | 3fdf057738cb98399156660c4d445210f30bd28d | []
| no_license | ryansisco/Final-Project-B | https://github.com/ryansisco/Final-Project-B | 0948477d957fec09a994cf65a570c5387211d524 | d78b6521dd993d4a7b00b3382add3b1b227ff338 | refs/heads/master | 2020-03-19T22:58:39.011000 | 2018-06-12T06:20:25 | 2018-06-12T06:20:25 | 136,987,931 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package finalprojectB;
import junit.framework.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Random;
//You can use this as a skeleton for your 3 different test approach
//It is an optional to use this file, you can generate your own test file(s) to test the target function!
// Again, it is up to you to use this file or not!
public class UrlValidatorTest {
@Test
public void Test01_Manual_Testing() throws Throwable //Tests known websites
{
System.out.print("\nTesting websites known to exist\n");
UrlValidator urlVal = new UrlValidator(null, null, UrlValidator.ALLOW_ALL_SCHEMES); //testing constructor
UrlValidator urlVal2 = new UrlValidator(); //testing constructor
long digit = 22222222;
RegexValidator val = null;
UrlValidator urlVal3 = new UrlValidator(0); //testing constructor
UrlValidator urlVal4 = new UrlValidator(val, 0); //testing constructor
assertTrue(urlVal.isValid("http://www.youtube.com"));
assertTrue(urlVal.isValid("http://web.engr.oregonstate.edu/~siscor/"));
assertTrue(urlVal.isValid("http://www.reddit.com:65535"));
assertTrue(urlVal.isValid("ftp://www.spotify.com"));
assertTrue(urlVal.isValid("http://www.google.com/$23"));
assertTrue(urlVal.isValid("https://www.amazon.com?action=view"));
assertTrue(urlVal2.isValid("http://www.youtube.com"));
assertTrue(urlVal2.isValid("http://www.reddit.com"));
assertTrue(urlVal2.isValid("http://www.spotify.com"));
assertTrue(urlVal2.isValid("https://www.google.com"));
assertTrue(urlVal2.isValid("http://www.amazon.com"));
assertTrue(urlVal2.isValid("http://www.ebay.com"));
assertTrue(urlVal2.isValid("http://www.amazon.com"));
assertTrue(urlVal2.isValid("http://www.ebay.com"));
}
@Test
public void Test02_Manual_Testing() throws Throwable //Tests websites that don't exist
{
System.out.print("\nTesting websites known to NOT exist\n");
UrlValidator urlVal = new UrlValidator(null, null, UrlValidator.ALLOW_ALL_SCHEMES); //testing constructor
UrlValidator urlVal2 = new UrlValidator(); //testing constructor
assertFalse(urlVal.isValid(null));
assertFalse(urlVal.isValid("youtube.com/http/.39org"));
assertFalse(urlVal.isValid("//localfiletest32432424.org"));
assertFalse(urlVal.isValid("345453eb3ay1236456456452"));
assertFalse(urlVal.isValid("://h.youtube1321354313123.com"));
assertFalse(urlVal.isValid("6.6.6.6.6.6.6"));
assertFalse(urlVal.isValid("10.10.10.10"));
assertFalse(urlVal2.isValid("http://.spotify56456."));
assertFalse(urlVal.isValid("http://www.google.com/..//file"));
}
@Test
public void Test03_Partition_Test() throws Throwable //tests protocol
{
System.out.print("\nTesting string with improper protocol\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
String precomp = "://www.google.com";
Random rand = new Random();
for (int i = 0; i < 100000; i++) { //long loop
String protocol = ""; //clears buffer
int pass = 0; //clears buffer
for (int j = 0; j < (rand.nextInt(8) + 1); j++) { //gets size of protocol
char randchar = (char)(rand.nextInt(97) + 1); //generates protocol
protocol = protocol.concat(String.valueOf(randchar));
}
if ((protocol.equals("http")) || (protocol.equals("ftp")) //if protocol is valid
|| (protocol.equals("h3t")) || (protocol.equals("https"))){
pass = 1;
}
protocol = protocol.concat(precomp);
if (pass == 1)
assertTrue(urlVal.isValid(protocol)); //should be true
else
assertFalse(urlVal.isValid(protocol)); //should be false
}
}
@Test
public void Test04_Partition_Test() throws Throwable //tests top-level domain
{
System.out.print("\nTesting string with improper top-level domain\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
Random rand = new Random();
for (int i = 0; i < 100000; i++) { //long loop
String protocol = ""; //clears buffer
String precomp = "http://www.google."; //clears buffer
int pass = 0;
for (int j = 0; j < (rand.nextInt(3) + 3); j++) { //small buffer for top-level domain
char randchar = (char)(rand.nextInt(97) + 1);
protocol = protocol.concat(String.valueOf(randchar)); //generates tl domain
}
if ((protocol.equals("com")) || (protocol.equals("org")) //known valid input
|| protocol.equals("net")) {
pass = 1;
}
precomp = precomp.concat(protocol);
if (pass == 1)
assertTrue(urlVal.isValid(protocol)); //should be true
else
assertFalse(urlVal.isValid(protocol)); //should be false
}
}
@Test
public void Test05_Programming_Test() throws Throwable //tests generated URLs
{
System.out.print("\nTesting random combination of web URLs\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
Random rand = new Random();
for (int i = 0; i < 300000; i++) { //long loop
String test = "";
int pass;
int randy = rand.nextInt(4) + 1;
pass = 1;
if ((randy == 1) || (randy == 2)) { //sets http
test = "http://";
}
if (randy == 3) { //sets empty
test = "";
pass = 0;
}
if (randy == 4) { //sets error
test = "FAIL";
pass = 0;
}
randy = rand.nextInt(10) + 1;
if (randy < 8) { //valid, gives known domain name
if (randy == 1) {
if (test.length() > 0)
test = test.concat("www.google.com");
else
test = "www.google.com";
}
if (randy == 2) {
if (test.length() > 0)
test = test.concat("www.youtube.com");
else
test = "www.youtube.com";
}
if (randy == 3) {
if (test.length() > 0)
test = test.concat("www.bing.com");
else
test = "www.bing.com";
}
if (randy == 4) {
if (test.length() > 0)
test = test.concat("www.yahoo.com");
else
test = "www.yahoo.com";
}
if (randy == 5) {
if (test.length() > 0)
test = test.concat("www.gmail.com");
else
test = "www.gmail.com";
}
if (randy == 6) {
if (test.length() > 0)
test = test.concat("www.github.com");
else
test = "www.github.com";
}
if (randy == 7) {
if (test.length() > 0) {
test = test.concat("www.facebook.com");
}
else
test = "www.facebook.com";
}
}
else { //invalid
pass = 0;
for (int j = 0; j < randy*2; j++) { //adds random to domain
test = test.concat(Integer.toString(rand.nextInt(79) + 47));
}
}
if (pass == 1) {
assertTrue(urlVal.isValid(test)); //should be true
}
if (pass == 0) {
assertFalse(urlVal.isValid(test)); //should be false
}
}
}
}
| UTF-8 | Java | 6,594 | java | UrlValidatorTest.java | Java | [
{
"context": "(urlVal.isValid(\"http://web.engr.oregonstate.edu/~siscor/\"));\n\t\tassertTrue(urlVal.isValid(\"http://www.redd",
"end": 1048,
"score": 0.9990311861038208,
"start": 1042,
"tag": "USERNAME",
"value": "siscor"
}
]
| null | []
|
package finalprojectB;
import junit.framework.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Random;
//You can use this as a skeleton for your 3 different test approach
//It is an optional to use this file, you can generate your own test file(s) to test the target function!
// Again, it is up to you to use this file or not!
public class UrlValidatorTest {
@Test
public void Test01_Manual_Testing() throws Throwable //Tests known websites
{
System.out.print("\nTesting websites known to exist\n");
UrlValidator urlVal = new UrlValidator(null, null, UrlValidator.ALLOW_ALL_SCHEMES); //testing constructor
UrlValidator urlVal2 = new UrlValidator(); //testing constructor
long digit = 22222222;
RegexValidator val = null;
UrlValidator urlVal3 = new UrlValidator(0); //testing constructor
UrlValidator urlVal4 = new UrlValidator(val, 0); //testing constructor
assertTrue(urlVal.isValid("http://www.youtube.com"));
assertTrue(urlVal.isValid("http://web.engr.oregonstate.edu/~siscor/"));
assertTrue(urlVal.isValid("http://www.reddit.com:65535"));
assertTrue(urlVal.isValid("ftp://www.spotify.com"));
assertTrue(urlVal.isValid("http://www.google.com/$23"));
assertTrue(urlVal.isValid("https://www.amazon.com?action=view"));
assertTrue(urlVal2.isValid("http://www.youtube.com"));
assertTrue(urlVal2.isValid("http://www.reddit.com"));
assertTrue(urlVal2.isValid("http://www.spotify.com"));
assertTrue(urlVal2.isValid("https://www.google.com"));
assertTrue(urlVal2.isValid("http://www.amazon.com"));
assertTrue(urlVal2.isValid("http://www.ebay.com"));
assertTrue(urlVal2.isValid("http://www.amazon.com"));
assertTrue(urlVal2.isValid("http://www.ebay.com"));
}
@Test
public void Test02_Manual_Testing() throws Throwable //Tests websites that don't exist
{
System.out.print("\nTesting websites known to NOT exist\n");
UrlValidator urlVal = new UrlValidator(null, null, UrlValidator.ALLOW_ALL_SCHEMES); //testing constructor
UrlValidator urlVal2 = new UrlValidator(); //testing constructor
assertFalse(urlVal.isValid(null));
assertFalse(urlVal.isValid("youtube.com/http/.39org"));
assertFalse(urlVal.isValid("//localfiletest32432424.org"));
assertFalse(urlVal.isValid("345453eb3ay1236456456452"));
assertFalse(urlVal.isValid("://h.youtube1321354313123.com"));
assertFalse(urlVal.isValid("6.6.6.6.6.6.6"));
assertFalse(urlVal.isValid("10.10.10.10"));
assertFalse(urlVal2.isValid("http://.spotify56456."));
assertFalse(urlVal.isValid("http://www.google.com/..//file"));
}
@Test
public void Test03_Partition_Test() throws Throwable //tests protocol
{
System.out.print("\nTesting string with improper protocol\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
String precomp = "://www.google.com";
Random rand = new Random();
for (int i = 0; i < 100000; i++) { //long loop
String protocol = ""; //clears buffer
int pass = 0; //clears buffer
for (int j = 0; j < (rand.nextInt(8) + 1); j++) { //gets size of protocol
char randchar = (char)(rand.nextInt(97) + 1); //generates protocol
protocol = protocol.concat(String.valueOf(randchar));
}
if ((protocol.equals("http")) || (protocol.equals("ftp")) //if protocol is valid
|| (protocol.equals("h3t")) || (protocol.equals("https"))){
pass = 1;
}
protocol = protocol.concat(precomp);
if (pass == 1)
assertTrue(urlVal.isValid(protocol)); //should be true
else
assertFalse(urlVal.isValid(protocol)); //should be false
}
}
@Test
public void Test04_Partition_Test() throws Throwable //tests top-level domain
{
System.out.print("\nTesting string with improper top-level domain\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
Random rand = new Random();
for (int i = 0; i < 100000; i++) { //long loop
String protocol = ""; //clears buffer
String precomp = "http://www.google."; //clears buffer
int pass = 0;
for (int j = 0; j < (rand.nextInt(3) + 3); j++) { //small buffer for top-level domain
char randchar = (char)(rand.nextInt(97) + 1);
protocol = protocol.concat(String.valueOf(randchar)); //generates tl domain
}
if ((protocol.equals("com")) || (protocol.equals("org")) //known valid input
|| protocol.equals("net")) {
pass = 1;
}
precomp = precomp.concat(protocol);
if (pass == 1)
assertTrue(urlVal.isValid(protocol)); //should be true
else
assertFalse(urlVal.isValid(protocol)); //should be false
}
}
@Test
public void Test05_Programming_Test() throws Throwable //tests generated URLs
{
System.out.print("\nTesting random combination of web URLs\n");
UrlValidator urlVal = new UrlValidator(); //testing constructor
Random rand = new Random();
for (int i = 0; i < 300000; i++) { //long loop
String test = "";
int pass;
int randy = rand.nextInt(4) + 1;
pass = 1;
if ((randy == 1) || (randy == 2)) { //sets http
test = "http://";
}
if (randy == 3) { //sets empty
test = "";
pass = 0;
}
if (randy == 4) { //sets error
test = "FAIL";
pass = 0;
}
randy = rand.nextInt(10) + 1;
if (randy < 8) { //valid, gives known domain name
if (randy == 1) {
if (test.length() > 0)
test = test.concat("www.google.com");
else
test = "www.google.com";
}
if (randy == 2) {
if (test.length() > 0)
test = test.concat("www.youtube.com");
else
test = "www.youtube.com";
}
if (randy == 3) {
if (test.length() > 0)
test = test.concat("www.bing.com");
else
test = "www.bing.com";
}
if (randy == 4) {
if (test.length() > 0)
test = test.concat("www.yahoo.com");
else
test = "www.yahoo.com";
}
if (randy == 5) {
if (test.length() > 0)
test = test.concat("www.gmail.com");
else
test = "www.gmail.com";
}
if (randy == 6) {
if (test.length() > 0)
test = test.concat("www.github.com");
else
test = "www.github.com";
}
if (randy == 7) {
if (test.length() > 0) {
test = test.concat("www.facebook.com");
}
else
test = "www.facebook.com";
}
}
else { //invalid
pass = 0;
for (int j = 0; j < randy*2; j++) { //adds random to domain
test = test.concat(Integer.toString(rand.nextInt(79) + 47));
}
}
if (pass == 1) {
assertTrue(urlVal.isValid(test)); //should be true
}
if (pass == 0) {
assertFalse(urlVal.isValid(test)); //should be false
}
}
}
}
| 6,594 | 0.638914 | 0.611617 | 195 | 32.810257 | 26.424929 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.579487 | false | false | 0 |
94c3da6247b9f8bf866fb0496029fadeba3f0a79 | 26,216,480,431,125 | 04b224cd24423cd25f35f4e8dba194b2cccf884a | /devconsole/src/main/java/com/mydev/dao/impl/CassandraDaoImpl.java | 86b6b063adb356a1a6062e7983048fd49a87a5b5 | []
| no_license | wengmingdong/mydev | https://github.com/wengmingdong/mydev | a80196862f0fc575d145ac83b516063c865d78e6 | 9b696a31b5725138abe8362c5f4656fc2a6e5337 | refs/heads/master | 2020-05-16T04:23:41.992000 | 2015-04-06T13:06:45 | 2015-04-06T13:16:27 | 33,466,413 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.mydev.dao.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.Clause;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import com.mydev.dao.DatabaseDao;
import com.mydev.entity.FieldBean;
import com.mydev.entity.TableBean;
import com.mydev.entity.UserCustomField;
/**
*
* 项目名字:mydev<br>
* 类描述:<br>
* 创建人:wengmd<br>
* 创建时间:2015年3月30日<br>
* 修改人:<br>
* 修改时间:2015年3月30日<br>
* 修改备注:<br>
*
* @version 0.2<br>
*/
@Repository
public class CassandraDaoImpl implements DatabaseDao {
private static final Logger logger = LoggerFactory
.getLogger(CassandraDaoImpl.class);
private static final String DBLIST = "org.apache.cassandra.db.marshal.ListType";
private static final String DBMAP = "org.apache.cassandra.db.marshal.MapType";
private Cluster cluster;
private Session session;
private String keyspace;
public static final Map<String, Class> DBTYPE = new HashMap<String, Class>();
static {
DBTYPE.put("org.apache.cassandra.db.marshal.UTF8Type", String.class);
DBTYPE.put("org.apache.cassandra.db.marshal.Int32Type", Integer.class);
DBTYPE.put(DBLIST, List.class);
DBTYPE.put(DBMAP, Map.class);
DBTYPE.put("org.apache.cassandra.db.marshal.UserType", UserCustomField.class);
DBTYPE.put("org.apache.cassandra.db.marshal.BytesType", Byte[].class);
DBTYPE.put("org.apache.cassandra.db.marshal.LongType", Long.class);
DBTYPE.put("org.apache.cassandra.db.marshal.TimestampType", Timestamp.class);
}
protected Session getSession() {
return this.session;
}
@Override
public void connect(String node, String username, String password, String keyspace) {
this.keyspace = keyspace;
cluster = Cluster.builder()
.addContactPoint(node).withCredentials(username, password)
.build();
Metadata metadata = cluster.getMetadata();
logger.info("Connected to cluster: \n", metadata.getClusterName());
for ( Host host : metadata.getAllHosts() ) {
logger.info("Datatacenter: " + host.getDatacenter() + ";" + host.getAddress() + ";" + host.getRack());
}
session = cluster.connect();
}
@Override
public Class toJavaType(FieldBean bean, String dbtype) throws Exception {
// TODO Auto-generated method stub
if (StringUtils.isEmpty(dbtype))
throw new Exception("dbtype param is null");
Class javaCls = DBTYPE.get(dbtype);
if (javaCls == null) {
//用户自定义类型
if (dbtype.indexOf("org.apache.cassandra.db.marshal.UserType") >= 0) {
javaCls = UserCustomField.class;
} else if (dbtype.indexOf(DBLIST) >= 0) {
String subDbtype = dbtype.substring(DBLIST.length() + 1, dbtype.length() - 1);
Class subClass = toJavaType(bean, subDbtype);
javaCls = List.class;
bean.setFieldTypeStr("List<" + subClass.getSimpleName() + ">");
} else if (dbtype.indexOf(DBMAP) >= 0) {
String subDbtype = dbtype.substring(DBMAP.length() + 1, dbtype.length() - 1);
String[] subDbtypes = subDbtype.split(",");
Class subClassKey = toJavaType(bean, subDbtypes[0]);
Class subClassVal = toJavaType(bean, subDbtypes[1]);
bean.setFieldTypeStr("Map<" + subClassKey.getSimpleName() + "," + subClassVal.getSimpleName() + ">");
} else
throw new Exception(dbtype + " javaClass is null");
}
bean.setFieldType(javaCls);
return javaCls;
}
public void close() {
session.close();
cluster.close();
}
@Override
public List<TableBean> getTables() {
// TODO Auto-generated method stub
Clause clause = QueryBuilder.eq("keyspace_name", keyspace);
Select select = QueryBuilder.select().from("system", "schema_columnfamilies");
select.where(clause);
// BoundStatement bindStatement =
// session.prepare(
// "select * from system.schema_columnfamilies where keyspace_name=?")
// .bind(keyspace);
// session.execute(bindStatement);
ResultSet results = session.execute(select);
List<Row> rows = results.all();
List<TableBean>rt = new ArrayList<TableBean>();
for (Row row: rows) {
TableBean bean = new TableBean();
bean.setName(row.getString("columnfamily_name"));
bean.setComment(row.getString("comment"));
rt.add(bean);
}
return rt;
}
@Override
public List<FieldBean> getFields(String tableName) throws Exception {
// TODO Auto-generated method stub
Select select = QueryBuilder.select("column_name", "type", "validator").from("system", "schema_columns");
select.where(QueryBuilder.eq("keyspace_name", keyspace)).and(QueryBuilder.eq("columnfamily_name", tableName));
ResultSet results = session.execute(select);
List<Row> rows = results.all();
List<FieldBean>rt = new ArrayList<FieldBean>();
for (Row row: rows) {
FieldBean bean = new FieldBean();
bean.setFieldName(fieldNameDelUnderline(row.getString("column_name")));
//bean.setFieldType(fieldType);
String dbtype = row.getString("validator");
toJavaType(bean, dbtype);
bean.setComment("请注解");
rt.add(bean);
}
return rt;
}
protected String fieldNameDelUnderline(String fieldName) {
String[] fieldNameArr = fieldName.split("_");
if (fieldNameArr.length <= 0)
return fieldName;
StringBuilder rt = new StringBuilder();
int i = 0;
for (String s: fieldNameArr) {
if (i == 0) {
rt.append(s);
} else {
rt.append(StringUtils.capitalize(s));
}
i++;
}
return rt.toString();
}
public void validSession() throws Exception {
if (session == null)
throw new Exception("session is null");
}
}
| UTF-8 | Java | 6,308 | java | CassandraDaoImpl.java | Java | [
{
"context": "\n/**\r\n * \r\n * 项目名字:mydev<br>\r\n * 类描述:<br>\r\n * 创建人:wengmd<br>\r\n * 创建时间:2015年3月30日<br>\r\n * 修改人:<br>\r\n * 修改时间",
"end": 1008,
"score": 0.9994686245918274,
"start": 1002,
"tag": "USERNAME",
"value": "wengmd"
}
]
| null | []
| /**
*
*/
package com.mydev.dao.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.Clause;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import com.mydev.dao.DatabaseDao;
import com.mydev.entity.FieldBean;
import com.mydev.entity.TableBean;
import com.mydev.entity.UserCustomField;
/**
*
* 项目名字:mydev<br>
* 类描述:<br>
* 创建人:wengmd<br>
* 创建时间:2015年3月30日<br>
* 修改人:<br>
* 修改时间:2015年3月30日<br>
* 修改备注:<br>
*
* @version 0.2<br>
*/
@Repository
public class CassandraDaoImpl implements DatabaseDao {
private static final Logger logger = LoggerFactory
.getLogger(CassandraDaoImpl.class);
private static final String DBLIST = "org.apache.cassandra.db.marshal.ListType";
private static final String DBMAP = "org.apache.cassandra.db.marshal.MapType";
private Cluster cluster;
private Session session;
private String keyspace;
public static final Map<String, Class> DBTYPE = new HashMap<String, Class>();
static {
DBTYPE.put("org.apache.cassandra.db.marshal.UTF8Type", String.class);
DBTYPE.put("org.apache.cassandra.db.marshal.Int32Type", Integer.class);
DBTYPE.put(DBLIST, List.class);
DBTYPE.put(DBMAP, Map.class);
DBTYPE.put("org.apache.cassandra.db.marshal.UserType", UserCustomField.class);
DBTYPE.put("org.apache.cassandra.db.marshal.BytesType", Byte[].class);
DBTYPE.put("org.apache.cassandra.db.marshal.LongType", Long.class);
DBTYPE.put("org.apache.cassandra.db.marshal.TimestampType", Timestamp.class);
}
protected Session getSession() {
return this.session;
}
@Override
public void connect(String node, String username, String password, String keyspace) {
this.keyspace = keyspace;
cluster = Cluster.builder()
.addContactPoint(node).withCredentials(username, password)
.build();
Metadata metadata = cluster.getMetadata();
logger.info("Connected to cluster: \n", metadata.getClusterName());
for ( Host host : metadata.getAllHosts() ) {
logger.info("Datatacenter: " + host.getDatacenter() + ";" + host.getAddress() + ";" + host.getRack());
}
session = cluster.connect();
}
@Override
public Class toJavaType(FieldBean bean, String dbtype) throws Exception {
// TODO Auto-generated method stub
if (StringUtils.isEmpty(dbtype))
throw new Exception("dbtype param is null");
Class javaCls = DBTYPE.get(dbtype);
if (javaCls == null) {
//用户自定义类型
if (dbtype.indexOf("org.apache.cassandra.db.marshal.UserType") >= 0) {
javaCls = UserCustomField.class;
} else if (dbtype.indexOf(DBLIST) >= 0) {
String subDbtype = dbtype.substring(DBLIST.length() + 1, dbtype.length() - 1);
Class subClass = toJavaType(bean, subDbtype);
javaCls = List.class;
bean.setFieldTypeStr("List<" + subClass.getSimpleName() + ">");
} else if (dbtype.indexOf(DBMAP) >= 0) {
String subDbtype = dbtype.substring(DBMAP.length() + 1, dbtype.length() - 1);
String[] subDbtypes = subDbtype.split(",");
Class subClassKey = toJavaType(bean, subDbtypes[0]);
Class subClassVal = toJavaType(bean, subDbtypes[1]);
bean.setFieldTypeStr("Map<" + subClassKey.getSimpleName() + "," + subClassVal.getSimpleName() + ">");
} else
throw new Exception(dbtype + " javaClass is null");
}
bean.setFieldType(javaCls);
return javaCls;
}
public void close() {
session.close();
cluster.close();
}
@Override
public List<TableBean> getTables() {
// TODO Auto-generated method stub
Clause clause = QueryBuilder.eq("keyspace_name", keyspace);
Select select = QueryBuilder.select().from("system", "schema_columnfamilies");
select.where(clause);
// BoundStatement bindStatement =
// session.prepare(
// "select * from system.schema_columnfamilies where keyspace_name=?")
// .bind(keyspace);
// session.execute(bindStatement);
ResultSet results = session.execute(select);
List<Row> rows = results.all();
List<TableBean>rt = new ArrayList<TableBean>();
for (Row row: rows) {
TableBean bean = new TableBean();
bean.setName(row.getString("columnfamily_name"));
bean.setComment(row.getString("comment"));
rt.add(bean);
}
return rt;
}
@Override
public List<FieldBean> getFields(String tableName) throws Exception {
// TODO Auto-generated method stub
Select select = QueryBuilder.select("column_name", "type", "validator").from("system", "schema_columns");
select.where(QueryBuilder.eq("keyspace_name", keyspace)).and(QueryBuilder.eq("columnfamily_name", tableName));
ResultSet results = session.execute(select);
List<Row> rows = results.all();
List<FieldBean>rt = new ArrayList<FieldBean>();
for (Row row: rows) {
FieldBean bean = new FieldBean();
bean.setFieldName(fieldNameDelUnderline(row.getString("column_name")));
//bean.setFieldType(fieldType);
String dbtype = row.getString("validator");
toJavaType(bean, dbtype);
bean.setComment("请注解");
rt.add(bean);
}
return rt;
}
protected String fieldNameDelUnderline(String fieldName) {
String[] fieldNameArr = fieldName.split("_");
if (fieldNameArr.length <= 0)
return fieldName;
StringBuilder rt = new StringBuilder();
int i = 0;
for (String s: fieldNameArr) {
if (i == 0) {
rt.append(s);
} else {
rt.append(StringUtils.capitalize(s));
}
i++;
}
return rt.toString();
}
public void validSession() throws Exception {
if (session == null)
throw new Exception("session is null");
}
}
| 6,308 | 0.688403 | 0.682943 | 190 | 30.768421 | 25.663593 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.336842 | false | false | 0 |
59af1a0f4f4ec117dd458b34b65da823484ef723 | 1,520,418,482,357 | 13586c59f5bb834d98dfe31c1faef2f94f07c8da | /src/main/java/com/jarven/domain/product/ProductIndex.java | 7630463c32abe49731d3e347a81af3159858c95b | []
| no_license | jarven-he/spring-elasticsearch-demo | https://github.com/jarven-he/spring-elasticsearch-demo | 1fc41004d4cfc26ac35933857ce7d6207468cb6c | 6622d65030fc5f07959e35c01f753a8c59e83e41 | refs/heads/master | 2020-12-10T09:10:48.400000 | 2020-01-15T01:54:46 | 2020-01-15T01:54:46 | 233,553,453 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jarven.domain.product;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.List;
/**
* @description:
* @author: 何佳文
* @date: 2020-01-10 15:28
*/
@Data
@Document(indexName = "product-index", type = "product", replicas = 0)
public class ProductIndex {
@Id
@Field(type = FieldType.Integer)
private Integer productId;
@Field(type = FieldType.Text)
private String productName;
@Field(type = FieldType.Keyword)
private List<String> tag;
@Field(type = FieldType.Keyword)
private String brand;
@Field(type = FieldType.Keyword)
private String category;
@Field(type = FieldType.Keyword)
private String image;
}
| UTF-8 | Java | 919 | java | ProductIndex.java | Java | [
{
"context": "java.util.List;\n\n/**\n * @description:\n * @author: 何佳文\n * @date: 2020-01-10 15:28\n */\n\n@Data\n@Document(i",
"end": 366,
"score": 0.9998513460159302,
"start": 363,
"tag": "NAME",
"value": "何佳文"
}
]
| null | []
| package com.jarven.domain.product;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.List;
/**
* @description:
* @author: 何佳文
* @date: 2020-01-10 15:28
*/
@Data
@Document(indexName = "product-index", type = "product", replicas = 0)
public class ProductIndex {
@Id
@Field(type = FieldType.Integer)
private Integer productId;
@Field(type = FieldType.Text)
private String productName;
@Field(type = FieldType.Keyword)
private List<String> tag;
@Field(type = FieldType.Keyword)
private String brand;
@Field(type = FieldType.Keyword)
private String category;
@Field(type = FieldType.Keyword)
private String image;
}
| 919 | 0.729463 | 0.715225 | 39 | 22.410257 | 20.831089 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 0 |
3774e41d5249a2468e5258bb3912f6dd50b0058e | 8,108,898,294,712 | 11ec62cfdd7ee328d774ab7a8fe846300543ad4d | /calculator.java | 556255d3ae8ccd79b40d19172c9ad5e4442bdcfd | []
| no_license | Mohini-30/AutomationAcad | https://github.com/Mohini-30/AutomationAcad | 3684233a65976eaa0bc0fb7703069b807472f89f | f1734d3d9eafa9406c48b5dde65b061205be51d5 | refs/heads/master | 2023-08-21T09:06:49.781000 | 2021-10-22T06:40:50 | 2021-10-22T06:40:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//Addition function
static int add(int a, int b){
return a+b;
}
//Subtraction Function
static int subtract(int a,int b){
return a -b;
}
//division function
static int division(int a, int b){
return a/b;
}
//multiplication function
static int multiply(int a, int b){
return a*b;
} | UTF-8 | Java | 287 | java | calculator.java | Java | []
| null | []
|
//Addition function
static int add(int a, int b){
return a+b;
}
//Subtraction Function
static int subtract(int a,int b){
return a -b;
}
//division function
static int division(int a, int b){
return a/b;
}
//multiplication function
static int multiply(int a, int b){
return a*b;
} | 287 | 0.696864 | 0.696864 | 19 | 14.105263 | 12.349706 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false | 0 |
f7b4ef48cb3984c7b7b724a0bbd55c16f6fc8617 | 9,552,007,284,341 | 8014ea7366fbdba7328e829412d51bb85f22850f | /app/src/main/java/de/nadinekost/transit_app/data/model/SegmentModel.java | 6c155e2213e1d804b42123abba690a121213ac01 | []
| no_license | elaydis/transit-app | https://github.com/elaydis/transit-app | bbba959d47dc398f6756b96e41ff9ee1619d9790 | 77935dbf1ae2791d9065e01b39b6ef83502ee947 | refs/heads/master | 2016-09-19T14:43:49.677000 | 2016-09-05T17:33:16 | 2016-09-05T17:33:16 | 67,122,082 | 0 | 0 | null | false | 2016-09-05T17:33:17 | 2016-09-01T10:32:47 | 2016-09-01T11:00:41 | 2016-09-05T17:33:16 | 783 | 0 | 0 | 0 | Java | null | null | package de.nadinekost.transit_app.data.model;
import com.google.gson.annotations.SerializedName;
import io.realm.RealmList;
import io.realm.RealmObject;
public class SegmentModel extends RealmObject {
@SerializedName("name")
String name;
@SerializedName("num_stops")
int numberOfStops;
@SerializedName("stops")
RealmList<StopModel> stops;
@SerializedName("travel_mode")
String travelMode;
@SerializedName("description")
String description;
@SerializedName("color")
String color;
@SerializedName("icon_url")
String iconUrl;
@SerializedName("polyline")
String polyline;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumberOfStops() {
return numberOfStops;
}
public void setNumberOfStops(int numberOfStops) {
this.numberOfStops = numberOfStops;
}
public RealmList<StopModel> getStops() {
return stops;
}
public void setStops(RealmList<StopModel> stops) {
this.stops = stops;
}
public String getTravelMode() {
return travelMode;
}
public void setTravelMode(String travelMode) {
this.travelMode = travelMode;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getPolyline() {
return polyline;
}
public void setPolyline(String polyline) {
this.polyline = polyline;
}
}
| UTF-8 | Java | 1,893 | java | SegmentModel.java | Java | []
| null | []
| package de.nadinekost.transit_app.data.model;
import com.google.gson.annotations.SerializedName;
import io.realm.RealmList;
import io.realm.RealmObject;
public class SegmentModel extends RealmObject {
@SerializedName("name")
String name;
@SerializedName("num_stops")
int numberOfStops;
@SerializedName("stops")
RealmList<StopModel> stops;
@SerializedName("travel_mode")
String travelMode;
@SerializedName("description")
String description;
@SerializedName("color")
String color;
@SerializedName("icon_url")
String iconUrl;
@SerializedName("polyline")
String polyline;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumberOfStops() {
return numberOfStops;
}
public void setNumberOfStops(int numberOfStops) {
this.numberOfStops = numberOfStops;
}
public RealmList<StopModel> getStops() {
return stops;
}
public void setStops(RealmList<StopModel> stops) {
this.stops = stops;
}
public String getTravelMode() {
return travelMode;
}
public void setTravelMode(String travelMode) {
this.travelMode = travelMode;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getPolyline() {
return polyline;
}
public void setPolyline(String polyline) {
this.polyline = polyline;
}
}
| 1,893 | 0.637612 | 0.637612 | 97 | 18.515465 | 16.906727 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28866 | false | false | 0 |
61ea801295e96d8453523869561df8728101b38c | 8,684,423,921,676 | c27cb144b8500d9b1e12ddb0d0e2f5a163bab309 | /src/main/java/org/quark/microapidemo/schedule/MaintainSchedule.java | a271054d6ece20a2aa6fb2e5108ce2c7633c33f5 | [
"Apache-2.0"
]
| permissive | lanyusteffen/micro-api-demo | https://github.com/lanyusteffen/micro-api-demo | b4677ad18865bc46994d784d445ed0dd0f7f22cc | 9988f737922b95addc3410c12ace5964ff408f2d | refs/heads/master | 2020-03-07T04:40:06.742000 | 2018-03-30T09:48:27 | 2018-03-30T09:48:27 | 127,272,956 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.quark.microapidemo.schedule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@Component
public class MaintainSchedule {
@Autowired(required = true)
private ApplicationContext context;
}
| UTF-8 | Java | 328 | java | MaintainSchedule.java | Java | []
| null | []
| package org.quark.microapidemo.schedule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@Component
public class MaintainSchedule {
@Autowired(required = true)
private ApplicationContext context;
}
| 328 | 0.826219 | 0.826219 | 12 | 26.333334 | 22.148489 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 0 |
0522f67a84e5766f5b30145351461c15312c92c2 | 17,248,588,661,548 | 088efb94f273566369cbf43105b5fb7082870b43 | /src/test/java/org/laxio/piston/protocol/v340/TestConnection.java | 93f49963317bab993f7b011ae9af090ba4ec05eb | [
"MIT"
]
| permissive | fossabot/Protocol | https://github.com/fossabot/Protocol | 05495b915418e43005bbcec774ed0967be18f0b6 | 207b8f65d2f45a3b06be330c7ee16f62af388119 | refs/heads/master | 2021-09-02T09:38:08.499000 | 2018-01-01T14:13:30 | 2018-01-01T14:13:30 | 115,923,414 | 0 | 0 | null | true | 2018-01-01T14:13:25 | 2018-01-01T14:13:24 | 2017-12-31T19:36:13 | 2018-01-01T11:48:58 | 288 | 0 | 0 | 0 | null | false | null | package org.laxio.piston.protocol.v340;
import org.laxio.piston.piston.protocol.Connection;
import org.laxio.piston.piston.protocol.Packet;
import org.laxio.piston.piston.protocol.ProtocolState;
import java.net.InetSocketAddress;
public class TestConnection implements Connection {
@Override
public ProtocolState getState() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public void setState(ProtocolState state) {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public void sendPacket(Packet packet) {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public boolean isEncrypted() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public InetSocketAddress getAddress() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public int getProtocolVersion() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
}
| UTF-8 | Java | 1,129 | java | TestConnection.java | Java | []
| null | []
| package org.laxio.piston.protocol.v340;
import org.laxio.piston.piston.protocol.Connection;
import org.laxio.piston.piston.protocol.Packet;
import org.laxio.piston.piston.protocol.ProtocolState;
import java.net.InetSocketAddress;
public class TestConnection implements Connection {
@Override
public ProtocolState getState() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public void setState(ProtocolState state) {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public void sendPacket(Packet packet) {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public boolean isEncrypted() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public InetSocketAddress getAddress() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
@Override
public int getProtocolVersion() {
throw new UnsupportedOperationException("Unavailable in test phase");
}
}
| 1,129 | 0.726306 | 0.723649 | 41 | 26.536585 | 27.35146 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.268293 | false | false | 0 |
3de711497c5c54c1585fc256e64e27e5b7bd6ced | 24,103,356,478,291 | cbc61ffb33570a1bc55bb1e754510192b0366de2 | /ole-app/olefs/src/main/java/org/kuali/ole/select/document/OlePurchaseOrderRetransmitDocument.java | 72f2ee2d71d7b7f070bc1295f1932b1baab0d1b7 | [
"ECL-2.0"
]
| permissive | VU-libtech/OLE-INST | https://github.com/VU-libtech/OLE-INST | 42b3656d145a50deeb22f496f6f430f1d55283cb | 9f5efae4dfaf810fa671c6ac6670a6051303b43d | refs/heads/master | 2021-07-08T11:01:19.692000 | 2015-05-15T14:40:50 | 2015-05-15T14:40:50 | 24,459,494 | 1 | 0 | ECL-2.0 | false | 2021-04-26T17:01:11 | 2014-09-25T13:40:33 | 2017-01-26T03:50:53 | 2021-04-26T17:01:11 | 134,328 | 2 | 0 | 16 | Java | false | false | /*
* Copyright 2011 The Kuali Foundation.
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.ole.select.document;
import org.kuali.ole.module.purap.document.PurchaseOrderRetransmitDocument;
import org.kuali.ole.module.purap.document.RequisitionDocument;
import org.kuali.ole.select.document.service.OlePurchaseOrderDocumentHelperService;
import org.kuali.ole.sys.OLEConstants;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.ole.vnd.businessobject.VendorAlias;
import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class is the document class for Ole Purchase Order Close Document
*/
public class OlePurchaseOrderRetransmitDocument extends PurchaseOrderRetransmitDocument {
private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderRetransmitDocument.class);
/**
* This method is overridden to populate newly added ole fields from requisition into Ole Purchase Order Retransmit Document.
*
* @see org.kuali.ole.module.purap.document.PurchaseOrderDocument#populatePurchaseOrderFromRequisition(org.kuali.ole.module.purap.document.RequisitionDocument)
*/
private String vendorPoNumber;
public String getVendorPoNumber() {
return vendorPoNumber;
}
public void setVendorPoNumber(String vendorPoNumber) {
this.vendorPoNumber = vendorPoNumber;
}
@Override
public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).populatePurchaseOrderFromRequisition(this, requisitionDocument);
}
/**
* This method is overriden to populate bib info in Ole Purchase Order Retransmit Document
*
* @see org.kuali.ole.module.purap.document.PurchaseOrderDocument#prepareForSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
*/
@Override
public void prepareForSave(KualiDocumentEvent event) {
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).prepareForSave(this, event);
super.prepareForSave(event);
}
/**
* This method is overriden to populate bib info in Ole Purchase Order Retransmit Document
*
* @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#processAfterRetrieve()
*/
@Override
public void processAfterRetrieve() {
if (this.getVendorAliasName() == null) {
populateVendorAliasName();
}
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).processAfterRetrieve(this);
}
@Override
public List getItemsActiveOnly() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnly(this);
}
/**
* Gets the active items in this Purchase Order, and sets up the alternate amount for GL entry creation.
*
* @return the list of all active items in this Purchase Order.
*/
@Override
public List getItemsActiveOnlySetupAlternateAmount() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnlySetupAlternateAmount(this);
}
@Override
public boolean getAdditionalChargesExist() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getAdditionalChargesExist(this);
}
/**
* This method returns if Purchase Order Document created is in Final Status
*
* @return
*/
public boolean getIsFinalReqs() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsFinalReqs(this);
}
public boolean getIsSplitPO() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsSplitPO(this);
}
public boolean getIsReOpenPO() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsReOpenPO(this);
}
/**
* This method is used to get the bibedtior creat url from propertie file
*
* @return Bibeditor creat url string
*/
public String getBibeditorCreateURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorCreateURL();
}
public String getBibSearchURL() {
LOG.debug("Inside getBibSearchURL of OlePurchaseOrderRetransmitDocument");
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibSearchURL();
}
/**
* This method is used to get the bibedtior edit url from propertie file
*
* @return Bibeditor edit url string
*/
public String getBibeditorEditURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorEditURL();
}
/**
* This method is used to get the dublinedtior edit url from propertie file
*
* @return Dublineditor edit url string
*/
public String getDublinEditorEditURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorEditURL();
}
/**
* This method is used to get the Instanceeditor url from propertie file
*
* @return Instanceeditor url string
*/
public String getInstanceEditorURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getInstanceEditorURL();
}
/**
* This method is used to get the bibedtior view url from propertie file
*
* @return Bibeditor view url string
*/
public String getBibeditorViewURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorViewURL();
}
/**
* This method is used to get the dublinedtior view url from propertie file
*
* @return dublineditor view url string
*/
public String getDublinEditorViewURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorViewURL();
}
/**
* This method is used to get the directory path where the marc xml files need to be created
*
* @return Directory path string
*/
public String getMarcXMLFileDirLocation() throws Exception {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getMarcXMLFileDirLocation();
}
/**
* This method is used to check the status of the document for displaying view and edit buttons in line item
*
* @return boolean
*/
public boolean getIsSaved() {
if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
return true;
}
return false;
}
public boolean getIsATypeOfRCVGDoc() {
return false;
}
public boolean getIsATypeOfCORRDoc() {
return false;
}
private void populateVendorAliasName() {
Map vendorDetailMap = new HashMap();
vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorHeaderGeneratedIdentifier());
vendorDetailMap.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER, this.getVendorDetailAssignedIdentifier());
List<VendorAlias> vendorDetailList = (List) getBusinessObjectService().findMatching(VendorAlias.class, vendorDetailMap);
if (vendorDetailList != null && vendorDetailList.size() > 0) {
this.setVendorAliasName(vendorDetailList.get(0).getVendorAliasName());
}
}
}
| UTF-8 | Java | 8,279 | java | OlePurchaseOrderRetransmitDocument.java | Java | []
| null | []
| /*
* Copyright 2011 The Kuali Foundation.
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kuali.ole.select.document;
import org.kuali.ole.module.purap.document.PurchaseOrderRetransmitDocument;
import org.kuali.ole.module.purap.document.RequisitionDocument;
import org.kuali.ole.select.document.service.OlePurchaseOrderDocumentHelperService;
import org.kuali.ole.sys.OLEConstants;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.ole.vnd.businessobject.VendorAlias;
import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class is the document class for Ole Purchase Order Close Document
*/
public class OlePurchaseOrderRetransmitDocument extends PurchaseOrderRetransmitDocument {
private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderRetransmitDocument.class);
/**
* This method is overridden to populate newly added ole fields from requisition into Ole Purchase Order Retransmit Document.
*
* @see org.kuali.ole.module.purap.document.PurchaseOrderDocument#populatePurchaseOrderFromRequisition(org.kuali.ole.module.purap.document.RequisitionDocument)
*/
private String vendorPoNumber;
public String getVendorPoNumber() {
return vendorPoNumber;
}
public void setVendorPoNumber(String vendorPoNumber) {
this.vendorPoNumber = vendorPoNumber;
}
@Override
public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).populatePurchaseOrderFromRequisition(this, requisitionDocument);
}
/**
* This method is overriden to populate bib info in Ole Purchase Order Retransmit Document
*
* @see org.kuali.ole.module.purap.document.PurchaseOrderDocument#prepareForSave(org.kuali.rice.krad.rule.event.KualiDocumentEvent)
*/
@Override
public void prepareForSave(KualiDocumentEvent event) {
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).prepareForSave(this, event);
super.prepareForSave(event);
}
/**
* This method is overriden to populate bib info in Ole Purchase Order Retransmit Document
*
* @see org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocumentBase#processAfterRetrieve()
*/
@Override
public void processAfterRetrieve() {
if (this.getVendorAliasName() == null) {
populateVendorAliasName();
}
SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).processAfterRetrieve(this);
}
@Override
public List getItemsActiveOnly() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnly(this);
}
/**
* Gets the active items in this Purchase Order, and sets up the alternate amount for GL entry creation.
*
* @return the list of all active items in this Purchase Order.
*/
@Override
public List getItemsActiveOnlySetupAlternateAmount() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnlySetupAlternateAmount(this);
}
@Override
public boolean getAdditionalChargesExist() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getAdditionalChargesExist(this);
}
/**
* This method returns if Purchase Order Document created is in Final Status
*
* @return
*/
public boolean getIsFinalReqs() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsFinalReqs(this);
}
public boolean getIsSplitPO() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsSplitPO(this);
}
public boolean getIsReOpenPO() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsReOpenPO(this);
}
/**
* This method is used to get the bibedtior creat url from propertie file
*
* @return Bibeditor creat url string
*/
public String getBibeditorCreateURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorCreateURL();
}
public String getBibSearchURL() {
LOG.debug("Inside getBibSearchURL of OlePurchaseOrderRetransmitDocument");
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibSearchURL();
}
/**
* This method is used to get the bibedtior edit url from propertie file
*
* @return Bibeditor edit url string
*/
public String getBibeditorEditURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorEditURL();
}
/**
* This method is used to get the dublinedtior edit url from propertie file
*
* @return Dublineditor edit url string
*/
public String getDublinEditorEditURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorEditURL();
}
/**
* This method is used to get the Instanceeditor url from propertie file
*
* @return Instanceeditor url string
*/
public String getInstanceEditorURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getInstanceEditorURL();
}
/**
* This method is used to get the bibedtior view url from propertie file
*
* @return Bibeditor view url string
*/
public String getBibeditorViewURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorViewURL();
}
/**
* This method is used to get the dublinedtior view url from propertie file
*
* @return dublineditor view url string
*/
public String getDublinEditorViewURL() {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorViewURL();
}
/**
* This method is used to get the directory path where the marc xml files need to be created
*
* @return Directory path string
*/
public String getMarcXMLFileDirLocation() throws Exception {
return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getMarcXMLFileDirLocation();
}
/**
* This method is used to check the status of the document for displaying view and edit buttons in line item
*
* @return boolean
*/
public boolean getIsSaved() {
if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
return true;
}
return false;
}
public boolean getIsATypeOfRCVGDoc() {
return false;
}
public boolean getIsATypeOfCORRDoc() {
return false;
}
private void populateVendorAliasName() {
Map vendorDetailMap = new HashMap();
vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorHeaderGeneratedIdentifier());
vendorDetailMap.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER, this.getVendorDetailAssignedIdentifier());
List<VendorAlias> vendorDetailList = (List) getBusinessObjectService().findMatching(VendorAlias.class, vendorDetailMap);
if (vendorDetailList != null && vendorDetailList.size() > 0) {
this.setVendorAliasName(vendorDetailList.get(0).getVendorAliasName());
}
}
}
| 8,279 | 0.709506 | 0.708177 | 215 | 36.506977 | 39.76511 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.265116 | false | false | 0 |
5c10f6e0ccf0bbf1164c9a681d4707cdbde82921 | 9,758,165,749,277 | 4a37e7521ed9662a8d34d1bce725f96677de2141 | /src/main/java/edu/rsvier/springmvc/model/Persoon.java | eae7640b1ad4b6f243b0fc674455af8ed48e4bca | []
| no_license | GeertZondervan/Cursisttraject | https://github.com/GeertZondervan/Cursisttraject | 5ff9560b7ffb271adbf0f7f9c9cae13af164dd0c | 51a27b09efae5ca586800ec2d7e617b4c2e2b478 | refs/heads/master | 2021-01-10T17:32:28.161000 | 2015-05-02T12:55:42 | 2015-05-02T12:55:42 | 43,089,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.rsvier.springmvc.model;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "persoon", catalog = "cursisttraject_relatiebeheer")
public class Persoon implements java.io.Serializable {
private Integer id;
private String voornaam;
private String achternaam;
private Set<Persoonsrol> persoonsrollen = new HashSet<Persoonsrol>(0);
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "voornaam", nullable = false, length = 45)
public String getVoornaam() {
return this.voornaam;
}
public void setVoornaam(String voornaam) {
this.voornaam = voornaam;
}
@Column(name = "achternaam", nullable = false, length = 45)
public String getAchternaam() {
return this.achternaam;
}
public void setAchternaam(String achternaam) {
this.achternaam = achternaam;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "persoon")
public Set<Persoonsrol> getPersoonsrollen() {
return this.persoonsrollen;
}
public void setPersoonsrollen(Set<Persoonsrol> persoonsrollen) {
this.persoonsrollen = persoonsrollen;
}
@Override
public boolean equals(Object anderPersoon) {
if (anderPersoon instanceof Persoon) {
if (getId() == ((Persoon)anderPersoon).getId() && getVoornaam() == ((Persoon)anderPersoon).getVoornaam()
&& getPersoonsrollen() == ((Persoon)anderPersoon).getPersoonsrollen()) {
return true;
}
}
return false;
}
}
| UTF-8 | Java | 2,061 | java | Persoon.java | Java | []
| null | []
| package edu.rsvier.springmvc.model;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "persoon", catalog = "cursisttraject_relatiebeheer")
public class Persoon implements java.io.Serializable {
private Integer id;
private String voornaam;
private String achternaam;
private Set<Persoonsrol> persoonsrollen = new HashSet<Persoonsrol>(0);
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "voornaam", nullable = false, length = 45)
public String getVoornaam() {
return this.voornaam;
}
public void setVoornaam(String voornaam) {
this.voornaam = voornaam;
}
@Column(name = "achternaam", nullable = false, length = 45)
public String getAchternaam() {
return this.achternaam;
}
public void setAchternaam(String achternaam) {
this.achternaam = achternaam;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "persoon")
public Set<Persoonsrol> getPersoonsrollen() {
return this.persoonsrollen;
}
public void setPersoonsrollen(Set<Persoonsrol> persoonsrollen) {
this.persoonsrollen = persoonsrollen;
}
@Override
public boolean equals(Object anderPersoon) {
if (anderPersoon instanceof Persoon) {
if (getId() == ((Persoon)anderPersoon).getId() && getVoornaam() == ((Persoon)anderPersoon).getVoornaam()
&& getPersoonsrollen() == ((Persoon)anderPersoon).getPersoonsrollen()) {
return true;
}
}
return false;
}
}
| 2,061 | 0.66327 | 0.660844 | 75 | 26.48 | 24.411123 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false | 0 |
72a6dc37532ba301bc14a73239ce396529d0910d | 1,486,058,714,948 | bcaf5e9d8ff3467c21f525e742fa63fb77c9bfa6 | /crm/src/main/java/com/keeps/crm/service/impl/RoleServiceImpl.java | e4c0409bc5f1ff2dacbafd3c93dc66c952b9f3f3 | [
"Apache-2.0"
]
| permissive | keepsl/keepsmis | https://github.com/keepsl/keepsmis | 6cf47873bf3926c73471d4647001af3ef5952a31 | 730c27c7ed36da5169cec6c2a4eb8bdacb28db0f | refs/heads/master | 2021-01-11T20:53:37.600000 | 2017-10-16T05:05:14 | 2017-10-16T05:05:14 | 79,206,022 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.keeps.crm.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.keeps.core.model.utils.IdTypes;
import com.keeps.core.service.AbstractService;
import com.keeps.crm.dao.RoleDao;
import com.keeps.crm.service.RoleService;
import com.keeps.model.TRole;
import com.keeps.tools.exception.CapecException;
import com.keeps.tools.utils.Assert;
import com.keeps.tools.utils.EditType;
import com.keeps.tools.utils.StringUtils;
import com.keeps.tools.utils.page.Page;
import com.keeps.tools.utils.threadlocal.UserSchoolThread;
import com.keeps.utils.TreeNode;
/**
* <p>Title: RoleServiceImpl.java</p>
* <p>Description: 角色Service实现类 </p>
* <p>Copyright: Copyright (c) KEEPS</p>
* @author keeps
* @version v 1.00
* @date 创建日期:2017年6月18日
* 修改日期:
* 修改人:
* 复审人:
*/
@Service
public class RoleServiceImpl extends AbstractService implements RoleService {
@Autowired
private RoleDao roleDao;
@Override
public Page queryList(TRole role) {
return roleDao.queryList(role);
}
@Override
public List<TRole> getList(TRole role) {
return roleDao.getList(role);
}
@Override
public TRole getById(Integer id){
return super.get(TRole.class, id);
}
public String saveOrUpdate(TRole role){
Assert.isTrue(StringUtils.hasText(role.getName()), "角色名称不能为空!");
Assert.isTrue(role.getStatus()!=null, "角色状态不能为空!");
Assert.isTrue(role.getRoletype()!=null, "角色类型不能为空!");
role.setSort(0);
if(!roleDao.isUnique(role, new String[]{"name"})){
throw new CapecException("["+role.getName()+"]角色名称已经存在,不允许重复添加!");
}
return super.saveOrUpdateEntity(role,EditType.NULL_UN_UPDATE);
}
public String delete(String ids){
Assert.isTrue(StringUtils.hasText(ids), "请选择要删除的数据.");
super.removeEntity(TRole.class, ids, IdTypes.Integer);
roleDao.deleteMenuOperateAccessByRoleids(ids);
roleDao.deleteEmproleByRoleids(ids);
return "删除成功!";
}
public List<TreeNode> getRoleTree(String roleids){
TreeNode node = new TreeNode();
node.setId("0");
node.setpId("0");
node.setOpen(1);
node.setName("全部组织");
List<TreeNode> listtreenode = roleDao.getListTree();
if (StringUtils.hasText(roleids)) {
String[] roleidsp = roleids.split(",");
for (TreeNode treeNode : listtreenode) {
for (String roleid : roleidsp) {
if(treeNode.getId().equals(roleid)){
treeNode.setChecked(1);
}
}
}
}
listtreenode.add(node);
return listtreenode;
}
public String getRolenamesByEmpid(){
if (UserSchoolThread.get().isSuperAdmin()) {
return "超级管理员";
}
List<TRole> listrole = roleDao.getListByEmpid(UserSchoolThread.get().getUserid());
if (listrole==null) {
return "";
}
String rolenames = "";
for (TRole tRole : listrole) {
rolenames += tRole.getName()+",";
}
return StringUtils.hasText(rolenames)?rolenames.substring(0, rolenames.length()-1):rolenames;
}
}
| UTF-8 | Java | 3,228 | java | RoleServiceImpl.java | Java | []
| null | []
| package com.keeps.crm.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.keeps.core.model.utils.IdTypes;
import com.keeps.core.service.AbstractService;
import com.keeps.crm.dao.RoleDao;
import com.keeps.crm.service.RoleService;
import com.keeps.model.TRole;
import com.keeps.tools.exception.CapecException;
import com.keeps.tools.utils.Assert;
import com.keeps.tools.utils.EditType;
import com.keeps.tools.utils.StringUtils;
import com.keeps.tools.utils.page.Page;
import com.keeps.tools.utils.threadlocal.UserSchoolThread;
import com.keeps.utils.TreeNode;
/**
* <p>Title: RoleServiceImpl.java</p>
* <p>Description: 角色Service实现类 </p>
* <p>Copyright: Copyright (c) KEEPS</p>
* @author keeps
* @version v 1.00
* @date 创建日期:2017年6月18日
* 修改日期:
* 修改人:
* 复审人:
*/
@Service
public class RoleServiceImpl extends AbstractService implements RoleService {
@Autowired
private RoleDao roleDao;
@Override
public Page queryList(TRole role) {
return roleDao.queryList(role);
}
@Override
public List<TRole> getList(TRole role) {
return roleDao.getList(role);
}
@Override
public TRole getById(Integer id){
return super.get(TRole.class, id);
}
public String saveOrUpdate(TRole role){
Assert.isTrue(StringUtils.hasText(role.getName()), "角色名称不能为空!");
Assert.isTrue(role.getStatus()!=null, "角色状态不能为空!");
Assert.isTrue(role.getRoletype()!=null, "角色类型不能为空!");
role.setSort(0);
if(!roleDao.isUnique(role, new String[]{"name"})){
throw new CapecException("["+role.getName()+"]角色名称已经存在,不允许重复添加!");
}
return super.saveOrUpdateEntity(role,EditType.NULL_UN_UPDATE);
}
public String delete(String ids){
Assert.isTrue(StringUtils.hasText(ids), "请选择要删除的数据.");
super.removeEntity(TRole.class, ids, IdTypes.Integer);
roleDao.deleteMenuOperateAccessByRoleids(ids);
roleDao.deleteEmproleByRoleids(ids);
return "删除成功!";
}
public List<TreeNode> getRoleTree(String roleids){
TreeNode node = new TreeNode();
node.setId("0");
node.setpId("0");
node.setOpen(1);
node.setName("全部组织");
List<TreeNode> listtreenode = roleDao.getListTree();
if (StringUtils.hasText(roleids)) {
String[] roleidsp = roleids.split(",");
for (TreeNode treeNode : listtreenode) {
for (String roleid : roleidsp) {
if(treeNode.getId().equals(roleid)){
treeNode.setChecked(1);
}
}
}
}
listtreenode.add(node);
return listtreenode;
}
public String getRolenamesByEmpid(){
if (UserSchoolThread.get().isSuperAdmin()) {
return "超级管理员";
}
List<TRole> listrole = roleDao.getListByEmpid(UserSchoolThread.get().getUserid());
if (listrole==null) {
return "";
}
String rolenames = "";
for (TRole tRole : listrole) {
rolenames += tRole.getName()+",";
}
return StringUtils.hasText(rolenames)?rolenames.substring(0, rolenames.length()-1):rolenames;
}
}
| 3,228 | 0.692207 | 0.686641 | 110 | 25.763636 | 21.836554 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.790909 | false | false | 0 |
781a80caf9441a70ffecbe4d7ba7a02b6d942194 | 26,972,394,683,053 | ae99925a88c34d8362d57ee97cbed1591010c763 | /src/main/java/edu/conncoll/peci/models/phone/PhoneImpl.java | c1280124bf101daa078908a9ceaed22719006c90 | []
| no_license | maddick/sandbox | https://github.com/maddick/sandbox | 0bcf479e37c754bb30ffea31f05db47e78a97c71 | 2c62ded59a082b7319413ddb4bb2d3d552650ec9 | refs/heads/master | 2017-05-03T13:48:27.368000 | 2016-12-21T13:56:23 | 2016-12-21T13:56:23 | 47,581,071 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.conncoll.peci.models.phone;
import java.util.List;
import edu.conncoll.peci.models.EntityModelPK;
import edu.conncoll.peci.models.Annotations.PeciEntityModelDaoBean;
/**
* <p>This implementation of {@link edu.conncoll.peci.models.phone.Phone Phone}
* handles phones for all {@link edu.conncoll.peci.models.Person Persons} apart from
* {@link edu.conncoll.peci.models.parent.MatchingPerson MatchingPersons} who utilize
* the {@link edu.conncoll.peci.models.phone.MatchingPersonPhone MatchingPersonPhone}
* implementation instead.</p>
*
* <p>If PECI specific information is to be retrieved from the Storage Solution, then
* this implementation should be used.</p>
*
* <p>It should be noted that the validation for this implementation is more
* encompassing than that of other implementations as its intended design is to house
* a more complete set of data regarding {@link edu.conncoll.peci.models.phone.Phone Phones}.
*
* @author Mike
*
*/
@PeciEntityModelDaoBean(saveDao = "phoneSaveDao", updateDao = "phoneUpdateDao")
public class PhoneImpl extends AbstractPhone {
/**
*
*/
private static final long serialVersionUID = 6616022593688114088L;
public PhoneImpl() {
super();
}
public PhoneImpl(EntityModelPK entityModelPk) {
super(entityModelPk);
}
public PhoneImpl(Phone phone) {
super(phone);
}
@Override
public List<String> validate() {
List<String> errors = super.validate();
Boolean isValidPhoneCode = false;
for ( PeciPhoneCodes code : PeciPhoneCodes.values()) {
if ( this.getPeciPhoneCode().equals(code.toString()) ) {
isValidPhoneCode = true;
break;
}
}
if ( !isValidPhoneCode ) {
errors.add(this.getPeciPhoneCode().toString() + " is not a valid PECI phone code.");
}
if ( !this.getPpid().getClass().equals(Integer.class) ) {
errors.add("Phone PPID must be of type Integer.");
} else if ( Integer.signum(this.getPpid()) <= 0 ) {
errors.add("Phone PPID must be a positive non-zero integer value.");
}
if ( !this.getPhoneSeqNo().getClass().equals(Integer.class) ) {
errors.add("Phone sequence number must be of type Integer.");
} else if ( Integer.signum(this.getPhoneSeqNo()) <= -1 ) {
errors.add("Phone sequence number must be a positive integer value.");
}
return errors;
}
}
| UTF-8 | Java | 2,329 | java | PhoneImpl.java | Java | [
{
"context": "ll.peci.models.phone.Phone Phones}.\n * \n * @author Mike\n *\n */\n@PeciEntityModelDaoBean(saveDao = \"phoneSa",
"end": 973,
"score": 0.9771450757980347,
"start": 969,
"tag": "NAME",
"value": "Mike"
}
]
| null | []
| package edu.conncoll.peci.models.phone;
import java.util.List;
import edu.conncoll.peci.models.EntityModelPK;
import edu.conncoll.peci.models.Annotations.PeciEntityModelDaoBean;
/**
* <p>This implementation of {@link edu.conncoll.peci.models.phone.Phone Phone}
* handles phones for all {@link edu.conncoll.peci.models.Person Persons} apart from
* {@link edu.conncoll.peci.models.parent.MatchingPerson MatchingPersons} who utilize
* the {@link edu.conncoll.peci.models.phone.MatchingPersonPhone MatchingPersonPhone}
* implementation instead.</p>
*
* <p>If PECI specific information is to be retrieved from the Storage Solution, then
* this implementation should be used.</p>
*
* <p>It should be noted that the validation for this implementation is more
* encompassing than that of other implementations as its intended design is to house
* a more complete set of data regarding {@link edu.conncoll.peci.models.phone.Phone Phones}.
*
* @author Mike
*
*/
@PeciEntityModelDaoBean(saveDao = "phoneSaveDao", updateDao = "phoneUpdateDao")
public class PhoneImpl extends AbstractPhone {
/**
*
*/
private static final long serialVersionUID = 6616022593688114088L;
public PhoneImpl() {
super();
}
public PhoneImpl(EntityModelPK entityModelPk) {
super(entityModelPk);
}
public PhoneImpl(Phone phone) {
super(phone);
}
@Override
public List<String> validate() {
List<String> errors = super.validate();
Boolean isValidPhoneCode = false;
for ( PeciPhoneCodes code : PeciPhoneCodes.values()) {
if ( this.getPeciPhoneCode().equals(code.toString()) ) {
isValidPhoneCode = true;
break;
}
}
if ( !isValidPhoneCode ) {
errors.add(this.getPeciPhoneCode().toString() + " is not a valid PECI phone code.");
}
if ( !this.getPpid().getClass().equals(Integer.class) ) {
errors.add("Phone PPID must be of type Integer.");
} else if ( Integer.signum(this.getPpid()) <= 0 ) {
errors.add("Phone PPID must be a positive non-zero integer value.");
}
if ( !this.getPhoneSeqNo().getClass().equals(Integer.class) ) {
errors.add("Phone sequence number must be of type Integer.");
} else if ( Integer.signum(this.getPhoneSeqNo()) <= -1 ) {
errors.add("Phone sequence number must be a positive integer value.");
}
return errors;
}
}
| 2,329 | 0.711035 | 0.702018 | 77 | 29.246754 | 30.722958 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.428571 | false | false | 0 |
5da6f83af421ff10c456c05ddcd967026b78ee7b | 17,282,948,422,314 | 34b8ae5562e3d51857f2d4d78ecb178e44cc463a | /app/src/main/java/com/example/vishnubk/sharjahcharity/Models/Post.java | 58f431e680e43617c92817ec55e0e85a806198d5 | []
| no_license | vbk6/SharjahCharity | https://github.com/vbk6/SharjahCharity | 97a945a39caff77a9ef42edcbf86ae9db38c102e | 4607f2f067d109ed87f8fb9ac2eed96abc0aaafc | refs/heads/master | 2021-01-12T07:16:25.848000 | 2017-03-13T11:14:15 | 2017-03-13T11:14:15 | 76,929,654 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.vishnubk.sharjahcharity.Models;
/**
* Created by vishnubk on 9/11/16.
*/
public class Post {
byte[] image;
String title;
// public Post(byte[] image, String title){
// this.image=image;
// this.title=title;
// }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public byte[] getImage() {
return image;
}
public void setImage(byte[] image) {
this.image = image;
}
}
| UTF-8 | Java | 546 | java | Post.java | Java | [
{
"context": "package com.example.vishnubk.sharjahcharity.Models;\n\n/**\n * Created by vishnub",
"end": 28,
"score": 0.9830173254013062,
"start": 20,
"tag": "USERNAME",
"value": "vishnubk"
},
{
"context": "vishnubk.sharjahcharity.Models;\n\n/**\n * Created by vishnubk on 9/11/16.\n */\npublic class Post {\n\n byte[] i",
"end": 79,
"score": 0.9996647834777832,
"start": 71,
"tag": "USERNAME",
"value": "vishnubk"
}
]
| null | []
| package com.example.vishnubk.sharjahcharity.Models;
/**
* Created by vishnubk on 9/11/16.
*/
public class Post {
byte[] image;
String title;
// public Post(byte[] image, String title){
// this.image=image;
// this.title=title;
// }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public byte[] getImage() {
return image;
}
public void setImage(byte[] image) {
this.image = image;
}
}
| 546 | 0.56044 | 0.551282 | 38 | 13.368421 | 15.378422 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 0 |
3f8101984741d8218a474c25e1cead83dcedbf05 | 17,497,696,769,442 | abf4831bbae14a2025e41c17126ed078c70ce544 | /cn1-xataface/src/com/xataface/ui/XFUIPropertiesPanel.java | 6fdb7aed80a42e4b6cd514e17026bdc27dce08f2 | [
"Apache-2.0"
]
| permissive | shannah/cn1-xataface | https://github.com/shannah/cn1-xataface | d4631d99e9bcce21e28d6347359290baa5b0262f | 9c183d8ea2dcb9cbae7da476e8f92af53e658ba7 | refs/heads/master | 2020-06-28T06:17:10.333000 | 2020-05-07T12:40:56 | 2020-05-07T12:40:56 | 74,502,228 | 1 | 1 | null | false | 2020-05-12T23:20:20 | 2016-11-22T18:34:42 | 2020-05-07T12:41:10 | 2020-05-07T12:41:06 | 14,083 | 1 | 1 | 1 | Java | false | false | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.xataface.ui;
import com.codename1.components.ToastBar;
import com.codename1.ui.Button;
import com.codename1.ui.Command;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.TextField;
import com.codename1.ui.animations.CommonTransitions;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.table.TableLayout;
import com.codename1.ui.util.EventDispatcher;
import com.xataface.query.XFClient;
import com.xataface.query.XFRecord;
/**
*
* @author shannah
*/
public class XFUIPropertiesPanel extends Container {
private final XFRecord record;
private final XFClient client;
private final ViewFactory viewFactory;
private XFUIEditorKit editorKit = new XFUIEditorKit();
public XFClient getClient() {
return client;
}
public static interface ViewFactory {
public Component createWidget(XFUIPropertiesPanel propertiesPanel, XFRecord record, String column);
}
public XFUIPropertiesPanel(XFRecord record, XFClient client) {
this(record, client, new XFUIViewFactory());
}
public XFUIPropertiesPanel(XFRecord record, XFClient client, ViewFactory viewFactory) {
this.record = record;
this.client = client;
this.viewFactory = viewFactory;
this.setLayout(new BorderLayout());
this.addComponent(BorderLayout.CENTER, createDetailsTable(record, client));
}
private Container createDetailsTable(XFRecord record, XFClient client) {
Container wrapper = new Container(new BorderLayout());
TableLayout l = new TableLayout(record.getColumnNames().size(), 2);
Container details = new Container(l);
int row=0;
for (String col : record.getColumnNames()) {
details.add(l.createConstraint(row, 0), col);
Component widget = viewFactory.createWidget(this, record, col);
details.add(l.createConstraint(row, 1), widget);
row++;
}
Command saveCmd = editorKit.getSaveCommand(client, record, res->{
if (res != null) {
wrapper.getParent().replace(wrapper, createDetailsTable(res, client), CommonTransitions.createFade(300));
}
});
Button btnSave = new Button(saveCmd);
Command deleteCmd = editorKit.getDeleteCommand(client, record, res->{
if (res) {
Command back = Display.getInstance().getCurrent().getBackCommand();
if (back != null) {
back.actionPerformed(new ActionEvent(this));
}
}
});
Button btnDelete = new Button(deleteCmd);
Container north = new Container(new BorderLayout());
north.add(BorderLayout.EAST, btnSave);
north.add(BorderLayout.WEST, btnDelete);
wrapper.add(BorderLayout.NORTH, north);
details.setScrollableY(true);
wrapper.addComponent(BorderLayout.CENTER, details);
return wrapper;
}
}
| UTF-8 | Java | 3,493 | java | XFUIPropertiesPanel.java | Java | [
{
"context": "rt com.xataface.query.XFRecord;\n\n/**\n *\n * @author shannah\n */\npublic class XFUIPropertiesPanel extends",
"end": 829,
"score": 0.8658860325813293,
"start": 827,
"tag": "NAME",
"value": "sh"
},
{
"context": "com.xataface.query.XFRecord;\n\n/**\n *\n * @author shannah\n */\npublic class XFUIPropertiesPanel extends Co",
"end": 832,
"score": 0.6139527559280396,
"start": 829,
"tag": "USERNAME",
"value": "ann"
},
{
"context": ".xataface.query.XFRecord;\n\n/**\n *\n * @author shannah\n */\npublic class XFUIPropertiesPanel extends Cont",
"end": 834,
"score": 0.5068807601928711,
"start": 832,
"tag": "NAME",
"value": "ah"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.xataface.ui;
import com.codename1.components.ToastBar;
import com.codename1.ui.Button;
import com.codename1.ui.Command;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.TextField;
import com.codename1.ui.animations.CommonTransitions;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.table.TableLayout;
import com.codename1.ui.util.EventDispatcher;
import com.xataface.query.XFClient;
import com.xataface.query.XFRecord;
/**
*
* @author shannah
*/
public class XFUIPropertiesPanel extends Container {
private final XFRecord record;
private final XFClient client;
private final ViewFactory viewFactory;
private XFUIEditorKit editorKit = new XFUIEditorKit();
public XFClient getClient() {
return client;
}
public static interface ViewFactory {
public Component createWidget(XFUIPropertiesPanel propertiesPanel, XFRecord record, String column);
}
public XFUIPropertiesPanel(XFRecord record, XFClient client) {
this(record, client, new XFUIViewFactory());
}
public XFUIPropertiesPanel(XFRecord record, XFClient client, ViewFactory viewFactory) {
this.record = record;
this.client = client;
this.viewFactory = viewFactory;
this.setLayout(new BorderLayout());
this.addComponent(BorderLayout.CENTER, createDetailsTable(record, client));
}
private Container createDetailsTable(XFRecord record, XFClient client) {
Container wrapper = new Container(new BorderLayout());
TableLayout l = new TableLayout(record.getColumnNames().size(), 2);
Container details = new Container(l);
int row=0;
for (String col : record.getColumnNames()) {
details.add(l.createConstraint(row, 0), col);
Component widget = viewFactory.createWidget(this, record, col);
details.add(l.createConstraint(row, 1), widget);
row++;
}
Command saveCmd = editorKit.getSaveCommand(client, record, res->{
if (res != null) {
wrapper.getParent().replace(wrapper, createDetailsTable(res, client), CommonTransitions.createFade(300));
}
});
Button btnSave = new Button(saveCmd);
Command deleteCmd = editorKit.getDeleteCommand(client, record, res->{
if (res) {
Command back = Display.getInstance().getCurrent().getBackCommand();
if (back != null) {
back.actionPerformed(new ActionEvent(this));
}
}
});
Button btnDelete = new Button(deleteCmd);
Container north = new Container(new BorderLayout());
north.add(BorderLayout.EAST, btnSave);
north.add(BorderLayout.WEST, btnDelete);
wrapper.add(BorderLayout.NORTH, north);
details.setScrollableY(true);
wrapper.addComponent(BorderLayout.CENTER, details);
return wrapper;
}
}
| 3,493 | 0.645004 | 0.639279 | 109 | 31.045872 | 26.600471 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.743119 | false | false | 0 |
f732af0d8e384147031e83cee749201aee0d8794 | 2,353,642,085,038 | 795135dcc3342d44030c775db3eef04561f82a7e | /app/src/paid/java/com/phuctv/builditbigger/MainActivity.java | 5e2f3def8b0ab6fd93b381b7d95568e0c5adaea0 | []
| no_license | vinhphucit/Udacity-AND-04-Build-It-Bigger | https://github.com/vinhphucit/Udacity-AND-04-Build-It-Bigger | eccc2aec92626c8776b9cd26c0081185cdb98ec8 | 705faa0ae14e23fcbb62259313bea545bc7da5e3 | refs/heads/master | 2021-07-15T19:12:03.682000 | 2017-10-23T08:42:32 | 2017-10-23T08:42:32 | 107,953,738 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.phuctv.builditbigger;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.phuctv.builditbigger.tasks.ApiTask;
import com.phuctv.jokeshower.JokeDisplayActivity;
public class MainActivity extends AppCompatActivity {
private Button btnTellJoke;
private ApiTask.TellJokeCallback callback;
private View mProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
callback = new ApiTask.TellJokeCallback() {
@Override
public void onLoadJoke() {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.VISIBLE);
}
}
@Override
public void tellJoke(String joke) {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.GONE);
}
Intent intent = new Intent(MainActivity.this, JokeDisplayActivity.class);
intent.putExtra(JokeDisplayActivity.ARGS_JOKE, joke);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
};
mProgressBar = findViewById(R.id.progressbar);
btnTellJoke = (Button) findViewById(R.id.btnTellJoke);
btnTellJoke.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new ApiTask(callback).execute();
}
});
}
}
| UTF-8 | Java | 1,694 | java | MainActivity.java | Java | []
| null | []
| package com.phuctv.builditbigger;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.phuctv.builditbigger.tasks.ApiTask;
import com.phuctv.jokeshower.JokeDisplayActivity;
public class MainActivity extends AppCompatActivity {
private Button btnTellJoke;
private ApiTask.TellJokeCallback callback;
private View mProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
callback = new ApiTask.TellJokeCallback() {
@Override
public void onLoadJoke() {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.VISIBLE);
}
}
@Override
public void tellJoke(String joke) {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.GONE);
}
Intent intent = new Intent(MainActivity.this, JokeDisplayActivity.class);
intent.putExtra(JokeDisplayActivity.ARGS_JOKE, joke);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
};
mProgressBar = findViewById(R.id.progressbar);
btnTellJoke = (Button) findViewById(R.id.btnTellJoke);
btnTellJoke.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new ApiTask(callback).execute();
}
});
}
}
| 1,694 | 0.622196 | 0.621606 | 52 | 31.576923 | 22.564734 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 0 |
d2712228fa55b7b987ba11d3aad6d6d2b43546c9 | 10,084,583,263,181 | e86aff15fc4a80d16eaba2f0ad742d5b1ddb3a6b | /HumanAction.java | 64460d6e757d967400897e6ad2d310d2183a5a9c | []
| no_license | Naseebullah-Wali/LAB-4_ITMO_java | https://github.com/Naseebullah-Wali/LAB-4_ITMO_java | c29140661085b2330a66d9cfbd0974b144c748d4 | 11435fe528ab5a3a1121780bd003b312241a1da4 | refs/heads/main | 2023-02-28T18:37:27.945000 | 2021-02-08T16:02:14 | 2021-02-08T16:02:14 | 337,121,126 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
abstract class HumanAction extends Actions{
HumanAction(Guys p, String n){
super(p, n);
}
public void getTypeAndName(){
System.out.print(getType()+"");
System.out.print(getName());
}
public void admired(String Admired){
this.getTypeAndName();
System.out.println(Admired);
}
public void idea(String ide){
this.getTypeAndName();
System.out.println(ide);
}
public void believed(String belive){
this.getTypeAndName();
System.out.println(belive);
}
public void Sattle(String sitt){
this.getTypeAndName();
System.out.println(sitt);
}
public void point(String po){
this.getTypeAndName();
System.out.println(po);
}
public void asked(String ask){
this.getTypeAndName();
System.out.println(ask);
}
public void laughed(String lau){
this.getTypeAndName();
System.out.println(lau);
}
public void Swallowed(String Swal){
this.getTypeAndName();
System.out.println(Swal);
}
public void ate(String eat){
this.getTypeAndName();
System.out.println(eat);
}
public void stretched(String stre){
this.getTypeAndName();
System.out.println(stre);
}
public void want(String wan){
this.getTypeAndName();
System.out.println(wan);
}
public void like(String lak){
this.getTypeAndName();
System.out.println(lak);
}
public void put(String pu){
this.getTypeAndName();
System.out.println(pu);
}
public void took(String take){
this.getTypeAndName();
System.out.println(take);
}
public void went(String go){
this.getTypeAndName();
System.out.println(go);
}
}
| UTF-8 | Java | 1,900 | java | HumanAction.java | Java | []
| null | []
|
abstract class HumanAction extends Actions{
HumanAction(Guys p, String n){
super(p, n);
}
public void getTypeAndName(){
System.out.print(getType()+"");
System.out.print(getName());
}
public void admired(String Admired){
this.getTypeAndName();
System.out.println(Admired);
}
public void idea(String ide){
this.getTypeAndName();
System.out.println(ide);
}
public void believed(String belive){
this.getTypeAndName();
System.out.println(belive);
}
public void Sattle(String sitt){
this.getTypeAndName();
System.out.println(sitt);
}
public void point(String po){
this.getTypeAndName();
System.out.println(po);
}
public void asked(String ask){
this.getTypeAndName();
System.out.println(ask);
}
public void laughed(String lau){
this.getTypeAndName();
System.out.println(lau);
}
public void Swallowed(String Swal){
this.getTypeAndName();
System.out.println(Swal);
}
public void ate(String eat){
this.getTypeAndName();
System.out.println(eat);
}
public void stretched(String stre){
this.getTypeAndName();
System.out.println(stre);
}
public void want(String wan){
this.getTypeAndName();
System.out.println(wan);
}
public void like(String lak){
this.getTypeAndName();
System.out.println(lak);
}
public void put(String pu){
this.getTypeAndName();
System.out.println(pu);
}
public void took(String take){
this.getTypeAndName();
System.out.println(take);
}
public void went(String go){
this.getTypeAndName();
System.out.println(go);
}
}
| 1,900 | 0.564211 | 0.564211 | 71 | 24.704226 | 13.173163 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.492958 | false | false | 0 |
de41bfaf328cf307d1840dcab62541214f2bc7b7 | 10,960,756,568,659 | d5ef56491dda38d8df5cb53d858e52a6a78f9fbf | /tcrs-acceptplat/tcrs-acceptplat-web/src/main/java/com/pansky/acceptplat/web/controller/unemployment/jntsbtcontroller/SyjfhdController.java | 1fbb86a5dade6c8568ff2a3dad5b8b02c781827a | []
| no_license | 2352504297/yayb | https://github.com/2352504297/yayb | 2e47ea5ff95dc76d18f53bef1e1285d474f35133 | d2f11faf29e60ab80bb1a03c39b7fe71654b44d8 | refs/heads/master | 2020-09-05T14:17:56.582000 | 2019-11-07T03:09:23 | 2019-11-07T03:09:23 | 220,129,517 | 0 | 0 | null | false | 2019-11-07T03:09:24 | 2019-11-07T01:59:55 | 2019-11-07T02:56:12 | 2019-11-07T03:09:23 | 0 | 0 | 0 | 0 | null | false | false | package com.pansky.acceptplat.web.controller.unemployment.jntsbtcontroller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pansky.acceptplat.common.util.ArchivesUtil;
import com.pansky.acceptplat.common.util.CodeConstant;
import com.pansky.acceptplat.common.util.CommonUtility;
import com.pansky.acceptplat.dao.dto.GxdwjbxxDTO;
import com.pansky.acceptplat.dao.dto.JfhdDTO;
import com.pansky.acceptplat.dao.model.*;
import com.pansky.acceptplat.rpc.api.*;
import com.pansky.acceptplat.web.controller.unemployment.cbdj.StaticCodeUtil;
import com.pansky.acceptplat.web.util.*;
import com.pansky.common.base.BaseController;
import com.pansky.common.model.json.AjaxJson;
import com.pansky.common.model.json.DataGrid;
import com.pansky.common.model.json.DataGridReturn;
import com.pansky.common.util.CodeCacheUtils;
import com.pansky.common.util.DateUtils;
import com.pansky.common.util.JSONHelper;
import com.pansky.upms.client.shiro.realm.ShiroUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import net.vsame.url2sql.utils.PostParam;
import org.apache.poi.hssf.usermodel.*;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 失业保险缴费基数申报与核定
* 叶大洲
* 2018-05-21
*/
@Api(value = "失业保险缴费基数申报与核定", description = "失业保险缴费基数申报与核定")
@Controller
@RequestMapping("/tcrs/sybx/sydwjfhd")
public class SyjfhdController extends BaseController {
@Autowired
private Dj04Service dj04Service;
@Autowired
private Sa06aService sa06aService;
@Autowired
private Sd05Service sd05Service;
@Autowired
private Sz18Service sz18Service;
@Autowired
private Sa06kService sa06kService;
@Autowired
private SequenceService sequenceService;
@Autowired
CommonService commonService;
private static Logger _log = LoggerFactory.getLogger(SyjfhdController.class);
private static String SAA004 = "00000269";//事项id
private static String SBB004 = "C120";//事项id
//private static String NODEID="1696";//模板id
private static DateFormat DFYYYYMMM = new SimpleDateFormat("yyyyMM");
private static DateFormat DFYYYY = new SimpleDateFormat("yyyy");
@ApiOperation(value = "进入首页面")
@RequestMapping("/index")
public String getIndex(Model model, String saa200, String sbb004, String saa036, String viewType) throws ParseException {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd051 = sd05Service.selectById(saa200);
String backUrl = ArchivesMessage.getBackUrl(suser.getUserType(), sd051.getSaa004());
String userType = suser.getUserType();
//sd05.setSaa200(Long.parseLong("4473"));
try {
com.alibaba.fastjson.JSONArray sd05Array = com.alibaba.fastjson.JSONArray.parseArray(sd051.getAae440());
com.alibaba.fastjson.JSONObject sd05json = sd05Array.getJSONObject(0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String end = DFYYYY.format(new Date()) + "12";
if (sd05Array == null || sd05Array.size() == 0) {
model.addAttribute("msg", "发号单未发现申请单位信息");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
String aab001 = sd05json.getString("aab001");
if (StringUtils.isBlank(aab001)) {
model.addAttribute("msg", "未发现申请单位编号");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
String datapartid = sd051.getSza017();//行政区划
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(datapartid);
if ("610221".equals(datapartid)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
if (StringUtils.isBlank(saa036)) {
String formJson = "";//获得表单信息
Wrapper<Sa06a> sa06aWrapper = new EntityWrapper<>();
sa06aWrapper.eq("SBB004", sbb004);
sa06aWrapper.eq("BAE703", sd05json.getString("aab001"));
sa06aWrapper.ne("SAA043", CodeConstant.SAA043_5);
sa06aWrapper.ne("SAA043", CodeConstant.SAA043_6);
List<Sa06a> sa06as = sa06aService.selectList(sa06aWrapper);
if (CodeConstant.USER_TYPE_0.equals(userType) || CodeConstant.USER_TYPE_1.equals(userType)) {
if (!sa06as.isEmpty()) {
model.addAttribute("msg", "此单位有一笔已经提交或正在受理的失业保险单位缴费核定与基数申报,不能重复办理");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
formJson = commonService.findOnlineUncommitted(sd05json.getString("aab001"), sbb004);
} else if (CodeConstant.USER_TYPE_2.equals(userType)) {
if (sa06as != null && sa06as.size() > 0) {
String saa043 = sa06as.get(0).getSaa043();
if (CodeConstant.SAA043_2.equals(saa043)) {
Sa06a sa06a = sa06as.get(0);
formJson = sa06a.getSaa039();
model.addAttribute("saa036", sa06a.getSaa036());
} else {
model.addAttribute("msg", "此单位有一笔正在审核中的失业保险单位缴费核定与基数申报,不能重复办理");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
}
}
if (StringUtils.isNotBlank(formJson)) {
model.addAttribute("nodeId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("nodeId"));
model.addAttribute("fondsId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("fondsId"));
model.addAttribute("rae001", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("rae001"));
model.addAttribute("archiveId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("archiveId"));
model.addAttribute("saa200", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("saa200"));
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhdDTO = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
JfhdDTO jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
} else {
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhdDTO = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
long archivesId = createArchives(datapartid, jfhdDTO, suser);
if (archivesId <= 0) {
model.addAttribute("msg", "电子档案系统请求异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
//插入数据库表sd06,sd07,sd08,修改sd05,
Wrapper<Sa06k> wrapper = new EntityWrapper();
wrapper.like("SAA004", sd051.getSaa004());
wrapper.like("SZZ304", "1");
List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
com.alibaba.fastjson.JSONObject sd06Json = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd051));
sd06Json.put("baa001", datapartid);
sd06Json.put("archiveId", String.valueOf(archivesId));
sd06Json.put("sbb004", sbb004);
sd06Json.put("rae001", sequenceService.selectSequence("SD06"));
Sd06 sd06 = ArchivesMessage.getSd06(sd06Json);
sd06.setSaa210(CodeConstant.SAA210_1);
String rae002 = sequenceService.selectSequence("SD07");
com.alibaba.fastjson.JSONObject sd07Json = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd06));
//Sd07 sd07 =CommonStorageUtil.saveSd07(com.alibaba.fastjson.JSONObject.toJSONString(json),"1",suser);
//封装表单信息
com.alibaba.fastjson.JSONObject formInfo = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));
formInfo.put("saa200", sd051.getSaa200());
formInfo.put("saa004", sd051.getSaa004());
formInfo.put("archiveId", String.valueOf(archivesId));
formInfo.put("fondsId", fondscode);
formInfo.put("nodeId", CodeConstant.SY_JFHD_NODEID);
formInfo.put("sbb004", sbb004);
formInfo.put("rae001", sd06.getRae001());
sd07Json.put("rae003", formInfo.toJSONString());
sd07Json.put("aae140", CodeConstant.SY_GG_AAE140);
sd07Json.put("rae002", rae002);
Sd07 sd07 = ArchivesMessage.getSd07(sd07Json);
sd07.setSaa210(CodeConstant.SAA210_2);
boolean flag = false;
if (CodeConstant.USER_TYPE_0.equals(userType) || CodeConstant.USER_TYPE_1.equals(userType)) {
flag = commonService.saveOnLineBak(sd06, sd07, sa06kList);
} else if (CodeConstant.USER_TYPE_2.equals(userType)) {
sd06.setSaa210(CodeConstant.SAA210_2);//申报状态已申报
Sa06 sa06 = StaticCodeUtil.getSa06bySaa004(sd051.getSaa004());
com.alibaba.fastjson.JSONObject sa06aJson = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd051));
sa06aJson.put("saa039", formInfo.toJSONString());
sa06aJson.put("rae001", sd06.getRae001());
sa06aJson.put("sbb004", sbb004);
sa06aJson.put("baa001", datapartid);
sa06aJson.put("aae140", CodeConstant.SY_GG_AAE140);
sa06aJson.put("sa06", com.alibaba.fastjson.JSONObject.toJSONString(sa06));
sa06aJson.put("saa036", sequenceService.selectSequence("SA06A"));
sa06aJson.put("saa015", CodeConstant.SY_JFHD_GZSB_SAA015);
Sa06a sa06a = ArchivesMessage.saveSa06a(sa06aJson);
sa06a.setSaa042(CodeConstant.SAA042_1);
flag = commonService.saveOfLineBak(sd06, sd07, sa06kList, sa06a);
if (flag) {
commonService.saveSd11Info(String.valueOf(sd06.getRae001()), String.valueOf(sa06a.getSaa036()), sa06a.getSaa043(), CodeConstant.RAE013_SD11_1, "");
}
}
if (!flag) {
model.addAttribute("msg", "请求异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
JfhdDTO jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
model.addAttribute("rae001", sd06.getRae001());
model.addAttribute("archiveId", archivesId);
model.addAttribute("nodeId", CodeConstant.SY_JFHD_NODEID);
model.addAttribute("fondsId", fondscode);
model.addAttribute("saa200", saa200);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
}
model.addAttribute("saa004", sd051.getSaa004());//事项id
model.addAttribute("userType", userType);//区域服务id
model.addAttribute("targeturl", backUrl);//跳转url
model.addAttribute("sbb004", sbb004);
model.addAttribute("viewType", viewType);
} else {
//先查询受理单sa06a获取数据
Sa06a sa06a = sa06aService.selectById(saa036);
if (sa06a == null || "".equals(sa06a)) {
model.addAttribute("msg", "没有查询到审核所需要的受理单");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
} else {
String saa039 = sa06a.getSaa039();
JfhdDTO jfhdDTO = com.alibaba.fastjson.JSONObject.parseObject(saa039, JfhdDTO.class);
com.alibaba.fastjson.JSONObject sa06aJosn = com.alibaba.fastjson.JSONObject.parseObject(saa039);
model.addAttribute("saa036", saa036);
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhd = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
model.addAttribute("saa036", saa036);
model.addAttribute("userType", userType);//区域服务id
model.addAttribute("targeturl", backUrl);//跳转url
model.addAttribute("viewType", viewType);
model.addAttribute("nodeId", sa06aJosn.getString("nodeId"));
model.addAttribute("fondsId", sa06aJosn.getString("fondsId"));
model.addAttribute("rae001", sa06aJosn.getString("rae001"));
model.addAttribute("archiveId", sa06aJosn.getString("archiveId"));
model.addAttribute("sbb004", sa06aJosn.getString("sbb004"));
model.addAttribute("saa004", sa06aJosn.getString("saa004"));
model.addAttribute("saa200", sa06aJosn.getString("saa200"));
}
}
} catch (Exception e) {
e.printStackTrace();
model.addAttribute("msg", "系统异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
return "/unemployment/syjfhd/index.jsp";
}
public JfhdDTO getjfhdss(String aab001, String start, String end, String baa001) {
JfhdDTO jfhd = new JfhdDTO();
try {
List<JfhdDTO> listall = getjfxxList(aab001, start, end, baa001);
if (listall.size() > 0) {
String aae002 = listall.get(0).getAae002();
Date date = DFYYYYMMM.parse(aae002);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 1);
String aae002_show = DFYYYYMMM.format(cal.getTime());
if (Integer.parseInt(aae002_show) > Integer.parseInt(end)) {
aae002_show = end;
}
jfhd.setAae002(aae002_show);
jfhd.setAae003(end);
} else {
String aae002_show = DFYYYY.format(new Date()) + "01";
jfhd.setAae002(aae002_show);
jfhd.setAae003(end);
}
} catch (Exception e) {
e.printStackTrace();
}
return jfhd;
}
@ApiOperation(value = "缴费信息")
@RequestMapping("/gridList")
@ResponseBody
public DataGridReturn gridFileList(String aab001, String startYM, String endYM, String saa200, String baa001) throws ParseException {
// Sd05 sd05 = sd05Service.selectById(saa200);
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = getAb01ByAab001(baa001, aab001);
GxdwjbxxDTO gxdwjbxxDTO = new GxdwjbxxDTO();
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
//将返回的json封装到类
DataGridReturn dataGridReturn = null;
if ("0".equals(jsonObject.getString("code"))) {
com.alibaba.fastjson.JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("result"));
gxdwjbxxDTO = JSON.parseObject(result.toJSONString().toLowerCase(), GxdwjbxxDTO.class);
if (gxdwjbxxDTO != null && !"null".equals(gxdwjbxxDTO)) {
//aab050单位登记时间
String aab050 = gxdwjbxxDTO.getAab050().substring(0, 4);
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String date = DFYYYY.format(new Date());
if (!"".equals(gxdwjbxxDTO.getAab050()) && !"null".equals(gxdwjbxxDTO.getAab050()) && gxdwjbxxDTO.getAab050() != null) {
if (Integer.parseInt(date) == Integer.parseInt(aab050)) {
dataGridReturn = new DataGridReturn((long) 1, list_return);
} else {
list_return = getjfxxList(aab001, startYM, endYM, baa001);
dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
}
}
}
}
return dataGridReturn;
}
@ApiOperation(value = "缴费信息")
@RequestMapping("/gridListDetail")
@ResponseBody
public DataGridReturn gridListDetail(String aab001, String startYM, String endYM, String saa200, String baa001) throws ParseException {
//Sd05 sd05 = sd05Service.selectById(saa200);
List<JfhdDTO> list_return = getjfxxList(aab001, startYM, endYM, baa001);
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
return dataGridReturn;
}
// public com.alibaba.fastjson.JSONObject getAb01ByAab001(String aab001,String baa001) {
// com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
// param.put("BAA001", baa001);//数据分区
// param.put("AAB001", aab001);//单位编号
// param.put("AAE170", SLPT);//操作人
// return RestfulUtil.getJson(param, "/loseJob/unit/basicInfoQuery.json");
// }
@ApiOperation(value = "缴费信息列表")
@RequestMapping("/jfxxList")
public String jfxxList(ModelMap model, String aab001, String aab004, String startYM, String endYM, String saa200, String baa001)
throws ParseException, UnsupportedEncodingException {
//Sd05 sd05 = sd05Service.selectById(saa200);
model.addAttribute("aab001", aab001);
model.addAttribute("aab004", URLDecoder.decode(aab004, "UTF-8"));
model.addAttribute("startYM", startYM);
model.addAttribute("endYM", endYM);
List<JfhdDTO> list_return = getjfxxList(aab001, startYM, endYM, baa001);
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("gridmapyd", JSONHelper.array2json(listyd));
return "/unemployment/syjfhd/jfxxList.jsp";
}
/**
* 获取缴费信息列表公共方法
*
* @return
*/
public List<JfhdDTO> getjfxxList(String aab001, String startYM, String endYM, String baa001) throws ParseException {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Calendar cal = Calendar.getInstance();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
// String dateString = sdf.format(cal.getTime());
// String endYM=dateString;
// if(aae002!=null&&!"".equals(aae002)){
// endYM=aae002;
// Date date = sdf.parse(aae002);//初始日期
// cal.setTime(date);
// }
// cal.add(Calendar.MONTH, -5);
// String startYM = sdf.format(cal.getTime());
// if(start!=null&&!"".equals(start)){
// startYM=aae002;
// }
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", aab001);
map.put("StartYM", startYM);
map.put("EndYM", endYM);
com.alibaba.fastjson.JSONObject jsonObject = getjfxxList(map, suser, baa001);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 获取缴费核定信息列表,当期人员异动信息,本期人员基数低于缴费下限或高于上限明细
*
* @param jfhdDTO
* @return
*/
public Map<String, List<JfhdDTO>> getreturnCheckList(JfhdDTO jfhdDTO, String code) {
Map<String, List<JfhdDTO>> maprs = new HashMap<String, List<JfhdDTO>>();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("StartYM", jfhdDTO.getStartYM());
map.put("EndYM", jfhdDTO.getEndYM());
String id = suser.getId();
//String code = sd05.getSza017();
com.alibaba.fastjson.JSONObject jsonObject = getjfhdList(map, code, id);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
JSONArray jsonArrayac88 = new JSONArray();
if ("0".equals(result.get("code"))) {
DecimalFormat df = new DecimalFormat("######0.00");
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
String aab004 = jsonArray.getJSONObject(0).get("AAB004").toString();
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (json.getString("AAB001") != null) {
json.put("AAB121", df.format(Double.parseDouble(json.getString("AAB121"))));
json.put("AAB120", df.format(Double.parseDouble(json.getString("AAB120"))));
json.put("BAB701", df.format(Double.parseDouble(json.getString("BAB701"))));
json.put("AAB122", df.format(Double.parseDouble(json.getString("AAB122"))));
json.put("BAE742", df.format(Double.parseDouble(json.getString("BAE742"))));
json.put("AAB137", df.format(Double.parseDouble(json.getString("AAB137"))));
json.put("AAB004", aab004);
jsonArraynew.add(json);
}
JSONArray jsonArrayac88temp = JSONArray.parseArray(json.getString("AC88ViewList"));
if (jsonArrayac88temp != null && jsonArrayac88temp.size() > 0) {
for (int j = 0; j < jsonArrayac88temp.size(); j++) {
com.alibaba.fastjson.JSONObject js = jsonArrayac88temp.getJSONObject(j);
js.put("AAE002", json.getString("AAE002"));
jsonArrayac88.add(js);
}
}
}
//当期缴费核定信息
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
}
//List<JfhdDTO> list_returnyd;
if (list_return.size() > 0) {
//当期人员异动信息
maprs.put("ryyd", jsonArrayac88.toJavaList(JfhdDTO.class));
maprs.put("heightprotect", new ArrayList<JfhdDTO>());
} else {
//本期人员基数低于缴费下限或高于上限明细
maprs.put("ryyd", new ArrayList<JfhdDTO>());
maprs.put("heightprotect", jsonArrayac88.toJavaList(JfhdDTO.class));
}
maprs.put("check", list_return);
//maprs.put("ryyd",list_returnyd);
return maprs;
}
@ApiOperation(value = "跳转到校核页面")
@RequestMapping("/checkpage")
@ResponseBody
public AjaxJson checkpage(JfhdDTO jfhdDTO, String saa200, String rae001, String baa001) throws UnsupportedEncodingException {
//rae001="0";
//archives="0";
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
//ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
//Sd05 sd05 = sd05Service.selectById(saa200.trim());
Map<String, List<JfhdDTO>> maprs = getreturnCheckList(jfhdDTO, baa001);
List<JfhdDTO> list_return = maprs.get("check");
List<JfhdDTO> ryyd = maprs.get("ryyd");
List<JfhdDTO> heightprotect = maprs.get("heightprotect");
AjaxJson j = new AjaxJson();
if (heightprotect.size() > 0) {
j.setSuccess(false);
j.setMsg("有缴费基数低于缴费下限或高于上限的职工不能申报缴费核定业务,请在缴费基数申报功能中修改职工缴费基数");
return j;
}
//String fail="";
//String success="";
if (list_return.size() > 0) {
String aa = "";
//Sd05 sd051=sd05Service.selectById(saa200.trim());
//String datapartid=sd051.getSza017();//琛屾斂鍖哄垝suser.getUserInfo().getUpmsOrganizations().getCode()
for (JfhdDTO js : list_return) {
aa = aa + js.getAae002() + ",";
// if("".equals(rae001)){
// //Wrapper<Sa06> wrapper06 = new EntityWrapper();
// //wrapper06.eq("SAA004",sd05.getSaa004());
// //List<Sa06> sa06=sa06Service.selectList(wrapper06);
// //Sd23 sd23=new Sd23();
// //sd23.setSza020(sa06.get(0).getSza020());
// //sd23.setSza010(datapartid);
// //sd23=sd23Service.selectOne(sd23);
// //String fondsId=sd23Service.selectOne(sd23).getSza011();
// //Map<String,String> archivesmap=new HashMap<String,String>();
// //archivesmap.put("aab001",js.getAab001());//单位编号
// //archivesmap.put("aab004",js.getAab004());//单位名称
// //archivesmap.put("fondsId",fondsId.trim());//全宗号
// //archivesmap.put("datapartId",datapartid);//行政区划
// //archivesmap.put("loginName",suser.getLoginName());//经办人登陆账号
// //archivesmap.put("id",suser.getId().toString());//经办人账号ID
// //archivesmap.put("name",suser.getName());//经办人姓名
// //Sa06 ss=new Sa06();
// //ss.setSaa004(SAA004);
// //Sa06 idsa06=sa06Service.selectOne(ss);
// //archivesmap.put("nodeId",idsa06.getSza018().trim());//模板idsa06.getSza018()
// //archivesmap.put("businessType",null);//业务类型名称
// //archives=String.valueOf(ArchivesUtil.archives(archivesmap)) ;//生成档案编号
// //long archives=Long.parseLong("89607");
// //插入数据库表sd06,sd07,sd08,修改sd05,
// Wrapper<Sa06k> wrapper = new EntityWrapper();
// wrapper.like("SAA004",SAA004);
// wrapper.like("SZZ304","1");
// List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
// Sd06 sd06 = this.saveSd06(js,suser,String.valueOf(archives));
// Sd07 sd07 = this.saveSd07(js,suser);
// String orgName = "";
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// orgName = suser.getUserInfo().getUpmsOrganizations().getOrgName();
// name = suser.getName();
// }
// Long re = medicalYdzzService.saveYdzzSbd(sd05, sd06, sd07,sa06kList,orgName,name);
// if(re!=null&&re > 0){
// rae001=String.valueOf(re);
// //success=success+js.getAae002()+",";
// }else {
// fail=js.getAae002()+",";
// //break;
// }
// }else{
// Sd07 sd07 = this.saveSd07(js,suser);
// sd07.setRae001(Long.parseLong(rae001));
// String rae002 = sequenceService.selectSequence("SD07");
// sd07.setRae002(Long.parseLong(rae002));
// Integer re = sd07Service.insert(sd07);
// if(re!=null&&re > 0){
// //success=success+js.getAae002()+",";
// }else {
// fail=js.getAae002()+",";
// //break;
// }
// }
}
aa = aa.substring(0, aa.length() - 1);
// if(!"".equals(fail)){
// fail=fail.substring(0,fail.length()-1);
// j.setSuccess(true);
// j.setMsg("费款所属期"+aa+"生成单位缴费核定业务数据成功,但其中费款所属期"+fail+"流程记录失败");
// }else{
// j.setSuccess(true);
// j.setMsg("费款所属期"+aa+"生成单位缴费核定业务数据成功");
// }
j.setSuccess(true);
j.setMsg("费款所属期" + aa + "生成单位缴费核定业务数据成功");
Map<String, Object> map = new HashMap<String, Object>();
map.put("rae001", rae001);
//map.put("archives",archives);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
List listyd = new ArrayList();
for (int y = 0; y < ryyd.size(); y++) {
JfhdDTO js = ryyd.get(y);
List bac720 = CodeCacheUtils.getCodeList("SYE_AAC050");
for (int i = 0; i < bac720.size(); i++) {
JSONObject jsonObject = JSONObject.fromObject(bac720.get(i));
if (js.getBac720().equals(jsonObject.getString("value"))) {
js.setAac050(jsonObject.getString("value"));
js.setBac720(jsonObject.getString("name"));
break;
}
}
listyd.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("gridmap", JSONHelper.array2json(list));
jsonObject.put("gridmapyd", JSONHelper.array2json(listyd));
j.setObj(jsonObject);
j.setAttributes(map);
} else {
j.setSuccess(false);
j.setMsg("生成单位缴费核定业务数据失败,请到失业保险中心查询相关信息");
}
// List list=new ArrayList();
// for (JfhdDTO js:list_return
// ) {
// list.add(transBean2Map(js));
// }
// List listyd=new ArrayList();
// for (JfhdDTO js:maprs.get("ryyd")
// ) {
// listyd.add(transBean2Map(js));
// }
// List heightprotect2=new ArrayList();
// for (JfhdDTO js:maprs.get("heightprotect")
// ) {
// heightprotect2.add(transBean2Map(js));
// }
// model.addAttribute("gridmap", JSONHelper.array2json(list));
// model.addAttribute("gridmapyd", JSONHelper.array2json(listyd));
// model.addAttribute("gridmapsxx", JSONHelper.array2json(heightprotect2));
// model.addAttribute("aab001",jfhdDTO.getAab001());
// model.addAttribute("aab004", jfhdDTO.getAab004());
// model.addAttribute("aae002",jfhdDTO.getAae002());
return j;
}
private ValueFilter filter = new ValueFilter() {
@Override
public Object process(Object obj, String s, Object v) {
if (v == null)
return "";
return v;
}
};
public JfhdDTO transNull(JfhdDTO js) {
String str = JSON.toJSONString(js, filter);
return JSON.parseObject(str, JfhdDTO.class);
}
/**
* 对象转map
*
* @param obj
* @return
*/
public Map<String, Object> transBean2Map(Object obj) {
if (obj == null) {
return null;
}
Map<String, Object> map = new HashMap<String, Object>();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
// 过滤class属性
if (!key.equals("class")) {
// 得到property对应的getter方法
Method getter = property.getReadMethod();
Object value = getter.invoke(obj);
map.put(key, value);
}
}
} catch (Exception e) {
System.out.println("transBean2Map Error " + e);
}
return map;
}
@ApiOperation(value = "人员异动详细信息页面跳转")
@RequestMapping("/yddetail")
public String yddetail(ModelMap model, JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
model.addAttribute("aae002", jfhdDTO.getAae002());
model.addAttribute("aab001", jfhdDTO.getAab001());
model.addAttribute("baa001", jfhdDTO.getBaa001());
model.addAttribute("aac050", jfhdDTO.getAac050());
if (jfhdDTO.getAab004() == null || "".equals(jfhdDTO.getAab004())) {
model.addAttribute("aab004", "");
} else {
model.addAttribute("aab004", URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
}
model.addAttribute("bac720", jfhdDTO.getBac720());
return "/unemployment/syjfhd/yddetail.jsp";
}
@ApiOperation(value = "缴费工资申报页面跳转")
@RequestMapping("/gzsb")
public String gzsb(ModelMap model, JfhdDTO jfhdDTO, String saa200, String rae001, String archiveId, String sbb004, String saa004) throws UnsupportedEncodingException {
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
// Sd05 sd051=sd05Service.selectById(saa200.trim());
//// String datapartid=sd051.getSza017();
//// if("610221".equals(datapartid)){
//// datapartid="610204";
//// }
//// Wrapper<Sa06> wrapper06 = new EntityWrapper();
//// wrapper06.eq("SAA004",SAA004);
//// List<Sa06> sa06=sa06Service.selectList(wrapper06);
//// Sd23 sd23=new Sd23();
//// sd23.setSza020(sa06.get(0).getSza020());
//// sd23.setSza010(datapartid);
//// sd23=sd23Service.selectOne(sd23);
//// String fondsId=sd23Service.selectOne(sd23).getSza011();
// Map<String,String> archivesmap=new HashMap<String,String>();
// archivesmap.put("aab001",jfhdDTO.getAab001());//单位编号
// archivesmap.put("aab004",jfhdDTO.getAab004());//单位名称
// archivesmap.put("fondsId", CodeConstant.ARCHIVES_QZ_SY.get(jfhdDTO.getBaa001()));//全宗号
// archivesmap.put("datapartId",jfhdDTO.getBaa001());//行政区划
// archivesmap.put("loginName",suser.getLoginName());//经办人登陆账号
// archivesmap.put("id",suser.getId());//经办人账号ID
// archivesmap.put("name",suser.getName());//经办人姓名
//// Sa06 ss=new Sa06();
//// ss.setSaa004(SAA004);
//// Sa06 idsa06=sa06Service.selectOne(ss);
// archivesmap.put("nodeId",CodeConstant.SY_JFHD_NODEID);//模板idsa06.getSza018()
// archivesmap.put("businessType",null);//业务类型名称
// String archives=String.valueOf(ArchivesUtil.archives(archivesmap)) ;//生成档案编号
//
// Wrapper<Sa06k> wrapper = new EntityWrapper();
// wrapper.like("SAA004",SAA004);
// wrapper.like("SZZ304","1");
// List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
// //Sd05 sd05 = new Sd05();
// //sd05.setSaa200(Long.parseLong(saa200.trim()));
// Sd06 sd06 = this.saveSd06(jfhdDTO,suser,String.valueOf(archives));
// Sd07 sd07 = this.saveSd07(jfhdDTO,suser);
// String orgName = "";
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// orgName = suser.getUserInfo().getUpmsOrganizations().getOrgName();
// name = suser.getName();
// }
// Long re = medicalYdzzService.saveYdzzSbd(sd051, sd06, sd07,sa06kList,orgName,name);
// if(re!=null&&re > 0){
// model.addAttribute("gzsb_rae001",rae001);
// model.addAttribute("gzsb_archivesId",archiveId);
// }else{
// model.addAttribute("gzsb_rae001","");
// model.addAttribute("gzsb_archivesId","");
// }
jfhdDTO.setAac002("");
jfhdDTO.setAac003("");
model.addAttribute("gzsbform", jfhdDTO);
// model.addAttribute("gzsb_aac003","");
model.addAttribute("gzsb_rae001", rae001);
model.addAttribute("gzsb_archivesId", archiveId);
model.addAttribute("gzsb_saa200", saa200);
model.addAttribute("gzsb_sbb004", sbb004);
model.addAttribute("gzsb_saa004", saa004);
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(jfhdDTO.getBaa001());
if ("610221".equals(jfhdDTO.getBaa001())) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
model.addAttribute("gzsb_fondsId", fondscode);
model.addAttribute("gzsb_aab001", jfhdDTO.getAab001());
model.addAttribute("gzsb_baa001", jfhdDTO.getBaa001());
model.addAttribute("gzsb_aab004", jfhdDTO.getAab004());
List<JfhdDTO> list = gzsbList(jfhdDTO);
float sp = Float.parseFloat("0");
if (list.size() > 0) {
sp = Float.parseFloat(list.get(0).getBac504().trim());
}
double xx = getTwoDecimal(sp * 0.6);
double sx = getTwoDecimal(sp * 3);
DateFormat df = new SimpleDateFormat("yyyy");
model.addAttribute("gzsb_aae030", df.format(new Date()));
model.addAttribute("gzsb_bac504", sp);
model.addAttribute("gzsb_bac504_x", xx);
model.addAttribute("gzsb_bac504_s", sx);
List listyd = new ArrayList();
for (JfhdDTO js : list) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("gzsbList", JSONHelper.array2json(listyd));
model.addAttribute("gzsb_bac504_js", "0");
return "/unemployment/syjfhd/gzsb.jsp";
}
@ApiOperation(value = "根据单位编号查询单位工资列表")
@RequestMapping(value = "/getgzsbList")
@ResponseBody
public String getgzsbList(String aab001, String baa001, String aac002, String aac003) {
List listyd = new ArrayList();
try {
JfhdDTO jfhdDTO = new JfhdDTO();
jfhdDTO.setAab001(aab001);
jfhdDTO.setBaa001(baa001);
jfhdDTO.setAac002(aac002);
List<JfhdDTO> list = gzsbList(jfhdDTO);
for (JfhdDTO js : list) {
listyd.add(transBean2Map(transNull(js)));
}
} catch (Exception e) {
e.printStackTrace();
}
DataGridReturn dataGridReturn = new DataGridReturn((long) listyd.size(), listyd);
return JSONHelper.array2json(listyd);
}
public long createArchives(String datapartid, JfhdDTO syRyxcbDto, ShiroUser suser) {
if ("610221".equals(datapartid)) {
datapartid = "610204";
}
Map<String, String> archivesmap = new HashMap<String, String>();
archivesmap.put("aab001", syRyxcbDto.getAab001());//单位编号
archivesmap.put("aab004", syRyxcbDto.getAab004());//单位名称
//archivesmap.put("aac002",syRyxcbDto.getAac002());//身份证
//archivesmap.put("aac003",syRyxcbDto.getAac003());//姓名
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(datapartid);
if ("610221".equals(datapartid)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
archivesmap.put("fondsId", fondscode);//全宗号
archivesmap.put("datapartId", datapartid);//行政区划
archivesmap.put("loginName", suser.getLoginName());//经办人登陆账号
archivesmap.put("id", suser.getId());//经办人账号ID
archivesmap.put("name", suser.getName());//经办人姓名
archivesmap.put("nodeId", CodeConstant.SY_JFHD_NODEID);//模板idsa06.getSza018()"1377"
archivesmap.put("businessType", null);//业务类型名称
long archives = ArchivesUtil.archives(archivesmap);//生成档案编号
return archives;
}
private double getTwoDecimal(double num) {
DecimalFormat dFormat = new DecimalFormat("#.00");
String yearString = dFormat.format(num);
Double temp = Double.valueOf(yearString);
return temp;
}
@ApiOperation(value = "单位工资申报列表查询")
@RequestMapping("/gzsbList")
@ResponseBody
public List<JfhdDTO> gzsbList(JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
List<PostParam> params = new ArrayList<PostParam>();
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
if (jfhdDTO.getAac002() != null && !"".equals(jfhdDTO.getAac002())) {
param.put("AAC002", jfhdDTO.getAac002());//身份证
}
if (jfhdDTO.getAac003() != null && !"".equals(jfhdDTO.getAac003())) {
param.put("AAC003", jfhdDTO.getAac003());//身份证
}
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject rs = PostHelper.send("/loseJob/person/baseInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(rs.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
// List listyd=new ArrayList();
// for (JfhdDTO js:list_return
// ) {
// listyd.add(transBean2Map(js));
// }
// JSONObject jsonObject=new JSONObject();
// String js=JSONHelper.array2json(listyd);
// jsonObject.put("gridmap", JSONHelper.array2json(listyd));
// return "/unemployment/syjfhd/jfhddetail.jsp";
}
@ApiOperation(value = "缴费核定详细信息页面跳转")
@RequestMapping("/jfhddetail")
public String jfhddetail(ModelMap model, JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
model.addAttribute("jfhddetail_aae002", jfhdDTO.getAae002());
model.addAttribute("jfhddetail_aab001", jfhdDTO.getAab001());
model.addAttribute("jfhddetail_baa001", jfhdDTO.getBaa001());
model.addAttribute("jfhddetail_aab004", URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
model.addAttribute("jfhddetail_baa005", jfhdDTO.getBaa005());
return "/unemployment/syjfhd/jfhddetail.jsp";
}
@ApiOperation(value = "人员异动信息列表")
@RequestMapping("/gridYddetailList")
@ResponseBody
public DataGridReturn gridYddetailList(JfhdDTO jfhdDTO) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAC050", jfhdDTO.getAac050());//查询人员增减明细信息
param.put("BAC809", 1);//页码
param.put("BAC808", 1000);//每页记录数
param.put("AAE035", jfhdDTO.getAae002());//缴费类型
param.put("AAE002", jfhdDTO.getAae002());//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject json = PostHelper.send("/loseJob/person/insuredInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(json.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
List<JfhdDTO> list_returnnew = new ArrayList<JfhdDTO>();
for (int y = 0; y < list_return.size(); y++) {
JfhdDTO js = list_return.get(y);
List bac720 = CodeCacheUtils.getCodeList("SYE_AAC050");
for (int i = 0; i < bac720.size(); i++) {
JSONObject jsonObject = JSONObject.fromObject(bac720.get(i));
if (js.getAac050().equals(jsonObject.getString("value"))) {
js.setAac050(jsonObject.getString("name"));
break;
}
}
js.setAae002(list_return.get(y).getAae002());
list_returnnew.add(js);
}
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_returnnew);
return dataGridReturn;
}
@ApiOperation(value = "缴费核定详细信息列表")
@RequestMapping("/gridCheckList")
@ResponseBody
public DataGridReturn gridCheckList(JfhdDTO jfhdDTO) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("AAE002", jfhdDTO.getAae002());
map.put("BAA005", jfhdDTO.getBaa005());
com.alibaba.fastjson.JSONObject json = getjfmx(map, jfhdDTO.getBaa001());
JSONObject result = JSONObject.fromObject(json.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
return dataGridReturn;
}
// @ApiOperation(value = "人员异动列表")
// @RequestMapping("/gridRyydList")
// @ResponseBody
// public DataGridReturn gridRyydList(JfhdDTO jfhdDTO,String saa200){
// Sd05 sd05 = sd05Service.selectById(saa200.trim());
// Map<String ,List<JfhdDTO>> maprs=getreturnCheckList(jfhdDTO,sd05);
// List<JfhdDTO> list_return= maprs.get("ryyd");
// DataGridReturn dataGridReturn =new DataGridReturn((long)list_return.size(), list_return);
// return dataGridReturn;
// }
// @ApiOperation(value = "本期人员基数低于缴费下限或高于上限")
// @RequestMapping("/gridsxList")
// @ResponseBody
// public DataGridReturn gridsxList(JfhdDTO jfhdDTO,String saa200){
// Sd05 sd05 = sd05Service.selectById(saa200.trim());
// Map<String ,List<JfhdDTO>> maprs=getreturnCheckList(jfhdDTO,sd05);
// List<JfhdDTO> list_return= maprs.get("heightprotect");
// DataGridReturn dataGridReturn =new DataGridReturn((long)list_return.size(), list_return);
// return dataGridReturn;
// }
@ApiOperation(value = "缴费核定提交审核")
@RequestMapping("/submit")
@ResponseBody
public AjaxJson getSubmit(String saa200, String rae001, String data, String saa004) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
try {
//net.sf.json.JSONArray json= net.sf.json.JSONArray.fromObject(list);
List<JfhdDTO> jsonArray = JSONArray.parseArray(data, JfhdDTO.class);
// Sd07 sd07=new Sd07();
// sd07.setRae001(Long.parseLong(rae001));
// Wrapper<Sd07> wrapper07 = new EntityWrapper();
// wrapper07.eq("RAE001",Long.parseLong(rae001));
// wrapper07.eq("SAA210","1");
// List<Sd07> lsd07=sd07Service.selectList(wrapper07);
//判断提交人员是否有未办结的业务
// String aae002str="";
// for(Sd07 ss:lsd07){
// JfhdDTO wbjss= JSON.parseObject(ss.getRae003(),JfhdDTO.class);
// Wrapper<Sa06a> wrappersa06a = new EntityWrapper();
// wrappersa06a.eq("SAA004",SAA004);//事项id
// wrappersa06a.eq("AAC044",wbjss.getAab001()+"_"+wbjss.getAae002());//申请人证件号
// wrappersa06a.ne("SAA043","3");//办理状态
// List<Sa06a> sa06aList=sa06aService.selectList(wrappersa06a);
// if(sa06aList.size()>0){
// aae002str=aae002str+wbjss.getAae002()+",";
// }
// }
//JfhdDTO wbj= JSON.parseObject(sd071.getRae003(),JfhdDTO.class);
// if(aae002str.length()>0){
// aae002str=aae002str.substring(0,aae002str.length()-1);
// j.setMsg("费款所属期"+aae002str+"有未办结的此项业务!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费核定:{}","费款所属期"+aae002str+"有未办结的此项业务!!!");
// return j;
// }
//检查电子档案是否已上传完成
// String strdzda="";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001",rae001);
// wrapper.eq("SAA104","1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m=0;m<sd08List.size();m++){
// String saa213 = sd08List.get(m).getSaa213();
// if("0".equals(saa213)){
// strdzda= strdzda+","+sd08List.get(m).getSaa017();
// }
// }
// if(!"".equals(strdzda)){
// strdzda=strdzda.substring(1,strdzda.length());
// j.setMsg(strdzda+"电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费核定:{}",strdzda+"电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
//提交核心库
String success = "";
String fail = "";
// Sd05 sd05 = sd05Service.selectById(saa200);
// sd05.setRae001(rae001);
for (JfhdDTO wbjhx : jsonArray) {
//JfhdDTO wbjhx= JSON.parseObject(hx.getRae003(),JfhdDTO.class);
String sa06aId = sequenceService.selectSequence("SA06A");
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// name = suser.getName();
// }
// Sa06a sa06a=saveSa06a(wbjhx, suser,wbjhx.getAab001()+"_"+wbjhx.getAae002());
// sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId.trim()));
// Sd11 sd11 =sd11Bean(rae001,name,sd05.getSza017(),sa06aId);
// //修改申请状态
// Sd06 sd06 = sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd05.setSaa204("4");
// boolean flag=sybxdyshService.submitSybxdjsh(sa06a, sd05, sd06, sd11);
// if(flag) {
com.alibaba.fastjson.JSONObject rs = saveUnemployedInfo(rae001, wbjhx, suser, saa004, sa06aId);
JSONObject result = JSONObject.fromObject(rs.get("result"));
if ("0".equals(result.getString("code"))) {//提交核心成功
success = success + wbjhx.getAae002() + ",";
// hx.setSaa210("2");
// sd07Service.updateById(hx);
} else {//提交核心失败
fail = fail + wbjhx.getAae002() + ",";
}
// }else{
// //插入提交失败信息
// sd06.setSaa210("1");
// sd06.setSaa503("插入受理平台表失败");
// sd06Service.updateById(sd06);
// j.setMsg("失业人员丧葬补助金和抚恤金审核提交失败,失败原因:插入受理平台表失败");
// j.setSuccess(false);
// }
}
if (!"".equals(success)) {
if (!"".equals(fail)) {
success = success.substring(0, success.length() - 1);
fail = fail.substring(0, fail.length() - 1);
j.setMsg("费款所属期" + success + "单位缴费核定提交成功,费款所属期" + fail + "单位缴费核定提交失败");
j.setSuccess(false);
Map<String, Object> map = new HashMap<String, Object>();
map.put("fail", fail);
j.setAttributes(map);
} else {
j.setMsg("费款所属期" + success + "单位缴费核定提交成功");
j.setSuccess(true);
//修改申请状态
// Sd06 sd06=sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd06Service.updateById(sd06);
}
} else {
if (!"".equals(fail)) {
fail = fail.substring(0, fail.length() - 1);
j.setMsg("费款所属期" + fail + "单位缴费核定提交失败");
j.setSuccess(false);
} else {
j.setMsg("所选费款所属期内无单位缴费核定信息");
j.setSuccess(false);
}
}
// String sa06aId= sequenceService.selectSequence("SA06A");
// com.alibaba.fastjson.JSONObject rs = saveUnemployedInfo(rae001,wbj,suser,sa06aId);//缴费核定
// JSONObject result = JSONObject.fromObject(rs.get("result"));
//if ("0".equals(result.getString("code"))) {//单位缴费核定提交核心成功
//com.alibaba.fastjson.JSONObject zjplan= this.getzjPlan(wbj.getBaa001(),wbj.getAab001(),"SLPT"+suser.getId(),wbj.getAae002());
// List<JfhdDTO> zjplan= this.getzjPlan(wbj.getBaa001(),wbj.getAab001(),"SLPT"+suser.getId(),wbj.getAae002());//征集计划查询
// //String sa06aId1= sequenceService.selectSequence("SA06A");
// wbj.setBaa005(zjplan.get(0).getBaa005());
// com.alibaba.fastjson.JSONObject zJplanInfo = saveZJplanInfo(rae001,wbj,suser,sa06aId1);//征集计划提交
// JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
// if ("0".equals(zJplanInforesult.getString("code"))) {
// //插入受理单表
// Sa06a sa06a=saveSa06a(wbj, suser);
// sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId1));
// Integer re = sa06aService.insert(sa06a);
//
// //修改申请状态
// Sd06 sd06=sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd06Service.updateById(sd06);
// j.setMsg("失业保险单位缴费核定提交成功,失业保险单位征集计划提交成功");
// j.setSuccess(true);
// }else{
//
// j.setMsg("失业保险单位缴费核定提交成功,失业保险单位征集计划提交失败");
// j.setSuccess(true);
// }
} catch (Exception e) {
e.printStackTrace();
j.setMsg("失业保险单位缴费核定提交失败");
j.setSuccess(false);
_log.error("失业保险单位缴费核定提交失败", e.getMessage(), e);
}
return j;
}
/*--------------------------------------------------------------------------*/
@ApiOperation(value = "征集计划提交审核")
@RequestMapping("/zjplan")
@ResponseBody
public AjaxJson zjplan(String data, String data1, JfhdDTO jfhdDTO, String rae001) {
AjaxJson j = new AjaxJson();
List<JfhdDTO> zjplan = JSONArray.parseArray(data, JfhdDTO.class);
List<JfhdDTO> zjplan1 = JSONArray.parseArray(data1, JfhdDTO.class);
//ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
String sa06aId = sequenceService.selectSequence("SA06A");
Collections.sort(zjplan, new Comparator<JfhdDTO>() {
@Override
public int compare(JfhdDTO o1, JfhdDTO o2) {
int i = Integer.valueOf(o1.getAae002()) - Integer.valueOf(o2.getAae002());
if (i == 0) {
return Integer.valueOf(o1.getAae002()) - Integer.valueOf(o2.getAae002());
}
return i;
}
});
try {
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
if (zjplan.size() <= 0) {
j.setMsg("费款所属期内未查询到可操作的征集计划");
j.setSuccess(false);
return j;
}
// List<String> list=this.getbetweentimes(jfhdDTO.getStartYM(),jfhdDTO.getEndYM());
// String fail="";
// for (String month:list){
// boolean flag=false;
// for(JfhdDTO jfhdDTO1:zjplan){
// if(jfhdDTO1.getStartYM().equals(month)){
// flag=true;
// break;
// }
// }
// if(!flag){
// fail=fail+month+",";
// }
// }
// if(!"".equals(fail)){
// fail=fail.substring(0,fail.length()-1);
// j.setMsg("费款所属期"+fail+"未完成缴费核定业务,请确认缴费核定完成后再做征集计划");
// j.setSuccess(false);
// return j;
// }
String baa005 = "";
for (JfhdDTO jfhdDTO1 : zjplan) {
baa005 = baa005 + "'" + jfhdDTO1.getBaa005() + "',";
}
String bae718 = "";
for (JfhdDTO jfhdDTO1 : zjplan1) {
bae718 = bae718 + "'" + jfhdDTO1.getBae718() + "',";
}
if (bae718 != null && !"".equals(bae718))
jfhdDTO.setBae715(bae718.substring(0, bae718.length() - 1));
jfhdDTO.setBaa005(baa005.substring(0, baa005.length() - 1));
jfhdDTO.setAab120(zjplan.get(0).getAab120());
jfhdDTO.setAab122(zjplan.get(0).getAab122());
jfhdDTO.setAab121(zjplan.get(0).getAab121());
jfhdDTO.setAab137(zjplan.get(0).getAab137());
jfhdDTO.setBab701(zjplan.get(0).getBab701());
jfhdDTO.setBae742(zjplan.get(0).getBae742());
jfhdDTO.setStartYM(zjplan.get(0).getAae002());
jfhdDTO.setEndYM(zjplan.get(zjplan.size() - 1).getAae002());
com.alibaba.fastjson.JSONObject zJplanInfo = saveZJplanInfo(rae001, jfhdDTO, sa06aId);//征集计划提交
JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
if ("0".equals(zJplanInforesult.getString("code"))) {
j.setMsg("失业保险单位征集计划提交成功");
j.setSuccess(true);
//创建单据信息反馈保存对象 调用SavePrintInfo方法保存dj04
Dj04 dj04 = new Dj04();
dj04.setDj02id("1001");//单据类型ID
dj04.setBaa001(jfhdDTO.getBaa001());//行政区划
dj04.setBae702("1");//申请主体类型(1单位,2个人,3家庭,5社区,6学校)
dj04.setAac043(jfhdDTO.getAab001());//申请主体编号
dj04.setAac044(jfhdDTO.getAab003());//申请主体证件号码
dj04.setSaa037(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));//申请主体名称
ShiroUser shiroUser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
dj04.setAae011(shiroUser.getName());//经办人
dj04.setAae036( CommonUtility.get19BitCurTimeAPP());//生成日期
dj04.setAae140(CodeConstant.AAE140_2);
// com.alibaba.fastjson.JSONObject jsonObject = zjjjRemoveList(zjplan.get(0).getAae002(), zjplan.get(zjplan.size() - 1).getAae002(), jfhdDTO.getAab001(),jfhdDTO.getBaa001());
// JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
// if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(zJplanInforesult.getString("LIST"));
if (jsonArray.size() > 0) {
for(int i = 0 ; i < jsonArray.size() ; i++){
com.alibaba.fastjson.JSONObject jsonObject1 = jsonArray.getJSONObject(i);
//获取征集计划流水号
String aae063 = jsonObject1.getString("AAE063");
//判断是否存在
Dj04 d = new Dj04();
d.setDj041(aae063);
d = dj04Service.selectOne(d);
if(null==d){
dj04.setDj04id(sequenceService.selectSequence("DJ04"));
dj04.setDj041(aae063);//业务单据编号 在这相当于征集计划流水号
dj04Service.insert(dj04);
}
}
}
// }
//插入受理单表
//Sa06a sa06a=saveSa06a(jfhdDTO, suser,jfhdDTO.getAab001()+"_"+jfhdDTO.getStartYM()+"_"+jfhdDTO.getEndYM());
//sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId));
// Integer re = sa06aService.insert(sa06a);
} else {
j.setMsg("失业保险单位征集计划提交失败,失败原因:" + zJplanInforesult.getString("msg"));
j.setSuccess(false);
}
} catch (Exception e) {
j.setMsg("失业保险单位征集计划提交失败");
j.setSuccess(false);
_log.error("失业保险单位征集计划提交失败", e.getMessage(), e);
}
return j;
}
@ApiOperation(value = "缴费工资申报提交审核")
@RequestMapping("/gssb_submit")
@ResponseBody
public AjaxJson gssb_submit(String list, String rae001, String saa004, String saa200, String archivesId, String sbb004) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
//String sa06aId= sequenceService.selectSequence("SA06A");
net.sf.json.JSONArray json = net.sf.json.JSONArray.fromObject(list);
try {
List<JfhdDTO> list1 = new ArrayList<JfhdDTO>();
for (int i = 0; i < json.size(); i++) {
JSONObject jsonObject = json.getJSONObject(i);
JfhdDTO jfhdDTO = JSON.parseObject(jsonObject.toString(), JfhdDTO.class);
list1.add(jfhdDTO);
}
String baa001 = list1.get(0).getBaa001();
//检查电子档案是否已上传完成
j = commonService.dzdaOnOrOff(suser.getId(), suser.getUserType(), rae001);//电子档案开关控制以及判断材料是否上传
if (!j.isSuccess()) {
return j;
}
// if("2".equals(suser.getUserType())) {//线下才加开关
// Sz19 sz19 = new Sz19();
// sz19.setUserId(Long.valueOf(suser.getId()));
// sz19 = sz19Service.selectOne(sz19);//线上ID是加密的但sz19id是number类型
// if ("1".equals(sz19.getAaa042())) {//1为开启电子档案
// String strdzda = "";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001", rae001);
// wrapper.eq("SAA104", "1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m = 0; m < sd08List.size(); m++) {
// String saa213 = sd08List.get(m).getSaa213();
// if ("0".equals(saa213)) {
// strdzda = strdzda + "," + sd08List.get(m).getSaa017();
// }
// }
// if (!"".equals(strdzda)) {
// strdzda = strdzda.substring(1, strdzda.length());
// j.setMsg(strdzda + "电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费基数申报:{}", strdzda + "电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
// }
// }else {
// String strdzda = "";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001", rae001);
// wrapper.eq("SAA104", "1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m = 0; m < sd08List.size(); m++) {
// String saa213 = sd08List.get(m).getSaa213();
// if ("0".equals(saa213)) {
// strdzda = strdzda + "," + sd08List.get(m).getSaa017();
// }
// }
// if (!"".equals(strdzda)) {
// strdzda = strdzda.substring(1, strdzda.length());
// j.setMsg(strdzda + "电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费基数申报:{}", strdzda + "电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
// }
Sa06a sa06a = new Sa06a();
sa06a.setRae001(rae001);
sa06a = sa06aService.selectOne(sa06a);
if (!CodeConstant.SAA043_2.equals(sa06a.getSaa043())) {
j.setSuccess(false);
j.setMsg("该笔业务已经受理,请查看后续进度");
return j;
}
com.alibaba.fastjson.JSONObject zJplanInfo = savejssbInfo(String.valueOf(sa06a.getSaa036()), list1, suser, sa06a.getSaa036().toString());//缴费基数申报提交
JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
String saa043 = StaticCodeUtil.getOfLineSAA043(saa004);
if ("0".equals(zJplanInforesult.getString("code"))) {
j.setMsg("失业保险单位缴费基数申报提交成功");
j.setSuccess(true);
//插入受理单表
//Sa06a sa06a=saveSa06a(list1.get(0), suser,"jssb_"+list1.get(0).getAab001()+"_"+list1.get(0).getAae030()+"01");
//sa06a.setRae001(rae001);
JfhdDTO jfhdDTO = com.alibaba.fastjson.JSONObject.parseObject(sa06a.getSaa039(), JfhdDTO.class);
com.alibaba.fastjson.JSONObject formInfo = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));
formInfo.put("saa200", saa200);
formInfo.put("saa004", saa004);
formInfo.put("archiveId", String.valueOf(archivesId));
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(baa001);
if ("610221".equals(baa001)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
formInfo.put("fondsId", fondscode);
formInfo.put("nodeId", CodeConstant.SY_JFHD_NODEID);
formInfo.put("sbb004", sbb004);
formInfo.put("rae001", rae001);
formInfo.put("data", list);
sa06a.setSaa043(saa043);
sa06a.setSaa042(CodeConstant.SAA042_2);
if (CodeConstant.SAA043_5.equals(saa043)) {
sa06a.setSaa211(CodeConstant.SAA211_2);
}
sa06a.setSaa041(CommonUtility.get19BitCurTimeAPP());
sa06a.setSaa039(formInfo.toJSONString());
Integer i = sa06aService.updateById(sa06a);
if (i > 0) {
commonService.saveSd11Info(rae001, String.valueOf(sa06a.getSaa036()), sa06a.getSaa043(), CodeConstant.RAE013_SD11_1, "");
j.setSuccess(true);
j.setMsg("提交成功");
} else {
j.setSuccess(false);
j.setMsg("提交失败:受理单状态更新失败");
}
} else {
j.setMsg("失业保险单位缴费基数申报提交失败,失败原因:" + zJplanInforesult.getString("msg"));
j.setSuccess(false);
}
} catch (Exception e) {
e.printStackTrace();
j.setMsg("失业保险单位征缴费基数申报提交失败");
j.setSuccess(false);
_log.error("失业保险单位缴费基数申报提交失败", e.getMessage(), e);
}
return j;
}
/**
* 单位缴费核定确认提交核心库
*/
public com.alibaba.fastjson.JSONObject saveUnemployedInfo(String rae001, JfhdDTO jfhdDTO, ShiroUser suser, String saa004, String sa06aId) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", CodeConstant.SY_GG_AAE140);//险种
param.put("AAE143", CodeConstant.SY_JFHD_JFHD_AAE143);//缴费记录类型
param.put("SAA036", sa06aId);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("SAA015", CodeConstant.SY_JFHD_JFHD_SAA015);//功能id
param.put("SAA004", saa004);//事项id
param.put("AAB034", jfhdDTO.getBaa001());//经办机构编码
param.put("BAE702", CodeConstant.SY_JFHD_JFHD_BAE702);//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("SAA043", CodeConstant.SAA043_3);//业务状态
param.put("SZZ003", jfhdDTO.getBaa001());//服务机构ID
param.put("BAA005", jfhdDTO.getBaa005());//审核编号
param.put("AAE002", jfhdDTO.getAae002());//费款所属期
param.put("AAE003", jfhdDTO.getAae003());//对应费款所属期
param.put("AAB004", jfhdDTO.getAab004());//单位名称
param.put("AAB083", jfhdDTO.getAab083());//在职人数
param.put("AAB121", jfhdDTO.getAab121());//单位基数总额
param.put("AAB120", jfhdDTO.getAab120());//个人基数总额
param.put("BAB701", jfhdDTO.getBab701());//个人应缴额
param.put("AAB122", jfhdDTO.getAab122());//单位应缴额
param.put("AAB137", jfhdDTO.getAab137());//合计金额
param.put("BAB706", jfhdDTO.getBab706());//应收核定类别
param.put("AAB019", jfhdDTO.getAab019());//单位类型
param.put("AAB020", jfhdDTO.getAab020());//经济类型
param.put("AAB021", jfhdDTO.getAab021());//隶属关系
param.put("AAB022", jfhdDTO.getAab022());//行业代码
param.put("AAB082", jfhdDTO.getAab082());//离退休(职)人次
param.put("BAC701", jfhdDTO.getBac701());//本期个人应缴划入统筹金额
param.put("BAC702", jfhdDTO.getBac702());//本期个人应缴划入帐户金额
param.put("BAC703", jfhdDTO.getBac703());//审核时个人缴费部分应补帐户利息
param.put("BAC704", jfhdDTO.getBac704());//审核时个人缴费部分应补统筹利息
param.put("AAB123", jfhdDTO.getAab123());//本期单位缴费应划入个人帐户金额
param.put("AAB124", jfhdDTO.getAab124());//本期单位缴费应划入统筹金额
param.put("BAB702", jfhdDTO.getBab702());//审核时单位缴费应划入个人帐户部分应补利息
param.put("BAB703", jfhdDTO.getBab703());//审核时单位缴费划入统筹金利息
param.put("BAB705", jfhdDTO.getBab705());//核销个人应缴划入帐户金额
param.put("BAB706", jfhdDTO.getBab706());//核销个人应缴划入统筹金额
param.put("AAD003", jfhdDTO.getAad003());//核销单位欠缴应划入帐户金额
param.put("AAD004", jfhdDTO.getAad004());//核销单位欠缴统筹金额
param.put("BAC707", jfhdDTO.getBac707());//核销个人帐户做实金额
param.put("BAC708", jfhdDTO.getBac708());//本期个人帐户做实金额
param.put("BAC709", jfhdDTO.getBac709());//核销在职人数
param.put("BAC710", jfhdDTO.getBac710());//核销离退休(职)人数
param.put("BAC711", jfhdDTO.getBac711());//征集时个人缴费部分应补帐户利息
param.put("BAC712", jfhdDTO.getBac712());//征集时个人缴费部分应补统筹利息
param.put("BAB704", jfhdDTO.getBab704());//征集时单位缴费应划入个人帐户部分应补利息
param.put("BAB705", jfhdDTO.getBab705());//征集时单位缴费划入统筹金利息
param.put("BAE742", jfhdDTO.getBae742());//审核时应缴滞纳金金额
param.put("BAE743", jfhdDTO.getBae743());//审核时减免滞纳金金额
param.put("BAE749", jfhdDTO.getBae749());//征集时滞纳金金额
param.put("BAE745", jfhdDTO.getBae745());//征集时减免滞纳金金额
param.put("BAE746", jfhdDTO.getBae746());//补息标志
param.put("BAE747", jfhdDTO.getBae747());//滞纳金征收标志
param.put("BAE748", jfhdDTO.getBae748());//核销小计
param.put("BAE750", jfhdDTO.getBae750());//缓缴截止日期
param.put("AAB137", jfhdDTO.getAab137());//应缴合计
param.put("AAB033", jfhdDTO.getAab033());//缴费方式
param.put("AAE011", ApplySaveUtil.SY_GG_CZR());//经办人
param.put("AAE036", DateUtils.datetimeFormat.format(new Date()));//经办时间
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/pay/check.json", params);
}
/**
* 单位征集计划确认提交核心库
*/
public com.alibaba.fastjson.JSONObject saveZJplanInfo(String rae001, JfhdDTO jfhdDTO, String sa06aId) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAE715", jfhdDTO.getBae715());
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAB034", jfhdDTO.getBaa001());//经办机构编码
param.put("BAA005", jfhdDTO.getBaa005());//审核编号
param.put("BAE702", "1");//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("AAB121", jfhdDTO.getAab121());//单位基数总额
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费记录类型
param.put("SAA036", sa06aId);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("SAA015", "M4008");//功能id
param.put("SAA004", SAA004);//事项id
param.put("startYM", jfhdDTO.getStartYM());//开始费款所属期
param.put("endYM", jfhdDTO.getEndYM());//截止费款所属期
param.put("AAB120", jfhdDTO.getAab120());//个人基数总额
param.put("BAB701", jfhdDTO.getBab701());//个人应缴额
param.put("BAE742", jfhdDTO.getBae742());//滞纳金
param.put("AAB122", jfhdDTO.getAab122());//单位应缴额
param.put("AAB137", jfhdDTO.getAab137());//合计金额
String a = param.toJSONString();
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/collection/check.json", params);
}
/**
* 缴费基数申报确认提交核心库
*/
public com.alibaba.fastjson.JSONObject savejssbInfo(String rae001, List<JfhdDTO> list, ShiroUser suser, String saa036) {
//缴费基数申报
net.sf.json.JSONArray jsonArray = new net.sf.json.JSONArray();
List<PostParam> params = new ArrayList<PostParam>();
for (JfhdDTO jfhdDTO : list) {
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("SAA036", saa036);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("AAC001", jfhdDTO.getAac001());//个人编号
param.put("AAE030", jfhdDTO.getAae030() + "01");//开始年月
param.put("AAC040", jfhdDTO.getAac040());//缴费工资
param.put("TAA101", DateUtils.datetimeFormat.format(new Date()));//申报时间
param.put("AAE036", DateUtils.datetimeFormat.format(new Date()));//经办时间
param.put("SAA038", DateUtils.datetimeFormat.format(new Date()));//申请时间
param.put("AAE011", ApplySaveUtil.SY_GG_CZR());//经办人
param.put("SAA037", ApplySaveUtil.SY_GG_CZR());//申请人
param.put("SAA015", "M4006");//功能id
param.put("SAA004", SAA004);//事项id
param.put("BAE702", "1");//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("SAA043", "3");//业务状态
param.put("SZZ003", jfhdDTO.getBaa001());//服务机构ID
param.put("TAA103", "0");//审核结果
param.put("TAA105", "4");//申报来源
param.put("AAE143", "1");//缴费核定类型
jsonArray.add(param);
}
params.add(new PostParam("params", "string", jsonArray.toString()));
//com.alibaba.fastjson.JSONObject rs= PostHelper.send("/loseJob/paymentBase/declaration.json", params);
//JSONObject result = JSONObject.fromObject(rs.get("result"));
return PostHelper.send("/loseJob/paymentBase/declaration.json", params);
}
/**
* 根据单位编号查询单位信息
*/
public com.alibaba.fastjson.JSONObject getAb01ByAab001(String datacode, String aab001) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", datacode);//数据分区
param.put("AAB001", aab001);//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/basicInfoQuery.json", params);
}
/**
* 征集计划查询
*/
public List<JfhdDTO> getzjPlan(String datacode, String aab001, String aae002, String aae003) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", datacode);//数据分区suser.getUserInfo().getUpmsOrganizations().getCode()
param.put("AAB001", aab001);//单位编号
//param.put("BAE702","1");//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE063", "-1");//BAB811为1时分组增加费款所属期及基金配置流水号
param.put("AAE140", "2");//险种
param.put("AAB033", "2");//缴费类型
param.put("AAE143", "1");//缴费记录类型
param.put("StartYM", aae002);//开始费款所属期
param.put("EndYM", aae003);//结束费款所属期
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject zjplan = PostHelper.send("/loseJob/unit/payInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(zjplan.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 单位缴费信息查询
*/
public com.alibaba.fastjson.JSONObject getjfxxList(Map<String, String> map, ShiroUser suser, String baa001) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", baa001);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAB033", "2");//缴费类型
param.put("AAE143", "1");//缴费记录类型
param.put("BAB811", "1");//BAB811为1时分组增加费款所属期及基金配置流水号
param.put("StartYM", map.get("StartYM"));//缴费类型
param.put("EndYM", map.get("EndYM"));//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/payInfoQuery.json", params);
}
/**
* 单位缴费核定信息查询
*/
public com.alibaba.fastjson.JSONObject getjfhdList(Map<String, String> map, String code, String id) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", code);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费核定类型
param.put("StartYM", map.get("StartYM"));//缴费类型
param.put("EndYM", map.get("EndYM"));//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/pay/query.json", params);
}
/**
* 查询缴费明细信息
*
* @return
*/
public com.alibaba.fastjson.JSONObject getjfmx(Map<String, String> map, String code) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", code);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费核定类型
param.put("AAE002", map.get("AAE002"));//费款所属期
//param.put("AAE003",map.get("AAE002"));//对应费款所属期
param.put("BAA005", map.get("BAA005"));//审核编号
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/person/payInfoQuery.json", params);
}
//生成sd06对象公共方法
public Sd06 saveSd06(JfhdDTO jfhdDTO, ShiroUser suser, String archives) {
Sd06 sd06 = new Sd06();
sd06.setSaa004(SAA004); //事项ID
sd06.setSbb004(SBB004); //功能ID
sd06.setSaa205("1");//申请渠道
sd06.setSaa210("1");//申报状态
sd06.setSaa037(jfhdDTO.getAab004());//申请人
sd06.setAac043("1");//申请人证件类型(1身份证,2出生证,3护照
sd06.setAac044(jfhdDTO.getAab001());//申请人证件号
sd06.setAaa025("1");//申请主体类型(1单位,2个人,3家庭,5社区,6学校
sd06.setSaa203(DateUtils.datetimeFormat.format(new Date()));//申请时间
sd06.setAae011(suser.getId());//经办人
sd06.setAae036(DateUtils.datetimeFormat.format(new Date()));//经办时间
sd06.setBae011(suser.getId());//变更人
sd06.setBae036(DateUtils.datetimeFormat.format(new Date()));//变更时间
sd06.setSzz007(suser.getUserInfo().getUpmsOrganizations().getCode());//机构id String.valueOf(suser.getOrgid())
sd06.setSza016(suser.getUserInfo().getUpmsOrganizations().getCode());//行政区划suser.getUserInfo().getUpmsOrganizations().getCode()
sd06.setAaa026(jfhdDTO.getAab001());//申请主体编号
sd06.setPan001(archives);
return sd06;
}
public Sd07 saveSd07(JfhdDTO jfhdDTO, ShiroUser suser) {
Sd07 sd07 = new Sd07();
sd07.setRae003(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));//表单信息
sd07.setSaa210("1"); //申报状态
sd07.setAae011(suser.getLoginName().toString()); //经办人
return sd07;
}
// public Sa06a saveSa06a (JfhdDTO jfhdDTO, ShiroUser suser,String aac044){
// Sa06 sa06=sa06Service.selectById(SAA004);
// Sa06a sa06a=new Sa06a();
// sa06a.setSaa004(SAA004);//事项id
// sa06a.setSbb004(SBB004);//事项id
// sa06a.setSaa043("6");//业务状态(1填写资料,2提交审核,3预审,4受理,5审核,6办结
// sa06a.setSaa080(suser.getLoginName().toString());//经办人
// sa06a.setSaa039(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));//表单信息
// sa06a.setSaa024(sa06.getSaa024());//法定期限
// sa06a.setSaa018(sa06.getSaa018());//承诺时限
// sa06a.setBusId(sa06.getBusId());//业务id
// sa06a.setSaa037(jfhdDTO.getAab004());//申请人
// sa06a.setSaa038(DateUtils.datetimeFormat.format(new Date()));//申请时间
// sa06a.setSaa015("M4007");//功能ID
// sa06a.setBae702(sa06.getSaa062());//主体类型(0个人,1单位)
// sa06a.setBae703(jfhdDTO.getAab001());//主体编号
// sa06a.setSaa017(sa06.getSaa005());//申报名称
// sa06a.setSaa205("1");//申请渠道(1受理平台,2网上办事,3手机APP)
// sa06a.setAac043("1");//申请人证件类型(1身份证,2出生证,3护照)
// sa06a.setAac044(aac044);//申请人证件号
// sa06a.setAab004(jfhdDTO.getAab004());//单位名称
// sa06a.setSza016(suser.getUserInfo().getUpmsOrganizations().getCode());//suser.getUserInfo().getUpmsOrganizations().getCode()
// sa06a.setSaa211("2");//办结状态(1未办结,2已办结)
// return sa06a;
// }
public Sd11 sd11Bean(String rae001, String name, String code, String saa036) {
Sd11 sd11 = new Sd11();
sd11.setRae001(rae001);//服务事项办理过程ID 申报ID
Sz18 sz18 = new Sz18();
sz18.setSbb004(SBB004);
sz18.setRae009("2");
sz18 = sz18Service.selectOne(sz18);
sd11.setRae008(sz18.getSz18id());//业务环节ID 申报状态 0为已申报
sd11.setRae009("2");//环节顺序 第一步环节
sd11.setRae010("受理");//环节名称
sd11.setRae011("");//环节承诺时间 sa06.getSaa018()
sd11.setRae012("1");//环节状态
sd11.setRae013("1");//办理状态(1通过2未通过)
sd11.setAae189("同意");//办理意见
sd11.setAae011(name);//经办人
sd11.setAae013("");//备注
sd11.setAae036(DateUtils.datetimeFormat.format(new Date()));//经办时间
sd11.setSzz007("");//服务机构ID
sd11.setSza016(code);//行政区划(6102铜川市,610202铜川市王益区,610203铜川市印台区,610204铜川市耀州区,610207铜川市新区,610208铜川市矿务局,610222铜川市宜君县,610299铜川市本级)
sd11.setSaa900("0");//同步状态(0未同步,1已同步)
sd11.setSaa901("");//同步时间
sd11.setSaa902("");//同步说明
sd11.setBae941(saa036);//流水号(调用工作流返回的流水号,用于跟核心反馈的数据同步受理单状态)
sd11.setSaa036(saa036);//受理单ID
sd11.setSda009(DateUtils.datetimeFormat.format(new Date()));//开始时间
sd11.setSbb004(SBB004);
return sd11;
}
@ApiOperation(value = "缴费明细导出")
@RequestMapping("/exportxlsjf")
@ResponseBody
public String exportxlsjf(JfhdDTO jfhdDTO, HttpServletResponse response) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("AAE002", jfhdDTO.getAae002());
map.put("BAA005", jfhdDTO.getBaa005());
com.alibaba.fastjson.JSONObject json = getjfmx(map, jfhdDTO.getBaa001());
JSONObject result = JSONObject.fromObject(json.get("result"));
if ("0".equals(result.getString("code"))) {
List<JfhdDTO> list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
if (list_return.size() <= 0) {
return "没有可导出的数据";
}
//指定下载的文件名
String fileName = "人员缴费查询列表.xls";
// 定义单元格报头
String worksheetTitle = "人员缴费查询列表";
List<String> columsTitles = new ArrayList<String>();
columsTitles.add("个人编号");
columsTitles.add("姓名");
columsTitles.add("身份证");
columsTitles.add("缴费类型");
columsTitles.add("费款所属期");
columsTitles.add("个人缴费基数总额");
columsTitles.add("个人缴费金额");
columsTitles.add("单位应缴金额");
columsTitles.add("缴费合计");
columsTitles.add("缴费标志");
try {
fileName = new String(fileName.getBytes("GBK"), "iso8859-1");
response.reset();
response.setHeader("Content-Disposition", "attachment;filename="
+ fileName);// 指定下载的文件名
//response.setContentType("application/vnd.ms-excel");
response.setContentType("APPLICATION/OCTET-STREAM;charset=UTF-8");//设置类型
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
OutputStream output = null;
output = response.getOutputStream();
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
HSSFWorkbook wb = new HSSFWorkbook();
// 创建单元格样式
HSSFCellStyle cellStyleTitle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyleTitle.setWrapText(true);
// ------------------------------------------------------------------
HSSFCellStyle cellStyle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyle.setWrapText(true);
// ------------------------------------------------------------------
// 设置单元格字体
HSSFFont font = wb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontName("宋体");
font.setFontHeight((short) 200);
cellStyleTitle.setFont(font);
// 工作表名
HSSFSheet sheet = wb.createSheet("sheet1");
ExportExcel exportExcel = new ExportExcel(wb, sheet);
// 创建报表头部
exportExcel.createNormalHead(worksheetTitle, columsTitles.size() + 1);
// 定义第一行
HSSFRow row1 = sheet.createRow(1);
//第一行第i列;
for (int i = 0; i < columsTitles.size(); i++) {
HSSFCell cell1 = row1.createCell(i);
cell1.setCellStyle(cellStyleTitle);
cell1.setCellValue(new HSSFRichTextString(columsTitles.get(i)));
}
//定义第二行
HSSFRow row = sheet.createRow(2);
HSSFCell cell = row.createCell(1);
List list_aae143 = CodeCacheUtils.getCodeList("AAE143");
List aae114List = CodeCacheUtils.getCodeList("AAE114");
for (int j = 0; j < list_return.size(); j++) {
JfhdDTO jf = list_return.get(j);
//个人编号,姓名,身份证,错误原因
row = sheet.createRow(j + 2);
//个人编号
cell = row.createCell(0);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac001().trim()));
//姓名
cell = row.createCell(1);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac003().trim()));
//身份证
cell = row.createCell(2);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac002().trim()));
//缴费类型
for (int k = 0; k < list_aae143.size(); k++) {
JSONObject jsonObject = JSONObject.fromObject(list_aae143.get(k));
if ((jsonObject.getString("value")).equals(jf.getAae143())) {
String name1 = jsonObject.getString("name");
cell = row.createCell(3);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(name1));
break;
}
}
//费款所属期
cell = row.createCell(4);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAae002()));
//个人缴费基数总额
cell = row.createCell(5);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getBac504().trim()));
//个人缴费金额
cell = row.createCell(6);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac123().trim()));
//单位应缴金额
cell = row.createCell(7);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac127().trim()));
//缴费合计
cell = row.createCell(8);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getBac504_1().trim()));
//缴费标志
for (int m = 0; m < aae114List.size(); m++) {
JSONObject jsonObject = JSONObject.fromObject(aae114List.get(m));
if ((jsonObject.getString("value")).equals(jf.getAae114())) {
String name2 = jsonObject.getString("name");
cell = row.createCell(9);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(name2));
break;
}
}
}
wb.write(bufferedOutPut);
bufferedOutPut.flush();
bufferedOutPut.close();
return null;
} catch (IOException e) {
e.printStackTrace();
return "导出异常";
} finally {
}
} else {
return result.getString("msg");
}
//return "";
}
public List<String> getbetweentimes(String start, String end) throws ParseException {
List<String> list = new ArrayList<String>();
list.add(start);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
Date date1 = sdf.parse(start);
Date date2 = sdf.parse(end);
cal.setTime(date1);
while (date1.before(date2)) {
cal.add(Calendar.MONTH, 1);
date1 = cal.getTime();
String str = sdf.format(date1);
list.add(str);
}
return list;
}
public static void main(String[] args) throws ParseException {
//个人编号查询
com.alibaba.fastjson.JSONObject j = new com.alibaba.fastjson.JSONObject();
j.put("AAE170", "SLPT123");
j.put("AAB001", "10202000017");
j.put("BAA001", "'610202'");
j.put("BAC808", "10");//每页多少条
j.put("BAC809", "1"); //页码
j.put("AAC002", "");
j.put("AAC001", "");
j.put("AAC003", "");
j.put("AAC050", "");//异动类型
j.put("AAC031", "");
j.put("TAE100", "");
j.put("SAA015", "");
j.put("AAE140", "2");//险种类型
com.alibaba.fastjson.JSONObject json = RestfulUtil.getJson(j, "/loseJob/person/insuredInfoQuery.json");
System.out.println(json.toString());
}
@RequestMapping("/zjjjDetail")
public String zjjjDetail(HttpServletResponse response, ModelMap model,
String startYM, String endYM, String aab001, String baa001, String saa200, String aab004) {
try {
aab004 = URLDecoder.decode(URLDecoder.decode(aab004, "UTF-8"), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
model.addAttribute("startYM", startYM);
model.addAttribute("endYM", endYM);
model.addAttribute("aab001", aab001);
model.addAttribute("baa001", baa001);
model.addAttribute("aab004", aab004);
model.addAttribute("saa200", saa200);
List<JfhdDTO> list_return = zjjjList(startYM, endYM, aab001, baa001);
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("zjjjList", JSONHelper.array2json(listyd));
return "/unemployment/syjfhd/zjjjList.jsp";
}
public List<JfhdDTO> zjjjList(String startYM, String endYM, String aab001, String baa001) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", aab001);//单位编号
jsonObject.put("BAA001", baa001);//数据分区
jsonObject.put("BAB811", "");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "");// 否
jsonObject.put("AAE143", "");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", startYM);//
jsonObject.put("EndYM", endYM);//
jsonObject.put("AAE063", "");// 征集计划标识
jsonObject.put("AAE140", "");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
net.sf.json.JSONObject result = net.sf.json.JSONObject.fromObject(j.getString("result"));
//####################################################################
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 缴费核定撤销页面
*
* @param jfhd
* @param response
* @param model
* @param saa200
* @param aab004
* @param rae001
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/checkremove")
public String checkremove(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
try {
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("aab004", URLDecoder.decode(jfhd.getAab004(), "UTF-8"));
model.addAttribute("saa200", saa200);
model.addAttribute("saa004", saa004);
// model.addAttribute("rae001",rae001);
} catch (Exception e) {
e.printStackTrace();
}
return "/unemployment/syjfhd/checkRemove.jsp";
}
/**
* 缴费核定撤销list
*
* @param
* @param response
* @param model
* @param saa200
* @param aab004
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/checkRemoveList")
@ResponseBody
public AjaxJson checkRemoveList(String baa005, HttpServletResponse response, ModelMap model, String saa200, String aab004, String saa004, String aae002, String aae003) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if ("".equals(baa005) || baa005 == null) {
if (json.getString("AAB001") != null) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
} else {
if (baa005.equals(json.getString("BAA005"))) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
try {
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("gridmap1", JSONHelper.array2json(list));
j.setObj(jsonObject1);
j.setSuccess(true);
} catch (Exception e) {
j.setMsg("失败");
j.setSuccess(false);
}
}
return j;
}
@ApiOperation("批量撤销缴费核定")
@RequestMapping("/batchdelete")
@ResponseBody
public AjaxJson batchDelete(String data, String saa200, Sd05 sd05) {
AjaxJson ajaxJson = new AjaxJson();
List<JfhdDTO> lists = JSONArray.parseArray(data, JfhdDTO.class);
sd05 = sd05Service.selectById(saa200);
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
try {
for (JfhdDTO jfhdDTO : lists) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAE143", jfhdDTO.getAae143());// 缴费类型
jsonObject.put("AAE003", jfhdDTO.getAae003());// 对应费款所属期
jsonObject.put("BAA005", jfhdDTO.getBaa005());// 审核流水号
jsonObject.put("BAE703", sd05.getAaa026());// 主体编号
jsonObject.put("AAB137", jfhdDTO.getAab137());// 应缴合计
params.add(new PostParam("params", "string", "[" + jsonObject.toJSONString() + "]"));
json = PostHelper.send("/loseJob/unit/collection/del.json", params);
}
if (json.getString("code").equals("0")) {
ajaxJson.setMsg("撤销成功");
ajaxJson.setSuccess(true);
} else {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
} catch (Exception e) {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
return ajaxJson;
}
public com.alibaba.fastjson.JSONObject jfhdcxList(Map map, Sd05 sd05) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("BAB811", "1");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "");// 否
jsonObject.put("AAE143", "1");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", map.get("StartYM"));//
jsonObject.put("EndYM", map.get("EndYM"));//
jsonObject.put("AAE063", "-1");// 征集计划标识
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
return j;
}
/*
-------------------------------------------------------------------------------
*/
@RequestMapping("/zjjhremove")
public String zjjhremove(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
try {
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("aab004", URLDecoder.decode(jfhd.getAab004(), "UTF-8"));
model.addAttribute("saa200", saa200);
model.addAttribute("saa004", saa004);
} catch (Exception e) {
e.printStackTrace();
}
return "/unemployment/syjfhd/zzjhRemove.jsp";
}
/**
* 征集计划撤销list
*
* @param
* @param response
* @param model
* @param saa200
* @param aab004
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/zzjhremovelist")
@ResponseBody
public AjaxJson zzjhremovelist(String aae063, HttpServletResponse response, ModelMap model, String saa200, String aab004, String saa004, String aae002, String aae003) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd05 = sd05Service.selectById(saa200);
com.alibaba.fastjson.JSONObject jsonObject = zjjjRemoveList(aae002, aae003, sd05.getAaa026(), sd05.getSza017());
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
if (jsonArray.size() <= 0) {
j.setMsg("费款所属期内未查询到可操作的征集计划");
j.setSuccess(false);
return j;
}
DecimalFormat df = new DecimalFormat("######0.00");
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if ("".equals(aae063) || aae063 == null) {
if (json.getString("AAB001") != null) {
json.put("AAB004", json.getString("AAB004"));
json.put("BAE713", df.format(Double.parseDouble(json.getString("BAE713"))));
json.put("AAE063", json.getString("AAE063"));
json.put("BAE703", json.getString("BAE703"));
json.put("AAE003", json.getString("AAE003"));
// if(json.getString("StartYM").equals(json.getString("EndYM"))){
// json.put("start_end",(json.getString("StartYM")));
// }else{
json.put("start_end", (json.getString("StartYM") + "~" + json.getString("EndYM")));
// }
// json.put("BAE742",json.getString("BAE742"));
// json.put("BAE713",json.getString("BAE713"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
} else {
if (aae063.equals(json.getString("AAE063"))) {
json.put("AAB004", json.getString("AAB004"));
json.put("BAE713", df.format(Double.parseDouble(json.getString("BAE713"))));
// if(json.getString("StartYM").equals(json.getString("EndYM"))){
// json.put("start_end",(json.getString("StartYM")));
// }else{
json.put("start_end", (json.getString("StartYM") + "~" + json.getString("EndYM")));
// }
json.put("AAE063", json.getString("AAE063"));
json.put("BAE703", json.getString("BAE703"));
json.put("AAE003", json.getString("AAE003"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
try {
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("gridmap2", JSONHelper.array2json(list));
j.setObj(jsonObject1);
j.setSuccess(true);
} catch (Exception e) {
j.setMsg("失败");
j.setSuccess(false);
}
}
return j;
}
public com.alibaba.fastjson.JSONObject zjjjRemoveList(String startYM, String endYM, String aab001, String baa001) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", aab001);//单位编号
jsonObject.put("BAA001", baa001);//数据分区
jsonObject.put("BAB811", "");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "2");// 否
jsonObject.put("AAE143", "");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", startYM);//
jsonObject.put("EndYM", endYM);//
jsonObject.put("AAE063", "");// 征集计划标识
jsonObject.put("AAE140", "");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
return j;
}
@ApiOperation("批量撤销征集计划")
@RequestMapping("/removeAllzjjh")
@ResponseBody
public AjaxJson removeAllzjjh(String data, String saa200, Sd05 sd05) {
AjaxJson ajaxJson = new AjaxJson();
List<JfhdDTO> lists = JSONArray.parseArray(data, JfhdDTO.class);
sd05 = sd05Service.selectById(saa200);
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
try {
for (JfhdDTO jfhdDTO : lists) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAE003", jfhdDTO.getAae003());// 对应费款所属期
// jsonObject.put("BAA005",jfhdDTO.getBaa005());// 审核流水号
jsonObject.put("BAE703", sd05.getAaa026());// 主体编号
jsonObject.put("AAE063", jfhdDTO.getAae063());//
jsonObject.put("AAB137", jfhdDTO.getBae713());// 应缴合计
params.add(new PostParam("params", "string", "[" + jsonObject.toJSONString() + "]"));
json = PostHelper.send("/loseJob/unit/collection/del.json", params);
Dj04 dj04 = new Dj04();
dj04.setDj041(jfhdDTO.getAae063());
dj04.setDj02id("1001");
//删除地沟04
dj04 = dj04Service.selectOne(dj04);
if(null!=dj04){
dj04Service.deleteByEntity(dj04);
}
}
if (json.getString("code").equals("0")) {
ajaxJson.setMsg("撤销成功");
ajaxJson.setSuccess(true);
} else {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
} catch (Exception e) {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
return ajaxJson;
}
/*----------------------------------------------------------*/
@RequestMapping("/dzjjlistView")
public String dzjjlistView(ModelMap model, String saa200, String aae002, String aae003) {
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return "/unemployment/syjfhd/dzjjList.jsp";
}
@RequestMapping("/dzjjlist")
@ResponseBody
public DataGridReturn dzjjList(Sd05 sd05, JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aae002, String aae003) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (json.getString("AAB001") != null) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List<PostParam> params = new ArrayList<PostParam>();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
if ("0".equals(result1.get("code"))) {
list_return1 = JSONArray.parseArray(result1.getString("RETLIST"), JfhdDTO.class);
}
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("dzjjlist1", JSONHelper.array2json(listyd));
int count = 0;
List<JfhdDTO> listdz1 = new ArrayList();
List<JfhdDTO> listdz2 = new ArrayList();
List<JfhdDTO> listdz3 = new ArrayList();
for (JfhdDTO js : list_return1) {
if (js.getBae718().equals("1")) {
listdz1.add(js);
}
if (js.getBae718().equals("4")) {
listdz2.add(js);
}
if (js.getBae718().equals("5")) {
listdz3.add(js);
}
}
List<JfhdDTO> listend = new ArrayList();
if (listdz1.size() > 0)
listend.add(listdz1.get(0));
if (listdz2.size() > 0)
listend.add(listdz2.get(0));
if (listdz3.size() > 0)
listend.add(listdz3.get(0));
List listdz = new ArrayList();
for (JfhdDTO js : listend) {
listdz.add(transBean2Map(transNull(js)));
}
model.addAttribute("dzjjsls", JSONHelper.array2json(listdz));
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return new DataGridReturn((long) listyd.size(), listyd);
}
/*
*/
@RequestMapping("/dzjjClsaalist")
@ResponseBody
public DataGridReturn dzjjClsaalist(Sd05 sd05, ModelMap model, String saa200, String aae002, String aae003) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
List<PostParam> params = new ArrayList<PostParam>();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
if ("0".equals(result1.get("code"))) {
list_return1 = JSONArray.parseArray(result1.getString("RETLIST"), JfhdDTO.class);
}
List listyd = new ArrayList();
List<JfhdDTO> listdz1 = new ArrayList();
List<JfhdDTO> listdz2 = new ArrayList();
List<JfhdDTO> listdz3 = new ArrayList();
for (JfhdDTO js : list_return1) {
if (js.getBae718().equals("1")) {
listdz1.add(js);
}
if (js.getBae718().equals("4")) {
listdz2.add(js);
}
if (js.getBae718().equals("5")) {
listdz3.add(js);
}
}
List<JfhdDTO> listend = new ArrayList();
if (listdz1.size() > 0)
listend.add(listdz1.get(0));
if (listdz2.size() > 0)
listend.add(listdz2.get(0));
if (listdz3.size() > 0)
listend.add(listdz3.get(0));
List listdz = new ArrayList();
// for (JfhdDTO js:listend) {
// listdz.add(transBean2Map(js));
// }
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return new DataGridReturn((long) listend.size(), listend);
}
@RequestMapping("/dzjjEnd")
public String dzjjEnd(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return "/unemployment/syjfhd/dzjjEnd.jsp";
}
@RequestMapping("/dzjjEndList")
@ResponseBody
public DataGridReturn dzjjEndList(DataGrid dataGrid, String saa200, String aae002, String aae003, Sd05 sd05, Model model) {
AjaxJson ajaxJson = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
JSONArray jsonArray = JSONArray.parseArray(result1.getString("RETLIST"));
JSONArray jsonArraynew = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (Double.valueOf(json.getString("BAE716").trim()) < 0) {
json.put("BAE703", json.getString("BAE703"));
json.put("BAA001", json.getString("BAA001"));
json.put("AAE003", json.getString("AAE003"));
json.put("BAE715", json.getString("BAE715"));
json.put("BAE718", json.getString("BAE718"));
json.put("BAE716", json.getString("BAE716"));
json.put("AAE011", json.getString("AAE011"));
json.put("AAE036", json.getString("AAE036"));
jsonArraynew.add(json);
}
}
list_return1 = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return1) {
list.add(transBean2Map(js));
}
int a = dataGrid.getPage();
int b = dataGrid.getRows();
Wrapper wrapper = new EntityWrapper();
PageHelper.startPage(dataGrid.getPage(), dataGrid.getRows());
PageInfo pageInfo = new PageInfo(list);
return new DataGridReturn(pageInfo.getTotal(), pageInfo.getList());
}
}
| UTF-8 | Java | 136,121 | java | SyjfhdController.java | Java | [
{
"context": "mat;\nimport java.util.*;\n\n/**\n * 失业保险缴费基数申报与核定\n * 叶大洲\n * 2018-05-21\n */\n@Api(value = \"失业保险缴费基数申报与核定\", d",
"end": 2345,
"score": 0.9892095327377319,
"start": 2342,
"tag": "NAME",
"value": "叶大洲"
}
]
| null | []
| package com.pansky.acceptplat.web.controller.unemployment.jntsbtcontroller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pansky.acceptplat.common.util.ArchivesUtil;
import com.pansky.acceptplat.common.util.CodeConstant;
import com.pansky.acceptplat.common.util.CommonUtility;
import com.pansky.acceptplat.dao.dto.GxdwjbxxDTO;
import com.pansky.acceptplat.dao.dto.JfhdDTO;
import com.pansky.acceptplat.dao.model.*;
import com.pansky.acceptplat.rpc.api.*;
import com.pansky.acceptplat.web.controller.unemployment.cbdj.StaticCodeUtil;
import com.pansky.acceptplat.web.util.*;
import com.pansky.common.base.BaseController;
import com.pansky.common.model.json.AjaxJson;
import com.pansky.common.model.json.DataGrid;
import com.pansky.common.model.json.DataGridReturn;
import com.pansky.common.util.CodeCacheUtils;
import com.pansky.common.util.DateUtils;
import com.pansky.common.util.JSONHelper;
import com.pansky.upms.client.shiro.realm.ShiroUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import net.vsame.url2sql.utils.PostParam;
import org.apache.poi.hssf.usermodel.*;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 失业保险缴费基数申报与核定
* 叶大洲
* 2018-05-21
*/
@Api(value = "失业保险缴费基数申报与核定", description = "失业保险缴费基数申报与核定")
@Controller
@RequestMapping("/tcrs/sybx/sydwjfhd")
public class SyjfhdController extends BaseController {
@Autowired
private Dj04Service dj04Service;
@Autowired
private Sa06aService sa06aService;
@Autowired
private Sd05Service sd05Service;
@Autowired
private Sz18Service sz18Service;
@Autowired
private Sa06kService sa06kService;
@Autowired
private SequenceService sequenceService;
@Autowired
CommonService commonService;
private static Logger _log = LoggerFactory.getLogger(SyjfhdController.class);
private static String SAA004 = "00000269";//事项id
private static String SBB004 = "C120";//事项id
//private static String NODEID="1696";//模板id
private static DateFormat DFYYYYMMM = new SimpleDateFormat("yyyyMM");
private static DateFormat DFYYYY = new SimpleDateFormat("yyyy");
@ApiOperation(value = "进入首页面")
@RequestMapping("/index")
public String getIndex(Model model, String saa200, String sbb004, String saa036, String viewType) throws ParseException {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd051 = sd05Service.selectById(saa200);
String backUrl = ArchivesMessage.getBackUrl(suser.getUserType(), sd051.getSaa004());
String userType = suser.getUserType();
//sd05.setSaa200(Long.parseLong("4473"));
try {
com.alibaba.fastjson.JSONArray sd05Array = com.alibaba.fastjson.JSONArray.parseArray(sd051.getAae440());
com.alibaba.fastjson.JSONObject sd05json = sd05Array.getJSONObject(0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String end = DFYYYY.format(new Date()) + "12";
if (sd05Array == null || sd05Array.size() == 0) {
model.addAttribute("msg", "发号单未发现申请单位信息");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
String aab001 = sd05json.getString("aab001");
if (StringUtils.isBlank(aab001)) {
model.addAttribute("msg", "未发现申请单位编号");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
String datapartid = sd051.getSza017();//行政区划
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(datapartid);
if ("610221".equals(datapartid)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
if (StringUtils.isBlank(saa036)) {
String formJson = "";//获得表单信息
Wrapper<Sa06a> sa06aWrapper = new EntityWrapper<>();
sa06aWrapper.eq("SBB004", sbb004);
sa06aWrapper.eq("BAE703", sd05json.getString("aab001"));
sa06aWrapper.ne("SAA043", CodeConstant.SAA043_5);
sa06aWrapper.ne("SAA043", CodeConstant.SAA043_6);
List<Sa06a> sa06as = sa06aService.selectList(sa06aWrapper);
if (CodeConstant.USER_TYPE_0.equals(userType) || CodeConstant.USER_TYPE_1.equals(userType)) {
if (!sa06as.isEmpty()) {
model.addAttribute("msg", "此单位有一笔已经提交或正在受理的失业保险单位缴费核定与基数申报,不能重复办理");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
formJson = commonService.findOnlineUncommitted(sd05json.getString("aab001"), sbb004);
} else if (CodeConstant.USER_TYPE_2.equals(userType)) {
if (sa06as != null && sa06as.size() > 0) {
String saa043 = sa06as.get(0).getSaa043();
if (CodeConstant.SAA043_2.equals(saa043)) {
Sa06a sa06a = sa06as.get(0);
formJson = sa06a.getSaa039();
model.addAttribute("saa036", sa06a.getSaa036());
} else {
model.addAttribute("msg", "此单位有一笔正在审核中的失业保险单位缴费核定与基数申报,不能重复办理");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
}
}
if (StringUtils.isNotBlank(formJson)) {
model.addAttribute("nodeId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("nodeId"));
model.addAttribute("fondsId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("fondsId"));
model.addAttribute("rae001", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("rae001"));
model.addAttribute("archiveId", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("archiveId"));
model.addAttribute("saa200", com.alibaba.fastjson.JSONObject.parseObject(formJson).getString("saa200"));
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhdDTO = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
JfhdDTO jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
} else {
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhdDTO = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
long archivesId = createArchives(datapartid, jfhdDTO, suser);
if (archivesId <= 0) {
model.addAttribute("msg", "电子档案系统请求异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
//插入数据库表sd06,sd07,sd08,修改sd05,
Wrapper<Sa06k> wrapper = new EntityWrapper();
wrapper.like("SAA004", sd051.getSaa004());
wrapper.like("SZZ304", "1");
List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
com.alibaba.fastjson.JSONObject sd06Json = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd051));
sd06Json.put("baa001", datapartid);
sd06Json.put("archiveId", String.valueOf(archivesId));
sd06Json.put("sbb004", sbb004);
sd06Json.put("rae001", sequenceService.selectSequence("SD06"));
Sd06 sd06 = ArchivesMessage.getSd06(sd06Json);
sd06.setSaa210(CodeConstant.SAA210_1);
String rae002 = sequenceService.selectSequence("SD07");
com.alibaba.fastjson.JSONObject sd07Json = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd06));
//Sd07 sd07 =CommonStorageUtil.saveSd07(com.alibaba.fastjson.JSONObject.toJSONString(json),"1",suser);
//封装表单信息
com.alibaba.fastjson.JSONObject formInfo = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));
formInfo.put("saa200", sd051.getSaa200());
formInfo.put("saa004", sd051.getSaa004());
formInfo.put("archiveId", String.valueOf(archivesId));
formInfo.put("fondsId", fondscode);
formInfo.put("nodeId", CodeConstant.SY_JFHD_NODEID);
formInfo.put("sbb004", sbb004);
formInfo.put("rae001", sd06.getRae001());
sd07Json.put("rae003", formInfo.toJSONString());
sd07Json.put("aae140", CodeConstant.SY_GG_AAE140);
sd07Json.put("rae002", rae002);
Sd07 sd07 = ArchivesMessage.getSd07(sd07Json);
sd07.setSaa210(CodeConstant.SAA210_2);
boolean flag = false;
if (CodeConstant.USER_TYPE_0.equals(userType) || CodeConstant.USER_TYPE_1.equals(userType)) {
flag = commonService.saveOnLineBak(sd06, sd07, sa06kList);
} else if (CodeConstant.USER_TYPE_2.equals(userType)) {
sd06.setSaa210(CodeConstant.SAA210_2);//申报状态已申报
Sa06 sa06 = StaticCodeUtil.getSa06bySaa004(sd051.getSaa004());
com.alibaba.fastjson.JSONObject sa06aJson = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(sd051));
sa06aJson.put("saa039", formInfo.toJSONString());
sa06aJson.put("rae001", sd06.getRae001());
sa06aJson.put("sbb004", sbb004);
sa06aJson.put("baa001", datapartid);
sa06aJson.put("aae140", CodeConstant.SY_GG_AAE140);
sa06aJson.put("sa06", com.alibaba.fastjson.JSONObject.toJSONString(sa06));
sa06aJson.put("saa036", sequenceService.selectSequence("SA06A"));
sa06aJson.put("saa015", CodeConstant.SY_JFHD_GZSB_SAA015);
Sa06a sa06a = ArchivesMessage.saveSa06a(sa06aJson);
sa06a.setSaa042(CodeConstant.SAA042_1);
flag = commonService.saveOfLineBak(sd06, sd07, sa06kList, sa06a);
if (flag) {
commonService.saveSd11Info(String.valueOf(sd06.getRae001()), String.valueOf(sa06a.getSaa036()), sa06a.getSaa043(), CodeConstant.RAE013_SD11_1, "");
}
}
if (!flag) {
model.addAttribute("msg", "请求异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
JfhdDTO jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
model.addAttribute("rae001", sd06.getRae001());
model.addAttribute("archiveId", archivesId);
model.addAttribute("nodeId", CodeConstant.SY_JFHD_NODEID);
model.addAttribute("fondsId", fondscode);
model.addAttribute("saa200", saa200);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
}
model.addAttribute("saa004", sd051.getSaa004());//事项id
model.addAttribute("userType", userType);//区域服务id
model.addAttribute("targeturl", backUrl);//跳转url
model.addAttribute("sbb004", sbb004);
model.addAttribute("viewType", viewType);
} else {
//先查询受理单sa06a获取数据
Sa06a sa06a = sa06aService.selectById(saa036);
if (sa06a == null || "".equals(sa06a)) {
model.addAttribute("msg", "没有查询到审核所需要的受理单");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
} else {
String saa039 = sa06a.getSaa039();
JfhdDTO jfhdDTO = com.alibaba.fastjson.JSONObject.parseObject(saa039, JfhdDTO.class);
com.alibaba.fastjson.JSONObject sa06aJosn = com.alibaba.fastjson.JSONObject.parseObject(saa039);
model.addAttribute("saa036", saa036);
com.alibaba.fastjson.JSONObject json = getAb01ByAab001(datapartid, aab001);//10202000038
JSONObject result = JSONObject.fromObject(json.get("result"));
JfhdDTO jfhd = new JfhdDTO();
if ("0".equals(result.get("code"))) {
jfhdDTO.setAab001(result.getString("AAB001"));
jfhdDTO.setBaa001(result.getString("BAA001"));
jfhdDTO.setAab004(result.getString("AAB004"));
jfhdDTO.setAab003(result.getString("AAB003"));
jfhdDTO.setAab035(result.getString("AAB035"));
jfhdDTO.setAab036(result.getString("AAB036"));
jfhdDTO.setAae006(result.getString("AAE006"));
String start = DFYYYYMMM.format(sdf.parse(result.getString("BAB510")));
if (start == null || "".equals(start)) {
start = DFYYYYMMM.format(sdf.parse(result.getString("AAE036")));
}
jfhd = getjfhdss(result.getString("AAB001"), start, end, datapartid);
} else {
model.addAttribute("msg", result.get("msg"));
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("jfhd", jfhdDTO);
model.addAttribute("saa036", saa036);
model.addAttribute("userType", userType);//区域服务id
model.addAttribute("targeturl", backUrl);//跳转url
model.addAttribute("viewType", viewType);
model.addAttribute("nodeId", sa06aJosn.getString("nodeId"));
model.addAttribute("fondsId", sa06aJosn.getString("fondsId"));
model.addAttribute("rae001", sa06aJosn.getString("rae001"));
model.addAttribute("archiveId", sa06aJosn.getString("archiveId"));
model.addAttribute("sbb004", sa06aJosn.getString("sbb004"));
model.addAttribute("saa004", sa06aJosn.getString("saa004"));
model.addAttribute("saa200", sa06aJosn.getString("saa200"));
}
}
} catch (Exception e) {
e.printStackTrace();
model.addAttribute("msg", "系统异常");
model.addAttribute("backurl", backUrl);
if (CodeConstant.USER_TYPE_2.equals(userType)) {
return "/errorpageSLPT.jsp";
} else {
return "/errorpage.jsp";
}
}
return "/unemployment/syjfhd/index.jsp";
}
public JfhdDTO getjfhdss(String aab001, String start, String end, String baa001) {
JfhdDTO jfhd = new JfhdDTO();
try {
List<JfhdDTO> listall = getjfxxList(aab001, start, end, baa001);
if (listall.size() > 0) {
String aae002 = listall.get(0).getAae002();
Date date = DFYYYYMMM.parse(aae002);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 1);
String aae002_show = DFYYYYMMM.format(cal.getTime());
if (Integer.parseInt(aae002_show) > Integer.parseInt(end)) {
aae002_show = end;
}
jfhd.setAae002(aae002_show);
jfhd.setAae003(end);
} else {
String aae002_show = DFYYYY.format(new Date()) + "01";
jfhd.setAae002(aae002_show);
jfhd.setAae003(end);
}
} catch (Exception e) {
e.printStackTrace();
}
return jfhd;
}
@ApiOperation(value = "缴费信息")
@RequestMapping("/gridList")
@ResponseBody
public DataGridReturn gridFileList(String aab001, String startYM, String endYM, String saa200, String baa001) throws ParseException {
// Sd05 sd05 = sd05Service.selectById(saa200);
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = getAb01ByAab001(baa001, aab001);
GxdwjbxxDTO gxdwjbxxDTO = new GxdwjbxxDTO();
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
//将返回的json封装到类
DataGridReturn dataGridReturn = null;
if ("0".equals(jsonObject.getString("code"))) {
com.alibaba.fastjson.JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("result"));
gxdwjbxxDTO = JSON.parseObject(result.toJSONString().toLowerCase(), GxdwjbxxDTO.class);
if (gxdwjbxxDTO != null && !"null".equals(gxdwjbxxDTO)) {
//aab050单位登记时间
String aab050 = gxdwjbxxDTO.getAab050().substring(0, 4);
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String date = DFYYYY.format(new Date());
if (!"".equals(gxdwjbxxDTO.getAab050()) && !"null".equals(gxdwjbxxDTO.getAab050()) && gxdwjbxxDTO.getAab050() != null) {
if (Integer.parseInt(date) == Integer.parseInt(aab050)) {
dataGridReturn = new DataGridReturn((long) 1, list_return);
} else {
list_return = getjfxxList(aab001, startYM, endYM, baa001);
dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
}
}
}
}
return dataGridReturn;
}
@ApiOperation(value = "缴费信息")
@RequestMapping("/gridListDetail")
@ResponseBody
public DataGridReturn gridListDetail(String aab001, String startYM, String endYM, String saa200, String baa001) throws ParseException {
//Sd05 sd05 = sd05Service.selectById(saa200);
List<JfhdDTO> list_return = getjfxxList(aab001, startYM, endYM, baa001);
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
return dataGridReturn;
}
// public com.alibaba.fastjson.JSONObject getAb01ByAab001(String aab001,String baa001) {
// com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
// param.put("BAA001", baa001);//数据分区
// param.put("AAB001", aab001);//单位编号
// param.put("AAE170", SLPT);//操作人
// return RestfulUtil.getJson(param, "/loseJob/unit/basicInfoQuery.json");
// }
@ApiOperation(value = "缴费信息列表")
@RequestMapping("/jfxxList")
public String jfxxList(ModelMap model, String aab001, String aab004, String startYM, String endYM, String saa200, String baa001)
throws ParseException, UnsupportedEncodingException {
//Sd05 sd05 = sd05Service.selectById(saa200);
model.addAttribute("aab001", aab001);
model.addAttribute("aab004", URLDecoder.decode(aab004, "UTF-8"));
model.addAttribute("startYM", startYM);
model.addAttribute("endYM", endYM);
List<JfhdDTO> list_return = getjfxxList(aab001, startYM, endYM, baa001);
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("gridmapyd", JSONHelper.array2json(listyd));
return "/unemployment/syjfhd/jfxxList.jsp";
}
/**
* 获取缴费信息列表公共方法
*
* @return
*/
public List<JfhdDTO> getjfxxList(String aab001, String startYM, String endYM, String baa001) throws ParseException {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Calendar cal = Calendar.getInstance();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
// String dateString = sdf.format(cal.getTime());
// String endYM=dateString;
// if(aae002!=null&&!"".equals(aae002)){
// endYM=aae002;
// Date date = sdf.parse(aae002);//初始日期
// cal.setTime(date);
// }
// cal.add(Calendar.MONTH, -5);
// String startYM = sdf.format(cal.getTime());
// if(start!=null&&!"".equals(start)){
// startYM=aae002;
// }
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", aab001);
map.put("StartYM", startYM);
map.put("EndYM", endYM);
com.alibaba.fastjson.JSONObject jsonObject = getjfxxList(map, suser, baa001);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 获取缴费核定信息列表,当期人员异动信息,本期人员基数低于缴费下限或高于上限明细
*
* @param jfhdDTO
* @return
*/
public Map<String, List<JfhdDTO>> getreturnCheckList(JfhdDTO jfhdDTO, String code) {
Map<String, List<JfhdDTO>> maprs = new HashMap<String, List<JfhdDTO>>();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("StartYM", jfhdDTO.getStartYM());
map.put("EndYM", jfhdDTO.getEndYM());
String id = suser.getId();
//String code = sd05.getSza017();
com.alibaba.fastjson.JSONObject jsonObject = getjfhdList(map, code, id);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
JSONArray jsonArrayac88 = new JSONArray();
if ("0".equals(result.get("code"))) {
DecimalFormat df = new DecimalFormat("######0.00");
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
String aab004 = jsonArray.getJSONObject(0).get("AAB004").toString();
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (json.getString("AAB001") != null) {
json.put("AAB121", df.format(Double.parseDouble(json.getString("AAB121"))));
json.put("AAB120", df.format(Double.parseDouble(json.getString("AAB120"))));
json.put("BAB701", df.format(Double.parseDouble(json.getString("BAB701"))));
json.put("AAB122", df.format(Double.parseDouble(json.getString("AAB122"))));
json.put("BAE742", df.format(Double.parseDouble(json.getString("BAE742"))));
json.put("AAB137", df.format(Double.parseDouble(json.getString("AAB137"))));
json.put("AAB004", aab004);
jsonArraynew.add(json);
}
JSONArray jsonArrayac88temp = JSONArray.parseArray(json.getString("AC88ViewList"));
if (jsonArrayac88temp != null && jsonArrayac88temp.size() > 0) {
for (int j = 0; j < jsonArrayac88temp.size(); j++) {
com.alibaba.fastjson.JSONObject js = jsonArrayac88temp.getJSONObject(j);
js.put("AAE002", json.getString("AAE002"));
jsonArrayac88.add(js);
}
}
}
//当期缴费核定信息
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
}
//List<JfhdDTO> list_returnyd;
if (list_return.size() > 0) {
//当期人员异动信息
maprs.put("ryyd", jsonArrayac88.toJavaList(JfhdDTO.class));
maprs.put("heightprotect", new ArrayList<JfhdDTO>());
} else {
//本期人员基数低于缴费下限或高于上限明细
maprs.put("ryyd", new ArrayList<JfhdDTO>());
maprs.put("heightprotect", jsonArrayac88.toJavaList(JfhdDTO.class));
}
maprs.put("check", list_return);
//maprs.put("ryyd",list_returnyd);
return maprs;
}
@ApiOperation(value = "跳转到校核页面")
@RequestMapping("/checkpage")
@ResponseBody
public AjaxJson checkpage(JfhdDTO jfhdDTO, String saa200, String rae001, String baa001) throws UnsupportedEncodingException {
//rae001="0";
//archives="0";
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
//ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
//Sd05 sd05 = sd05Service.selectById(saa200.trim());
Map<String, List<JfhdDTO>> maprs = getreturnCheckList(jfhdDTO, baa001);
List<JfhdDTO> list_return = maprs.get("check");
List<JfhdDTO> ryyd = maprs.get("ryyd");
List<JfhdDTO> heightprotect = maprs.get("heightprotect");
AjaxJson j = new AjaxJson();
if (heightprotect.size() > 0) {
j.setSuccess(false);
j.setMsg("有缴费基数低于缴费下限或高于上限的职工不能申报缴费核定业务,请在缴费基数申报功能中修改职工缴费基数");
return j;
}
//String fail="";
//String success="";
if (list_return.size() > 0) {
String aa = "";
//Sd05 sd051=sd05Service.selectById(saa200.trim());
//String datapartid=sd051.getSza017();//琛屾斂鍖哄垝suser.getUserInfo().getUpmsOrganizations().getCode()
for (JfhdDTO js : list_return) {
aa = aa + js.getAae002() + ",";
// if("".equals(rae001)){
// //Wrapper<Sa06> wrapper06 = new EntityWrapper();
// //wrapper06.eq("SAA004",sd05.getSaa004());
// //List<Sa06> sa06=sa06Service.selectList(wrapper06);
// //Sd23 sd23=new Sd23();
// //sd23.setSza020(sa06.get(0).getSza020());
// //sd23.setSza010(datapartid);
// //sd23=sd23Service.selectOne(sd23);
// //String fondsId=sd23Service.selectOne(sd23).getSza011();
// //Map<String,String> archivesmap=new HashMap<String,String>();
// //archivesmap.put("aab001",js.getAab001());//单位编号
// //archivesmap.put("aab004",js.getAab004());//单位名称
// //archivesmap.put("fondsId",fondsId.trim());//全宗号
// //archivesmap.put("datapartId",datapartid);//行政区划
// //archivesmap.put("loginName",suser.getLoginName());//经办人登陆账号
// //archivesmap.put("id",suser.getId().toString());//经办人账号ID
// //archivesmap.put("name",suser.getName());//经办人姓名
// //Sa06 ss=new Sa06();
// //ss.setSaa004(SAA004);
// //Sa06 idsa06=sa06Service.selectOne(ss);
// //archivesmap.put("nodeId",idsa06.getSza018().trim());//模板idsa06.getSza018()
// //archivesmap.put("businessType",null);//业务类型名称
// //archives=String.valueOf(ArchivesUtil.archives(archivesmap)) ;//生成档案编号
// //long archives=Long.parseLong("89607");
// //插入数据库表sd06,sd07,sd08,修改sd05,
// Wrapper<Sa06k> wrapper = new EntityWrapper();
// wrapper.like("SAA004",SAA004);
// wrapper.like("SZZ304","1");
// List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
// Sd06 sd06 = this.saveSd06(js,suser,String.valueOf(archives));
// Sd07 sd07 = this.saveSd07(js,suser);
// String orgName = "";
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// orgName = suser.getUserInfo().getUpmsOrganizations().getOrgName();
// name = suser.getName();
// }
// Long re = medicalYdzzService.saveYdzzSbd(sd05, sd06, sd07,sa06kList,orgName,name);
// if(re!=null&&re > 0){
// rae001=String.valueOf(re);
// //success=success+js.getAae002()+",";
// }else {
// fail=js.getAae002()+",";
// //break;
// }
// }else{
// Sd07 sd07 = this.saveSd07(js,suser);
// sd07.setRae001(Long.parseLong(rae001));
// String rae002 = sequenceService.selectSequence("SD07");
// sd07.setRae002(Long.parseLong(rae002));
// Integer re = sd07Service.insert(sd07);
// if(re!=null&&re > 0){
// //success=success+js.getAae002()+",";
// }else {
// fail=js.getAae002()+",";
// //break;
// }
// }
}
aa = aa.substring(0, aa.length() - 1);
// if(!"".equals(fail)){
// fail=fail.substring(0,fail.length()-1);
// j.setSuccess(true);
// j.setMsg("费款所属期"+aa+"生成单位缴费核定业务数据成功,但其中费款所属期"+fail+"流程记录失败");
// }else{
// j.setSuccess(true);
// j.setMsg("费款所属期"+aa+"生成单位缴费核定业务数据成功");
// }
j.setSuccess(true);
j.setMsg("费款所属期" + aa + "生成单位缴费核定业务数据成功");
Map<String, Object> map = new HashMap<String, Object>();
map.put("rae001", rae001);
//map.put("archives",archives);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
List listyd = new ArrayList();
for (int y = 0; y < ryyd.size(); y++) {
JfhdDTO js = ryyd.get(y);
List bac720 = CodeCacheUtils.getCodeList("SYE_AAC050");
for (int i = 0; i < bac720.size(); i++) {
JSONObject jsonObject = JSONObject.fromObject(bac720.get(i));
if (js.getBac720().equals(jsonObject.getString("value"))) {
js.setAac050(jsonObject.getString("value"));
js.setBac720(jsonObject.getString("name"));
break;
}
}
listyd.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("gridmap", JSONHelper.array2json(list));
jsonObject.put("gridmapyd", JSONHelper.array2json(listyd));
j.setObj(jsonObject);
j.setAttributes(map);
} else {
j.setSuccess(false);
j.setMsg("生成单位缴费核定业务数据失败,请到失业保险中心查询相关信息");
}
// List list=new ArrayList();
// for (JfhdDTO js:list_return
// ) {
// list.add(transBean2Map(js));
// }
// List listyd=new ArrayList();
// for (JfhdDTO js:maprs.get("ryyd")
// ) {
// listyd.add(transBean2Map(js));
// }
// List heightprotect2=new ArrayList();
// for (JfhdDTO js:maprs.get("heightprotect")
// ) {
// heightprotect2.add(transBean2Map(js));
// }
// model.addAttribute("gridmap", JSONHelper.array2json(list));
// model.addAttribute("gridmapyd", JSONHelper.array2json(listyd));
// model.addAttribute("gridmapsxx", JSONHelper.array2json(heightprotect2));
// model.addAttribute("aab001",jfhdDTO.getAab001());
// model.addAttribute("aab004", jfhdDTO.getAab004());
// model.addAttribute("aae002",jfhdDTO.getAae002());
return j;
}
private ValueFilter filter = new ValueFilter() {
@Override
public Object process(Object obj, String s, Object v) {
if (v == null)
return "";
return v;
}
};
public JfhdDTO transNull(JfhdDTO js) {
String str = JSON.toJSONString(js, filter);
return JSON.parseObject(str, JfhdDTO.class);
}
/**
* 对象转map
*
* @param obj
* @return
*/
public Map<String, Object> transBean2Map(Object obj) {
if (obj == null) {
return null;
}
Map<String, Object> map = new HashMap<String, Object>();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
// 过滤class属性
if (!key.equals("class")) {
// 得到property对应的getter方法
Method getter = property.getReadMethod();
Object value = getter.invoke(obj);
map.put(key, value);
}
}
} catch (Exception e) {
System.out.println("transBean2Map Error " + e);
}
return map;
}
@ApiOperation(value = "人员异动详细信息页面跳转")
@RequestMapping("/yddetail")
public String yddetail(ModelMap model, JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
model.addAttribute("aae002", jfhdDTO.getAae002());
model.addAttribute("aab001", jfhdDTO.getAab001());
model.addAttribute("baa001", jfhdDTO.getBaa001());
model.addAttribute("aac050", jfhdDTO.getAac050());
if (jfhdDTO.getAab004() == null || "".equals(jfhdDTO.getAab004())) {
model.addAttribute("aab004", "");
} else {
model.addAttribute("aab004", URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
}
model.addAttribute("bac720", jfhdDTO.getBac720());
return "/unemployment/syjfhd/yddetail.jsp";
}
@ApiOperation(value = "缴费工资申报页面跳转")
@RequestMapping("/gzsb")
public String gzsb(ModelMap model, JfhdDTO jfhdDTO, String saa200, String rae001, String archiveId, String sbb004, String saa004) throws UnsupportedEncodingException {
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
// Sd05 sd051=sd05Service.selectById(saa200.trim());
//// String datapartid=sd051.getSza017();
//// if("610221".equals(datapartid)){
//// datapartid="610204";
//// }
//// Wrapper<Sa06> wrapper06 = new EntityWrapper();
//// wrapper06.eq("SAA004",SAA004);
//// List<Sa06> sa06=sa06Service.selectList(wrapper06);
//// Sd23 sd23=new Sd23();
//// sd23.setSza020(sa06.get(0).getSza020());
//// sd23.setSza010(datapartid);
//// sd23=sd23Service.selectOne(sd23);
//// String fondsId=sd23Service.selectOne(sd23).getSza011();
// Map<String,String> archivesmap=new HashMap<String,String>();
// archivesmap.put("aab001",jfhdDTO.getAab001());//单位编号
// archivesmap.put("aab004",jfhdDTO.getAab004());//单位名称
// archivesmap.put("fondsId", CodeConstant.ARCHIVES_QZ_SY.get(jfhdDTO.getBaa001()));//全宗号
// archivesmap.put("datapartId",jfhdDTO.getBaa001());//行政区划
// archivesmap.put("loginName",suser.getLoginName());//经办人登陆账号
// archivesmap.put("id",suser.getId());//经办人账号ID
// archivesmap.put("name",suser.getName());//经办人姓名
//// Sa06 ss=new Sa06();
//// ss.setSaa004(SAA004);
//// Sa06 idsa06=sa06Service.selectOne(ss);
// archivesmap.put("nodeId",CodeConstant.SY_JFHD_NODEID);//模板idsa06.getSza018()
// archivesmap.put("businessType",null);//业务类型名称
// String archives=String.valueOf(ArchivesUtil.archives(archivesmap)) ;//生成档案编号
//
// Wrapper<Sa06k> wrapper = new EntityWrapper();
// wrapper.like("SAA004",SAA004);
// wrapper.like("SZZ304","1");
// List<Sa06k> sa06kList = sa06kService.selectList(wrapper);
// //Sd05 sd05 = new Sd05();
// //sd05.setSaa200(Long.parseLong(saa200.trim()));
// Sd06 sd06 = this.saveSd06(jfhdDTO,suser,String.valueOf(archives));
// Sd07 sd07 = this.saveSd07(jfhdDTO,suser);
// String orgName = "";
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// orgName = suser.getUserInfo().getUpmsOrganizations().getOrgName();
// name = suser.getName();
// }
// Long re = medicalYdzzService.saveYdzzSbd(sd051, sd06, sd07,sa06kList,orgName,name);
// if(re!=null&&re > 0){
// model.addAttribute("gzsb_rae001",rae001);
// model.addAttribute("gzsb_archivesId",archiveId);
// }else{
// model.addAttribute("gzsb_rae001","");
// model.addAttribute("gzsb_archivesId","");
// }
jfhdDTO.setAac002("");
jfhdDTO.setAac003("");
model.addAttribute("gzsbform", jfhdDTO);
// model.addAttribute("gzsb_aac003","");
model.addAttribute("gzsb_rae001", rae001);
model.addAttribute("gzsb_archivesId", archiveId);
model.addAttribute("gzsb_saa200", saa200);
model.addAttribute("gzsb_sbb004", sbb004);
model.addAttribute("gzsb_saa004", saa004);
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(jfhdDTO.getBaa001());
if ("610221".equals(jfhdDTO.getBaa001())) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
model.addAttribute("gzsb_fondsId", fondscode);
model.addAttribute("gzsb_aab001", jfhdDTO.getAab001());
model.addAttribute("gzsb_baa001", jfhdDTO.getBaa001());
model.addAttribute("gzsb_aab004", jfhdDTO.getAab004());
List<JfhdDTO> list = gzsbList(jfhdDTO);
float sp = Float.parseFloat("0");
if (list.size() > 0) {
sp = Float.parseFloat(list.get(0).getBac504().trim());
}
double xx = getTwoDecimal(sp * 0.6);
double sx = getTwoDecimal(sp * 3);
DateFormat df = new SimpleDateFormat("yyyy");
model.addAttribute("gzsb_aae030", df.format(new Date()));
model.addAttribute("gzsb_bac504", sp);
model.addAttribute("gzsb_bac504_x", xx);
model.addAttribute("gzsb_bac504_s", sx);
List listyd = new ArrayList();
for (JfhdDTO js : list) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("gzsbList", JSONHelper.array2json(listyd));
model.addAttribute("gzsb_bac504_js", "0");
return "/unemployment/syjfhd/gzsb.jsp";
}
@ApiOperation(value = "根据单位编号查询单位工资列表")
@RequestMapping(value = "/getgzsbList")
@ResponseBody
public String getgzsbList(String aab001, String baa001, String aac002, String aac003) {
List listyd = new ArrayList();
try {
JfhdDTO jfhdDTO = new JfhdDTO();
jfhdDTO.setAab001(aab001);
jfhdDTO.setBaa001(baa001);
jfhdDTO.setAac002(aac002);
List<JfhdDTO> list = gzsbList(jfhdDTO);
for (JfhdDTO js : list) {
listyd.add(transBean2Map(transNull(js)));
}
} catch (Exception e) {
e.printStackTrace();
}
DataGridReturn dataGridReturn = new DataGridReturn((long) listyd.size(), listyd);
return JSONHelper.array2json(listyd);
}
public long createArchives(String datapartid, JfhdDTO syRyxcbDto, ShiroUser suser) {
if ("610221".equals(datapartid)) {
datapartid = "610204";
}
Map<String, String> archivesmap = new HashMap<String, String>();
archivesmap.put("aab001", syRyxcbDto.getAab001());//单位编号
archivesmap.put("aab004", syRyxcbDto.getAab004());//单位名称
//archivesmap.put("aac002",syRyxcbDto.getAac002());//身份证
//archivesmap.put("aac003",syRyxcbDto.getAac003());//姓名
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(datapartid);
if ("610221".equals(datapartid)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
archivesmap.put("fondsId", fondscode);//全宗号
archivesmap.put("datapartId", datapartid);//行政区划
archivesmap.put("loginName", suser.getLoginName());//经办人登陆账号
archivesmap.put("id", suser.getId());//经办人账号ID
archivesmap.put("name", suser.getName());//经办人姓名
archivesmap.put("nodeId", CodeConstant.SY_JFHD_NODEID);//模板idsa06.getSza018()"1377"
archivesmap.put("businessType", null);//业务类型名称
long archives = ArchivesUtil.archives(archivesmap);//生成档案编号
return archives;
}
private double getTwoDecimal(double num) {
DecimalFormat dFormat = new DecimalFormat("#.00");
String yearString = dFormat.format(num);
Double temp = Double.valueOf(yearString);
return temp;
}
@ApiOperation(value = "单位工资申报列表查询")
@RequestMapping("/gzsbList")
@ResponseBody
public List<JfhdDTO> gzsbList(JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
List<PostParam> params = new ArrayList<PostParam>();
// ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
if (jfhdDTO.getAac002() != null && !"".equals(jfhdDTO.getAac002())) {
param.put("AAC002", jfhdDTO.getAac002());//身份证
}
if (jfhdDTO.getAac003() != null && !"".equals(jfhdDTO.getAac003())) {
param.put("AAC003", jfhdDTO.getAac003());//身份证
}
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject rs = PostHelper.send("/loseJob/person/baseInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(rs.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
// List listyd=new ArrayList();
// for (JfhdDTO js:list_return
// ) {
// listyd.add(transBean2Map(js));
// }
// JSONObject jsonObject=new JSONObject();
// String js=JSONHelper.array2json(listyd);
// jsonObject.put("gridmap", JSONHelper.array2json(listyd));
// return "/unemployment/syjfhd/jfhddetail.jsp";
}
@ApiOperation(value = "缴费核定详细信息页面跳转")
@RequestMapping("/jfhddetail")
public String jfhddetail(ModelMap model, JfhdDTO jfhdDTO) throws UnsupportedEncodingException {
model.addAttribute("jfhddetail_aae002", jfhdDTO.getAae002());
model.addAttribute("jfhddetail_aab001", jfhdDTO.getAab001());
model.addAttribute("jfhddetail_baa001", jfhdDTO.getBaa001());
model.addAttribute("jfhddetail_aab004", URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
model.addAttribute("jfhddetail_baa005", jfhdDTO.getBaa005());
return "/unemployment/syjfhd/jfhddetail.jsp";
}
@ApiOperation(value = "人员异动信息列表")
@RequestMapping("/gridYddetailList")
@ResponseBody
public DataGridReturn gridYddetailList(JfhdDTO jfhdDTO) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAC050", jfhdDTO.getAac050());//查询人员增减明细信息
param.put("BAC809", 1);//页码
param.put("BAC808", 1000);//每页记录数
param.put("AAE035", jfhdDTO.getAae002());//缴费类型
param.put("AAE002", jfhdDTO.getAae002());//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject json = PostHelper.send("/loseJob/person/insuredInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(json.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
List<JfhdDTO> list_returnnew = new ArrayList<JfhdDTO>();
for (int y = 0; y < list_return.size(); y++) {
JfhdDTO js = list_return.get(y);
List bac720 = CodeCacheUtils.getCodeList("SYE_AAC050");
for (int i = 0; i < bac720.size(); i++) {
JSONObject jsonObject = JSONObject.fromObject(bac720.get(i));
if (js.getAac050().equals(jsonObject.getString("value"))) {
js.setAac050(jsonObject.getString("name"));
break;
}
}
js.setAae002(list_return.get(y).getAae002());
list_returnnew.add(js);
}
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_returnnew);
return dataGridReturn;
}
@ApiOperation(value = "缴费核定详细信息列表")
@RequestMapping("/gridCheckList")
@ResponseBody
public DataGridReturn gridCheckList(JfhdDTO jfhdDTO) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("AAE002", jfhdDTO.getAae002());
map.put("BAA005", jfhdDTO.getBaa005());
com.alibaba.fastjson.JSONObject json = getjfmx(map, jfhdDTO.getBaa001());
JSONObject result = JSONObject.fromObject(json.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
DataGridReturn dataGridReturn = new DataGridReturn((long) list_return.size(), list_return);
return dataGridReturn;
}
// @ApiOperation(value = "人员异动列表")
// @RequestMapping("/gridRyydList")
// @ResponseBody
// public DataGridReturn gridRyydList(JfhdDTO jfhdDTO,String saa200){
// Sd05 sd05 = sd05Service.selectById(saa200.trim());
// Map<String ,List<JfhdDTO>> maprs=getreturnCheckList(jfhdDTO,sd05);
// List<JfhdDTO> list_return= maprs.get("ryyd");
// DataGridReturn dataGridReturn =new DataGridReturn((long)list_return.size(), list_return);
// return dataGridReturn;
// }
// @ApiOperation(value = "本期人员基数低于缴费下限或高于上限")
// @RequestMapping("/gridsxList")
// @ResponseBody
// public DataGridReturn gridsxList(JfhdDTO jfhdDTO,String saa200){
// Sd05 sd05 = sd05Service.selectById(saa200.trim());
// Map<String ,List<JfhdDTO>> maprs=getreturnCheckList(jfhdDTO,sd05);
// List<JfhdDTO> list_return= maprs.get("heightprotect");
// DataGridReturn dataGridReturn =new DataGridReturn((long)list_return.size(), list_return);
// return dataGridReturn;
// }
@ApiOperation(value = "缴费核定提交审核")
@RequestMapping("/submit")
@ResponseBody
public AjaxJson getSubmit(String saa200, String rae001, String data, String saa004) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
try {
//net.sf.json.JSONArray json= net.sf.json.JSONArray.fromObject(list);
List<JfhdDTO> jsonArray = JSONArray.parseArray(data, JfhdDTO.class);
// Sd07 sd07=new Sd07();
// sd07.setRae001(Long.parseLong(rae001));
// Wrapper<Sd07> wrapper07 = new EntityWrapper();
// wrapper07.eq("RAE001",Long.parseLong(rae001));
// wrapper07.eq("SAA210","1");
// List<Sd07> lsd07=sd07Service.selectList(wrapper07);
//判断提交人员是否有未办结的业务
// String aae002str="";
// for(Sd07 ss:lsd07){
// JfhdDTO wbjss= JSON.parseObject(ss.getRae003(),JfhdDTO.class);
// Wrapper<Sa06a> wrappersa06a = new EntityWrapper();
// wrappersa06a.eq("SAA004",SAA004);//事项id
// wrappersa06a.eq("AAC044",wbjss.getAab001()+"_"+wbjss.getAae002());//申请人证件号
// wrappersa06a.ne("SAA043","3");//办理状态
// List<Sa06a> sa06aList=sa06aService.selectList(wrappersa06a);
// if(sa06aList.size()>0){
// aae002str=aae002str+wbjss.getAae002()+",";
// }
// }
//JfhdDTO wbj= JSON.parseObject(sd071.getRae003(),JfhdDTO.class);
// if(aae002str.length()>0){
// aae002str=aae002str.substring(0,aae002str.length()-1);
// j.setMsg("费款所属期"+aae002str+"有未办结的此项业务!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费核定:{}","费款所属期"+aae002str+"有未办结的此项业务!!!");
// return j;
// }
//检查电子档案是否已上传完成
// String strdzda="";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001",rae001);
// wrapper.eq("SAA104","1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m=0;m<sd08List.size();m++){
// String saa213 = sd08List.get(m).getSaa213();
// if("0".equals(saa213)){
// strdzda= strdzda+","+sd08List.get(m).getSaa017();
// }
// }
// if(!"".equals(strdzda)){
// strdzda=strdzda.substring(1,strdzda.length());
// j.setMsg(strdzda+"电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费核定:{}",strdzda+"电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
//提交核心库
String success = "";
String fail = "";
// Sd05 sd05 = sd05Service.selectById(saa200);
// sd05.setRae001(rae001);
for (JfhdDTO wbjhx : jsonArray) {
//JfhdDTO wbjhx= JSON.parseObject(hx.getRae003(),JfhdDTO.class);
String sa06aId = sequenceService.selectSequence("SA06A");
// String name = "";
// if(!"2".equals(suser.getUserType())){
// name=suser.getLoginName();
// }else {
// name = suser.getName();
// }
// Sa06a sa06a=saveSa06a(wbjhx, suser,wbjhx.getAab001()+"_"+wbjhx.getAae002());
// sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId.trim()));
// Sd11 sd11 =sd11Bean(rae001,name,sd05.getSza017(),sa06aId);
// //修改申请状态
// Sd06 sd06 = sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd05.setSaa204("4");
// boolean flag=sybxdyshService.submitSybxdjsh(sa06a, sd05, sd06, sd11);
// if(flag) {
com.alibaba.fastjson.JSONObject rs = saveUnemployedInfo(rae001, wbjhx, suser, saa004, sa06aId);
JSONObject result = JSONObject.fromObject(rs.get("result"));
if ("0".equals(result.getString("code"))) {//提交核心成功
success = success + wbjhx.getAae002() + ",";
// hx.setSaa210("2");
// sd07Service.updateById(hx);
} else {//提交核心失败
fail = fail + wbjhx.getAae002() + ",";
}
// }else{
// //插入提交失败信息
// sd06.setSaa210("1");
// sd06.setSaa503("插入受理平台表失败");
// sd06Service.updateById(sd06);
// j.setMsg("失业人员丧葬补助金和抚恤金审核提交失败,失败原因:插入受理平台表失败");
// j.setSuccess(false);
// }
}
if (!"".equals(success)) {
if (!"".equals(fail)) {
success = success.substring(0, success.length() - 1);
fail = fail.substring(0, fail.length() - 1);
j.setMsg("费款所属期" + success + "单位缴费核定提交成功,费款所属期" + fail + "单位缴费核定提交失败");
j.setSuccess(false);
Map<String, Object> map = new HashMap<String, Object>();
map.put("fail", fail);
j.setAttributes(map);
} else {
j.setMsg("费款所属期" + success + "单位缴费核定提交成功");
j.setSuccess(true);
//修改申请状态
// Sd06 sd06=sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd06Service.updateById(sd06);
}
} else {
if (!"".equals(fail)) {
fail = fail.substring(0, fail.length() - 1);
j.setMsg("费款所属期" + fail + "单位缴费核定提交失败");
j.setSuccess(false);
} else {
j.setMsg("所选费款所属期内无单位缴费核定信息");
j.setSuccess(false);
}
}
// String sa06aId= sequenceService.selectSequence("SA06A");
// com.alibaba.fastjson.JSONObject rs = saveUnemployedInfo(rae001,wbj,suser,sa06aId);//缴费核定
// JSONObject result = JSONObject.fromObject(rs.get("result"));
//if ("0".equals(result.getString("code"))) {//单位缴费核定提交核心成功
//com.alibaba.fastjson.JSONObject zjplan= this.getzjPlan(wbj.getBaa001(),wbj.getAab001(),"SLPT"+suser.getId(),wbj.getAae002());
// List<JfhdDTO> zjplan= this.getzjPlan(wbj.getBaa001(),wbj.getAab001(),"SLPT"+suser.getId(),wbj.getAae002());//征集计划查询
// //String sa06aId1= sequenceService.selectSequence("SA06A");
// wbj.setBaa005(zjplan.get(0).getBaa005());
// com.alibaba.fastjson.JSONObject zJplanInfo = saveZJplanInfo(rae001,wbj,suser,sa06aId1);//征集计划提交
// JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
// if ("0".equals(zJplanInforesult.getString("code"))) {
// //插入受理单表
// Sa06a sa06a=saveSa06a(wbj, suser);
// sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId1));
// Integer re = sa06aService.insert(sa06a);
//
// //修改申请状态
// Sd06 sd06=sd06Service.selectById(rae001);
// sd06.setSaa210("2");
// sd06Service.updateById(sd06);
// j.setMsg("失业保险单位缴费核定提交成功,失业保险单位征集计划提交成功");
// j.setSuccess(true);
// }else{
//
// j.setMsg("失业保险单位缴费核定提交成功,失业保险单位征集计划提交失败");
// j.setSuccess(true);
// }
} catch (Exception e) {
e.printStackTrace();
j.setMsg("失业保险单位缴费核定提交失败");
j.setSuccess(false);
_log.error("失业保险单位缴费核定提交失败", e.getMessage(), e);
}
return j;
}
/*--------------------------------------------------------------------------*/
@ApiOperation(value = "征集计划提交审核")
@RequestMapping("/zjplan")
@ResponseBody
public AjaxJson zjplan(String data, String data1, JfhdDTO jfhdDTO, String rae001) {
AjaxJson j = new AjaxJson();
List<JfhdDTO> zjplan = JSONArray.parseArray(data, JfhdDTO.class);
List<JfhdDTO> zjplan1 = JSONArray.parseArray(data1, JfhdDTO.class);
//ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
String sa06aId = sequenceService.selectSequence("SA06A");
Collections.sort(zjplan, new Comparator<JfhdDTO>() {
@Override
public int compare(JfhdDTO o1, JfhdDTO o2) {
int i = Integer.valueOf(o1.getAae002()) - Integer.valueOf(o2.getAae002());
if (i == 0) {
return Integer.valueOf(o1.getAae002()) - Integer.valueOf(o2.getAae002());
}
return i;
}
});
try {
jfhdDTO.setAab004(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));
if (zjplan.size() <= 0) {
j.setMsg("费款所属期内未查询到可操作的征集计划");
j.setSuccess(false);
return j;
}
// List<String> list=this.getbetweentimes(jfhdDTO.getStartYM(),jfhdDTO.getEndYM());
// String fail="";
// for (String month:list){
// boolean flag=false;
// for(JfhdDTO jfhdDTO1:zjplan){
// if(jfhdDTO1.getStartYM().equals(month)){
// flag=true;
// break;
// }
// }
// if(!flag){
// fail=fail+month+",";
// }
// }
// if(!"".equals(fail)){
// fail=fail.substring(0,fail.length()-1);
// j.setMsg("费款所属期"+fail+"未完成缴费核定业务,请确认缴费核定完成后再做征集计划");
// j.setSuccess(false);
// return j;
// }
String baa005 = "";
for (JfhdDTO jfhdDTO1 : zjplan) {
baa005 = baa005 + "'" + jfhdDTO1.getBaa005() + "',";
}
String bae718 = "";
for (JfhdDTO jfhdDTO1 : zjplan1) {
bae718 = bae718 + "'" + jfhdDTO1.getBae718() + "',";
}
if (bae718 != null && !"".equals(bae718))
jfhdDTO.setBae715(bae718.substring(0, bae718.length() - 1));
jfhdDTO.setBaa005(baa005.substring(0, baa005.length() - 1));
jfhdDTO.setAab120(zjplan.get(0).getAab120());
jfhdDTO.setAab122(zjplan.get(0).getAab122());
jfhdDTO.setAab121(zjplan.get(0).getAab121());
jfhdDTO.setAab137(zjplan.get(0).getAab137());
jfhdDTO.setBab701(zjplan.get(0).getBab701());
jfhdDTO.setBae742(zjplan.get(0).getBae742());
jfhdDTO.setStartYM(zjplan.get(0).getAae002());
jfhdDTO.setEndYM(zjplan.get(zjplan.size() - 1).getAae002());
com.alibaba.fastjson.JSONObject zJplanInfo = saveZJplanInfo(rae001, jfhdDTO, sa06aId);//征集计划提交
JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
if ("0".equals(zJplanInforesult.getString("code"))) {
j.setMsg("失业保险单位征集计划提交成功");
j.setSuccess(true);
//创建单据信息反馈保存对象 调用SavePrintInfo方法保存dj04
Dj04 dj04 = new Dj04();
dj04.setDj02id("1001");//单据类型ID
dj04.setBaa001(jfhdDTO.getBaa001());//行政区划
dj04.setBae702("1");//申请主体类型(1单位,2个人,3家庭,5社区,6学校)
dj04.setAac043(jfhdDTO.getAab001());//申请主体编号
dj04.setAac044(jfhdDTO.getAab003());//申请主体证件号码
dj04.setSaa037(URLDecoder.decode(jfhdDTO.getAab004(), "UTF-8"));//申请主体名称
ShiroUser shiroUser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
dj04.setAae011(shiroUser.getName());//经办人
dj04.setAae036( CommonUtility.get19BitCurTimeAPP());//生成日期
dj04.setAae140(CodeConstant.AAE140_2);
// com.alibaba.fastjson.JSONObject jsonObject = zjjjRemoveList(zjplan.get(0).getAae002(), zjplan.get(zjplan.size() - 1).getAae002(), jfhdDTO.getAab001(),jfhdDTO.getBaa001());
// JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
// if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(zJplanInforesult.getString("LIST"));
if (jsonArray.size() > 0) {
for(int i = 0 ; i < jsonArray.size() ; i++){
com.alibaba.fastjson.JSONObject jsonObject1 = jsonArray.getJSONObject(i);
//获取征集计划流水号
String aae063 = jsonObject1.getString("AAE063");
//判断是否存在
Dj04 d = new Dj04();
d.setDj041(aae063);
d = dj04Service.selectOne(d);
if(null==d){
dj04.setDj04id(sequenceService.selectSequence("DJ04"));
dj04.setDj041(aae063);//业务单据编号 在这相当于征集计划流水号
dj04Service.insert(dj04);
}
}
}
// }
//插入受理单表
//Sa06a sa06a=saveSa06a(jfhdDTO, suser,jfhdDTO.getAab001()+"_"+jfhdDTO.getStartYM()+"_"+jfhdDTO.getEndYM());
//sa06a.setRae001(rae001);
// sa06a.setSaa036(Long.parseLong(sa06aId));
// Integer re = sa06aService.insert(sa06a);
} else {
j.setMsg("失业保险单位征集计划提交失败,失败原因:" + zJplanInforesult.getString("msg"));
j.setSuccess(false);
}
} catch (Exception e) {
j.setMsg("失业保险单位征集计划提交失败");
j.setSuccess(false);
_log.error("失业保险单位征集计划提交失败", e.getMessage(), e);
}
return j;
}
@ApiOperation(value = "缴费工资申报提交审核")
@RequestMapping("/gssb_submit")
@ResponseBody
public AjaxJson gssb_submit(String list, String rae001, String saa004, String saa200, String archivesId, String sbb004) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
//String sa06aId= sequenceService.selectSequence("SA06A");
net.sf.json.JSONArray json = net.sf.json.JSONArray.fromObject(list);
try {
List<JfhdDTO> list1 = new ArrayList<JfhdDTO>();
for (int i = 0; i < json.size(); i++) {
JSONObject jsonObject = json.getJSONObject(i);
JfhdDTO jfhdDTO = JSON.parseObject(jsonObject.toString(), JfhdDTO.class);
list1.add(jfhdDTO);
}
String baa001 = list1.get(0).getBaa001();
//检查电子档案是否已上传完成
j = commonService.dzdaOnOrOff(suser.getId(), suser.getUserType(), rae001);//电子档案开关控制以及判断材料是否上传
if (!j.isSuccess()) {
return j;
}
// if("2".equals(suser.getUserType())) {//线下才加开关
// Sz19 sz19 = new Sz19();
// sz19.setUserId(Long.valueOf(suser.getId()));
// sz19 = sz19Service.selectOne(sz19);//线上ID是加密的但sz19id是number类型
// if ("1".equals(sz19.getAaa042())) {//1为开启电子档案
// String strdzda = "";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001", rae001);
// wrapper.eq("SAA104", "1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m = 0; m < sd08List.size(); m++) {
// String saa213 = sd08List.get(m).getSaa213();
// if ("0".equals(saa213)) {
// strdzda = strdzda + "," + sd08List.get(m).getSaa017();
// }
// }
// if (!"".equals(strdzda)) {
// strdzda = strdzda.substring(1, strdzda.length());
// j.setMsg(strdzda + "电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费基数申报:{}", strdzda + "电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
// }
// }else {
// String strdzda = "";
// Wrapper<Sd08> wrapper = new EntityWrapper();
// wrapper.eq("RAE001", rae001);
// wrapper.eq("SAA104", "1");
// List<Sd08> sd08List = sd08Service.selectList(wrapper);
// for (int m = 0; m < sd08List.size(); m++) {
// String saa213 = sd08List.get(m).getSaa213();
// if ("0".equals(saa213)) {
// strdzda = strdzda + "," + sd08List.get(m).getSaa017();
// }
// }
// if (!"".equals(strdzda)) {
// strdzda = strdzda.substring(1, strdzda.length());
// j.setMsg(strdzda + "电子档案资料未上传,请补齐档案资料后再提交!!!");
// j.setSuccess(false);
// _log.info("失业保险单位缴费基数申报:{}", strdzda + "电子档案资料不足,请补齐档案资料后再提交!!!");
// return j;
// }
// }
Sa06a sa06a = new Sa06a();
sa06a.setRae001(rae001);
sa06a = sa06aService.selectOne(sa06a);
if (!CodeConstant.SAA043_2.equals(sa06a.getSaa043())) {
j.setSuccess(false);
j.setMsg("该笔业务已经受理,请查看后续进度");
return j;
}
com.alibaba.fastjson.JSONObject zJplanInfo = savejssbInfo(String.valueOf(sa06a.getSaa036()), list1, suser, sa06a.getSaa036().toString());//缴费基数申报提交
JSONObject zJplanInforesult = JSONObject.fromObject(zJplanInfo.get("result"));
String saa043 = StaticCodeUtil.getOfLineSAA043(saa004);
if ("0".equals(zJplanInforesult.getString("code"))) {
j.setMsg("失业保险单位缴费基数申报提交成功");
j.setSuccess(true);
//插入受理单表
//Sa06a sa06a=saveSa06a(list1.get(0), suser,"jssb_"+list1.get(0).getAab001()+"_"+list1.get(0).getAae030()+"01");
//sa06a.setRae001(rae001);
JfhdDTO jfhdDTO = com.alibaba.fastjson.JSONObject.parseObject(sa06a.getSaa039(), JfhdDTO.class);
com.alibaba.fastjson.JSONObject formInfo = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));
formInfo.put("saa200", saa200);
formInfo.put("saa004", saa004);
formInfo.put("archiveId", String.valueOf(archivesId));
String fondscode = CodeConstant.ARCHIVES_QZ_SY.get(baa001);
if ("610221".equals(baa001)) {
fondscode = CodeConstant.ARCHIVES_QZ_SY.get("610204");
}
formInfo.put("fondsId", fondscode);
formInfo.put("nodeId", CodeConstant.SY_JFHD_NODEID);
formInfo.put("sbb004", sbb004);
formInfo.put("rae001", rae001);
formInfo.put("data", list);
sa06a.setSaa043(saa043);
sa06a.setSaa042(CodeConstant.SAA042_2);
if (CodeConstant.SAA043_5.equals(saa043)) {
sa06a.setSaa211(CodeConstant.SAA211_2);
}
sa06a.setSaa041(CommonUtility.get19BitCurTimeAPP());
sa06a.setSaa039(formInfo.toJSONString());
Integer i = sa06aService.updateById(sa06a);
if (i > 0) {
commonService.saveSd11Info(rae001, String.valueOf(sa06a.getSaa036()), sa06a.getSaa043(), CodeConstant.RAE013_SD11_1, "");
j.setSuccess(true);
j.setMsg("提交成功");
} else {
j.setSuccess(false);
j.setMsg("提交失败:受理单状态更新失败");
}
} else {
j.setMsg("失业保险单位缴费基数申报提交失败,失败原因:" + zJplanInforesult.getString("msg"));
j.setSuccess(false);
}
} catch (Exception e) {
e.printStackTrace();
j.setMsg("失业保险单位征缴费基数申报提交失败");
j.setSuccess(false);
_log.error("失业保险单位缴费基数申报提交失败", e.getMessage(), e);
}
return j;
}
/**
* 单位缴费核定确认提交核心库
*/
public com.alibaba.fastjson.JSONObject saveUnemployedInfo(String rae001, JfhdDTO jfhdDTO, ShiroUser suser, String saa004, String sa06aId) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", CodeConstant.SY_GG_AAE140);//险种
param.put("AAE143", CodeConstant.SY_JFHD_JFHD_AAE143);//缴费记录类型
param.put("SAA036", sa06aId);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("SAA015", CodeConstant.SY_JFHD_JFHD_SAA015);//功能id
param.put("SAA004", saa004);//事项id
param.put("AAB034", jfhdDTO.getBaa001());//经办机构编码
param.put("BAE702", CodeConstant.SY_JFHD_JFHD_BAE702);//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("SAA043", CodeConstant.SAA043_3);//业务状态
param.put("SZZ003", jfhdDTO.getBaa001());//服务机构ID
param.put("BAA005", jfhdDTO.getBaa005());//审核编号
param.put("AAE002", jfhdDTO.getAae002());//费款所属期
param.put("AAE003", jfhdDTO.getAae003());//对应费款所属期
param.put("AAB004", jfhdDTO.getAab004());//单位名称
param.put("AAB083", jfhdDTO.getAab083());//在职人数
param.put("AAB121", jfhdDTO.getAab121());//单位基数总额
param.put("AAB120", jfhdDTO.getAab120());//个人基数总额
param.put("BAB701", jfhdDTO.getBab701());//个人应缴额
param.put("AAB122", jfhdDTO.getAab122());//单位应缴额
param.put("AAB137", jfhdDTO.getAab137());//合计金额
param.put("BAB706", jfhdDTO.getBab706());//应收核定类别
param.put("AAB019", jfhdDTO.getAab019());//单位类型
param.put("AAB020", jfhdDTO.getAab020());//经济类型
param.put("AAB021", jfhdDTO.getAab021());//隶属关系
param.put("AAB022", jfhdDTO.getAab022());//行业代码
param.put("AAB082", jfhdDTO.getAab082());//离退休(职)人次
param.put("BAC701", jfhdDTO.getBac701());//本期个人应缴划入统筹金额
param.put("BAC702", jfhdDTO.getBac702());//本期个人应缴划入帐户金额
param.put("BAC703", jfhdDTO.getBac703());//审核时个人缴费部分应补帐户利息
param.put("BAC704", jfhdDTO.getBac704());//审核时个人缴费部分应补统筹利息
param.put("AAB123", jfhdDTO.getAab123());//本期单位缴费应划入个人帐户金额
param.put("AAB124", jfhdDTO.getAab124());//本期单位缴费应划入统筹金额
param.put("BAB702", jfhdDTO.getBab702());//审核时单位缴费应划入个人帐户部分应补利息
param.put("BAB703", jfhdDTO.getBab703());//审核时单位缴费划入统筹金利息
param.put("BAB705", jfhdDTO.getBab705());//核销个人应缴划入帐户金额
param.put("BAB706", jfhdDTO.getBab706());//核销个人应缴划入统筹金额
param.put("AAD003", jfhdDTO.getAad003());//核销单位欠缴应划入帐户金额
param.put("AAD004", jfhdDTO.getAad004());//核销单位欠缴统筹金额
param.put("BAC707", jfhdDTO.getBac707());//核销个人帐户做实金额
param.put("BAC708", jfhdDTO.getBac708());//本期个人帐户做实金额
param.put("BAC709", jfhdDTO.getBac709());//核销在职人数
param.put("BAC710", jfhdDTO.getBac710());//核销离退休(职)人数
param.put("BAC711", jfhdDTO.getBac711());//征集时个人缴费部分应补帐户利息
param.put("BAC712", jfhdDTO.getBac712());//征集时个人缴费部分应补统筹利息
param.put("BAB704", jfhdDTO.getBab704());//征集时单位缴费应划入个人帐户部分应补利息
param.put("BAB705", jfhdDTO.getBab705());//征集时单位缴费划入统筹金利息
param.put("BAE742", jfhdDTO.getBae742());//审核时应缴滞纳金金额
param.put("BAE743", jfhdDTO.getBae743());//审核时减免滞纳金金额
param.put("BAE749", jfhdDTO.getBae749());//征集时滞纳金金额
param.put("BAE745", jfhdDTO.getBae745());//征集时减免滞纳金金额
param.put("BAE746", jfhdDTO.getBae746());//补息标志
param.put("BAE747", jfhdDTO.getBae747());//滞纳金征收标志
param.put("BAE748", jfhdDTO.getBae748());//核销小计
param.put("BAE750", jfhdDTO.getBae750());//缓缴截止日期
param.put("AAB137", jfhdDTO.getAab137());//应缴合计
param.put("AAB033", jfhdDTO.getAab033());//缴费方式
param.put("AAE011", ApplySaveUtil.SY_GG_CZR());//经办人
param.put("AAE036", DateUtils.datetimeFormat.format(new Date()));//经办时间
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/pay/check.json", params);
}
/**
* 单位征集计划确认提交核心库
*/
public com.alibaba.fastjson.JSONObject saveZJplanInfo(String rae001, JfhdDTO jfhdDTO, String sa06aId) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAE715", jfhdDTO.getBae715());
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAB034", jfhdDTO.getBaa001());//经办机构编码
param.put("BAA005", jfhdDTO.getBaa005());//审核编号
param.put("BAE702", "1");//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("AAB121", jfhdDTO.getAab121());//单位基数总额
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费记录类型
param.put("SAA036", sa06aId);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("SAA015", "M4008");//功能id
param.put("SAA004", SAA004);//事项id
param.put("startYM", jfhdDTO.getStartYM());//开始费款所属期
param.put("endYM", jfhdDTO.getEndYM());//截止费款所属期
param.put("AAB120", jfhdDTO.getAab120());//个人基数总额
param.put("BAB701", jfhdDTO.getBab701());//个人应缴额
param.put("BAE742", jfhdDTO.getBae742());//滞纳金
param.put("AAB122", jfhdDTO.getAab122());//单位应缴额
param.put("AAB137", jfhdDTO.getAab137());//合计金额
String a = param.toJSONString();
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/collection/check.json", params);
}
/**
* 缴费基数申报确认提交核心库
*/
public com.alibaba.fastjson.JSONObject savejssbInfo(String rae001, List<JfhdDTO> list, ShiroUser suser, String saa036) {
//缴费基数申报
net.sf.json.JSONArray jsonArray = new net.sf.json.JSONArray();
List<PostParam> params = new ArrayList<PostParam>();
for (JfhdDTO jfhdDTO : list) {
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", jfhdDTO.getBaa001());//数据分区
param.put("AAB001", jfhdDTO.getAab001());//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("SAA036", saa036);//受理单号
param.put("BAE941", rae001);//申报流水号
param.put("AAC001", jfhdDTO.getAac001());//个人编号
param.put("AAE030", jfhdDTO.getAae030() + "01");//开始年月
param.put("AAC040", jfhdDTO.getAac040());//缴费工资
param.put("TAA101", DateUtils.datetimeFormat.format(new Date()));//申报时间
param.put("AAE036", DateUtils.datetimeFormat.format(new Date()));//经办时间
param.put("SAA038", DateUtils.datetimeFormat.format(new Date()));//申请时间
param.put("AAE011", ApplySaveUtil.SY_GG_CZR());//经办人
param.put("SAA037", ApplySaveUtil.SY_GG_CZR());//申请人
param.put("SAA015", "M4006");//功能id
param.put("SAA004", SAA004);//事项id
param.put("BAE702", "1");//主体类型
param.put("BAE703", jfhdDTO.getAab001());//主体编号
param.put("SAA043", "3");//业务状态
param.put("SZZ003", jfhdDTO.getBaa001());//服务机构ID
param.put("TAA103", "0");//审核结果
param.put("TAA105", "4");//申报来源
param.put("AAE143", "1");//缴费核定类型
jsonArray.add(param);
}
params.add(new PostParam("params", "string", jsonArray.toString()));
//com.alibaba.fastjson.JSONObject rs= PostHelper.send("/loseJob/paymentBase/declaration.json", params);
//JSONObject result = JSONObject.fromObject(rs.get("result"));
return PostHelper.send("/loseJob/paymentBase/declaration.json", params);
}
/**
* 根据单位编号查询单位信息
*/
public com.alibaba.fastjson.JSONObject getAb01ByAab001(String datacode, String aab001) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", datacode);//数据分区
param.put("AAB001", aab001);//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/basicInfoQuery.json", params);
}
/**
* 征集计划查询
*/
public List<JfhdDTO> getzjPlan(String datacode, String aab001, String aae002, String aae003) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", datacode);//数据分区suser.getUserInfo().getUpmsOrganizations().getCode()
param.put("AAB001", aab001);//单位编号
//param.put("BAE702","1");//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE063", "-1");//BAB811为1时分组增加费款所属期及基金配置流水号
param.put("AAE140", "2");//险种
param.put("AAB033", "2");//缴费类型
param.put("AAE143", "1");//缴费记录类型
param.put("StartYM", aae002);//开始费款所属期
param.put("EndYM", aae003);//结束费款所属期
params.add(new PostParam("params", "string", param.toJSONString()));
com.alibaba.fastjson.JSONObject zjplan = PostHelper.send("/loseJob/unit/payInfoQuery.json", params);
JSONObject result = JSONObject.fromObject(zjplan.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.get("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 单位缴费信息查询
*/
public com.alibaba.fastjson.JSONObject getjfxxList(Map<String, String> map, ShiroUser suser, String baa001) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", baa001);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAB033", "2");//缴费类型
param.put("AAE143", "1");//缴费记录类型
param.put("BAB811", "1");//BAB811为1时分组增加费款所属期及基金配置流水号
param.put("StartYM", map.get("StartYM"));//缴费类型
param.put("EndYM", map.get("EndYM"));//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/payInfoQuery.json", params);
}
/**
* 单位缴费核定信息查询
*/
public com.alibaba.fastjson.JSONObject getjfhdList(Map<String, String> map, String code, String id) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", code);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费核定类型
param.put("StartYM", map.get("StartYM"));//缴费类型
param.put("EndYM", map.get("EndYM"));//缴费类型
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/unit/pay/query.json", params);
}
/**
* 查询缴费明细信息
*
* @return
*/
public com.alibaba.fastjson.JSONObject getjfmx(Map<String, String> map, String code) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject param = new com.alibaba.fastjson.JSONObject();
param.put("BAA001", code);//数据分区
param.put("AAB001", map.get("AAB001"));//单位编号
param.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
param.put("AAE140", "2");//险种
param.put("AAE143", "1");//缴费核定类型
param.put("AAE002", map.get("AAE002"));//费款所属期
//param.put("AAE003",map.get("AAE002"));//对应费款所属期
param.put("BAA005", map.get("BAA005"));//审核编号
params.add(new PostParam("params", "string", param.toJSONString()));
return PostHelper.send("/loseJob/person/payInfoQuery.json", params);
}
//生成sd06对象公共方法
public Sd06 saveSd06(JfhdDTO jfhdDTO, ShiroUser suser, String archives) {
Sd06 sd06 = new Sd06();
sd06.setSaa004(SAA004); //事项ID
sd06.setSbb004(SBB004); //功能ID
sd06.setSaa205("1");//申请渠道
sd06.setSaa210("1");//申报状态
sd06.setSaa037(jfhdDTO.getAab004());//申请人
sd06.setAac043("1");//申请人证件类型(1身份证,2出生证,3护照
sd06.setAac044(jfhdDTO.getAab001());//申请人证件号
sd06.setAaa025("1");//申请主体类型(1单位,2个人,3家庭,5社区,6学校
sd06.setSaa203(DateUtils.datetimeFormat.format(new Date()));//申请时间
sd06.setAae011(suser.getId());//经办人
sd06.setAae036(DateUtils.datetimeFormat.format(new Date()));//经办时间
sd06.setBae011(suser.getId());//变更人
sd06.setBae036(DateUtils.datetimeFormat.format(new Date()));//变更时间
sd06.setSzz007(suser.getUserInfo().getUpmsOrganizations().getCode());//机构id String.valueOf(suser.getOrgid())
sd06.setSza016(suser.getUserInfo().getUpmsOrganizations().getCode());//行政区划suser.getUserInfo().getUpmsOrganizations().getCode()
sd06.setAaa026(jfhdDTO.getAab001());//申请主体编号
sd06.setPan001(archives);
return sd06;
}
public Sd07 saveSd07(JfhdDTO jfhdDTO, ShiroUser suser) {
Sd07 sd07 = new Sd07();
sd07.setRae003(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));//表单信息
sd07.setSaa210("1"); //申报状态
sd07.setAae011(suser.getLoginName().toString()); //经办人
return sd07;
}
// public Sa06a saveSa06a (JfhdDTO jfhdDTO, ShiroUser suser,String aac044){
// Sa06 sa06=sa06Service.selectById(SAA004);
// Sa06a sa06a=new Sa06a();
// sa06a.setSaa004(SAA004);//事项id
// sa06a.setSbb004(SBB004);//事项id
// sa06a.setSaa043("6");//业务状态(1填写资料,2提交审核,3预审,4受理,5审核,6办结
// sa06a.setSaa080(suser.getLoginName().toString());//经办人
// sa06a.setSaa039(com.alibaba.fastjson.JSONObject.toJSONString(jfhdDTO));//表单信息
// sa06a.setSaa024(sa06.getSaa024());//法定期限
// sa06a.setSaa018(sa06.getSaa018());//承诺时限
// sa06a.setBusId(sa06.getBusId());//业务id
// sa06a.setSaa037(jfhdDTO.getAab004());//申请人
// sa06a.setSaa038(DateUtils.datetimeFormat.format(new Date()));//申请时间
// sa06a.setSaa015("M4007");//功能ID
// sa06a.setBae702(sa06.getSaa062());//主体类型(0个人,1单位)
// sa06a.setBae703(jfhdDTO.getAab001());//主体编号
// sa06a.setSaa017(sa06.getSaa005());//申报名称
// sa06a.setSaa205("1");//申请渠道(1受理平台,2网上办事,3手机APP)
// sa06a.setAac043("1");//申请人证件类型(1身份证,2出生证,3护照)
// sa06a.setAac044(aac044);//申请人证件号
// sa06a.setAab004(jfhdDTO.getAab004());//单位名称
// sa06a.setSza016(suser.getUserInfo().getUpmsOrganizations().getCode());//suser.getUserInfo().getUpmsOrganizations().getCode()
// sa06a.setSaa211("2");//办结状态(1未办结,2已办结)
// return sa06a;
// }
public Sd11 sd11Bean(String rae001, String name, String code, String saa036) {
Sd11 sd11 = new Sd11();
sd11.setRae001(rae001);//服务事项办理过程ID 申报ID
Sz18 sz18 = new Sz18();
sz18.setSbb004(SBB004);
sz18.setRae009("2");
sz18 = sz18Service.selectOne(sz18);
sd11.setRae008(sz18.getSz18id());//业务环节ID 申报状态 0为已申报
sd11.setRae009("2");//环节顺序 第一步环节
sd11.setRae010("受理");//环节名称
sd11.setRae011("");//环节承诺时间 sa06.getSaa018()
sd11.setRae012("1");//环节状态
sd11.setRae013("1");//办理状态(1通过2未通过)
sd11.setAae189("同意");//办理意见
sd11.setAae011(name);//经办人
sd11.setAae013("");//备注
sd11.setAae036(DateUtils.datetimeFormat.format(new Date()));//经办时间
sd11.setSzz007("");//服务机构ID
sd11.setSza016(code);//行政区划(6102铜川市,610202铜川市王益区,610203铜川市印台区,610204铜川市耀州区,610207铜川市新区,610208铜川市矿务局,610222铜川市宜君县,610299铜川市本级)
sd11.setSaa900("0");//同步状态(0未同步,1已同步)
sd11.setSaa901("");//同步时间
sd11.setSaa902("");//同步说明
sd11.setBae941(saa036);//流水号(调用工作流返回的流水号,用于跟核心反馈的数据同步受理单状态)
sd11.setSaa036(saa036);//受理单ID
sd11.setSda009(DateUtils.datetimeFormat.format(new Date()));//开始时间
sd11.setSbb004(SBB004);
return sd11;
}
@ApiOperation(value = "缴费明细导出")
@RequestMapping("/exportxlsjf")
@ResponseBody
public String exportxlsjf(JfhdDTO jfhdDTO, HttpServletResponse response) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", jfhdDTO.getAab001());
map.put("AAE002", jfhdDTO.getAae002());
map.put("BAA005", jfhdDTO.getBaa005());
com.alibaba.fastjson.JSONObject json = getjfmx(map, jfhdDTO.getBaa001());
JSONObject result = JSONObject.fromObject(json.get("result"));
if ("0".equals(result.getString("code"))) {
List<JfhdDTO> list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
if (list_return.size() <= 0) {
return "没有可导出的数据";
}
//指定下载的文件名
String fileName = "人员缴费查询列表.xls";
// 定义单元格报头
String worksheetTitle = "人员缴费查询列表";
List<String> columsTitles = new ArrayList<String>();
columsTitles.add("个人编号");
columsTitles.add("姓名");
columsTitles.add("身份证");
columsTitles.add("缴费类型");
columsTitles.add("费款所属期");
columsTitles.add("个人缴费基数总额");
columsTitles.add("个人缴费金额");
columsTitles.add("单位应缴金额");
columsTitles.add("缴费合计");
columsTitles.add("缴费标志");
try {
fileName = new String(fileName.getBytes("GBK"), "iso8859-1");
response.reset();
response.setHeader("Content-Disposition", "attachment;filename="
+ fileName);// 指定下载的文件名
//response.setContentType("application/vnd.ms-excel");
response.setContentType("APPLICATION/OCTET-STREAM;charset=UTF-8");//设置类型
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
OutputStream output = null;
output = response.getOutputStream();
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
HSSFWorkbook wb = new HSSFWorkbook();
// 创建单元格样式
HSSFCellStyle cellStyleTitle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyleTitle.setWrapText(true);
// ------------------------------------------------------------------
HSSFCellStyle cellStyle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyle.setWrapText(true);
// ------------------------------------------------------------------
// 设置单元格字体
HSSFFont font = wb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontName("宋体");
font.setFontHeight((short) 200);
cellStyleTitle.setFont(font);
// 工作表名
HSSFSheet sheet = wb.createSheet("sheet1");
ExportExcel exportExcel = new ExportExcel(wb, sheet);
// 创建报表头部
exportExcel.createNormalHead(worksheetTitle, columsTitles.size() + 1);
// 定义第一行
HSSFRow row1 = sheet.createRow(1);
//第一行第i列;
for (int i = 0; i < columsTitles.size(); i++) {
HSSFCell cell1 = row1.createCell(i);
cell1.setCellStyle(cellStyleTitle);
cell1.setCellValue(new HSSFRichTextString(columsTitles.get(i)));
}
//定义第二行
HSSFRow row = sheet.createRow(2);
HSSFCell cell = row.createCell(1);
List list_aae143 = CodeCacheUtils.getCodeList("AAE143");
List aae114List = CodeCacheUtils.getCodeList("AAE114");
for (int j = 0; j < list_return.size(); j++) {
JfhdDTO jf = list_return.get(j);
//个人编号,姓名,身份证,错误原因
row = sheet.createRow(j + 2);
//个人编号
cell = row.createCell(0);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac001().trim()));
//姓名
cell = row.createCell(1);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac003().trim()));
//身份证
cell = row.createCell(2);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac002().trim()));
//缴费类型
for (int k = 0; k < list_aae143.size(); k++) {
JSONObject jsonObject = JSONObject.fromObject(list_aae143.get(k));
if ((jsonObject.getString("value")).equals(jf.getAae143())) {
String name1 = jsonObject.getString("name");
cell = row.createCell(3);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(name1));
break;
}
}
//费款所属期
cell = row.createCell(4);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAae002()));
//个人缴费基数总额
cell = row.createCell(5);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getBac504().trim()));
//个人缴费金额
cell = row.createCell(6);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac123().trim()));
//单位应缴金额
cell = row.createCell(7);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getAac127().trim()));
//缴费合计
cell = row.createCell(8);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(jf.getBac504_1().trim()));
//缴费标志
for (int m = 0; m < aae114List.size(); m++) {
JSONObject jsonObject = JSONObject.fromObject(aae114List.get(m));
if ((jsonObject.getString("value")).equals(jf.getAae114())) {
String name2 = jsonObject.getString("name");
cell = row.createCell(9);
cell.setCellStyle(cellStyle);
cell.setCellValue(new HSSFRichTextString(name2));
break;
}
}
}
wb.write(bufferedOutPut);
bufferedOutPut.flush();
bufferedOutPut.close();
return null;
} catch (IOException e) {
e.printStackTrace();
return "导出异常";
} finally {
}
} else {
return result.getString("msg");
}
//return "";
}
public List<String> getbetweentimes(String start, String end) throws ParseException {
List<String> list = new ArrayList<String>();
list.add(start);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
Date date1 = sdf.parse(start);
Date date2 = sdf.parse(end);
cal.setTime(date1);
while (date1.before(date2)) {
cal.add(Calendar.MONTH, 1);
date1 = cal.getTime();
String str = sdf.format(date1);
list.add(str);
}
return list;
}
public static void main(String[] args) throws ParseException {
//个人编号查询
com.alibaba.fastjson.JSONObject j = new com.alibaba.fastjson.JSONObject();
j.put("AAE170", "SLPT123");
j.put("AAB001", "10202000017");
j.put("BAA001", "'610202'");
j.put("BAC808", "10");//每页多少条
j.put("BAC809", "1"); //页码
j.put("AAC002", "");
j.put("AAC001", "");
j.put("AAC003", "");
j.put("AAC050", "");//异动类型
j.put("AAC031", "");
j.put("TAE100", "");
j.put("SAA015", "");
j.put("AAE140", "2");//险种类型
com.alibaba.fastjson.JSONObject json = RestfulUtil.getJson(j, "/loseJob/person/insuredInfoQuery.json");
System.out.println(json.toString());
}
@RequestMapping("/zjjjDetail")
public String zjjjDetail(HttpServletResponse response, ModelMap model,
String startYM, String endYM, String aab001, String baa001, String saa200, String aab004) {
try {
aab004 = URLDecoder.decode(URLDecoder.decode(aab004, "UTF-8"), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
model.addAttribute("startYM", startYM);
model.addAttribute("endYM", endYM);
model.addAttribute("aab001", aab001);
model.addAttribute("baa001", baa001);
model.addAttribute("aab004", aab004);
model.addAttribute("saa200", saa200);
List<JfhdDTO> list_return = zjjjList(startYM, endYM, aab001, baa001);
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("zjjjList", JSONHelper.array2json(listyd));
return "/unemployment/syjfhd/zjjjList.jsp";
}
public List<JfhdDTO> zjjjList(String startYM, String endYM, String aab001, String baa001) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", aab001);//单位编号
jsonObject.put("BAA001", baa001);//数据分区
jsonObject.put("BAB811", "");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "");// 否
jsonObject.put("AAE143", "");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", startYM);//
jsonObject.put("EndYM", endYM);//
jsonObject.put("AAE063", "");// 征集计划标识
jsonObject.put("AAE140", "");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
net.sf.json.JSONObject result = net.sf.json.JSONObject.fromObject(j.getString("result"));
//####################################################################
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
if ("0".equals(result.getString("code"))) {
list_return = JSONArray.parseArray(result.getString("LIST"), JfhdDTO.class);
}
return list_return;
}
/**
* 缴费核定撤销页面
*
* @param jfhd
* @param response
* @param model
* @param saa200
* @param aab004
* @param rae001
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/checkremove")
public String checkremove(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
try {
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("aab004", URLDecoder.decode(jfhd.getAab004(), "UTF-8"));
model.addAttribute("saa200", saa200);
model.addAttribute("saa004", saa004);
// model.addAttribute("rae001",rae001);
} catch (Exception e) {
e.printStackTrace();
}
return "/unemployment/syjfhd/checkRemove.jsp";
}
/**
* 缴费核定撤销list
*
* @param
* @param response
* @param model
* @param saa200
* @param aab004
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/checkRemoveList")
@ResponseBody
public AjaxJson checkRemoveList(String baa005, HttpServletResponse response, ModelMap model, String saa200, String aab004, String saa004, String aae002, String aae003) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if ("".equals(baa005) || baa005 == null) {
if (json.getString("AAB001") != null) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
} else {
if (baa005.equals(json.getString("BAA005"))) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
try {
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("gridmap1", JSONHelper.array2json(list));
j.setObj(jsonObject1);
j.setSuccess(true);
} catch (Exception e) {
j.setMsg("失败");
j.setSuccess(false);
}
}
return j;
}
@ApiOperation("批量撤销缴费核定")
@RequestMapping("/batchdelete")
@ResponseBody
public AjaxJson batchDelete(String data, String saa200, Sd05 sd05) {
AjaxJson ajaxJson = new AjaxJson();
List<JfhdDTO> lists = JSONArray.parseArray(data, JfhdDTO.class);
sd05 = sd05Service.selectById(saa200);
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
try {
for (JfhdDTO jfhdDTO : lists) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAE143", jfhdDTO.getAae143());// 缴费类型
jsonObject.put("AAE003", jfhdDTO.getAae003());// 对应费款所属期
jsonObject.put("BAA005", jfhdDTO.getBaa005());// 审核流水号
jsonObject.put("BAE703", sd05.getAaa026());// 主体编号
jsonObject.put("AAB137", jfhdDTO.getAab137());// 应缴合计
params.add(new PostParam("params", "string", "[" + jsonObject.toJSONString() + "]"));
json = PostHelper.send("/loseJob/unit/collection/del.json", params);
}
if (json.getString("code").equals("0")) {
ajaxJson.setMsg("撤销成功");
ajaxJson.setSuccess(true);
} else {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
} catch (Exception e) {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
return ajaxJson;
}
public com.alibaba.fastjson.JSONObject jfhdcxList(Map map, Sd05 sd05) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("BAB811", "1");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "");// 否
jsonObject.put("AAE143", "1");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", map.get("StartYM"));//
jsonObject.put("EndYM", map.get("EndYM"));//
jsonObject.put("AAE063", "-1");// 征集计划标识
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
return j;
}
/*
-------------------------------------------------------------------------------
*/
@RequestMapping("/zjjhremove")
public String zjjhremove(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
try {
model.addAttribute("jfhdaae", jfhd);
model.addAttribute("aab004", URLDecoder.decode(jfhd.getAab004(), "UTF-8"));
model.addAttribute("saa200", saa200);
model.addAttribute("saa004", saa004);
} catch (Exception e) {
e.printStackTrace();
}
return "/unemployment/syjfhd/zzjhRemove.jsp";
}
/**
* 征集计划撤销list
*
* @param
* @param response
* @param model
* @param saa200
* @param aab004
* @param saa004
* @param aae002
* @param aae003
* @return
*/
@RequestMapping("/zzjhremovelist")
@ResponseBody
public AjaxJson zzjhremovelist(String aae063, HttpServletResponse response, ModelMap model, String saa200, String aab004, String saa004, String aae002, String aae003) {
AjaxJson j = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
Sd05 sd05 = sd05Service.selectById(saa200);
com.alibaba.fastjson.JSONObject jsonObject = zjjjRemoveList(aae002, aae003, sd05.getAaa026(), sd05.getSza017());
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
if (jsonArray.size() <= 0) {
j.setMsg("费款所属期内未查询到可操作的征集计划");
j.setSuccess(false);
return j;
}
DecimalFormat df = new DecimalFormat("######0.00");
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if ("".equals(aae063) || aae063 == null) {
if (json.getString("AAB001") != null) {
json.put("AAB004", json.getString("AAB004"));
json.put("BAE713", df.format(Double.parseDouble(json.getString("BAE713"))));
json.put("AAE063", json.getString("AAE063"));
json.put("BAE703", json.getString("BAE703"));
json.put("AAE003", json.getString("AAE003"));
// if(json.getString("StartYM").equals(json.getString("EndYM"))){
// json.put("start_end",(json.getString("StartYM")));
// }else{
json.put("start_end", (json.getString("StartYM") + "~" + json.getString("EndYM")));
// }
// json.put("BAE742",json.getString("BAE742"));
// json.put("BAE713",json.getString("BAE713"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
} else {
if (aae063.equals(json.getString("AAE063"))) {
json.put("AAB004", json.getString("AAB004"));
json.put("BAE713", df.format(Double.parseDouble(json.getString("BAE713"))));
// if(json.getString("StartYM").equals(json.getString("EndYM"))){
// json.put("start_end",(json.getString("StartYM")));
// }else{
json.put("start_end", (json.getString("StartYM") + "~" + json.getString("EndYM")));
// }
json.put("AAE063", json.getString("AAE063"));
json.put("BAE703", json.getString("BAE703"));
json.put("AAE003", json.getString("AAE003"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
try {
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return) {
list.add(transBean2Map(transNull(js)));
}
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("gridmap2", JSONHelper.array2json(list));
j.setObj(jsonObject1);
j.setSuccess(true);
} catch (Exception e) {
j.setMsg("失败");
j.setSuccess(false);
}
}
return j;
}
public com.alibaba.fastjson.JSONObject zjjjRemoveList(String startYM, String endYM, String aab001, String baa001) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", aab001);//单位编号
jsonObject.put("BAA001", baa001);//数据分区
jsonObject.put("BAB811", "");//为1时分组增加费款所属期及基金配置流水号
jsonObject.put("BAE707", "2");// 否
jsonObject.put("AAE143", "");// 否 AAE143为1时查缴费记录 此时AAE063非空且大于0则查征集计划对应的缴费记录,否则查未做计划的缴费记录;
jsonObject.put("StartYM", startYM);//
jsonObject.put("EndYM", endYM);//
jsonObject.put("AAE063", "");// 征集计划标识
jsonObject.put("AAE140", "");// 险种(失业保险为‘2’)
jsonObject.put("AAB033", "");// 缴费方式(2税务征收,3经办机构自收)
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/unit/payInfoQuery.json");
return j;
}
@ApiOperation("批量撤销征集计划")
@RequestMapping("/removeAllzjjh")
@ResponseBody
public AjaxJson removeAllzjjh(String data, String saa200, Sd05 sd05) {
AjaxJson ajaxJson = new AjaxJson();
List<JfhdDTO> lists = JSONArray.parseArray(data, JfhdDTO.class);
sd05 = sd05Service.selectById(saa200);
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
try {
for (JfhdDTO jfhdDTO : lists) {
List<PostParam> params = new ArrayList<PostParam>();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("AAE140", "2");// 险种(失业保险为‘2’)
jsonObject.put("AAE003", jfhdDTO.getAae003());// 对应费款所属期
// jsonObject.put("BAA005",jfhdDTO.getBaa005());// 审核流水号
jsonObject.put("BAE703", sd05.getAaa026());// 主体编号
jsonObject.put("AAE063", jfhdDTO.getAae063());//
jsonObject.put("AAB137", jfhdDTO.getBae713());// 应缴合计
params.add(new PostParam("params", "string", "[" + jsonObject.toJSONString() + "]"));
json = PostHelper.send("/loseJob/unit/collection/del.json", params);
Dj04 dj04 = new Dj04();
dj04.setDj041(jfhdDTO.getAae063());
dj04.setDj02id("1001");
//删除地沟04
dj04 = dj04Service.selectOne(dj04);
if(null!=dj04){
dj04Service.deleteByEntity(dj04);
}
}
if (json.getString("code").equals("0")) {
ajaxJson.setMsg("撤销成功");
ajaxJson.setSuccess(true);
} else {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
} catch (Exception e) {
ajaxJson.setMsg(json.getString("msg"));
ajaxJson.setSuccess(false);
}
return ajaxJson;
}
/*----------------------------------------------------------*/
@RequestMapping("/dzjjlistView")
public String dzjjlistView(ModelMap model, String saa200, String aae002, String aae003) {
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return "/unemployment/syjfhd/dzjjList.jsp";
}
@RequestMapping("/dzjjlist")
@ResponseBody
public DataGridReturn dzjjList(Sd05 sd05, JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aae002, String aae003) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
JSONObject result = JSONObject.fromObject(jsonObject.get("result"));
List<JfhdDTO> list_return = new ArrayList<JfhdDTO>();
JSONArray jsonArraynew = new JSONArray();
if ("0".equals(result.get("code"))) {
JSONArray jsonArray = JSONArray.parseArray(result.getString("LIST"));
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (json.getString("AAB001") != null) {
json.put("BAA005", json.getString("BAA005"));
json.put("AAE140", json.getString("AAE140"));
json.put("AAE143", json.getString("AAE143"));
json.put("BAB701", json.getString("BAB701"));
json.put("AAB122", json.getString("AAB122"));
json.put("BAE742", json.getString("BAE742"));
json.put("BAB706", json.getString("BAB706"));
json.put("saa200", saa200);
jsonArraynew.add(json);
}
}
}
list_return = jsonArraynew.toJavaList(JfhdDTO.class);
List<PostParam> params = new ArrayList<PostParam>();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
if ("0".equals(result1.get("code"))) {
list_return1 = JSONArray.parseArray(result1.getString("RETLIST"), JfhdDTO.class);
}
List listyd = new ArrayList();
for (JfhdDTO js : list_return) {
listyd.add(transBean2Map(transNull(js)));
}
model.addAttribute("dzjjlist1", JSONHelper.array2json(listyd));
int count = 0;
List<JfhdDTO> listdz1 = new ArrayList();
List<JfhdDTO> listdz2 = new ArrayList();
List<JfhdDTO> listdz3 = new ArrayList();
for (JfhdDTO js : list_return1) {
if (js.getBae718().equals("1")) {
listdz1.add(js);
}
if (js.getBae718().equals("4")) {
listdz2.add(js);
}
if (js.getBae718().equals("5")) {
listdz3.add(js);
}
}
List<JfhdDTO> listend = new ArrayList();
if (listdz1.size() > 0)
listend.add(listdz1.get(0));
if (listdz2.size() > 0)
listend.add(listdz2.get(0));
if (listdz3.size() > 0)
listend.add(listdz3.get(0));
List listdz = new ArrayList();
for (JfhdDTO js : listend) {
listdz.add(transBean2Map(transNull(js)));
}
model.addAttribute("dzjjsls", JSONHelper.array2json(listdz));
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return new DataGridReturn((long) listyd.size(), listyd);
}
/*
*/
@RequestMapping("/dzjjClsaalist")
@ResponseBody
public DataGridReturn dzjjClsaalist(Sd05 sd05, ModelMap model, String saa200, String aae002, String aae003) {
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
Map<String, String> map = new HashMap<String, String>();
map.put("AAB001", sd05.getAaa026());//单位编号
map.put("StartYM", aae002);//开始费款所属期
map.put("EndYM", aae003);//截止费款所属期
com.alibaba.fastjson.JSONObject jsonObject = jfhdcxList(map, sd05);
List<PostParam> params = new ArrayList<PostParam>();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
if ("0".equals(result1.get("code"))) {
list_return1 = JSONArray.parseArray(result1.getString("RETLIST"), JfhdDTO.class);
}
List listyd = new ArrayList();
List<JfhdDTO> listdz1 = new ArrayList();
List<JfhdDTO> listdz2 = new ArrayList();
List<JfhdDTO> listdz3 = new ArrayList();
for (JfhdDTO js : list_return1) {
if (js.getBae718().equals("1")) {
listdz1.add(js);
}
if (js.getBae718().equals("4")) {
listdz2.add(js);
}
if (js.getBae718().equals("5")) {
listdz3.add(js);
}
}
List<JfhdDTO> listend = new ArrayList();
if (listdz1.size() > 0)
listend.add(listdz1.get(0));
if (listdz2.size() > 0)
listend.add(listdz2.get(0));
if (listdz3.size() > 0)
listend.add(listdz3.get(0));
List listdz = new ArrayList();
// for (JfhdDTO js:listend) {
// listdz.add(transBean2Map(js));
// }
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return new DataGridReturn((long) listend.size(), listend);
}
@RequestMapping("/dzjjEnd")
public String dzjjEnd(JfhdDTO jfhd, HttpServletResponse response, ModelMap model, String saa200, String aab004, String rae001, String saa004, String aae002, String aae003) {
model.addAttribute("saa200", saa200);
model.addAttribute("aae002", aae002);
model.addAttribute("aae003", aae003);
return "/unemployment/syjfhd/dzjjEnd.jsp";
}
@RequestMapping("/dzjjEndList")
@ResponseBody
public DataGridReturn dzjjEndList(DataGrid dataGrid, String saa200, String aae002, String aae003, Sd05 sd05, Model model) {
AjaxJson ajaxJson = new AjaxJson();
ShiroUser suser = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
sd05 = sd05Service.selectById(saa200);
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put("AAE170", ApplySaveUtil.SY_GG_CZR());//操作人
jsonObject.put("AAB001", sd05.getAaa026());//单位编号
jsonObject.put("BAA001", sd05.getSza017());//数据分区
jsonObject.put("startYM", aae002);//
jsonObject.put("endYM", aae003);//
com.alibaba.fastjson.JSONObject j = RestfulUtil.getJson(jsonObject, "/loseJob/toTurnMoey/info/query.json");
JSONObject result1 = JSONObject.fromObject(j.get("result"));
List<JfhdDTO> list_return1 = new ArrayList<JfhdDTO>();
JSONArray jsonArray = JSONArray.parseArray(result1.getString("RETLIST"));
JSONArray jsonArraynew = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
com.alibaba.fastjson.JSONObject json = jsonArray.getJSONObject(i);
if (Double.valueOf(json.getString("BAE716").trim()) < 0) {
json.put("BAE703", json.getString("BAE703"));
json.put("BAA001", json.getString("BAA001"));
json.put("AAE003", json.getString("AAE003"));
json.put("BAE715", json.getString("BAE715"));
json.put("BAE718", json.getString("BAE718"));
json.put("BAE716", json.getString("BAE716"));
json.put("AAE011", json.getString("AAE011"));
json.put("AAE036", json.getString("AAE036"));
jsonArraynew.add(json);
}
}
list_return1 = jsonArraynew.toJavaList(JfhdDTO.class);
List list = new ArrayList();
for (JfhdDTO js : list_return1) {
list.add(transBean2Map(js));
}
int a = dataGrid.getPage();
int b = dataGrid.getRows();
Wrapper wrapper = new EntityWrapper();
PageHelper.startPage(dataGrid.getPage(), dataGrid.getRows());
PageInfo pageInfo = new PageInfo(list);
return new DataGridReturn(pageInfo.getTotal(), pageInfo.getList());
}
}
| 136,121 | 0.558295 | 0.510944 | 2,598 | 48.326019 | 28.237724 | 189 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066205 | false | false | 0 |
4423c351aa27f17dcf6416627eb1824f6d0bf088 | 15,573,551,482,053 | a8a39fe2124319f525e3b9d0fe23f1abf46dcfdb | /src/com/gavinz/gbook/Chapter.java | eac4853c857bf31b3d43387329ff2aecbcfaa396 | []
| no_license | gavinz0228/GBook-Android | https://github.com/gavinz0228/GBook-Android | 179da09efce385e1f278c751c801d5d4b79b8cd2 | 62ab7b4cea1e9da622b9db711d73ec31c8c8da36 | refs/heads/master | 2021-01-01T17:22:07.912000 | 2015-02-20T04:00:56 | 2015-02-20T04:00:56 | 30,903,480 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gavinz.gbook;
public class Chapter {
public int id;
public String title;
public Section [] sections;
}
| UTF-8 | Java | 119 | java | Chapter.java | Java | []
| null | []
| package com.gavinz.gbook;
public class Chapter {
public int id;
public String title;
public Section [] sections;
}
| 119 | 0.739496 | 0.739496 | 7 | 16 | 10.474459 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 0 |
731c80754ddfd01e6454e5536e4fa416171a3f96 | 10,788,957,910,964 | d0e17794e58d18d2aae8259341d2c9f4fee1c22b | /app/src/main/java/com/algonquintimes/algonquintimes/Articles/PostAdapter.java | a5271ccc64716be49445c007b5c51028a5473f63 | []
| no_license | Rye434/AlgonquinTimes | https://github.com/Rye434/AlgonquinTimes | 74ddd81ae2c49acca0d26523bf7c9993e7386f65 | 9bdb2bea83ce372a0a70b7b91ea89b056ca2925d | refs/heads/master | 2020-03-23T20:26:09.546000 | 2018-09-23T17:15:03 | 2018-09-23T17:15:03 | 142,041,139 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.algonquintimes.algonquintimes.Articles;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.algonquintimes.algonquintimes.R;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import java.util.List;
import static com.bumptech.glide.request.RequestOptions.fitCenterTransform;
public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final static int FADE_DURATION = 1000;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
private static final int TYPE_FOOTER = 2;
private String TAG = "LoadImage";
private Context context;
Bundle bundle = new Bundle();
private List<Posts> questionList;
private boolean mWithHeader;
private boolean mWithFooter;
private View.OnClickListener mOnClickListener;
PostAdapter(List<Posts> posts, Context context, boolean withHeader, boolean withFooter) {
this.questionList = posts;
this.context = context;
this.mWithHeader = withHeader;
this.mWithFooter = withFooter;
}
@Override
public int getItemViewType(int position) {
if (mWithHeader && isPositionHeader(position))
return TYPE_HEADER;
if (mWithFooter && isPositionFooter(position))
return TYPE_FOOTER;
return TYPE_ITEM;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
Log.d("debugMode3", "in Recycleview");
View itemView = LayoutInflater.
from(viewGroup.getContext()).
inflate(R.layout.postitem, viewGroup, false);
// itemView.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT,
// RecyclerView.LayoutParams.WRAP_CONTENT));
VideoViewHolder holder = new VideoViewHolder(itemView);
itemView.setTag(holder);
// itemView.setOnClickListener(mOnClickListener);
return holder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof header) {
//((header) holder).vName.setText(album_name);
} else if (holder instanceof footer) {
((footer) holder).context = context;
} else {
Posts post = getItem(position);
((VideoViewHolder) holder).vTitle.setText(Html.fromHtml(post.getTitle()));
((VideoViewHolder) holder).vTitle.setClickable(true);
String excerpt = post.getExcerpt();
if (excerpt != null) {
if (excerpt.length() >= 254) {
((VideoViewHolder) holder).vExcerpt.setText(Html.fromHtml(excerpt.substring(0, 254) + " "));
} else {
((VideoViewHolder) holder).vExcerpt.setText(Html.fromHtml(post.getExcerpt() + " "));
}
}
((VideoViewHolder) holder).vExcerpt.setClickable(true);
((VideoViewHolder) holder).context = context;
((VideoViewHolder) holder).content = post.getContent();
((VideoViewHolder) holder).imageLink = post.postImg;
((VideoViewHolder) holder).title = post.Title;
((VideoViewHolder) holder).date = post.getExcerpt();
((VideoViewHolder) holder).link = post.getPostURL();
((VideoViewHolder) holder).author = post.getPostAuthor();
GlideApp.with(context)
.load(post.getPostThumb())
.thumbnail(1.0f)
.apply(fitCenterTransform())
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(false)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
Log.e(TAG, "Load failed", e);
// You can also log the individual causes:
for (Throwable t : e.getRootCauses()) {
Log.e(TAG, "Caused by", t);
}
// Or, to log all root causes locally, you can use the built in helper method:
e.logRootCauses(TAG);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
})
.into(((VideoViewHolder) holder).vImage);
}
}
private void setScaleAnimation(View view) {
ScaleAnimation anim = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
}
private void setFadeAnimation(View view) {
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
@Override
public int getItemCount() {
int itemCount = 0;
if (questionList != null) {
itemCount = questionList.size();
if (mWithHeader)
itemCount = itemCount + 1;
if (mWithFooter)
itemCount = itemCount + 1;
// return itemCount;
}
return itemCount;
}
private boolean isPositionHeader(int position) {
return position == 0;
}
private boolean isPositionFooter(int position) {
return position == getItemCount() - 1;
}
public void setOnClickListener(View.OnClickListener lis) {
mOnClickListener = lis;
}
protected Posts getItem(int position) {
return mWithHeader ? questionList.get(position - 1) : questionList.get(position);
}
private int getItemPosition(int position) {
return mWithHeader ? position - 1 : position;
}
public void setData(List<Posts> questionList) {
this.questionList = questionList;
}
public class VideoViewHolder extends RecyclerView.ViewHolder {
protected ImageView vImage;
protected TextView vName;
protected TextView vDetails, vTitle, vExcerpt;
String content;
String imageLink;
String title;
String date;
String link;
String author;
protected Context context;
public VideoViewHolder(View v) {
super(v);
vImage = v.findViewById(R.id.blog_image);
vTitle = v.findViewById(R.id.title);
vExcerpt = v.findViewById(R.id.excerpt);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "Item Clicked:" + vTitle.getText().toString());
Intent fullScreenIntent = new Intent(context.getApplicationContext(), PostFullScreen.class);
fullScreenIntent.putExtra("content", content);
fullScreenIntent.putExtra("image", imageLink);
fullScreenIntent.putExtra("title", title);
fullScreenIntent.putExtra("date", date);
fullScreenIntent.putExtra("link", link);
fullScreenIntent.putExtra("author", author);
context.startActivity(fullScreenIntent);
}
});
}
public void clearAnimation() {
this.clearAnimation();
}
}
public class header extends RecyclerView.ViewHolder {
protected Context context;
protected int position;
public header(View v) {
super(v);
}
}
public class footer extends RecyclerView.ViewHolder {
protected Context context;
protected int position;
public footer(View v) {
super(v);
}
}
}
| UTF-8 | Java | 9,136 | java | PostAdapter.java | Java | []
| null | []
| package com.algonquintimes.algonquintimes.Articles;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.algonquintimes.algonquintimes.R;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import java.util.List;
import static com.bumptech.glide.request.RequestOptions.fitCenterTransform;
public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final static int FADE_DURATION = 1000;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
private static final int TYPE_FOOTER = 2;
private String TAG = "LoadImage";
private Context context;
Bundle bundle = new Bundle();
private List<Posts> questionList;
private boolean mWithHeader;
private boolean mWithFooter;
private View.OnClickListener mOnClickListener;
PostAdapter(List<Posts> posts, Context context, boolean withHeader, boolean withFooter) {
this.questionList = posts;
this.context = context;
this.mWithHeader = withHeader;
this.mWithFooter = withFooter;
}
@Override
public int getItemViewType(int position) {
if (mWithHeader && isPositionHeader(position))
return TYPE_HEADER;
if (mWithFooter && isPositionFooter(position))
return TYPE_FOOTER;
return TYPE_ITEM;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
Log.d("debugMode3", "in Recycleview");
View itemView = LayoutInflater.
from(viewGroup.getContext()).
inflate(R.layout.postitem, viewGroup, false);
// itemView.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT,
// RecyclerView.LayoutParams.WRAP_CONTENT));
VideoViewHolder holder = new VideoViewHolder(itemView);
itemView.setTag(holder);
// itemView.setOnClickListener(mOnClickListener);
return holder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof header) {
//((header) holder).vName.setText(album_name);
} else if (holder instanceof footer) {
((footer) holder).context = context;
} else {
Posts post = getItem(position);
((VideoViewHolder) holder).vTitle.setText(Html.fromHtml(post.getTitle()));
((VideoViewHolder) holder).vTitle.setClickable(true);
String excerpt = post.getExcerpt();
if (excerpt != null) {
if (excerpt.length() >= 254) {
((VideoViewHolder) holder).vExcerpt.setText(Html.fromHtml(excerpt.substring(0, 254) + " "));
} else {
((VideoViewHolder) holder).vExcerpt.setText(Html.fromHtml(post.getExcerpt() + " "));
}
}
((VideoViewHolder) holder).vExcerpt.setClickable(true);
((VideoViewHolder) holder).context = context;
((VideoViewHolder) holder).content = post.getContent();
((VideoViewHolder) holder).imageLink = post.postImg;
((VideoViewHolder) holder).title = post.Title;
((VideoViewHolder) holder).date = post.getExcerpt();
((VideoViewHolder) holder).link = post.getPostURL();
((VideoViewHolder) holder).author = post.getPostAuthor();
GlideApp.with(context)
.load(post.getPostThumb())
.thumbnail(1.0f)
.apply(fitCenterTransform())
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(false)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
Log.e(TAG, "Load failed", e);
// You can also log the individual causes:
for (Throwable t : e.getRootCauses()) {
Log.e(TAG, "Caused by", t);
}
// Or, to log all root causes locally, you can use the built in helper method:
e.logRootCauses(TAG);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
})
.into(((VideoViewHolder) holder).vImage);
}
}
private void setScaleAnimation(View view) {
ScaleAnimation anim = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
}
private void setFadeAnimation(View view) {
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(FADE_DURATION);
view.startAnimation(anim);
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
@Override
public int getItemCount() {
int itemCount = 0;
if (questionList != null) {
itemCount = questionList.size();
if (mWithHeader)
itemCount = itemCount + 1;
if (mWithFooter)
itemCount = itemCount + 1;
// return itemCount;
}
return itemCount;
}
private boolean isPositionHeader(int position) {
return position == 0;
}
private boolean isPositionFooter(int position) {
return position == getItemCount() - 1;
}
public void setOnClickListener(View.OnClickListener lis) {
mOnClickListener = lis;
}
protected Posts getItem(int position) {
return mWithHeader ? questionList.get(position - 1) : questionList.get(position);
}
private int getItemPosition(int position) {
return mWithHeader ? position - 1 : position;
}
public void setData(List<Posts> questionList) {
this.questionList = questionList;
}
public class VideoViewHolder extends RecyclerView.ViewHolder {
protected ImageView vImage;
protected TextView vName;
protected TextView vDetails, vTitle, vExcerpt;
String content;
String imageLink;
String title;
String date;
String link;
String author;
protected Context context;
public VideoViewHolder(View v) {
super(v);
vImage = v.findViewById(R.id.blog_image);
vTitle = v.findViewById(R.id.title);
vExcerpt = v.findViewById(R.id.excerpt);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "Item Clicked:" + vTitle.getText().toString());
Intent fullScreenIntent = new Intent(context.getApplicationContext(), PostFullScreen.class);
fullScreenIntent.putExtra("content", content);
fullScreenIntent.putExtra("image", imageLink);
fullScreenIntent.putExtra("title", title);
fullScreenIntent.putExtra("date", date);
fullScreenIntent.putExtra("link", link);
fullScreenIntent.putExtra("author", author);
context.startActivity(fullScreenIntent);
}
});
}
public void clearAnimation() {
this.clearAnimation();
}
}
public class header extends RecyclerView.ViewHolder {
protected Context context;
protected int position;
public header(View v) {
super(v);
}
}
public class footer extends RecyclerView.ViewHolder {
protected Context context;
protected int position;
public footer(View v) {
super(v);
}
}
}
| 9,136 | 0.607049 | 0.602561 | 278 | 31.86331 | 28.652897 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586331 | false | false | 0 |
d9172ccb68d28732e35a46e30edb7640a0a76372 | 9,929,964,391,480 | 9fac6dd298708619d9da801eea3d6448fb855892 | /app/src/main/java/com/example/sherly/medigent/model/EditModel.java | f9468bcc589324f508573d301b3b75f73c3b2016 | []
| no_license | sherlyfekay/medigent | https://github.com/sherlyfekay/medigent | 76a878d61e621d5b02caa26080ac3f926de87a80 | 63f91cd89cdd7ecf50b502ce2bcd527fef1215b5 | refs/heads/master | 2021-09-18T15:36:10.019000 | 2018-07-16T16:52:16 | 2018-07-16T16:52:16 | 126,015,718 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.sherly.medigent.model;
public class EditModel {
String propName, value;
public EditModel(String propName, String value) {
this.propName = propName;
this.value = value;
}
}
| UTF-8 | Java | 222 | java | EditModel.java | Java | [
{
"context": "package com.example.sherly.medigent.model;\n\npublic class EditModel {\n Str",
"end": 26,
"score": 0.6257840394973755,
"start": 24,
"tag": "USERNAME",
"value": "ly"
}
]
| null | []
| package com.example.sherly.medigent.model;
public class EditModel {
String propName, value;
public EditModel(String propName, String value) {
this.propName = propName;
this.value = value;
}
}
| 222 | 0.671171 | 0.671171 | 10 | 21.200001 | 17.965523 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 0 |
446c8f590000767bfb9fb3631fe75aaa37c6fb72 | 23,287,312,686,390 | 2ea49bfaa6bc1b9301b025c5b2ca6fde7e5bb9df | /contributions/manuxviii/Java/Fundamentals/2016-10-28.java | 7346291587d19565d5ed071e627dd49c36fa54af | []
| no_license | 0x8801/commit | https://github.com/0x8801/commit | 18f25a9449f162ee92945b42b93700e12fd4fd77 | e7692808585bc7e9726f61f7f6baf43dc83e28ac | refs/heads/master | 2021-10-13T08:04:48.200000 | 2016-12-20T01:59:47 | 2016-12-20T01:59:47 | 76,935,980 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | Writing generic methods
Altering format string output by changing a format specifier's `argument_index`
Measuring time
Limit Accessibility of `Fields`
Avoid using `static` variables | UTF-8 | Java | 181 | java | 2016-10-28.java | Java | []
| null | []
| Writing generic methods
Altering format string output by changing a format specifier's `argument_index`
Measuring time
Limit Accessibility of `Fields`
Avoid using `static` variables | 181 | 0.834254 | 0.834254 | 5 | 35.400002 | 22.632719 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | false | false | 0 |
5dfee0f70831dc788870ca72a6153c666d4c99a7 | 12,386,685,742,284 | 5667b148414193c0cb992091823fc2522d124cd6 | /app/src/main/java/adam/notebook/example/com/kpproject6/module/profile/PasswordFragment.java | de4e80fc9fa4e346fbdc64bfc23ce05b89f024cb | []
| no_license | ahmadshofiehilmi/Project-KPlain | https://github.com/ahmadshofiehilmi/Project-KPlain | 8c4af586922fc3ed7273d3622b1a166f7c3c4f24 | 8dfcac4dcb77fb475e4e9c7b9522f0e1f6ba7f02 | refs/heads/master | 2020-04-24T22:09:23.503000 | 2019-02-26T04:30:07 | 2019-02-26T04:30:07 | 172,302,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package adam.notebook.example.com.kpproject6.module.profile;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import adam.notebook.example.com.kpproject6.R;
public class PasswordFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.password_fragment, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
}
| UTF-8 | Java | 821 | java | PasswordFragment.java | Java | []
| null | []
| package adam.notebook.example.com.kpproject6.module.profile;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import adam.notebook.example.com.kpproject6.R;
public class PasswordFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.password_fragment, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
}
| 821 | 0.780755 | 0.777101 | 26 | 30.576923 | 32.193134 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.653846 | false | false | 0 |
002e2672a7e56335766ed7d731f202f53df323e4 | 17,746,804,924,294 | 19ccae670e9da68224f41d5ec7c0b1c9dc4e92a1 | /week-02/day-4/Power.java | a0ffaee0572637d60d8fb91df289a6728e59c2c6 | []
| no_license | green-fox-academy/grinder | https://github.com/green-fox-academy/grinder | 7775e37a8cebc46b47acdb5350562934f253c949 | bccad198e6952073a76b8db34f4fbc82ded4ddb5 | refs/heads/master | 2020-05-05T02:47:47.848000 | 2019-06-06T11:56:55 | 2019-06-06T11:56:55 | 179,650,320 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Power {
public static void main(String[] args) {
//Given base and n that are both 1 or more, compute recursively
// (no loops) the value of base to the n power, so powerN(3, 2) is 9 (3 squared).
System.out.println(power(3, 4));
}
public static int power(int n, int powerMaker) {
if (n <= 1 || powerMaker <= 0) {
return 1;
}
else {
return n * power(n, powerMaker - 1);
}
}
}
| UTF-8 | Java | 488 | java | Power.java | Java | []
| null | []
| public class Power {
public static void main(String[] args) {
//Given base and n that are both 1 or more, compute recursively
// (no loops) the value of base to the n power, so powerN(3, 2) is 9 (3 squared).
System.out.println(power(3, 4));
}
public static int power(int n, int powerMaker) {
if (n <= 1 || powerMaker <= 0) {
return 1;
}
else {
return n * power(n, powerMaker - 1);
}
}
}
| 488 | 0.528689 | 0.506148 | 19 | 24.631578 | 25.984226 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.578947 | false | false | 0 |
0d91ad256981cd6e92725ed2a8886150456043cf | 33,397,665,755,430 | f91fa5521e61749618bd06b8994815016a8fe745 | /Java/Collections/GenericTypes.java | e4fc19089360c706b62467cba215deb1d05bc972 | []
| no_license | travisprol0/Infosys-Java | https://github.com/travisprol0/Infosys-Java | 2eeab6b705ca32c462143867688b1ae24e8340ca | 7124901de1a96fb7b253be18a80aad32e8336410 | refs/heads/master | 2023-03-21T12:56:57.405000 | 2021-03-08T20:48:38 | 2021-03-08T20:48:38 | 339,444,874 | 2 | 2 | null | false | 2021-03-02T22:30:56 | 2021-02-16T15:36:23 | 2021-03-02T21:33:55 | 2021-03-02T22:30:55 | 85,982 | 0 | 1 | 0 | Java | false | false | // Consider the following container class
public class Container {
private Object object;
public void set(Object object){
this.object = object;
}
public Object get(){
return object;
}
}
/*
This non-generic Container class operates on objects of any type.
Since its methods accept or return an Object, you can pass whatever you want but there is no way to verify at compile time, how the class is being used. Someone may place an Integer in the container and expect to get Integers out of it, while someone else may pass in a String resulting in a runtime error.
Generic version of the Container Class
A generic class is defined with the following format:
*/
class name<T1, T2, ..., Tn> { /* ... */ }
/*
The type parameter section, delimited by angle brackets (<>), follows the class name. It specifies the type parameters (also called type variables) T1, T2, ... and Tn.
Container class can be updated with Generics as follows:
*/
public class Container<T> {
// T stands for "Type"
private T t;
public void set(T t) {
this.t = t;
}
public T get() {
return t;
}
}
/*
As you can see, all occurrences of Objects are replaced by T.
A type variable can be any non-primitive type you specify, any class type, any interface type, any array type or even another type variable.
This same technique can be applied to create generic interfaces as well.
*/
| UTF-8 | Java | 1,415 | java | GenericTypes.java | Java | []
| null | []
| // Consider the following container class
public class Container {
private Object object;
public void set(Object object){
this.object = object;
}
public Object get(){
return object;
}
}
/*
This non-generic Container class operates on objects of any type.
Since its methods accept or return an Object, you can pass whatever you want but there is no way to verify at compile time, how the class is being used. Someone may place an Integer in the container and expect to get Integers out of it, while someone else may pass in a String resulting in a runtime error.
Generic version of the Container Class
A generic class is defined with the following format:
*/
class name<T1, T2, ..., Tn> { /* ... */ }
/*
The type parameter section, delimited by angle brackets (<>), follows the class name. It specifies the type parameters (also called type variables) T1, T2, ... and Tn.
Container class can be updated with Generics as follows:
*/
public class Container<T> {
// T stands for "Type"
private T t;
public void set(T t) {
this.t = t;
}
public T get() {
return t;
}
}
/*
As you can see, all occurrences of Objects are replaced by T.
A type variable can be any non-primitive type you specify, any class type, any interface type, any array type or even another type variable.
This same technique can be applied to create generic interfaces as well.
*/
| 1,415 | 0.710247 | 0.70742 | 55 | 24.709091 | 50.19405 | 306 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 0 |
95e70dbed7fd78cd08ee9e1d29d8a72ed1962abe | 17,721,035,113,531 | d11d70b60c797d6f36cf84ab9ca275284e8c8f15 | /src/main/java/it/relatech/model/Noleggio.java | 4fba81441e5d3f39c51f0b81580a146e226e04f1 | []
| no_license | Sonares/Noleggio | https://github.com/Sonares/Noleggio | 09932bfae02e72a1bfa51019e7db7177e7313507 | 21096c6919277d67aaa2d9cd2bb2f15ae3213783 | refs/heads/master | 2021-08-24T01:08:08.103000 | 2017-12-07T11:04:45 | 2017-12-07T11:04:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.relatech.model;
import java.time.LocalDate;
import it.relatech.serializer.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@Entity
public class Noleggio {
@Id
@GeneratedValue
private int id;
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate inizioNoleggio;
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate fineNoleggio;
private double costoNoleggio;
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinColumn(name = "CLIENTE_ID")
private Cliente cliente;
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinColumn(name = "VEICOLO_ID")
private Veicolo veicolo;
public Noleggio() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public LocalDate getInizioNoleggio() {
return inizioNoleggio;
}
public void setInizioNoleggio(LocalDate inizioNoleggio) {
this.inizioNoleggio = inizioNoleggio;
}
public LocalDate getFineNoleggio() {
return fineNoleggio;
}
public void setFineNoleggio(LocalDate fineNoleggio) {
this.fineNoleggio = fineNoleggio;
}
public double getCostoNoleggio() {
return costoNoleggio;
}
public void setCostoNoleggio(double costoNoleggio) {
this.costoNoleggio = costoNoleggio;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public Veicolo getVeicolo() {
return veicolo;
}
public void setVeicolo(Veicolo veicolo) {
this.veicolo = veicolo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cliente == null) ? 0 : cliente.hashCode());
long temp;
temp = Double.doubleToLongBits(costoNoleggio);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((fineNoleggio == null) ? 0 : fineNoleggio.hashCode());
result = prime * result + ((inizioNoleggio == null) ? 0 : inizioNoleggio.hashCode());
result = prime * result + ((veicolo == null) ? 0 : veicolo.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Noleggio other = (Noleggio) obj;
if (cliente == null) {
if (other.cliente != null)
return false;
} else if (!cliente.equals(other.cliente))
return false;
if (Double.doubleToLongBits(costoNoleggio) != Double.doubleToLongBits(other.costoNoleggio))
return false;
if (fineNoleggio == null) {
if (other.fineNoleggio != null)
return false;
} else if (!fineNoleggio.equals(other.fineNoleggio))
return false;
if (inizioNoleggio == null) {
if (other.inizioNoleggio != null)
return false;
} else if (!inizioNoleggio.equals(other.inizioNoleggio))
return false;
if (veicolo == null) {
if (other.veicolo != null)
return false;
} else if (!veicolo.equals(other.veicolo))
return false;
return true;
}
@Override
public String toString() {
return "Noleggio [id=" + id + ", inizioNoleggio=" + inizioNoleggio + ", fineNoleggio=" + fineNoleggio
+ ", costoNoleggio=" + costoNoleggio + ", cliente=" + cliente + ", veicolo=" + veicolo + "]";
}
}
| UTF-8 | Java | 3,688 | java | Noleggio.java | Java | []
| null | []
| package it.relatech.model;
import java.time.LocalDate;
import it.relatech.serializer.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@Entity
public class Noleggio {
@Id
@GeneratedValue
private int id;
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate inizioNoleggio;
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate fineNoleggio;
private double costoNoleggio;
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinColumn(name = "CLIENTE_ID")
private Cliente cliente;
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinColumn(name = "VEICOLO_ID")
private Veicolo veicolo;
public Noleggio() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public LocalDate getInizioNoleggio() {
return inizioNoleggio;
}
public void setInizioNoleggio(LocalDate inizioNoleggio) {
this.inizioNoleggio = inizioNoleggio;
}
public LocalDate getFineNoleggio() {
return fineNoleggio;
}
public void setFineNoleggio(LocalDate fineNoleggio) {
this.fineNoleggio = fineNoleggio;
}
public double getCostoNoleggio() {
return costoNoleggio;
}
public void setCostoNoleggio(double costoNoleggio) {
this.costoNoleggio = costoNoleggio;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public Veicolo getVeicolo() {
return veicolo;
}
public void setVeicolo(Veicolo veicolo) {
this.veicolo = veicolo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cliente == null) ? 0 : cliente.hashCode());
long temp;
temp = Double.doubleToLongBits(costoNoleggio);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((fineNoleggio == null) ? 0 : fineNoleggio.hashCode());
result = prime * result + ((inizioNoleggio == null) ? 0 : inizioNoleggio.hashCode());
result = prime * result + ((veicolo == null) ? 0 : veicolo.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Noleggio other = (Noleggio) obj;
if (cliente == null) {
if (other.cliente != null)
return false;
} else if (!cliente.equals(other.cliente))
return false;
if (Double.doubleToLongBits(costoNoleggio) != Double.doubleToLongBits(other.costoNoleggio))
return false;
if (fineNoleggio == null) {
if (other.fineNoleggio != null)
return false;
} else if (!fineNoleggio.equals(other.fineNoleggio))
return false;
if (inizioNoleggio == null) {
if (other.inizioNoleggio != null)
return false;
} else if (!inizioNoleggio.equals(other.inizioNoleggio))
return false;
if (veicolo == null) {
if (other.veicolo != null)
return false;
} else if (!veicolo.equals(other.veicolo))
return false;
return true;
}
@Override
public String toString() {
return "Noleggio [id=" + id + ", inizioNoleggio=" + inizioNoleggio + ", fineNoleggio=" + fineNoleggio
+ ", costoNoleggio=" + costoNoleggio + ", cliente=" + cliente + ", veicolo=" + veicolo + "]";
}
}
| 3,688 | 0.710683 | 0.708243 | 148 | 23.918919 | 22.826761 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.655405 | false | false | 0 |
0b5f25d05bdae23fc2d450068714ca0b4a164929 | 2,473,901,204,834 | 5b756956d7cb2027d9c7bf19ee485d577afdacdd | /sml-config/src/main/java/org/hw/sml/config/ch/server/ServerListener.java | c0152e036f72eb7a7b8f6a8dd3f2374aba0c117c | []
| no_license | huangwenjimmy/sml-module | https://github.com/huangwenjimmy/sml-module | 588c50b9e8e21e662dbd13e77fccbe2ff6be342a | 22034d6969c6e5a5bf51734452ee111edcc2b8d7 | refs/heads/master | 2021-01-11T00:57:04.707000 | 2020-06-11T10:25:05 | 2020-06-11T10:25:05 | 70,474,778 | 10 | 6 | null | false | 2020-10-13T01:45:00 | 2016-10-10T09:50:10 | 2020-09-15T02:58:01 | 2020-10-13T01:44:59 | 12,204 | 9 | 5 | 7 | JavaScript | false | false | package org.hw.sml.config.ch.server;
import java.util.Map;
import org.hw.sml.config.model.Service;
public interface ServerListener {
public void listener(Map<String,Service> services);
}
| UTF-8 | Java | 200 | java | ServerListener.java | Java | []
| null | []
| package org.hw.sml.config.ch.server;
import java.util.Map;
import org.hw.sml.config.model.Service;
public interface ServerListener {
public void listener(Map<String,Service> services);
}
| 200 | 0.745 | 0.745 | 9 | 20.222221 | 19.355032 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 0 |
bf93671bb1403b301b5e8fe26d39312ebc4299c7 | 28,054,726,382,744 | e1edfc604bb197ade75af36a69defb2224a30e0b | /src/main/java/com/example/dormitoryms/security/adminAuthenticationFilter.java | db33cb4560ed969426b086b5d3a36de37a54b563 | []
| no_license | Hanserr/dormitoryMS | https://github.com/Hanserr/dormitoryMS | b1e623d7fb2bedcf33abc51e04b60905d595155d | 77f8984da4b9d56e22d588c5c3cf595442760a14 | refs/heads/master | 2023-09-06T05:29:07.852000 | 2021-11-20T05:38:04 | 2021-11-20T05:38:04 | 385,967,058 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.dormitoryms.security;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 自定义用户验证过滤器
* @Auther Shelter
* @Date 10/4/2021
**/
public class adminAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (!request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
}
if (request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE)){
//获取用户名密码
String username = (String) request.getAttribute("username");
String password = (String) request.getAttribute("password");
if (username == null){
username = "";
}
if (password == null){
password = "";
}
username = username.trim();
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username,password);
setDetails(request,authenticationToken);
return this.getAuthenticationManager().authenticate(authenticationToken);
}
return super.attemptAuthentication(request,response);
}
}
| UTF-8 | Java | 1,877 | java | adminAuthenticationFilter.java | Java | [
{
"context": "HttpServletResponse;\n\n/**\n * 自定义用户验证过滤器\n * @Auther Shelter\n * @Date 10/4/2021\n **/\npublic class adminAuthent",
"end": 603,
"score": 0.9923129081726074,
"start": 596,
"tag": "USERNAME",
"value": "Shelter"
}
]
| null | []
| package com.example.dormitoryms.security;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 自定义用户验证过滤器
* @Auther Shelter
* @Date 10/4/2021
**/
public class adminAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
if (!request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
}
if (request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE)){
//获取用户名密码
String username = (String) request.getAttribute("username");
String password = (String) request.getAttribute("password");
if (username == null){
username = "";
}
if (password == null){
password = "";
}
username = username.trim();
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username,password);
setDetails(request,authenticationToken);
return this.getAuthenticationManager().authenticate(authenticationToken);
}
return super.attemptAuthentication(request,response);
}
}
| 1,877 | 0.727618 | 0.72382 | 41 | 43.951218 | 36.705784 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.560976 | false | false | 0 |
dae7b8a036a3595a1cd2541c7c9551b9294e4f4d | 10,127,532,891,528 | 38756e6af93b564a2f0699638a955e134de68894 | /src/offer/thirty/QuickSort.java | 2b06ac2637402459a51f59a957cd8b09b6565c3a | []
| no_license | colining/SwordtoOffer | https://github.com/colining/SwordtoOffer | b94ee0eba26dd27cbaee6e9b0199acb552aa3804 | 16792524aad9c0ecf38c01bad5c5d2cfdf89b225 | refs/heads/master | 2021-01-20T13:55:31.804000 | 2017-08-17T07:23:07 | 2017-08-17T07:23:07 | 90,535,976 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package offer.thirty;
import java.util.Arrays;
/**
* Created by asus on 2017/3/27.
*/
public class QuickSort {
/*
快排
*/
public static void main(String[] arg) {
int a[] = {2, 3, 5, 8, 2, 5, 0, 9};
System.out.println(Arrays.toString(quickSort1(a, 0, a.length - 1)));
}
public static int AdjustArray(int array[], int left, int right) {
int x = array[left];
while (left < right) {
while (array[right] >= x && left < right)
right--;
if (left < right) {
array[left] = array[right];
left++;
}
while (array[left] < x && left < right)
left++;
if (left < right) {
array[right] = array[left];
right--;
}
}
array[left] = x;
return left;
}
public static int[] quickSort(int array[], int left, int right) {
if (left < right) {
int mid = AdjustArray(array, left, right);
quickSort(array, left, mid - 1);
quickSort(array, mid + 1, right);
}
return array;
}
public static int[] quickSort1(int array[], int left, int right) {
if (left < right) {
//左右指针的备份,与哨兵x;
int leftBack = left;
int rightBack = right;
int x = array[leftBack];
while (left < right) {
//从右向左找到一个小于哨兵的值,然后扔到前面去,此时右指针还指向当前这个值,
//因为当前这个值小于哨兵,所以一定会被某个值取代
while (array[right] >= x && left < right) {
right--;
}
if (left < right) {
array[left] = array[right];
left++;
}
//从左向右找到大于哨兵的值
while (array[left] < x && left < right) {
left++;
}
if (left < right) {
array[right] = array[left];
right--;
}
}
//将哨兵补到最后剩余的位置,这就是它最后的位置,左面比它小,右面比它大
array[left] = x;
//进入递归,哨兵已然在正确的位置,所以不用对它排序了;
quickSort1(array, leftBack, left - 1);
quickSort1(array, left + 1, rightBack);
}
return array;
}
}
| UTF-8 | Java | 2,607 | java | QuickSort.java | Java | [
{
"context": "irty;\n\nimport java.util.Arrays;\n\n/**\n * Created by asus on 2017/3/27.\n */\npublic class QuickSort {\n /*",
"end": 71,
"score": 0.9971126317977905,
"start": 67,
"tag": "USERNAME",
"value": "asus"
}
]
| null | []
| package offer.thirty;
import java.util.Arrays;
/**
* Created by asus on 2017/3/27.
*/
public class QuickSort {
/*
快排
*/
public static void main(String[] arg) {
int a[] = {2, 3, 5, 8, 2, 5, 0, 9};
System.out.println(Arrays.toString(quickSort1(a, 0, a.length - 1)));
}
public static int AdjustArray(int array[], int left, int right) {
int x = array[left];
while (left < right) {
while (array[right] >= x && left < right)
right--;
if (left < right) {
array[left] = array[right];
left++;
}
while (array[left] < x && left < right)
left++;
if (left < right) {
array[right] = array[left];
right--;
}
}
array[left] = x;
return left;
}
public static int[] quickSort(int array[], int left, int right) {
if (left < right) {
int mid = AdjustArray(array, left, right);
quickSort(array, left, mid - 1);
quickSort(array, mid + 1, right);
}
return array;
}
public static int[] quickSort1(int array[], int left, int right) {
if (left < right) {
//左右指针的备份,与哨兵x;
int leftBack = left;
int rightBack = right;
int x = array[leftBack];
while (left < right) {
//从右向左找到一个小于哨兵的值,然后扔到前面去,此时右指针还指向当前这个值,
//因为当前这个值小于哨兵,所以一定会被某个值取代
while (array[right] >= x && left < right) {
right--;
}
if (left < right) {
array[left] = array[right];
left++;
}
//从左向右找到大于哨兵的值
while (array[left] < x && left < right) {
left++;
}
if (left < right) {
array[right] = array[left];
right--;
}
}
//将哨兵补到最后剩余的位置,这就是它最后的位置,左面比它小,右面比它大
array[left] = x;
//进入递归,哨兵已然在正确的位置,所以不用对它排序了;
quickSort1(array, leftBack, left - 1);
quickSort1(array, left + 1, rightBack);
}
return array;
}
}
| 2,607 | 0.432397 | 0.421598 | 81 | 27.580246 | 19.097452 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.679012 | false | false | 0 |
a4c4e254d22e725581f98a9a7b2e05b7f5f0983a | 13,168,369,789,400 | bd7e2cc63e58314226a3ea7e135618a6e4b966a0 | /src/basicWeb/CalendarSelection.java | 481bbf2e3fda1f2b9f6d5a271aac501522356c1e | []
| no_license | nishantmodh/Selenium-Practice | https://github.com/nishantmodh/Selenium-Practice | 1d28981f6d53bd8e25facb74782ac1848d01a493 | a8c79f507f876535cdded74f749f2450fdc917d7 | refs/heads/master | 2021-01-02T23:17:11.589000 | 2018-02-27T17:42:23 | 2018-02-27T17:42:23 | 99,254,988 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package basicWeb;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class CalendarSelection {
private WebDriver driver;
private String baseURL;
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseURL = "https://www.expedia.com/";
//driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void test1() throws Exception {
driver.get(baseURL);
driver.findElement(By.id("tab-flight-tab-hp")).click();
WebElement departingField = driver.findElement(By.id("flight-departing-hp-flight"));
departingField.click();
Thread.sleep(3000);
WebElement dateToSelect = driver.findElement(By.xpath("//div[@class='datepicker-cal-month'][position()=1]//button[text()='7']"));
dateToSelect.click();
}
@Test
public void test2() throws Exception {
driver.get(baseURL);
driver.findElement(By.id("tab-flight-tab-hp")).click();
WebElement departingField = driver.findElement(By.id("flight-departing-hp-flight"));
departingField.click();
WebElement calMonth = driver.findElement(By.xpath("//div[@class='datepicker-cal-month'][position()=1]"));
List<WebElement> allValidDates = calMonth.findElements(By.tagName("button"));
for(WebElement date: allValidDates) {
if(date.getText().equals("7")) {
date.click();
break;
}
}
}
@After
public void tearDown() throws Exception {
Thread.sleep(2000);
driver.quit();
}
}
| UTF-8 | Java | 1,707 | java | CalendarSelection.java | Java | []
| null | []
| package basicWeb;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class CalendarSelection {
private WebDriver driver;
private String baseURL;
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseURL = "https://www.expedia.com/";
//driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void test1() throws Exception {
driver.get(baseURL);
driver.findElement(By.id("tab-flight-tab-hp")).click();
WebElement departingField = driver.findElement(By.id("flight-departing-hp-flight"));
departingField.click();
Thread.sleep(3000);
WebElement dateToSelect = driver.findElement(By.xpath("//div[@class='datepicker-cal-month'][position()=1]//button[text()='7']"));
dateToSelect.click();
}
@Test
public void test2() throws Exception {
driver.get(baseURL);
driver.findElement(By.id("tab-flight-tab-hp")).click();
WebElement departingField = driver.findElement(By.id("flight-departing-hp-flight"));
departingField.click();
WebElement calMonth = driver.findElement(By.xpath("//div[@class='datepicker-cal-month'][position()=1]"));
List<WebElement> allValidDates = calMonth.findElements(By.tagName("button"));
for(WebElement date: allValidDates) {
if(date.getText().equals("7")) {
date.click();
break;
}
}
}
@After
public void tearDown() throws Exception {
Thread.sleep(2000);
driver.quit();
}
}
| 1,707 | 0.719977 | 0.710603 | 61 | 26.983606 | 27.422314 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.836066 | false | false | 0 |
49a00d6d0150cb6a82bdda272444ccb7f3445eec | 4,389,456,643,489 | 66040012e86f84b89c9a8e71301af257114489ef | /shop/src/test/java/com/vjshop/AbstractClientTest.java | ba31db9b3510a7af4b290066a76b2dbdcabbaa19 | []
| no_license | jjmnbv/vjshop-root | https://github.com/jjmnbv/vjshop-root | 92d3c364efe5e5624fb2d07c06071d0646cd8931 | 735488844d45d0f226922187fd4939df1a8893b1 | refs/heads/master | 2020-05-21T07:22:31.483000 | 2018-03-22T04:57:43 | 2018-03-22T04:57:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vjshop;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.internal.runners.JUnit4ClassRunner;
import org.junit.runner.RunWith;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
/**
* Created by moss-zc on 2017/5/22.
*
* @author yishop term
* @since 0.1
*/
@RunWith(JUnit4ClassRunner.class)
public class AbstractClientTest {
ObjectMapper objectMapper; //JSON
public String baseUri = "http://localhost:8090/api/";
private static Server server;
public RestTemplate restTemplate = new RestTemplate();
@Before
public void setUp() throws Exception {
objectMapper = new ObjectMapper(); //需要添加jackson jar包
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
messageConverters.add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
messageConverters.add(new FormHttpMessageConverter());
messageConverters.add(new MappingJackson2HttpMessageConverter());
restTemplate = new RestTemplate(messageConverters);
restTemplate.setRequestFactory(requestFactory);
restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
}
@BeforeClass
public static void beforeClass() throws Exception {
//创建一个server
server = new Server(8090);
WebAppContext context = new WebAppContext();
String webapp = "src/main/webapp";
context.setDescriptor(webapp + "/WEB-INF/web.xml"); //指定web.xml配置文件
context.setResourceBase(webapp); //指定webapp目录
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
}
@AfterClass
public static void afterClass() throws Exception {
server.stop(); //当测试结束时停止服务器
}
}
| UTF-8 | Java | 2,846 | java | AbstractClientTest.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by moss-zc on 2017/5/22.\n *\n * @author yishop term\n * @since",
"end": 1130,
"score": 0.9996495842933655,
"start": 1123,
"tag": "USERNAME",
"value": "moss-zc"
},
{
"context": "\n * Created by moss-zc on 2017/5/22.\n *\n * @author yishop term\n * @since 0.1\n */\n\n@RunWith(JUnit4ClassRunner.cla",
"end": 1170,
"score": 0.9878658056259155,
"start": 1159,
"tag": "USERNAME",
"value": "yishop term"
}
]
| null | []
| package com.vjshop;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.internal.runners.JUnit4ClassRunner;
import org.junit.runner.RunWith;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
/**
* Created by moss-zc on 2017/5/22.
*
* @author yishop term
* @since 0.1
*/
@RunWith(JUnit4ClassRunner.class)
public class AbstractClientTest {
ObjectMapper objectMapper; //JSON
public String baseUri = "http://localhost:8090/api/";
private static Server server;
public RestTemplate restTemplate = new RestTemplate();
@Before
public void setUp() throws Exception {
objectMapper = new ObjectMapper(); //需要添加jackson jar包
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
messageConverters.add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
messageConverters.add(new FormHttpMessageConverter());
messageConverters.add(new MappingJackson2HttpMessageConverter());
restTemplate = new RestTemplate(messageConverters);
restTemplate.setRequestFactory(requestFactory);
restTemplate.setErrorHandler(new DefaultResponseErrorHandler());
}
@BeforeClass
public static void beforeClass() throws Exception {
//创建一个server
server = new Server(8090);
WebAppContext context = new WebAppContext();
String webapp = "src/main/webapp";
context.setDescriptor(webapp + "/WEB-INF/web.xml"); //指定web.xml配置文件
context.setResourceBase(webapp); //指定webapp目录
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
}
@AfterClass
public static void afterClass() throws Exception {
server.stop(); //当测试结束时停止服务器
}
}
| 2,846 | 0.760589 | 0.751974 | 75 | 36.146667 | 26.594584 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 0 |
41fb838ec3cf6ed5dabf8b99348a7a7fc9419276 | 29,549,375,049,790 | a4dab24c0cdd7c8c52b5206f44a620c3d8dd8491 | /product-api/java/samples/src/main/java/com/expedia/lct/eps/sdk/product/samples/RoomTypeSamples.java | c012fd525839851c4f49d937044577e947b93500 | []
| no_license | houcin175/exp-connectivity-util | https://github.com/houcin175/exp-connectivity-util | 9cf79315442f776a4d9d3456eb455103a3effb8d | 5bda8532ff5c8a577626a510ceffa2638209513c | refs/heads/master | 2020-04-27T13:29:14.055000 | 2017-05-05T14:19:56 | 2017-05-05T14:19:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.expedia.lct.eps.sdk.product.samples;
import com.expedia.lct.eps.sdk.product.ApiClient;
import com.expedia.lct.eps.sdk.product.ApiException;
import com.expedia.lct.eps.sdk.product.Configuration;
import com.expedia.lct.eps.sdk.product.api.RoomTypeApi;
import com.expedia.lct.eps.sdk.product.model.RoomTypeDTO;
import java.util.List;
public class RoomTypeSamples {
public static final String PROPERTY_ID = "12933873";
public static final String ROOM_TYPE_ID = "201357991";
/*
* Set credentials in API Client.
*/
static {
final ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.setUsername("EQCtest12933873");
apiClient.setPassword("cc47an46");
}
private void runSamples() throws Exception {
System.out.println("*** getRoomTypes ***\n");
getRoomTypes();
System.out.println("*** getRoomType ***\n");
getRoomType();
System.out.println("*** createRoomType ***\n");
createRoomType();
System.out.println("*** updateRoomType ***\n");
updateRoomType();
}
public void getRoomTypes() throws ApiException {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final List<RoomTypeDTO> roomTypes =
roomTypeApi.getRoomTypes(PROPERTY_ID, null).getEntity();
roomTypes.stream().forEach(this::displayRoomType);
}
public void getRoomType() throws Exception {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final RoomTypeDTO roomTypeDTO =
roomTypeApi.getRoomType(PROPERTY_ID, ROOM_TYPE_ID).getEntity();
displayRoomType(roomTypeDTO);
}
public void createRoomType() throws Exception {
System.out.println("No sample");
System.out.println();
}
public void updateRoomType() throws Exception {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final RoomTypeDTO roomTypeDTO =
roomTypeApi.getRoomType(PROPERTY_ID, ROOM_TYPE_ID).getEntity();
System.out.println("Partner Code before update: " + roomTypeDTO.getPartnerCode());
roomTypeDTO.setPartnerCode("PC" + randomInt());
final RoomTypeDTO updatedRoomTypeDTO =
roomTypeApi.updateRoomType(PROPERTY_ID, ROOM_TYPE_ID, roomTypeDTO).getEntity();
System.out.println("Partner Code after update: " + updatedRoomTypeDTO.getPartnerCode());
}
private void displayRoomType(RoomTypeDTO roomTypeDTO) {
System.out.println("RoomType");
System.out.println(" id: " + roomTypeDTO.getResourceId());
System.out.println(" name: " + roomTypeDTO.getName().getValue());
System.out.println();
}
private int randomInt() {
return (int) (Math.random() * 1000);
}
public static void main(String[] args) throws Exception {
RoomTypeSamples roomTypeSamples = new RoomTypeSamples();
try {
roomTypeSamples.runSamples();
} catch (ApiException e) {
System.err.println("Product Error!!!");
System.err.println("Code " + e.getCode());
System.err.println("Body " + e.getResponseBody());
throw e;
}
}
}
| UTF-8 | Java | 3,199 | java | RoomTypeSamples.java | Java | [
{
"context": "efaultApiClient();\n apiClient.setUsername(\"EQCtest12933873\");\n apiClient.setPassword(\"cc47an46\");\n ",
"end": 680,
"score": 0.9983211755752563,
"start": 665,
"tag": "USERNAME",
"value": "EQCtest12933873"
},
{
"context": "EQCtest12933873\");\n apiClient.setPassword(\"cc47an46\");\n }\n\n private void runSamples() throws Ex",
"end": 723,
"score": 0.9993190765380859,
"start": 715,
"tag": "PASSWORD",
"value": "cc47an46"
}
]
| null | []
| package com.expedia.lct.eps.sdk.product.samples;
import com.expedia.lct.eps.sdk.product.ApiClient;
import com.expedia.lct.eps.sdk.product.ApiException;
import com.expedia.lct.eps.sdk.product.Configuration;
import com.expedia.lct.eps.sdk.product.api.RoomTypeApi;
import com.expedia.lct.eps.sdk.product.model.RoomTypeDTO;
import java.util.List;
public class RoomTypeSamples {
public static final String PROPERTY_ID = "12933873";
public static final String ROOM_TYPE_ID = "201357991";
/*
* Set credentials in API Client.
*/
static {
final ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.setUsername("EQCtest12933873");
apiClient.setPassword("<PASSWORD>");
}
private void runSamples() throws Exception {
System.out.println("*** getRoomTypes ***\n");
getRoomTypes();
System.out.println("*** getRoomType ***\n");
getRoomType();
System.out.println("*** createRoomType ***\n");
createRoomType();
System.out.println("*** updateRoomType ***\n");
updateRoomType();
}
public void getRoomTypes() throws ApiException {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final List<RoomTypeDTO> roomTypes =
roomTypeApi.getRoomTypes(PROPERTY_ID, null).getEntity();
roomTypes.stream().forEach(this::displayRoomType);
}
public void getRoomType() throws Exception {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final RoomTypeDTO roomTypeDTO =
roomTypeApi.getRoomType(PROPERTY_ID, ROOM_TYPE_ID).getEntity();
displayRoomType(roomTypeDTO);
}
public void createRoomType() throws Exception {
System.out.println("No sample");
System.out.println();
}
public void updateRoomType() throws Exception {
RoomTypeApi roomTypeApi = new RoomTypeApi();
final RoomTypeDTO roomTypeDTO =
roomTypeApi.getRoomType(PROPERTY_ID, ROOM_TYPE_ID).getEntity();
System.out.println("Partner Code before update: " + roomTypeDTO.getPartnerCode());
roomTypeDTO.setPartnerCode("PC" + randomInt());
final RoomTypeDTO updatedRoomTypeDTO =
roomTypeApi.updateRoomType(PROPERTY_ID, ROOM_TYPE_ID, roomTypeDTO).getEntity();
System.out.println("Partner Code after update: " + updatedRoomTypeDTO.getPartnerCode());
}
private void displayRoomType(RoomTypeDTO roomTypeDTO) {
System.out.println("RoomType");
System.out.println(" id: " + roomTypeDTO.getResourceId());
System.out.println(" name: " + roomTypeDTO.getName().getValue());
System.out.println();
}
private int randomInt() {
return (int) (Math.random() * 1000);
}
public static void main(String[] args) throws Exception {
RoomTypeSamples roomTypeSamples = new RoomTypeSamples();
try {
roomTypeSamples.runSamples();
} catch (ApiException e) {
System.err.println("Product Error!!!");
System.err.println("Code " + e.getCode());
System.err.println("Body " + e.getResponseBody());
throw e;
}
}
}
| 3,201 | 0.647077 | 0.636761 | 101 | 30.673267 | 26.866413 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.49505 | false | false | 0 |
9adf1c6222b4e8a803dad703a462c0ec39e74b6a | 15,676,630,699,230 | c439ab9f4a610c29d14d8ea2faec319546e707f4 | /src/main/java/com/wteam/ug/serviceImpl/PermissionServiceImpl.java | aeebe9fb7284ce569d1df7e23d2af033663faca0 | []
| no_license | GreenTo/UG | https://github.com/GreenTo/UG | cdf4af8ffcd5e73cdf654c779e3540e70dda202a | d2763b9d4d563cb4b9bdc6133a4cb8dc18015ac7 | refs/heads/master | 2020-04-18T16:47:53.266000 | 2019-01-26T02:44:29 | 2019-01-26T02:44:29 | 167,641,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wteam.ug.serviceImpl;
import com.wteam.ug.entity.Permission;
import com.wteam.ug.repository.PermissionRepository;
import com.wteam.ug.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.Date;
import java.util.List;
@Service
public class PermissionServiceImpl implements PermissionService {
@Autowired
PermissionRepository permissionRepository;
@Override
public boolean add(Permission permission) {
boolean b;
try {
permission.setCreateDate(new Date());
permissionRepository.save(permission);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public boolean update(Permission permission) {
boolean b;
try {
permissionRepository.save(permission);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public boolean delete(long id) {
boolean b;
try {
permissionRepository.deleteById(id);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public Permission findById(long id) {
Permission permission = permissionRepository.findById(id).get();
return permission;
}
@Override
public List<Permission> findAll() {
List<Permission> permissionList = permissionRepository.findAll();
return permissionList;
}
@Override
public Page<Permission> findByPage(Integer page, Integer size) {
Pageable pageable = new PageRequest(page - 1, size);
Page<Permission> permissionPage = permissionRepository.findAll(pageable);
return permissionPage;
}
@Override
public Page<Permission> search(String param, Integer page, Integer size) {
Pageable pageable = new PageRequest(page - 1, size);
Page<Permission> permissionPage = permissionRepository.findAll(new Specification<Permission>() {
@Override
public Predicate toPredicate(Root<Permission> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
Predicate predicate = criteriaBuilder.conjunction();
predicate.getExpressions().add(
criteriaBuilder.like(
root.get("name").as(String.class), "%" + param.trim() + "%"
)
);
return predicate;
}
}, pageable);
return permissionPage;
}
@Override
public Page<Permission> findByName(String name, Integer page, Integer size) {
Pageable pageable = new PageRequest(page-1,size);
Page<Permission> permissionPage = permissionRepository.findByName(name, pageable);
return permissionPage;
}
}
| UTF-8 | Java | 3,485 | java | PermissionServiceImpl.java | Java | []
| null | []
| package com.wteam.ug.serviceImpl;
import com.wteam.ug.entity.Permission;
import com.wteam.ug.repository.PermissionRepository;
import com.wteam.ug.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.Date;
import java.util.List;
@Service
public class PermissionServiceImpl implements PermissionService {
@Autowired
PermissionRepository permissionRepository;
@Override
public boolean add(Permission permission) {
boolean b;
try {
permission.setCreateDate(new Date());
permissionRepository.save(permission);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public boolean update(Permission permission) {
boolean b;
try {
permissionRepository.save(permission);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public boolean delete(long id) {
boolean b;
try {
permissionRepository.deleteById(id);
b = true;
}catch (RuntimeException e){
e.printStackTrace();
b = false;
}
return b;
}
@Override
public Permission findById(long id) {
Permission permission = permissionRepository.findById(id).get();
return permission;
}
@Override
public List<Permission> findAll() {
List<Permission> permissionList = permissionRepository.findAll();
return permissionList;
}
@Override
public Page<Permission> findByPage(Integer page, Integer size) {
Pageable pageable = new PageRequest(page - 1, size);
Page<Permission> permissionPage = permissionRepository.findAll(pageable);
return permissionPage;
}
@Override
public Page<Permission> search(String param, Integer page, Integer size) {
Pageable pageable = new PageRequest(page - 1, size);
Page<Permission> permissionPage = permissionRepository.findAll(new Specification<Permission>() {
@Override
public Predicate toPredicate(Root<Permission> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
Predicate predicate = criteriaBuilder.conjunction();
predicate.getExpressions().add(
criteriaBuilder.like(
root.get("name").as(String.class), "%" + param.trim() + "%"
)
);
return predicate;
}
}, pageable);
return permissionPage;
}
@Override
public Page<Permission> findByName(String name, Integer page, Integer size) {
Pageable pageable = new PageRequest(page-1,size);
Page<Permission> permissionPage = permissionRepository.findByName(name, pageable);
return permissionPage;
}
}
| 3,485 | 0.643329 | 0.642468 | 109 | 30.972477 | 25.802872 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59633 | false | false | 0 |
babde3725f509700026c948e1d2d5bec50c4ce08 | 17,858,474,086,354 | 7d416752fbddf376daf4f4ba78311d124a12ba76 | /src/main/java/com/olivier/worksheet/model/dao/VoterDao.java | 910778789877245c3bc6ed47cf2836642376b300 | []
| no_license | olivier741/Voting_service | https://github.com/olivier741/Voting_service | 7e3b5e3f31799da14f08094b5803ae0880dbe7fe | 869a2df87c2bb3852c3bd46492cb1e006ec91078 | refs/heads/master | 2021-05-20T09:42:19.459000 | 2020-04-03T14:18:41 | 2020-04-03T14:18:41 | 252,231,235 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.olivier.worksheet.model.dao;
import com.olivier.worksheet.model.Motion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
*
* @author olivier.tatsinkou
*/
@Repository
public interface VoterDao extends JpaRepository<Motion, Integer> {
} | UTF-8 | Java | 522 | java | VoterDao.java | Java | [
{
"context": "work.stereotype.Repository;\r\n\r\n/**\r\n *\r\n * @author olivier.tatsinkou\r\n */\r\n@Repository\r\npublic interface VoterDao exte",
"end": 431,
"score": 0.9948247671127319,
"start": 414,
"tag": "NAME",
"value": "olivier.tatsinkou"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.olivier.worksheet.model.dao;
import com.olivier.worksheet.model.Motion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
*
* @author olivier.tatsinkou
*/
@Repository
public interface VoterDao extends JpaRepository<Motion, Integer> {
} | 522 | 0.752874 | 0.752874 | 19 | 25.578947 | 26.519735 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 0 |
c5a098c1c4093c0a9aeefed0e949c94b9b5d9b53 | 23,003,844,880,062 | fdcd529e86cf15a7cfa42b5765a98e45226cf9f7 | /src/main/java/com/foundation/salesforce/core/utils/AccessToken.java | c9b658a2d9d68bb7342c1cbe8062c5ec75837aba | []
| no_license | automationtesting-10/Salesforce | https://github.com/automationtesting-10/Salesforce | 96f8e4cd22cf2c6222dc4707aab7ff25a7f758a0 | f738d359aa16daba298755bd8cf9098623bcaf5a | refs/heads/develop | 2020-07-04T08:04:45.992000 | 2019-08-29T10:51:29 | 2019-08-29T10:51:29 | 202,215,286 | 0 | 0 | null | false | 2019-08-29T10:51:30 | 2019-08-13T20:00:13 | 2019-08-29T10:17:34 | 2019-08-29T10:51:29 | 409 | 0 | 0 | 0 | Java | false | false | /*
* @(#) AccessToken.java Copyright (c) 2019 Jala Foundation.
* 2643 Av. Melchor Perez de Olguin, Colquiri Sud, Cochabamba, Bolivia.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Jala Foundation, ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Jala Foundation.
*/
package com.foundation.salesforce.core.utils;
import io.restassured.response.Response;
import static io.restassured.RestAssured.given;
import java.util.Map;
/**
* Class that allows to load the result of the salesforce page.
*
* @author Jesus Menacho.
* @version 1.0.
*/
public final class AccessToken {
private static AccessToken accessToken;
private static Response response;
private static Map mapJson;
/**
* Constructor let init the method initAccessToken.
*/
private AccessToken() {
initAccessToken();
}
/**
* Method let get the instance to the class Accesstoken.
*
* @return AccessToken.
*/
public static AccessToken getInstance() {
if (accessToken == null) {
accessToken = new AccessToken();
}
return accessToken;
}
/**
* Method that loads the values of the page.
*/
private static void initAccessToken() {
String urlAuth = PropertiesReader.getInstance().getConfig().getAuthUrl();
response = given()
.param("grant_type", "password")
.param("client_id", PropertiesReader.getInstance().getConfig().getClientID())
.param("client_secret", PropertiesReader.getInstance().getConfig().getClientSecret())
.param("username", PropertiesReader.getInstance().getConfig().getUserName())
.param("password", PropertiesReader.getInstance().getConfig().getPassword()
+ PropertiesReader.getInstance().getConfig().getToken())
.when()
.post(urlAuth);
mapJson = response.jsonPath().getMap("$");
}
/**
* Method return the response.
*
* @return mapJason.
*/
public Map getResponse() {
return mapJson;
}
}
| UTF-8 | Java | 2,296 | java | AccessToken.java | Java | [
{
"context": "va Copyright (c) 2019 Jala Foundation.\n * 2643 Av. Melchor Perez de Olguin, Colquiri Sud, Cochabamba, Bolivia.\n * All rights",
"end": 99,
"score": 0.9998825788497925,
"start": 76,
"tag": "NAME",
"value": "Melchor Perez de Olguin"
},
{
"context": "a Foundation.\n * 2643 Av. Melchor Perez de Olguin, Colquiri Sud, Cochabamba, Bolivia.\n * All rights reserved.\n *\n",
"end": 113,
"score": 0.9998811483383179,
"start": 101,
"tag": "NAME",
"value": "Colquiri Sud"
},
{
"context": " * 2643 Av. Melchor Perez de Olguin, Colquiri Sud, Cochabamba, Bolivia.\n * All rights reserved.\n *\n * T",
"end": 117,
"score": 0.7173473834991455,
"start": 115,
"tag": "NAME",
"value": "Co"
},
{
"context": "d the result of the salesforce page.\n *\n * @author Jesus Menacho.\n * @version 1.0.\n */\npublic final class AccessTo",
"end": 719,
"score": 0.9998806118965149,
"start": 706,
"tag": "NAME",
"value": "Jesus Menacho"
}
]
| null | []
| /*
* @(#) AccessToken.java Copyright (c) 2019 Jala Foundation.
* 2643 Av. <NAME>, <NAME>, Cochabamba, Bolivia.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Jala Foundation, ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Jala Foundation.
*/
package com.foundation.salesforce.core.utils;
import io.restassured.response.Response;
import static io.restassured.RestAssured.given;
import java.util.Map;
/**
* Class that allows to load the result of the salesforce page.
*
* @author <NAME>.
* @version 1.0.
*/
public final class AccessToken {
private static AccessToken accessToken;
private static Response response;
private static Map mapJson;
/**
* Constructor let init the method initAccessToken.
*/
private AccessToken() {
initAccessToken();
}
/**
* Method let get the instance to the class Accesstoken.
*
* @return AccessToken.
*/
public static AccessToken getInstance() {
if (accessToken == null) {
accessToken = new AccessToken();
}
return accessToken;
}
/**
* Method that loads the values of the page.
*/
private static void initAccessToken() {
String urlAuth = PropertiesReader.getInstance().getConfig().getAuthUrl();
response = given()
.param("grant_type", "password")
.param("client_id", PropertiesReader.getInstance().getConfig().getClientID())
.param("client_secret", PropertiesReader.getInstance().getConfig().getClientSecret())
.param("username", PropertiesReader.getInstance().getConfig().getUserName())
.param("password", PropertiesReader.getInstance().getConfig().getPassword()
+ PropertiesReader.getInstance().getConfig().getToken())
.when()
.post(urlAuth);
mapJson = response.jsonPath().getMap("$");
}
/**
* Method return the response.
*
* @return mapJason.
*/
public Map getResponse() {
return mapJson;
}
}
| 2,266 | 0.637195 | 0.63284 | 75 | 29.613333 | 27.391918 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.306667 | false | false | 0 |
35e61842efd4bdd18a5966d1aaac369d94977f9c | 3,616,362,528,890 | 296e6e458e6331a5e00071259d262b384a8e52a7 | /app/src/main/java/com/example/quranayahapp/database/Ayah.java | bbfc9163efec0a2fd2d0967ffb3416a4c3cbeac2 | []
| no_license | RazaCodeRepo/Project | https://github.com/RazaCodeRepo/Project | 0d09b10be1840a3802a77b0ba1e1280966b79b6e | e2e896473ee34b7c9d1aaa5fb38268014634c8cc | refs/heads/master | 2022-01-17T18:41:55.989000 | 2019-07-21T07:09:34 | 2019-07-21T07:09:34 | 198,024,509 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.quranayahapp.database;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
@Entity
public class Ayah {
@PrimaryKey(autoGenerate = true)
private int id;
private String ayat_number;
private String surah_name_english;
private String surah_name_arabic;
private String chapter_number;
private String name_english_meaning;
private String arabic_ayah;
private String url_audio_assudais;
private String url_audio_alafasy;
private String url_audio_almuaiqly;
private String ayah_english_translation;
private String downloaded_ayah_path;
@Ignore
public Ayah(String ayat_number, String surah_name_english, String surah_name_arabic, String chapter_number, String name_english_meaning,
String arabic_ayah, String url_audio_assudais, String url_audio_alafasy,
String url_audio_almuaiqly, String ayah_english_translation, String downloaded_ayah_path) {
this.ayat_number = ayat_number;
this.surah_name_english = surah_name_english;
this.surah_name_arabic = surah_name_arabic;
this.chapter_number = chapter_number;
this.name_english_meaning = name_english_meaning;
this.arabic_ayah = arabic_ayah;
this.url_audio_assudais = url_audio_assudais;
this.url_audio_alafasy = url_audio_alafasy;
this.url_audio_almuaiqly = url_audio_almuaiqly;
this.ayah_english_translation = ayah_english_translation;
this.downloaded_ayah_path = downloaded_ayah_path;
}
public Ayah(int id, String ayat_number, String surah_name_english, String surah_name_arabic, String chapter_number, String name_english_meaning,
String arabic_ayah, String url_audio_assudais, String url_audio_alafasy,
String url_audio_almuaiqly, String ayah_english_translation, String downloaded_ayah_path) {
this.id = id;
this.ayat_number = ayat_number;
this.surah_name_english = surah_name_english;
this.surah_name_arabic = surah_name_arabic;
this.chapter_number = chapter_number;
this.name_english_meaning = name_english_meaning;
this.arabic_ayah = arabic_ayah;
this.url_audio_assudais = url_audio_assudais;
this.url_audio_alafasy = url_audio_alafasy;
this.url_audio_almuaiqly = url_audio_almuaiqly;
this.ayah_english_translation = ayah_english_translation;
this.downloaded_ayah_path = downloaded_ayah_path;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAyat_number() {
return ayat_number;
}
public void setAyat_number(String ayat_number) {
this.ayat_number = ayat_number;
}
public String getSurah_name_english() {
return surah_name_english;
}
public void setSurah_name_english(String surah_name_english) {
this.surah_name_english = surah_name_english;
}
public String getSurah_name_arabic() {
return surah_name_arabic;
}
public void setSurah_name_arabic(String surah_name_arabic) {
this.surah_name_arabic = surah_name_arabic;
}
public String getChapter_number() {
return chapter_number;
}
public void setChapter_number(String chapter_number) {
this.chapter_number = chapter_number;
}
public String getName_english_meaning() {
return name_english_meaning;
}
public void setName_english_meaning(String name_english_meaning) {
this.name_english_meaning = name_english_meaning;
}
public String getArabic_ayah() {
return arabic_ayah;
}
public void setArabic_ayah(String arabic_ayah) {
this.arabic_ayah = arabic_ayah;
}
public String getUrl_audio_assudais() {
return url_audio_assudais;
}
public void setUrl_audio_assudais(String url_audio_assudais) {
this.url_audio_assudais = url_audio_assudais;
}
public String getUrl_audio_alafasy() {
return url_audio_alafasy;
}
public void setUrl_audio_alafasy(String url_audio_alafasy) {
this.url_audio_alafasy = url_audio_alafasy;
}
public String getUrl_audio_almuaiqly() {
return url_audio_almuaiqly;
}
public void setUrl_audio_almuaiqly(String url_audio_almuaiqly) {
this.url_audio_almuaiqly = url_audio_almuaiqly;
}
public String getAyah_english_translation() {
return ayah_english_translation;
}
public void setAyah_english_translation(String ayah_english_translation) {
this.ayah_english_translation = ayah_english_translation;
}
public String getDownloaded_ayah_path() {
return downloaded_ayah_path;
}
public void setDownloaded_ayah_path(String downloaded_ayah_path) {
this.downloaded_ayah_path = downloaded_ayah_path;
}
}
| UTF-8 | Java | 4,964 | java | Ayah.java | Java | []
| null | []
| package com.example.quranayahapp.database;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
@Entity
public class Ayah {
@PrimaryKey(autoGenerate = true)
private int id;
private String ayat_number;
private String surah_name_english;
private String surah_name_arabic;
private String chapter_number;
private String name_english_meaning;
private String arabic_ayah;
private String url_audio_assudais;
private String url_audio_alafasy;
private String url_audio_almuaiqly;
private String ayah_english_translation;
private String downloaded_ayah_path;
@Ignore
public Ayah(String ayat_number, String surah_name_english, String surah_name_arabic, String chapter_number, String name_english_meaning,
String arabic_ayah, String url_audio_assudais, String url_audio_alafasy,
String url_audio_almuaiqly, String ayah_english_translation, String downloaded_ayah_path) {
this.ayat_number = ayat_number;
this.surah_name_english = surah_name_english;
this.surah_name_arabic = surah_name_arabic;
this.chapter_number = chapter_number;
this.name_english_meaning = name_english_meaning;
this.arabic_ayah = arabic_ayah;
this.url_audio_assudais = url_audio_assudais;
this.url_audio_alafasy = url_audio_alafasy;
this.url_audio_almuaiqly = url_audio_almuaiqly;
this.ayah_english_translation = ayah_english_translation;
this.downloaded_ayah_path = downloaded_ayah_path;
}
public Ayah(int id, String ayat_number, String surah_name_english, String surah_name_arabic, String chapter_number, String name_english_meaning,
String arabic_ayah, String url_audio_assudais, String url_audio_alafasy,
String url_audio_almuaiqly, String ayah_english_translation, String downloaded_ayah_path) {
this.id = id;
this.ayat_number = ayat_number;
this.surah_name_english = surah_name_english;
this.surah_name_arabic = surah_name_arabic;
this.chapter_number = chapter_number;
this.name_english_meaning = name_english_meaning;
this.arabic_ayah = arabic_ayah;
this.url_audio_assudais = url_audio_assudais;
this.url_audio_alafasy = url_audio_alafasy;
this.url_audio_almuaiqly = url_audio_almuaiqly;
this.ayah_english_translation = ayah_english_translation;
this.downloaded_ayah_path = downloaded_ayah_path;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAyat_number() {
return ayat_number;
}
public void setAyat_number(String ayat_number) {
this.ayat_number = ayat_number;
}
public String getSurah_name_english() {
return surah_name_english;
}
public void setSurah_name_english(String surah_name_english) {
this.surah_name_english = surah_name_english;
}
public String getSurah_name_arabic() {
return surah_name_arabic;
}
public void setSurah_name_arabic(String surah_name_arabic) {
this.surah_name_arabic = surah_name_arabic;
}
public String getChapter_number() {
return chapter_number;
}
public void setChapter_number(String chapter_number) {
this.chapter_number = chapter_number;
}
public String getName_english_meaning() {
return name_english_meaning;
}
public void setName_english_meaning(String name_english_meaning) {
this.name_english_meaning = name_english_meaning;
}
public String getArabic_ayah() {
return arabic_ayah;
}
public void setArabic_ayah(String arabic_ayah) {
this.arabic_ayah = arabic_ayah;
}
public String getUrl_audio_assudais() {
return url_audio_assudais;
}
public void setUrl_audio_assudais(String url_audio_assudais) {
this.url_audio_assudais = url_audio_assudais;
}
public String getUrl_audio_alafasy() {
return url_audio_alafasy;
}
public void setUrl_audio_alafasy(String url_audio_alafasy) {
this.url_audio_alafasy = url_audio_alafasy;
}
public String getUrl_audio_almuaiqly() {
return url_audio_almuaiqly;
}
public void setUrl_audio_almuaiqly(String url_audio_almuaiqly) {
this.url_audio_almuaiqly = url_audio_almuaiqly;
}
public String getAyah_english_translation() {
return ayah_english_translation;
}
public void setAyah_english_translation(String ayah_english_translation) {
this.ayah_english_translation = ayah_english_translation;
}
public String getDownloaded_ayah_path() {
return downloaded_ayah_path;
}
public void setDownloaded_ayah_path(String downloaded_ayah_path) {
this.downloaded_ayah_path = downloaded_ayah_path;
}
}
| 4,964 | 0.668413 | 0.668413 | 157 | 30.617834 | 28.674438 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535032 | false | false | 0 |
fab668a47b55ad5d18c76587dfb93f36f1bb5e63 | 20,959,440,467,865 | 24b349ca46d80ca602b5510bc5cf8a6a599829b8 | /day14playerdetails_session2/src/Main.java | bc6141f098c34284d8f08674283a28fca4d1f911 | []
| no_license | withvidit/cheat | https://github.com/withvidit/cheat | a800ec4eaf1c57f2e179372ec476bd855c25e92d | 13050b1ae058e4d832e4d91512590c3ea69ee314 | refs/heads/master | 2021-01-22T01:58:11.452000 | 2017-02-06T05:07:17 | 2017-02-06T05:07:29 | 81,020,637 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number of players");
int n= Integer.parseInt(br.readLine());
Player[] playerList= new Player[n];
String name,country,skill;
for(int i=0;i<n;i++)
{
System.out.println("Enter the player name");
name=br.readLine();
System.out.println("Enter the country name");
country=br.readLine();
System.out.println("Enter the skill");
skill=br.readLine();
playerList[i]= new Player(name, country, skill);
}
PlayerBO bo= new PlayerBO();
bo.displayAllPlayerDetails(playerList);
System.out.println("Enter the country name for which players details to be known");
String search=br.readLine();
bo.displaySpecificPlayerDetails(playerList, search);
}
}
| UTF-8 | Java | 959 | java | Main.java | Java | []
| null | []
| import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number of players");
int n= Integer.parseInt(br.readLine());
Player[] playerList= new Player[n];
String name,country,skill;
for(int i=0;i<n;i++)
{
System.out.println("Enter the player name");
name=br.readLine();
System.out.println("Enter the country name");
country=br.readLine();
System.out.println("Enter the skill");
skill=br.readLine();
playerList[i]= new Player(name, country, skill);
}
PlayerBO bo= new PlayerBO();
bo.displayAllPlayerDetails(playerList);
System.out.println("Enter the country name for which players details to be known");
String search=br.readLine();
bo.displaySpecificPlayerDetails(playerList, search);
}
}
| 959 | 0.701773 | 0.70073 | 33 | 27.060606 | 22.848566 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.060606 | false | false | 0 |
3002d1ea83ec65082b3eee450d7779fcbdca97eb | 37,563,783,989,972 | 1b3eeec57dd6dea79e6533e2dd501993d4d70c3a | /src/main/java/com/versatile/api/service/VehicleService.java | 4e8a47307f799dda05230daac35b9c6cd036d3ae | []
| no_license | proteauj/api | https://github.com/proteauj/api | a90d3d2bce712dabb3eaaa859eba64d478fc6fb1 | 80f5dbd351f984b294646084aeb96e5b33fcaee5 | refs/heads/master | 2021-07-23T09:49:24.673000 | 2019-01-05T20:40:48 | 2019-01-05T20:40:48 | 147,988,036 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.versatile.api.service;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.versatile.api.exception.CarNotFoundException;
import com.versatile.api.mapper.CarMapper;
import com.versatile.api.mapper.VehicleMapper;
import com.versatile.api.repository.CarRepository;
import com.versatile.api.ressource.CarRessource;
import com.versatile.api.ressource.VehicleRessource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
@Service
public class VehicleService {
@Autowired
CarRepository repository;
@Autowired
CarMapper mapper;
@Autowired
VehicleMapper vehicleMapper;
@Autowired
RestTemplate restTemplate;
public CarRessource getByVin(String vin) throws IOException, SAXException, ParserConfigurationException {
CarRessource car;
try {
car = mapper.entityToModel(repository.getByVin(vin)
.orElseThrow(() -> new CarNotFoundException(vin)));
} catch (CarNotFoundException e) {
UriComponents builder = UriComponentsBuilder.newInstance()
.scheme("https")
.host("vpic.nhtsa.dot.gov")
.path("api/vehicles/DecodeVin/{vin}")
.query("format={format}").buildAndExpand(vin, "json");
URI uri = builder.toUri();
ResponseEntity<String> respEntity = restTemplate.getForEntity(uri, String.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
VehicleRessource vehicle = mapper.readValue(respEntity.getBody(), VehicleRessource.class);
car = vehicleMapper.getCarFromVehicle(vehicle);
String searchImage = car.getModel().getMake().getTitle() + " " +
car.getModel().getTitle() + " " +
car.getYear();
car.setImageUrl(getCarImage(searchImage));
}
return car;
}
public String getCarImage(String search) throws ParserConfigurationException, IOException, SAXException {
UriComponents builder = UriComponentsBuilder.newInstance()
.scheme("http")
.host("www.carimagery.com")
.path("api.asmx/GetImageUrl")
.query("searchTerm={search}").buildAndExpand(search);
URI uri = builder.toUri();
ResponseEntity<String> responseEntity = restTemplate.getForEntity(uri, String.class);
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(responseEntity.getBody()));
Document doc = db.parse(is);
NodeList nodes = doc.getChildNodes();
String node1 = nodes.item(0).getLastChild().getNodeValue();
return node1;
}
}
| UTF-8 | Java | 3,778 | java | VehicleService.java | Java | []
| null | []
| package com.versatile.api.service;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.versatile.api.exception.CarNotFoundException;
import com.versatile.api.mapper.CarMapper;
import com.versatile.api.mapper.VehicleMapper;
import com.versatile.api.repository.CarRepository;
import com.versatile.api.ressource.CarRessource;
import com.versatile.api.ressource.VehicleRessource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
@Service
public class VehicleService {
@Autowired
CarRepository repository;
@Autowired
CarMapper mapper;
@Autowired
VehicleMapper vehicleMapper;
@Autowired
RestTemplate restTemplate;
public CarRessource getByVin(String vin) throws IOException, SAXException, ParserConfigurationException {
CarRessource car;
try {
car = mapper.entityToModel(repository.getByVin(vin)
.orElseThrow(() -> new CarNotFoundException(vin)));
} catch (CarNotFoundException e) {
UriComponents builder = UriComponentsBuilder.newInstance()
.scheme("https")
.host("vpic.nhtsa.dot.gov")
.path("api/vehicles/DecodeVin/{vin}")
.query("format={format}").buildAndExpand(vin, "json");
URI uri = builder.toUri();
ResponseEntity<String> respEntity = restTemplate.getForEntity(uri, String.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
VehicleRessource vehicle = mapper.readValue(respEntity.getBody(), VehicleRessource.class);
car = vehicleMapper.getCarFromVehicle(vehicle);
String searchImage = car.getModel().getMake().getTitle() + " " +
car.getModel().getTitle() + " " +
car.getYear();
car.setImageUrl(getCarImage(searchImage));
}
return car;
}
public String getCarImage(String search) throws ParserConfigurationException, IOException, SAXException {
UriComponents builder = UriComponentsBuilder.newInstance()
.scheme("http")
.host("www.carimagery.com")
.path("api.asmx/GetImageUrl")
.query("searchTerm={search}").buildAndExpand(search);
URI uri = builder.toUri();
ResponseEntity<String> responseEntity = restTemplate.getForEntity(uri, String.class);
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(responseEntity.getBody()));
Document doc = db.parse(is);
NodeList nodes = doc.getChildNodes();
String node1 = nodes.item(0).getLastChild().getNodeValue();
return node1;
}
}
| 3,778 | 0.699312 | 0.697724 | 99 | 37.161617 | 27.511139 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 0 |
a4a98ae9dc2a5e2e4d587fea5626456305e568f4 | 34,686,155,928,175 | 2ac096380db8cd0325106a051bdec02c5b83d0f1 | /client/DemoViewPagerAndTabHost/app/src/main/java/com/hq/demoviewpagerandtabhost/ChangeprofileActivity.java | eedb096b038988cec14d76bf9f88c70ea04d2ea4 | []
| no_license | neyuqel/demochat | https://github.com/neyuqel/demochat | 5f8b46662d5afb258e9ed2a26cab362e8bed3b7c | 77a886a1f9d9c94d328387612dad94f0245ed23b | refs/heads/master | 2021-06-15T13:15:50.455000 | 2017-04-17T17:36:59 | 2017-04-17T17:36:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hq.demoviewpagerandtabhost;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
/**
* Created by My-PC on 3/25/2017.
*/
public class ChangeprofileActivity extends AppCompatActivity {
private Spinner spnGenderchange;
private EditText fnamechange, lnamechange, agechange, phonechange, passwordtoconf;
private Button btnProfilechange;
private Socket mSocket;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_changeprofile);
MSocket ms = (MSocket) getApplication();
mSocket = ms.getSocket();
Intent intent = this.getIntent();
final String username = intent.getStringExtra("username");
final String firstname = intent.getStringExtra("firstname");
final String lastname = intent.getStringExtra("lastname");
final String age = intent.getStringExtra("age");
final String phone = intent.getStringExtra("phone");
final String gender = intent.getStringExtra("gender");
Log.d("hquserpasschange", username);
spnGenderchange = (Spinner) findViewById(R.id.genderchange);
fnamechange = (EditText) findViewById(R.id.fnamechange);
lnamechange = (EditText) findViewById(R.id.lnamechange);
agechange = (EditText) findViewById(R.id.agechange);
phonechange = (EditText) findViewById(R.id.phonechange);
passwordtoconf = (EditText) findViewById(R.id.passwordtoconf);
btnProfilechange = (Button) findViewById(R.id.btnProfilechange);
final String[] genderchange = {null};
List<String> list = new ArrayList<>();
list.add("Male");
list.add("Female");
// spnGenderchange.setLabelFor(1);
fnamechange.setText(firstname);
lnamechange.setText(lastname);
agechange.setText(age);
phonechange.setText(phone);
ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
spnGenderchange.setAdapter(adapter);
spnGenderchange.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
genderchange[0] = String.valueOf(spnGenderchange.getSelectedItem());
Toast.makeText(ChangeprofileActivity.this, spnGenderchange.getSelectedItem().toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
btnProfilechange.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
String firstname = fnamechange.getText().toString();
String lastname = lnamechange.getText().toString();
String age = agechange.getText().toString();
final String phone = phonechange.getText().toString();
final String password = passwordtoconf.getText().toString();
Log.d("hquserprofilechange", username);
JSONObject data = null;
try {
data = new JSONObject("{\"username\": \"" + username + "\", \"password\": \"" + password + "\", \"firstname\": \"" + firstname + "\", \"lastname\": \"" + lastname + "\", \"age\": \"" + age + "\", \"gender\": \"" + genderchange[0] + "\", \"phone\": \"" + phone + "\"}");
} catch (JSONException e) {
e.printStackTrace();
}
Log.d("hquserdk", String.valueOf(data));
mSocket.emit("UPDATE_PROFILE", data);
mSocket.on("SERVER_UPDATE_PROFILE", new Emitter.Listener() {
@Override
public void call(final Object... args) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String updateok;
updateok = args[0].toString();
Toast.makeText(ChangeprofileActivity.this, "" + updateok, Toast.LENGTH_SHORT).show();
finish();
}
});
}
});
mSocket.on("SERVER_ERR", new Emitter.Listener() {
@Override
public void call(final Object... args) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String err;
err = args[0].toString();
Toast.makeText(ChangeprofileActivity.this, "Error: " + err, Toast.LENGTH_SHORT).show();
}
});
}
});
}
});
}
}
| UTF-8 | Java | 5,853 | java | ChangeprofileActivity.java | Java | [
{
"context": "port io.socket.emitter.Emitter;\n\n/**\n * Created by My-PC on 3/25/2017.\n */\n\npublic class ChangeprofileActi",
"end": 638,
"score": 0.9992966055870056,
"start": 633,
"tag": "USERNAME",
"value": "My-PC"
},
{
"context": " final String username = intent.getStringExtra(\"username\");\n final String firstname = intent.getStr",
"end": 1283,
"score": 0.9254562854766846,
"start": 1275,
"tag": "USERNAME",
"value": "username"
}
]
| null | []
| package com.hq.demoviewpagerandtabhost;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
/**
* Created by My-PC on 3/25/2017.
*/
public class ChangeprofileActivity extends AppCompatActivity {
private Spinner spnGenderchange;
private EditText fnamechange, lnamechange, agechange, phonechange, passwordtoconf;
private Button btnProfilechange;
private Socket mSocket;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_changeprofile);
MSocket ms = (MSocket) getApplication();
mSocket = ms.getSocket();
Intent intent = this.getIntent();
final String username = intent.getStringExtra("username");
final String firstname = intent.getStringExtra("firstname");
final String lastname = intent.getStringExtra("lastname");
final String age = intent.getStringExtra("age");
final String phone = intent.getStringExtra("phone");
final String gender = intent.getStringExtra("gender");
Log.d("hquserpasschange", username);
spnGenderchange = (Spinner) findViewById(R.id.genderchange);
fnamechange = (EditText) findViewById(R.id.fnamechange);
lnamechange = (EditText) findViewById(R.id.lnamechange);
agechange = (EditText) findViewById(R.id.agechange);
phonechange = (EditText) findViewById(R.id.phonechange);
passwordtoconf = (EditText) findViewById(R.id.passwordtoconf);
btnProfilechange = (Button) findViewById(R.id.btnProfilechange);
final String[] genderchange = {null};
List<String> list = new ArrayList<>();
list.add("Male");
list.add("Female");
// spnGenderchange.setLabelFor(1);
fnamechange.setText(firstname);
lnamechange.setText(lastname);
agechange.setText(age);
phonechange.setText(phone);
ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
spnGenderchange.setAdapter(adapter);
spnGenderchange.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
genderchange[0] = String.valueOf(spnGenderchange.getSelectedItem());
Toast.makeText(ChangeprofileActivity.this, spnGenderchange.getSelectedItem().toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
btnProfilechange.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
String firstname = fnamechange.getText().toString();
String lastname = lnamechange.getText().toString();
String age = agechange.getText().toString();
final String phone = phonechange.getText().toString();
final String password = passwordtoconf.getText().toString();
Log.d("hquserprofilechange", username);
JSONObject data = null;
try {
data = new JSONObject("{\"username\": \"" + username + "\", \"password\": \"" + password + "\", \"firstname\": \"" + firstname + "\", \"lastname\": \"" + lastname + "\", \"age\": \"" + age + "\", \"gender\": \"" + genderchange[0] + "\", \"phone\": \"" + phone + "\"}");
} catch (JSONException e) {
e.printStackTrace();
}
Log.d("hquserdk", String.valueOf(data));
mSocket.emit("UPDATE_PROFILE", data);
mSocket.on("SERVER_UPDATE_PROFILE", new Emitter.Listener() {
@Override
public void call(final Object... args) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String updateok;
updateok = args[0].toString();
Toast.makeText(ChangeprofileActivity.this, "" + updateok, Toast.LENGTH_SHORT).show();
finish();
}
});
}
});
mSocket.on("SERVER_ERR", new Emitter.Listener() {
@Override
public void call(final Object... args) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String err;
err = args[0].toString();
Toast.makeText(ChangeprofileActivity.this, "Error: " + err, Toast.LENGTH_SHORT).show();
}
});
}
});
}
});
}
}
| 5,853 | 0.563301 | 0.56108 | 143 | 39.930069 | 35.587704 | 293 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.748252 | false | false | 0 |
f16564e66813573729acd19e0e1fe7ca14519ba7 | 34,041,910,838,006 | 1db09d68a2a4bf4b11bd8e2e5e23ad8bbaac7362 | /baseprojectlib/src/main/java/com/jcb/android/baseprojectlib/manager/ProgressDialogManager.java | a5ff725e6ed63f036cef62d69a3e181005107bbb | []
| no_license | PorterKing/BaseProject | https://github.com/PorterKing/BaseProject | d7601c63ae437a6ed02c237752b839c2dd2d8f1a | e75f052b8af27a2eef0eab1033f2b972dc72b764 | refs/heads/master | 2020-07-07T14:40:30.702000 | 2019-08-20T13:15:18 | 2019-08-20T13:15:18 | 203,377,999 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jcb.android.baseprojectlib.manager;
import android.app.Dialog;
import com.jcb.android.baseprojectlib.view.dialog.ProgressDialog;
/**
* 菊花dialog 管理
* Created by Poterking on 19-8-13.
*/
public class ProgressDialogManager {
private Dialog dialog;
public static final ProgressDialogManager getInstance() {
return ProgressDialogManagerHelp.INTANCE;
}
private static class ProgressDialogManagerHelp {
private static final ProgressDialogManager INTANCE = new ProgressDialogManager();
}
public void show(String msg){
dialog = new ProgressDialog(AppManager.getAppManager().currentActivity(), ProgressDialog
.DIALOG_TYPE_NO_MESSAGE);
dialog.setTitle(msg);//设置对话框标题
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
public void dismissDialog( ) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
dialog = null;
}
}
}
| UTF-8 | Java | 1,050 | java | ProgressDialogManager.java | Java | [
{
"context": ".ProgressDialog;\n\n/**\n * 菊花dialog 管理\n * Created by Poterking on 19-8-13.\n */\npublic class ProgressDialogManage",
"end": 186,
"score": 0.9996311068534851,
"start": 177,
"tag": "USERNAME",
"value": "Poterking"
}
]
| null | []
| package com.jcb.android.baseprojectlib.manager;
import android.app.Dialog;
import com.jcb.android.baseprojectlib.view.dialog.ProgressDialog;
/**
* 菊花dialog 管理
* Created by Poterking on 19-8-13.
*/
public class ProgressDialogManager {
private Dialog dialog;
public static final ProgressDialogManager getInstance() {
return ProgressDialogManagerHelp.INTANCE;
}
private static class ProgressDialogManagerHelp {
private static final ProgressDialogManager INTANCE = new ProgressDialogManager();
}
public void show(String msg){
dialog = new ProgressDialog(AppManager.getAppManager().currentActivity(), ProgressDialog
.DIALOG_TYPE_NO_MESSAGE);
dialog.setTitle(msg);//设置对话框标题
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}
public void dismissDialog( ) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
dialog = null;
}
}
}
| 1,050 | 0.669261 | 0.664397 | 40 | 24.700001 | 25.331995 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 0 |
404af062407849078ddd361a19757da0379fe6ec | 36,867,999,293,216 | 3e81313866f8a9c226e01026f4bbdb101b73ae78 | /app/src/main/java/com/ferjuarez/bottomnavigationbootstrap/models/articles/Article.java | 4432531a15f8de60a54428e244fdd9846c5adf85 | []
| no_license | ferjuarezlp/BottomNavBootstrap | https://github.com/ferjuarezlp/BottomNavBootstrap | 49fb230b05073bdb31c6308e0dc0e9e525ac1fb9 | 29c47ac512056c1345951da18e5022b2a61864ca | refs/heads/master | 2020-04-21T17:53:59.710000 | 2019-02-09T19:30:13 | 2019-02-09T19:30:13 | 169,750,840 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ferjuarez.bottomnavigationbootstrap.models.articles;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Index;
import android.arch.persistence.room.PrimaryKey;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
@Entity(tableName = "article", indices = {@Index(value = {"relevadorCode"}, unique = true)})
public class Article implements Parcelable{
@PrimaryKey(autoGenerate = true)
@NonNull
@ColumnInfo
private int id;
@ColumnInfo
private Long fabricOrder;
@ColumnInfo
private Long fabricNumber;
@ColumnInfo
private String relevadorCode;
public Article(){
}
protected Article(Parcel in) {
id = in.readInt();
if (in.readByte() == 0) {
fabricOrder = null;
} else {
fabricOrder = in.readLong();
}
if (in.readByte() == 0) {
fabricNumber = null;
} else {
fabricNumber = in.readLong();
}
relevadorCode = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
if (fabricOrder == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(fabricOrder);
}
if (fabricNumber == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(fabricNumber);
}
dest.writeString(relevadorCode);
}
private Article(Builder builder) {
relevadorCode = builder.relevadorCode;
fabricNumber = builder.fabricNumber;
fabricOrder = builder.order;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<Article> CREATOR = new Creator<Article>() {
@Override
public Article createFromParcel(Parcel in) {
return new Article(in);
}
@Override
public Article[] newArray(int size) {
return new Article[size];
}
};
public Long getFabricNumber() {
return fabricNumber;
}
public void setFabricNumber(Long fabricNumber) {
this.fabricNumber = fabricNumber;
}
public Long getFabricOrder() {
return fabricOrder;
}
public void setFabricOrder(Long fabricOrder) {
this.fabricOrder = fabricOrder;
}
public String getRelevadorCode() {
return relevadorCode;
}
public void setRelevadorCode(String relevadorCode) {
this.relevadorCode = relevadorCode;
}
@NonNull
public int getId() {
return id;
}
public void setId(@NonNull int id) {
this.id = id;
}
public static final class Builder {
private String relevadorCode;
private Long fabricNumber;
private Long order;
private Long incrementalCode;
public Builder() {
}
public Builder fabricNumber(Long val) {
fabricNumber = val;
return this;
}
public Builder order(Long val) {
order = val;
return this;
}
public Builder relevadorCode(String val) {
relevadorCode = val;
return this;
}
public Builder incrementalCode(Long val) {
incrementalCode = val;
return this;
}
public Article build() {
return new Article(this);
}
}
} | UTF-8 | Java | 3,624 | java | Article.java | Java | [
{
"context": "package com.ferjuarez.bottomnavigationbootstrap.models.articles;\n\nimpo",
"end": 20,
"score": 0.6919483542442322,
"start": 12,
"tag": "USERNAME",
"value": "ferjuare"
}
]
| null | []
| package com.ferjuarez.bottomnavigationbootstrap.models.articles;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Index;
import android.arch.persistence.room.PrimaryKey;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
@Entity(tableName = "article", indices = {@Index(value = {"relevadorCode"}, unique = true)})
public class Article implements Parcelable{
@PrimaryKey(autoGenerate = true)
@NonNull
@ColumnInfo
private int id;
@ColumnInfo
private Long fabricOrder;
@ColumnInfo
private Long fabricNumber;
@ColumnInfo
private String relevadorCode;
public Article(){
}
protected Article(Parcel in) {
id = in.readInt();
if (in.readByte() == 0) {
fabricOrder = null;
} else {
fabricOrder = in.readLong();
}
if (in.readByte() == 0) {
fabricNumber = null;
} else {
fabricNumber = in.readLong();
}
relevadorCode = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
if (fabricOrder == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(fabricOrder);
}
if (fabricNumber == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(fabricNumber);
}
dest.writeString(relevadorCode);
}
private Article(Builder builder) {
relevadorCode = builder.relevadorCode;
fabricNumber = builder.fabricNumber;
fabricOrder = builder.order;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<Article> CREATOR = new Creator<Article>() {
@Override
public Article createFromParcel(Parcel in) {
return new Article(in);
}
@Override
public Article[] newArray(int size) {
return new Article[size];
}
};
public Long getFabricNumber() {
return fabricNumber;
}
public void setFabricNumber(Long fabricNumber) {
this.fabricNumber = fabricNumber;
}
public Long getFabricOrder() {
return fabricOrder;
}
public void setFabricOrder(Long fabricOrder) {
this.fabricOrder = fabricOrder;
}
public String getRelevadorCode() {
return relevadorCode;
}
public void setRelevadorCode(String relevadorCode) {
this.relevadorCode = relevadorCode;
}
@NonNull
public int getId() {
return id;
}
public void setId(@NonNull int id) {
this.id = id;
}
public static final class Builder {
private String relevadorCode;
private Long fabricNumber;
private Long order;
private Long incrementalCode;
public Builder() {
}
public Builder fabricNumber(Long val) {
fabricNumber = val;
return this;
}
public Builder order(Long val) {
order = val;
return this;
}
public Builder relevadorCode(String val) {
relevadorCode = val;
return this;
}
public Builder incrementalCode(Long val) {
incrementalCode = val;
return this;
}
public Article build() {
return new Article(this);
}
}
} | 3,624 | 0.584989 | 0.583057 | 148 | 23.493244 | 18.208439 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.385135 | false | false | 0 |
5a1e0c2c2d1f63a06f84d3aacacad98b1a8a4dd5 | 36,361,193,162,639 | c2e889c8f2ea7f4e13404e5521c60d8edb227d32 | /src/main/java/de/erdbeerbaerlp/guilib/components/ProgressBar.java | f3d56908a04acc09a6c6cdd9de31c9e3f5e1ba68 | [
"MIT"
]
| permissive | ErdbeerbaerLP/ErdbeerbaerGuiLib | https://github.com/ErdbeerbaerLP/ErdbeerbaerGuiLib | 42c0a22ad8f52e7c13edddf6540df81d30615037 | e89dc6f2fdaa2077c5d331c488fe55d247b2e7ae | refs/heads/1.19 | 2023-03-07T08:52:34.152000 | 2022-12-24T12:06:43 | 2022-12-24T12:06:43 | 183,681,706 | 14 | 7 | MIT | false | 2023-03-06T07:56:52 | 2019-04-26T19:12:35 | 2023-02-14T16:25:13 | 2023-03-06T07:56:49 | 384 | 11 | 4 | 4 | Java | false | false | package de.erdbeerbaerlp.guilib.components;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.BossEvent;
public class ProgressBar extends GuiComponent {
private static final ResourceLocation GUI_BARS_TEXTURES = new ResourceLocation("textures/gui/bars.png");
private boolean showPercentText = true;
private String text = "";
private BossEvent.BossBarColor color = BossEvent.BossBarColor.BLUE;
private int maxValue = 100;
private int value = 0;
private int precision = 1;
public ProgressBar(int x, int y, int widthIn) {
super(x, y, widthIn, 15);
}
public void setMaxValue(int maxValue) {
if (maxValue <= 0) throw new IllegalArgumentException("Max value can not be smaller than 1");
this.maxValue = maxValue;
if (value > maxValue) value = maxValue;
}
public void setText(String text) {
this.text = text;
}
public void setColor(BossEvent.BossBarColor color) {
this.color = color;
}
public void setShowPercentText(boolean showPercentText) {
this.showPercentText = showPercentText;
}
@Override
public void setHeight(int height) {
}
public void setPrecision(int precision) {
this.precision = precision;
}
@Override
public void render(PoseStack poseStack, int mouseX, int mouseY, float partial) {
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.setShaderTexture(0, GUI_BARS_TEXTURES);
int progress = (int) (getPercent() * getWidth());
for (int w = 0; w <= getWidth(); w++) {
if (w == 0) {
this.blit(poseStack, getX(), getY() + 10, 0, color.ordinal() * 5 * 2, 1, 5);
if (progress > 0) {
this.blit(poseStack, getX(), getY() + 10, 0, color.ordinal() * 5 * 2 + 5, 1, 5);
}
} else if (w == getWidth()) {
this.blit(poseStack, getX() + w, getY() + 10, 182, color.ordinal() * 5 * 2, 1, 5);
if (progress == 1.0f) {
this.blit(poseStack, getX() + w, getY() + 10, 182, color.ordinal() * 5 * 2 + 5, 1, 5);
}
} else {
this.blit(poseStack, getX() + w, getY() + 10, 5, color.ordinal() * 5 * 2, 1, 5);
if (progress >= w) {
this.blit(poseStack, getX() + w, getY() + 10, 5, color.ordinal() * 5 * 2 + 5, 1, 5);
}
}
}
String val = String.valueOf(getPercent() * 100);
if (val.substring(val.indexOf(".") + 1).length() > precision) {
val = val.substring(0, val.indexOf(".") + precision + 1);
if (val.endsWith(".")) {
val = val.substring(0, val.indexOf(".") + precision);
}
} else {
while (val.substring(val.indexOf(".") + 1).length() < precision) {
val = val + "0";
}
}
String s = text + (showPercentText ? (" " + val + "%") : "");
int l = mc.font.width(s);
mc.font.drawShadow(poseStack, s, getX() + (getWidth() / 2 - l / 2), (float) getY(), 16777215);
}
private float getPercent() {
return ((float) value) / (float) maxValue;
}
@Override
public void mouseClick(double mouseX, double mouseY, int mouseButton) {
}
@Override
public void mouseRelease(double mouseX, double mouseY, int state) {
}
@Override
public boolean charTyped(char typedChar, int keyCode) {
return false;
}
public void increment(int value) {
this.value = Math.min(maxValue, this.value + value);
}
public void decrement(int value) {
this.value = Math.max(0, this.value - value);
}
public double getValue() {
return this.value;
}
public void setValue(int value) {
this.value = Math.min(value, maxValue);
}
}
| UTF-8 | Java | 4,162 | java | ProgressBar.java | Java | []
| null | []
| package de.erdbeerbaerlp.guilib.components;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.BossEvent;
public class ProgressBar extends GuiComponent {
private static final ResourceLocation GUI_BARS_TEXTURES = new ResourceLocation("textures/gui/bars.png");
private boolean showPercentText = true;
private String text = "";
private BossEvent.BossBarColor color = BossEvent.BossBarColor.BLUE;
private int maxValue = 100;
private int value = 0;
private int precision = 1;
public ProgressBar(int x, int y, int widthIn) {
super(x, y, widthIn, 15);
}
public void setMaxValue(int maxValue) {
if (maxValue <= 0) throw new IllegalArgumentException("Max value can not be smaller than 1");
this.maxValue = maxValue;
if (value > maxValue) value = maxValue;
}
public void setText(String text) {
this.text = text;
}
public void setColor(BossEvent.BossBarColor color) {
this.color = color;
}
public void setShowPercentText(boolean showPercentText) {
this.showPercentText = showPercentText;
}
@Override
public void setHeight(int height) {
}
public void setPrecision(int precision) {
this.precision = precision;
}
@Override
public void render(PoseStack poseStack, int mouseX, int mouseY, float partial) {
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.setShaderTexture(0, GUI_BARS_TEXTURES);
int progress = (int) (getPercent() * getWidth());
for (int w = 0; w <= getWidth(); w++) {
if (w == 0) {
this.blit(poseStack, getX(), getY() + 10, 0, color.ordinal() * 5 * 2, 1, 5);
if (progress > 0) {
this.blit(poseStack, getX(), getY() + 10, 0, color.ordinal() * 5 * 2 + 5, 1, 5);
}
} else if (w == getWidth()) {
this.blit(poseStack, getX() + w, getY() + 10, 182, color.ordinal() * 5 * 2, 1, 5);
if (progress == 1.0f) {
this.blit(poseStack, getX() + w, getY() + 10, 182, color.ordinal() * 5 * 2 + 5, 1, 5);
}
} else {
this.blit(poseStack, getX() + w, getY() + 10, 5, color.ordinal() * 5 * 2, 1, 5);
if (progress >= w) {
this.blit(poseStack, getX() + w, getY() + 10, 5, color.ordinal() * 5 * 2 + 5, 1, 5);
}
}
}
String val = String.valueOf(getPercent() * 100);
if (val.substring(val.indexOf(".") + 1).length() > precision) {
val = val.substring(0, val.indexOf(".") + precision + 1);
if (val.endsWith(".")) {
val = val.substring(0, val.indexOf(".") + precision);
}
} else {
while (val.substring(val.indexOf(".") + 1).length() < precision) {
val = val + "0";
}
}
String s = text + (showPercentText ? (" " + val + "%") : "");
int l = mc.font.width(s);
mc.font.drawShadow(poseStack, s, getX() + (getWidth() / 2 - l / 2), (float) getY(), 16777215);
}
private float getPercent() {
return ((float) value) / (float) maxValue;
}
@Override
public void mouseClick(double mouseX, double mouseY, int mouseButton) {
}
@Override
public void mouseRelease(double mouseX, double mouseY, int state) {
}
@Override
public boolean charTyped(char typedChar, int keyCode) {
return false;
}
public void increment(int value) {
this.value = Math.min(maxValue, this.value + value);
}
public void decrement(int value) {
this.value = Math.max(0, this.value - value);
}
public double getValue() {
return this.value;
}
public void setValue(int value) {
this.value = Math.min(value, maxValue);
}
}
| 4,162 | 0.570639 | 0.548534 | 128 | 31.515625 | 29.902964 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.84375 | false | false | 0 |
890f423124d9310be1f204b9da94836d28d4cb5b | 39,075,612,463,297 | a7a532e7ac85daf5eb4d4988b49b606ca33fc8b8 | /src/ejerciciost6/tienda/ProductoSoftware.java | 07ee906067eadd6d82b67e1d64a26c3ca74aa8d4 | []
| no_license | CarlosGicer/Java_2021 | https://github.com/CarlosGicer/Java_2021 | c2039f809961cf4b09ae44c3a523d467c1e56514 | d7e9e7c231a6d7a51f9f4328a5e32bb9df018a3f | refs/heads/master | 2023-04-16T03:42:23.311000 | 2021-04-23T21:09:43 | 2021-04-23T21:09:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package ejerciciost6.tienda;
/**
* @author sjgui
*
*/
public class ProductoSoftware extends Producto {
private double version;
/**
* @param codigo
* @param nombre
* @param descripcion
* @param precioUnitario
*/
public ProductoSoftware(String codigo, String nombre, String descripcion, double precioUnitario, double version) {
super(codigo, nombre, descripcion, precioUnitario);
this.version = version;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProductoSoftware [version=");
builder.append(version);
builder.append(", toString()=");
builder.append(super.toString());
builder.append("]");
return builder.toString();
}
}
| UTF-8 | Java | 776 | java | ProductoSoftware.java | Java | [
{
"context": "/\r\npackage ejerciciost6.tienda;\r\n\r\n/**\r\n * @author sjgui\r\n *\r\n */\r\npublic class ProductoSoftware extends P",
"end": 68,
"score": 0.9995980858802795,
"start": 63,
"tag": "USERNAME",
"value": "sjgui"
}
]
| null | []
| /**
*
*/
package ejerciciost6.tienda;
/**
* @author sjgui
*
*/
public class ProductoSoftware extends Producto {
private double version;
/**
* @param codigo
* @param nombre
* @param descripcion
* @param precioUnitario
*/
public ProductoSoftware(String codigo, String nombre, String descripcion, double precioUnitario, double version) {
super(codigo, nombre, descripcion, precioUnitario);
this.version = version;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ProductoSoftware [version=");
builder.append(version);
builder.append(", toString()=");
builder.append(super.toString());
builder.append("]");
return builder.toString();
}
}
| 776 | 0.659794 | 0.658505 | 39 | 17.897436 | 22.271973 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 0 |
3278a90d40eb13efb8f52659be1ade7def62576f | 35,991,825,971,312 | 662103841eea5d99750fbecfbba7290f36115442 | /src/main/java/com/atsistemas/almunia/utils/Commands.java | 6101e31a0e6be7fbb68896458818e14d702affae | []
| no_license | Chillaso/Speech-Recognition | https://github.com/Chillaso/Speech-Recognition | 5c40423aa9f1dd5128b9a9a8a9ed61eb7cbafb81 | 32585f57ee156a89fbb0fb9028c1907b34cefe3b | refs/heads/master | 2020-04-19T13:02:35.320000 | 2019-01-31T08:37:56 | 2019-01-31T08:37:56 | 168,207,890 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atsistemas.almunia.utils;
import java.util.HashMap;
import java.util.Map;
public class Commands {
public static final String[] CAMELAR= {"google","cómo","aprobar","segundo"};
public static final String[] IES_ALMUNIA= {"miguel", "mejores", "alumnos"};
public static final String[] YOU_ARE = {"google","puto","amo","quién"};
public static final String[][] COMMANDS = {CAMELAR, IES_ALMUNIA, YOU_ARE};
private Map<String[],String> mapCommands;
public Commands()
{
mapCommands = new HashMap<>();
mapCommands.put(CAMELAR, ConstantUtils.CAMELAR);
mapCommands.put(IES_ALMUNIA, ConstantUtils.IES_ALMUNIA);
mapCommands.put(YOU_ARE, ConstantUtils.YOU_ARE);
}
public Map<String[], String> getMapCommands() {
return mapCommands;
}
}
| UTF-8 | Java | 767 | java | Commands.java | Java | [
{
"context": "o\"};\n\tpublic static final String[] IES_ALMUNIA= {\"miguel\", \"mejores\", \"alumnos\"};\n\tpublic static final Str",
"end": 243,
"score": 0.9874422550201416,
"start": 237,
"tag": "NAME",
"value": "miguel"
},
{
"context": "ic static final String[] IES_ALMUNIA= {\"miguel\", \"mejores\", \"alumnos\"};\n\tpublic static final String[] YOU_A",
"end": 254,
"score": 0.9145359396934509,
"start": 247,
"tag": "NAME",
"value": "mejores"
},
{
"context": "al String[] IES_ALMUNIA= {\"miguel\", \"mejores\", \"alumnos\"};\n\tpublic static final String[] YOU_ARE = {\"goog",
"end": 265,
"score": 0.8112480044364929,
"start": 260,
"tag": "NAME",
"value": "umnos"
}
]
| null | []
| package com.atsistemas.almunia.utils;
import java.util.HashMap;
import java.util.Map;
public class Commands {
public static final String[] CAMELAR= {"google","cómo","aprobar","segundo"};
public static final String[] IES_ALMUNIA= {"miguel", "mejores", "alumnos"};
public static final String[] YOU_ARE = {"google","puto","amo","quién"};
public static final String[][] COMMANDS = {CAMELAR, IES_ALMUNIA, YOU_ARE};
private Map<String[],String> mapCommands;
public Commands()
{
mapCommands = new HashMap<>();
mapCommands.put(CAMELAR, ConstantUtils.CAMELAR);
mapCommands.put(IES_ALMUNIA, ConstantUtils.IES_ALMUNIA);
mapCommands.put(YOU_ARE, ConstantUtils.YOU_ARE);
}
public Map<String[], String> getMapCommands() {
return mapCommands;
}
}
| 767 | 0.711111 | 0.711111 | 28 | 26.321428 | 26.93783 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.892857 | false | false | 0 |
d08015a5646aa5d6fb7398f5caad3214d7874556 | 39,513,699,134,317 | 7a7e5230ea8009528316c5b3a022470981009d14 | /src/main/java/com/grucas/desk/chemours/gui/MainForm.java | 98501bdefea74c67515c506f4e14a38fa8212572 | []
| no_license | PabloBenavides/ComparadorInventarios | https://github.com/PabloBenavides/ComparadorInventarios | 60562ed8f1ae146a52584cbc3e44aea82f3435ba | 728d41984f4d1efc1ac9bdc02866c11c41eca209 | refs/heads/master | 2019-06-15T05:30:43.674000 | 2017-11-02T19:23:45 | 2017-11-02T19:23:45 | 97,791,946 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.grucas.desk.chemours.gui;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.grucas.chemours.model.InventarioCiclico;
import com.grucas.chemours.model.InventarioCiclicoDet;
import com.grucas.desk.chemours.model.InventarioChemours;
import com.grucas.desk.chemours.parser.InventarioChemoursParser;
import com.grucas.desk.chemours.tmodel.InventarioChemoursTModel;
import com.rubik.Base.APIResponseBase;
import com.rubik.file.FileTypeFilter;
import com.rubik.manage.ManageDialogsSwing;
import com.rubik.request.HTTPResponseBase;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.filechooser.FileFilter;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
*
* @author Grucas
*/
public class MainForm extends javax.swing.JFrame {
ArrayList<InventarioChemours> inventarioHH = new ArrayList<>();
ArrayList<InventarioChemours> inventarioSAP = new ArrayList<>();
ArrayList<InventarioChemours> inventarioFinal = new ArrayList<>();
ArrayList<String> strLotesHHList = new ArrayList<>();
ArrayList<String> strLotesSAPList = new ArrayList<>();
Boolean excel = false;
List<InventarioCiclico> inventarios = new ArrayList<>();
// final String SERVER = "http://localhost:8080/";
final String SERVER = "http://maritimo.grupo-castaneda.com/";
/**
* Creates new form MainForm
*/
public MainForm() {
InventarioCiclico inventario_todos = new InventarioCiclico();
inventario_todos.setUnidad("TODOS");
inventario_todos.setFolio("0");
try {
initComponents();
// fill cbo
String strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclico?where=activo=1");
ObjectMapper mapper = new ObjectMapper();
APIResponseBase<InventarioCiclico> response = mapper.readValue(strResponse, new TypeReference<APIResponseBase<InventarioCiclico>>(){});
inventarios.add(inventario_todos);
for (int i = 0; i < response.getObjects().size(); i++) {
inventarios.add(response.getObjects().get(i));
}
for (int i = 0; i < inventarios.size(); i++) {
cboInventario.addItem(inventarios.get(i).toString());
}
cboInventario.setSelectedIndex(0);
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
txtSAP = new javax.swing.JTextField();
btnSAP = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
tblSAP = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
btnHH = new javax.swing.JButton();
txtHH = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
tblHH = new javax.swing.JTable();
chkExcel = new javax.swing.JCheckBox();
cboInventario = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
btnInve = new javax.swing.JButton();
btnCerrar = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Comparacion de inventarios");
setResizable(false);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Inventario SAP"));
txtSAP.setEditable(false);
btnSAP.setText("Cargar");
btnSAP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSAPActionPerformed(evt);
}
});
tblSAP.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane3.setViewportView(tblSAP);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btnSAP, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 224, Short.MAX_VALUE))
.addComponent(txtSAP))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btnSAP, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtSAP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Inventario Fisico HandHeld"));
btnHH.setText("Cargar");
btnHH.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHHActionPerformed(evt);
}
});
txtHH.setEditable(false);
tblHH.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane2.setViewportView(tblHH);
chkExcel.setText("Archivo Excel ");
jLabel1.setText("Inventario:");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(chkExcel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtHH, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cboInventario, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40)
.addComponent(btnHH, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtHH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkExcel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cboInventario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)))
.addComponent(btnHH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE)
.addContainerGap())
);
btnInve.setText("Inventario");
btnInve.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnInveActionPerformed(evt);
}
});
btnCerrar.setText("Cerrar");
btnCerrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCerrarActionPerformed(evt);
}
});
jButton1.setText("Etiquetas");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnInve, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnInve, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnSAPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSAPActionPerformed
JFileChooser fchooser = new JFileChooser();
FileFilter xlsFilter = new FileTypeFilter(".xls", "Microsoft Excel Documents ");
FileFilter xlsxFilter = new FileTypeFilter(".xlsx", "Microsoft Excel Documents");
fchooser.addChoosableFileFilter(xlsFilter);
fchooser.addChoosableFileFilter(xlsxFilter);
fchooser.setAcceptAllFileFilterUsed(true);
fchooser.setDialogTitle("Seleccione el Archivo de SAP con el Layout establecido:");
int result = fchooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fchooser.getSelectedFile();
txtSAP.setText(selectedFile.getName());
InventarioChemoursParser parser = new InventarioChemoursParser(selectedFile);
if (parser.fillArrayListSimple()) {
strLotesSAPList = parser.getLotesSAP();
inventarioSAP = parser.getInvDetList();
fillTable(inventarioSAP,true);
ManageDialogsSwing.messageDialog("Atencion", parser.getFilasLeidas() +
" leidas correctamente del archivo " + selectedFile.getName());
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
}
}//GEN-LAST:event_btnSAPActionPerformed
private void btnHHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHHActionPerformed
if(chkExcel.isSelected()){
JFileChooser fchooser = new JFileChooser();
FileFilter xlsFilter = new FileTypeFilter(".xls", "Microsoft Excel Documents ");
FileFilter xlsxFilter = new FileTypeFilter(".xlsx", "Microsoft Excel Documents");
fchooser.addChoosableFileFilter(xlsFilter);
fchooser.addChoosableFileFilter(xlsxFilter);
fchooser.setAcceptAllFileFilterUsed(true);
fchooser.setDialogTitle("Seleccione el Archivo de Toma de Inventario Generado por el sistema");
int result = fchooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fchooser.getSelectedFile();
txtHH.setText(selectedFile.getName());
InventarioChemoursParser parser = new InventarioChemoursParser(selectedFile);
if (parser.fillArrayListComplete()) {
strLotesHHList = parser.getLotesHH();
inventarioHH = parser.getInvDetList();
fillTable(inventarioHH, false);
ManageDialogsSwing.messageDialog("Atencion", parser.getFilasLeidas()
+ " leidas correctamente del archivo " + selectedFile.getName());
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
}
}else{
InventarioCiclico invSelected = inventarios.get(cboInventario.getSelectedIndex());
String strResponse = "";
if (invSelected.getFolio().equals("0")) {
strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclicoDet/all");
} else {
strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclicoDet/"+invSelected.getFolio());
}
ObjectMapper mapper = new ObjectMapper();
try {
APIResponseBase<InventarioCiclicoDet> response = mapper.readValue(strResponse, new TypeReference<APIResponseBase<InventarioCiclicoDet>>(){});
InventarioChemoursParser parser = new InventarioChemoursParser();
if (parser.fillArrayListComplete_FromList(response.getObjects())) {
strLotesHHList = parser.getLotesHH();
inventarioHH = parser.getInvDetList();
fillTable(inventarioHH, false);
ManageDialogsSwing.messageDialog("Atencion", "Informacion traida correctamente del servidor.");
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_btnHHActionPerformed
private void btnInveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInveActionPerformed
if(validOperation()){
inventarioFinal = new ArrayList<>();
btnInve.setEnabled(false);
ArrayList rows = new ArrayList();
for (int i = 0; i < strLotesHHList.size(); i++) {
String loteHH = strLotesHHList.get(i);
if(strLotesSAPList.contains(loteHH)){
inventarioFinal.add(new InventarioChemours(loteHH,loteHH,inventarioHH.get(i).getUbicacion(),"",inventarioHH.get(i).getAlmacen()));
}else{
inventarioFinal.add(new InventarioChemours("",loteHH,inventarioHH.get(i).getUbicacion(),"NO ENCONTRADO",inventarioHH.get(i).getAlmacen()));
}
}
// For de objetos
// for (String loteHH : strLotesHHList) {
//
// if(strLotesSAPList.contains(loteHH)){
// inventarioFinal.add(new InventarioChemours(loteHH,loteHH,""));
// }else{
// inventarioFinal.add(new InventarioChemours("",loteHH,"NO ENCONTRADO"));
// }
//
// }
// // For each function
// strLotesHHList.forEach((loteHH) -> {
// if(strLotesSAPList.contains(loteHH)){
// inventarioFinal.add(new InventarioChemours(loteHH,loteHH,""));
// }else{
// inventarioFinal.add(new InventarioChemours("",loteHH,"NO ENCONTRADO"));
// }
// });
//fill status in List HH
for (int i = 0; i < inventarioFinal.size(); i++) {
inventarioFinal.get(i).setStatus(inventarioHH.get(i).getStatus());
ArrayList<String> cells = new ArrayList();
cells.add(inventarioFinal.get(i).getLote_sap());
cells.add(inventarioFinal.get(i).getLote());
cells.add(inventarioFinal.get(i).getStatus());
cells.add(inventarioFinal.get(i).getAlmacen());
cells.add(inventarioFinal.get(i).getUbicacion());
rows.add(cells);
}
createFileXLSSimple(rows);
ManageDialogsSwing.messageDialog("Atencion!", "Archivo generado correctamente!");
btnInve.setEnabled(true);
}else{
ManageDialogsSwing.errorMessage("ERROR!", "Debe tener archivos cargados para poder hacer la comparacion seleccionada.");
}
}//GEN-LAST:event_btnInveActionPerformed
private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
this.dispose();
}//GEN-LAST:event_btnCerrarActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
EtiquetasForm etiquetas = new EtiquetasForm(this, true);
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
MainForm main = new MainForm();
// main.setExtendedState(MAXIMIZED_BOTH);
main.setLocationRelativeTo(null);
main.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCerrar;
private javax.swing.JButton btnHH;
private javax.swing.JButton btnInve;
private javax.swing.JButton btnSAP;
private javax.swing.JComboBox<String> cboInventario;
private javax.swing.JCheckBox chkExcel;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable tblHH;
private javax.swing.JTable tblSAP;
private javax.swing.JTextField txtHH;
private javax.swing.JTextField txtSAP;
// End of variables declaration//GEN-END:variables
public void fillTable(List<InventarioChemours> invDet, boolean sap) {
InventarioChemoursTModel tmodel = new InventarioChemoursTModel(sap);
tmodel.setValues(invDet);
tmodel.fireTableDataChanged();
if (sap) {
tblSAP.setModel(tmodel);
tblSAP.updateUI();
} else {
tblHH.setModel(tmodel);
tblHH.updateUI();
}
}
public Boolean validOperation(){
return (inventarioHH.size()>0 && inventarioSAP.size()>0);
}
public void createFileXLSSimple(ArrayList inventario){
SimpleDateFormat dt = new SimpleDateFormat("yyyy_MM_dd");
String sheetName = "Inventario";
ArrayList<String> headersList = new ArrayList<String>(){{
add("SAP(INV TEORICO)");
add("INV FISICO");
add("STATUS");
add("ALMACEN");
add("UBICACION");
}};
File directorioRaiz = new File("Inventario");
if(!directorioRaiz.exists()){
if(!directorioRaiz.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
String nombreDirectorioOperacion = "Inventario" + File.separator + dt.format(new Date());
File directorioOperacion = new File(nombreDirectorioOperacion);
if(!directorioOperacion.exists()){
if(!directorioOperacion.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
File archivo = new File(nombreDirectorioOperacion + File.separator + "InventarioFisico-Teorico.xls");
FileOutputStream outs = null;
try {
outs = new FileOutputStream(archivo);
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName);
int rowIdx = 0;
short cellIdx = 0;
// Header
XSSFRow hssfHeader = sheet.createRow(rowIdx);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
for (Iterator cells = headersList.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfHeader.createCell(cellIdx++);
hssfCell.setCellStyle(cellStyle);
hssfCell.setCellValue((String) cells.next());
}
// Data
rowIdx = 1;
for (Iterator rows = inventario.iterator(); rows.hasNext();) {
ArrayList row = (ArrayList) rows.next();
XSSFRow hssfRow = sheet.createRow(rowIdx++);
cellIdx = 0;
for (Iterator cells = row.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfRow.createCell(cellIdx++);
hssfCell.setCellValue((String) cells.next());
}
}
wb.setSheetName(0, sheetName);
try {
wb.write(outs);
outs.flush();
outs.close();
outs = null;
System.gc();
} catch (IOException e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el archivo de Excel, verifique que no este abierto.");
}
} catch (Exception e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "Error en la construccion del Excel File");
}
}
public void createFileXLS(ArrayList inventario, int operationType){
SimpleDateFormat dt = new SimpleDateFormat("yyyy_MM_dd");
String sheetName = "Inventario";
ArrayList<String> headersList = new ArrayList<String>(){{
add("LOTE");
add("PRODUCTO");
add("ALMACEN");
add("UBICACION");
add("STATUS");
}};
File directorioRaiz = new File("Inventarios");
if(!directorioRaiz.exists()){
if(!directorioRaiz.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
String nombreDirectorioOperacion = "Inventarios" + File.separator + dt.format(new Date());
File directorioOperacion = new File(nombreDirectorioOperacion);
if(!directorioOperacion.exists()){
if(!directorioOperacion.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
File archivo;
switch(operationType){
case 0:{ // Match SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvMatch.xls");
break;
}
case 1:{ // Faltantes SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvNoSAP_SiHH.xls");
break;
}
case 2:{ // Sobrantes SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvSiSAP_NoHH.xls");
break;
}
default: {
archivo = new File(nombreDirectorioOperacion + File.separator + "InvMatch.xls");
break;
}
}
FileOutputStream outs = null;
try {
outs = new FileOutputStream(archivo);
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName);
int rowIdx = 0;
short cellIdx = 0;
// Header
XSSFRow hssfHeader = sheet.createRow(rowIdx);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
for (Iterator cells = headersList.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfHeader.createCell(cellIdx++);
hssfCell.setCellStyle(cellStyle);
hssfCell.setCellValue((String) cells.next());
}
// Data
rowIdx = 1;
for (Iterator rows = inventario.iterator(); rows.hasNext();) {
ArrayList row = (ArrayList) rows.next();
XSSFRow hssfRow = sheet.createRow(rowIdx++);
cellIdx = 0;
for (Iterator cells = row.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfRow.createCell(cellIdx++);
hssfCell.setCellValue((String) cells.next());
}
}
wb.setSheetName(0, sheetName);
try {
wb.write(outs);
outs.flush();
outs.close();
outs = null;
System.gc();
} catch (IOException e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el archivo de Excel, verifique que no este abierto.");
}
} catch (Exception e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "Error en la construccion del Excel File");
}
}
}
| UTF-8 | Java | 34,398 | java | MainForm.java | Java | [
{
"context": "oi.xssf.usermodel.XSSFWorkbook;\n\n/**\n *\n * @author Grucas\n */\npublic class MainForm extends javax.swing.JFr",
"end": 1583,
"score": 0.998864471912384,
"start": 1577,
"tag": "NAME",
"value": "Grucas"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.grucas.desk.chemours.gui;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.grucas.chemours.model.InventarioCiclico;
import com.grucas.chemours.model.InventarioCiclicoDet;
import com.grucas.desk.chemours.model.InventarioChemours;
import com.grucas.desk.chemours.parser.InventarioChemoursParser;
import com.grucas.desk.chemours.tmodel.InventarioChemoursTModel;
import com.rubik.Base.APIResponseBase;
import com.rubik.file.FileTypeFilter;
import com.rubik.manage.ManageDialogsSwing;
import com.rubik.request.HTTPResponseBase;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.filechooser.FileFilter;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
*
* @author Grucas
*/
public class MainForm extends javax.swing.JFrame {
ArrayList<InventarioChemours> inventarioHH = new ArrayList<>();
ArrayList<InventarioChemours> inventarioSAP = new ArrayList<>();
ArrayList<InventarioChemours> inventarioFinal = new ArrayList<>();
ArrayList<String> strLotesHHList = new ArrayList<>();
ArrayList<String> strLotesSAPList = new ArrayList<>();
Boolean excel = false;
List<InventarioCiclico> inventarios = new ArrayList<>();
// final String SERVER = "http://localhost:8080/";
final String SERVER = "http://maritimo.grupo-castaneda.com/";
/**
* Creates new form MainForm
*/
public MainForm() {
InventarioCiclico inventario_todos = new InventarioCiclico();
inventario_todos.setUnidad("TODOS");
inventario_todos.setFolio("0");
try {
initComponents();
// fill cbo
String strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclico?where=activo=1");
ObjectMapper mapper = new ObjectMapper();
APIResponseBase<InventarioCiclico> response = mapper.readValue(strResponse, new TypeReference<APIResponseBase<InventarioCiclico>>(){});
inventarios.add(inventario_todos);
for (int i = 0; i < response.getObjects().size(); i++) {
inventarios.add(response.getObjects().get(i));
}
for (int i = 0; i < inventarios.size(); i++) {
cboInventario.addItem(inventarios.get(i).toString());
}
cboInventario.setSelectedIndex(0);
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
txtSAP = new javax.swing.JTextField();
btnSAP = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
tblSAP = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
btnHH = new javax.swing.JButton();
txtHH = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
tblHH = new javax.swing.JTable();
chkExcel = new javax.swing.JCheckBox();
cboInventario = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
btnInve = new javax.swing.JButton();
btnCerrar = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Comparacion de inventarios");
setResizable(false);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Inventario SAP"));
txtSAP.setEditable(false);
btnSAP.setText("Cargar");
btnSAP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSAPActionPerformed(evt);
}
});
tblSAP.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane3.setViewportView(tblSAP);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btnSAP, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 224, Short.MAX_VALUE))
.addComponent(txtSAP))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btnSAP, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtSAP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Inventario Fisico HandHeld"));
btnHH.setText("Cargar");
btnHH.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHHActionPerformed(evt);
}
});
txtHH.setEditable(false);
tblHH.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane2.setViewportView(tblHH);
chkExcel.setText("Archivo Excel ");
jLabel1.setText("Inventario:");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(chkExcel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtHH, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cboInventario, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(40, 40, 40)
.addComponent(btnHH, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtHH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkExcel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cboInventario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)))
.addComponent(btnHH, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE)
.addContainerGap())
);
btnInve.setText("Inventario");
btnInve.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnInveActionPerformed(evt);
}
});
btnCerrar.setText("Cerrar");
btnCerrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCerrarActionPerformed(evt);
}
});
jButton1.setText("Etiquetas");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnInve, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnInve, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnSAPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSAPActionPerformed
JFileChooser fchooser = new JFileChooser();
FileFilter xlsFilter = new FileTypeFilter(".xls", "Microsoft Excel Documents ");
FileFilter xlsxFilter = new FileTypeFilter(".xlsx", "Microsoft Excel Documents");
fchooser.addChoosableFileFilter(xlsFilter);
fchooser.addChoosableFileFilter(xlsxFilter);
fchooser.setAcceptAllFileFilterUsed(true);
fchooser.setDialogTitle("Seleccione el Archivo de SAP con el Layout establecido:");
int result = fchooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fchooser.getSelectedFile();
txtSAP.setText(selectedFile.getName());
InventarioChemoursParser parser = new InventarioChemoursParser(selectedFile);
if (parser.fillArrayListSimple()) {
strLotesSAPList = parser.getLotesSAP();
inventarioSAP = parser.getInvDetList();
fillTable(inventarioSAP,true);
ManageDialogsSwing.messageDialog("Atencion", parser.getFilasLeidas() +
" leidas correctamente del archivo " + selectedFile.getName());
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
}
}//GEN-LAST:event_btnSAPActionPerformed
private void btnHHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHHActionPerformed
if(chkExcel.isSelected()){
JFileChooser fchooser = new JFileChooser();
FileFilter xlsFilter = new FileTypeFilter(".xls", "Microsoft Excel Documents ");
FileFilter xlsxFilter = new FileTypeFilter(".xlsx", "Microsoft Excel Documents");
fchooser.addChoosableFileFilter(xlsFilter);
fchooser.addChoosableFileFilter(xlsxFilter);
fchooser.setAcceptAllFileFilterUsed(true);
fchooser.setDialogTitle("Seleccione el Archivo de Toma de Inventario Generado por el sistema");
int result = fchooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = fchooser.getSelectedFile();
txtHH.setText(selectedFile.getName());
InventarioChemoursParser parser = new InventarioChemoursParser(selectedFile);
if (parser.fillArrayListComplete()) {
strLotesHHList = parser.getLotesHH();
inventarioHH = parser.getInvDetList();
fillTable(inventarioHH, false);
ManageDialogsSwing.messageDialog("Atencion", parser.getFilasLeidas()
+ " leidas correctamente del archivo " + selectedFile.getName());
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
}
}else{
InventarioCiclico invSelected = inventarios.get(cboInventario.getSelectedIndex());
String strResponse = "";
if (invSelected.getFolio().equals("0")) {
strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclicoDet/all");
} else {
strResponse = HTTPResponseBase.get(SERVER + "ChemoursAPI/v1/InventarioCiclicoDet/"+invSelected.getFolio());
}
ObjectMapper mapper = new ObjectMapper();
try {
APIResponseBase<InventarioCiclicoDet> response = mapper.readValue(strResponse, new TypeReference<APIResponseBase<InventarioCiclicoDet>>(){});
InventarioChemoursParser parser = new InventarioChemoursParser();
if (parser.fillArrayListComplete_FromList(response.getObjects())) {
strLotesHHList = parser.getLotesHH();
inventarioHH = parser.getInvDetList();
fillTable(inventarioHH, false);
ManageDialogsSwing.messageDialog("Atencion", "Informacion traida correctamente del servidor.");
} else {
JOptionPane.showMessageDialog(this, "Error ocurrido al cargar el archivo.", "ATENCION", JOptionPane.ERROR_MESSAGE);
}
} catch (IOException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_btnHHActionPerformed
private void btnInveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInveActionPerformed
if(validOperation()){
inventarioFinal = new ArrayList<>();
btnInve.setEnabled(false);
ArrayList rows = new ArrayList();
for (int i = 0; i < strLotesHHList.size(); i++) {
String loteHH = strLotesHHList.get(i);
if(strLotesSAPList.contains(loteHH)){
inventarioFinal.add(new InventarioChemours(loteHH,loteHH,inventarioHH.get(i).getUbicacion(),"",inventarioHH.get(i).getAlmacen()));
}else{
inventarioFinal.add(new InventarioChemours("",loteHH,inventarioHH.get(i).getUbicacion(),"NO ENCONTRADO",inventarioHH.get(i).getAlmacen()));
}
}
// For de objetos
// for (String loteHH : strLotesHHList) {
//
// if(strLotesSAPList.contains(loteHH)){
// inventarioFinal.add(new InventarioChemours(loteHH,loteHH,""));
// }else{
// inventarioFinal.add(new InventarioChemours("",loteHH,"NO ENCONTRADO"));
// }
//
// }
// // For each function
// strLotesHHList.forEach((loteHH) -> {
// if(strLotesSAPList.contains(loteHH)){
// inventarioFinal.add(new InventarioChemours(loteHH,loteHH,""));
// }else{
// inventarioFinal.add(new InventarioChemours("",loteHH,"NO ENCONTRADO"));
// }
// });
//fill status in List HH
for (int i = 0; i < inventarioFinal.size(); i++) {
inventarioFinal.get(i).setStatus(inventarioHH.get(i).getStatus());
ArrayList<String> cells = new ArrayList();
cells.add(inventarioFinal.get(i).getLote_sap());
cells.add(inventarioFinal.get(i).getLote());
cells.add(inventarioFinal.get(i).getStatus());
cells.add(inventarioFinal.get(i).getAlmacen());
cells.add(inventarioFinal.get(i).getUbicacion());
rows.add(cells);
}
createFileXLSSimple(rows);
ManageDialogsSwing.messageDialog("Atencion!", "Archivo generado correctamente!");
btnInve.setEnabled(true);
}else{
ManageDialogsSwing.errorMessage("ERROR!", "Debe tener archivos cargados para poder hacer la comparacion seleccionada.");
}
}//GEN-LAST:event_btnInveActionPerformed
private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
this.dispose();
}//GEN-LAST:event_btnCerrarActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
EtiquetasForm etiquetas = new EtiquetasForm(this, true);
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
}
MainForm main = new MainForm();
// main.setExtendedState(MAXIMIZED_BOTH);
main.setLocationRelativeTo(null);
main.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCerrar;
private javax.swing.JButton btnHH;
private javax.swing.JButton btnInve;
private javax.swing.JButton btnSAP;
private javax.swing.JComboBox<String> cboInventario;
private javax.swing.JCheckBox chkExcel;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTable tblHH;
private javax.swing.JTable tblSAP;
private javax.swing.JTextField txtHH;
private javax.swing.JTextField txtSAP;
// End of variables declaration//GEN-END:variables
public void fillTable(List<InventarioChemours> invDet, boolean sap) {
InventarioChemoursTModel tmodel = new InventarioChemoursTModel(sap);
tmodel.setValues(invDet);
tmodel.fireTableDataChanged();
if (sap) {
tblSAP.setModel(tmodel);
tblSAP.updateUI();
} else {
tblHH.setModel(tmodel);
tblHH.updateUI();
}
}
public Boolean validOperation(){
return (inventarioHH.size()>0 && inventarioSAP.size()>0);
}
public void createFileXLSSimple(ArrayList inventario){
SimpleDateFormat dt = new SimpleDateFormat("yyyy_MM_dd");
String sheetName = "Inventario";
ArrayList<String> headersList = new ArrayList<String>(){{
add("SAP(INV TEORICO)");
add("INV FISICO");
add("STATUS");
add("ALMACEN");
add("UBICACION");
}};
File directorioRaiz = new File("Inventario");
if(!directorioRaiz.exists()){
if(!directorioRaiz.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
String nombreDirectorioOperacion = "Inventario" + File.separator + dt.format(new Date());
File directorioOperacion = new File(nombreDirectorioOperacion);
if(!directorioOperacion.exists()){
if(!directorioOperacion.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
File archivo = new File(nombreDirectorioOperacion + File.separator + "InventarioFisico-Teorico.xls");
FileOutputStream outs = null;
try {
outs = new FileOutputStream(archivo);
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName);
int rowIdx = 0;
short cellIdx = 0;
// Header
XSSFRow hssfHeader = sheet.createRow(rowIdx);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
for (Iterator cells = headersList.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfHeader.createCell(cellIdx++);
hssfCell.setCellStyle(cellStyle);
hssfCell.setCellValue((String) cells.next());
}
// Data
rowIdx = 1;
for (Iterator rows = inventario.iterator(); rows.hasNext();) {
ArrayList row = (ArrayList) rows.next();
XSSFRow hssfRow = sheet.createRow(rowIdx++);
cellIdx = 0;
for (Iterator cells = row.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfRow.createCell(cellIdx++);
hssfCell.setCellValue((String) cells.next());
}
}
wb.setSheetName(0, sheetName);
try {
wb.write(outs);
outs.flush();
outs.close();
outs = null;
System.gc();
} catch (IOException e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el archivo de Excel, verifique que no este abierto.");
}
} catch (Exception e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "Error en la construccion del Excel File");
}
}
public void createFileXLS(ArrayList inventario, int operationType){
SimpleDateFormat dt = new SimpleDateFormat("yyyy_MM_dd");
String sheetName = "Inventario";
ArrayList<String> headersList = new ArrayList<String>(){{
add("LOTE");
add("PRODUCTO");
add("ALMACEN");
add("UBICACION");
add("STATUS");
}};
File directorioRaiz = new File("Inventarios");
if(!directorioRaiz.exists()){
if(!directorioRaiz.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
String nombreDirectorioOperacion = "Inventarios" + File.separator + dt.format(new Date());
File directorioOperacion = new File(nombreDirectorioOperacion);
if(!directorioOperacion.exists()){
if(!directorioOperacion.mkdir()){
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el directorio con el archivo especificado");
}
}
File archivo;
switch(operationType){
case 0:{ // Match SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvMatch.xls");
break;
}
case 1:{ // Faltantes SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvNoSAP_SiHH.xls");
break;
}
case 2:{ // Sobrantes SAP -> HH
archivo = new File(nombreDirectorioOperacion + File.separator + "InvSiSAP_NoHH.xls");
break;
}
default: {
archivo = new File(nombreDirectorioOperacion + File.separator + "InvMatch.xls");
break;
}
}
FileOutputStream outs = null;
try {
outs = new FileOutputStream(archivo);
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName);
int rowIdx = 0;
short cellIdx = 0;
// Header
XSSFRow hssfHeader = sheet.createRow(rowIdx);
XSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
for (Iterator cells = headersList.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfHeader.createCell(cellIdx++);
hssfCell.setCellStyle(cellStyle);
hssfCell.setCellValue((String) cells.next());
}
// Data
rowIdx = 1;
for (Iterator rows = inventario.iterator(); rows.hasNext();) {
ArrayList row = (ArrayList) rows.next();
XSSFRow hssfRow = sheet.createRow(rowIdx++);
cellIdx = 0;
for (Iterator cells = row.iterator(); cells.hasNext();) {
XSSFCell hssfCell = hssfRow.createCell(cellIdx++);
hssfCell.setCellValue((String) cells.next());
}
}
wb.setSheetName(0, sheetName);
try {
wb.write(outs);
outs.flush();
outs.close();
outs = null;
System.gc();
} catch (IOException e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "No se pudo crear el archivo de Excel, verifique que no este abierto.");
}
} catch (Exception e) {
e.printStackTrace();
ManageDialogsSwing.errorMessage("ERROR!", "Error en la construccion del Excel File");
}
}
}
| 34,398 | 0.606896 | 0.602448 | 745 | 45.171814 | 36.528191 | 174 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.681879 | false | false | 0 |
ce77c3a990548439c8a1f59f5650a9379ba45a49 | 8,959,301,847,958 | 9da73c57a06784e4f8f65949746927ca1795b839 | /src/main/java/com/jack/simple/Beaver.java | 28ecf6cc0226d4ea9dc9e21e146672a03284adf3 | []
| no_license | joscha1996/BeaverQue | https://github.com/joscha1996/BeaverQue | 290433f2017384115a10b0a0508e2256e7665241 | fc481280b110cb2bd63b853139368fcfe24aec6f | refs/heads/master | 2019-12-19T18:17:00.932000 | 2017-02-08T18:05:38 | 2017-02-08T18:05:38 | 80,516,483 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jack.simple;
public class Beaver {
private boolean small;
public Beaver(boolean small) {
this.small = small;
}
public boolean isSmall() {
return small;
}
@Override
public String toString() {
return (small ? "small" : "big") + " beaver";
}
}
| UTF-8 | Java | 314 | java | Beaver.java | Java | []
| null | []
| package com.jack.simple;
public class Beaver {
private boolean small;
public Beaver(boolean small) {
this.small = small;
}
public boolean isSmall() {
return small;
}
@Override
public String toString() {
return (small ? "small" : "big") + " beaver";
}
}
| 314 | 0.566879 | 0.566879 | 19 | 15.526316 | 15.031085 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 0 |
f3c2b2660152f392cec3d2a1e651e44543c47c84 | 16,956,530,899,365 | 2b81595c4d02abb06e4d36f25f404bbb6200657a | /src/main/java/com/simpledata/frame/base/entity/vo/PageVO.java | 204eba201c6284a50f21d16cb9470f2e67614f73 | []
| no_license | 530335286/simple-data-framework | https://github.com/530335286/simple-data-framework | 0b66c5345a2ed8e3b3f304733a3c8952690ed338 | 7a3ae6b9eb4629f92ef432db6d7f8e45ce5fc4bc | refs/heads/master | 2023-03-07T16:02:28.824000 | 2021-02-24T08:57:04 | 2021-02-24T08:57:04 | 307,888,714 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.simpledata.frame.base.entity.vo;
import lombok.Data;
import java.util.List;
/***
* simple-data
* @author zcw
* @version 0.0.1
*/
@Data
public class PageVO<T> {
private Long current;
private Long pageSize;
private Boolean queryNum;
private List<T> data;
private Long total;
}
| UTF-8 | Java | 315 | java | PageVO.java | Java | [
{
"context": "rt java.util.List;\n\n/***\n * simple-data\n * @author zcw\n * @version 0.0.1\n */\n\n@Data\npublic class PageVO<",
"end": 125,
"score": 0.9996868968009949,
"start": 122,
"tag": "USERNAME",
"value": "zcw"
}
]
| null | []
| package com.simpledata.frame.base.entity.vo;
import lombok.Data;
import java.util.List;
/***
* simple-data
* @author zcw
* @version 0.0.1
*/
@Data
public class PageVO<T> {
private Long current;
private Long pageSize;
private Boolean queryNum;
private List<T> data;
private Long total;
}
| 315 | 0.67619 | 0.666667 | 20 | 14.75 | 12.316148 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 0 |
50c137f8abe13f60c9c4635d8460fb2d32ebdf4e | 26,852,135,586,896 | cc294d42e69f83ebc3192578424768638e7ec48b | /src/main/java/com/mystudypeer/mystudypeer/domains/Registration.java | 98ea0ffe4a0bbe2342d637f7b7ca11c021084340 | [
"MIT"
]
| permissive | Dexess/my-study-peer-backend | https://github.com/Dexess/my-study-peer-backend | 03d47183efae8d1159894d1bc20a094439bb9716 | a1ebc12530948831a2f70004ed854aae135c9092 | refs/heads/master | 2023-06-09T13:56:59.543000 | 2021-06-27T20:07:18 | 2021-06-27T20:07:18 | 373,848,697 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mystudypeer.mystudypeer.domains;
import lombok.Data;
@Data
public class Registration {
private String email;
private String name;
private String password;
private String surname;
private String city;
private String telno;
private int userClass;
private String uniName;
private String progName;
}
| UTF-8 | Java | 348 | java | Registration.java | Java | []
| null | []
| package com.mystudypeer.mystudypeer.domains;
import lombok.Data;
@Data
public class Registration {
private String email;
private String name;
private String password;
private String surname;
private String city;
private String telno;
private int userClass;
private String uniName;
private String progName;
}
| 348 | 0.727012 | 0.727012 | 18 | 18.333334 | 13.136041 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611111 | false | false | 0 |
5f7cd4382436fea0de185d49c995145a87b919d7 | 29,892,972,433,639 | df02358f214ca5d1210c47bd3fbedc580de389f3 | /src/gedcom/Test_US_CheckValidity.java | 6f89444f9d77368c98619c0dea741b5bb3d616cf | []
| no_license | allanshivji/CS_555_JAVS | https://github.com/allanshivji/CS_555_JAVS | c9bfdc63017cc2b6ac0acbce0d1be835af5b00ac | 8530eec981863ba74fc1a9a62dd9b0437872dadc | refs/heads/master | 2020-04-21T13:33:52.545000 | 2019-04-23T00:37:08 | 2019-04-23T00:37:08 | 169,603,238 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gedcom;
import static org.junit.Assert.*;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import org.junit.*;
public class Test_US_CheckValidity {
//
// int Age1 = 151;
// int Age2 = 13;
// int Age3 = 30;
// int Age4 = 150;
// int Age5 = 149;
// int Age6 = 14;
// String SpouseID1 = null;
// String SpouseID2 = "F1";
//
// int fatherAge1 = 100;
// int fatherAge2 = 90;
// int motherAge1 = 80;
// int motherAge2 = 70;
// int childAge1 = 5;
// int childAge2 = 10;
// int childAge3 = 20;
// int childAge4 = 40;
//
// String fatherId1 = "bi00";
// String fatherId2 = "bi01";
// String motherId1 = "bi10";
// String motherId2 = "bi11";
// String childId1 = "bi00";
// String childId2 = "bi11";
@Test
public void test_check_age() {
Individual indi = new Individual();
indi.setId("I01");
indi.setName("XX");
indi.setBirthDate("1 JAN 1900");
assertNull(US_CheckValidity.check_age(indi));
indi.setBirthDate("1 JAN 1800");
assertNotNull(US_CheckValidity.check_age(indi));
}
@Test
public void test_check_marriage_age() {
Individual indi = new Individual();
indi.setId("I01");
indi.setName("XX");
indi.setFamilySpouseId("F01");
indi.setBirthDate("1 JAN 2010");
assertNotNull(US_CheckValidity.check_marriage_age(indi));
indi.setBirthDate("1 JAN 2000");
assertNull(US_CheckValidity.check_marriage_age(indi));
}
@Test
public void test_check_parents_not_too_old() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setFamilySpouseId("F01");
indi_husband.setBirthDate("1 JAN 1900");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setFamilySpouseId("F01");
indi_wife.setBirthDate("1 JAN 1900");
Individual indi_child = new Individual();
indi_child.setId("I03");
indi_child.setName("Child");
indi_child.setFamilySpouseId("F01");
indi_child.setBirthDate("1 JAN 2000");
ArrayList<Individual> indi_children = new ArrayList<Individual>();
indi_children.add(indi_child);
assertNotEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
indi_husband.setBirthDate("1 JAN 1950");
assertNotEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
indi_wife.setBirthDate("1 JAN 1970");
assertEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
}
@Test
public void test_check_parents_no_marriages_to_children() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setFamilySpouseId("F01");
indi_husband.setBirthDate("1 JAN 1900");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setFamilySpouseId("F01");
indi_wife.setBirthDate("1 JAN 1900");
Individual indi_child = new Individual();
indi_child.setId("I03");
indi_child.setName("Child");
indi_child.setFamilySpouseId("F01");
indi_child.setBirthDate("1 JAN 2000");
ArrayList<Individual> indi_children1 = new ArrayList<Individual>();
indi_children1.add(indi_husband);
ArrayList<Individual> indi_children2 = new ArrayList<Individual>();
indi_children2.add(indi_wife);
ArrayList<Individual> indi_children3 = new ArrayList<Individual>();
indi_children3.add(indi_child);
assertNotEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children1, "F01").size(), 0);
assertNotEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children2, "F01").size(), 0);
assertEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children3, "F01").size(), 0);
}
@Test
public void test_check_divorce_before_death() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setBirthDate("1 JAN 1901");
indi_husband.setDeathDate("1 JAN 1981");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setDeathDate("1 JAN 1979");
Family indi_family1 = new Family();
indi_family1.setId("F01");
indi_family1.setDivorceDate("1 JAN 1980");
Family indi_family2 = new Family();
indi_family2.setId("F01");
indi_family2.setDivorceDate("1 JAN 1970");
assertNotEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family1).size(), 0);
assertNotEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family1).size(), 0);
assertEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family2).size(), 0);
}
@Test
public void test_check_multiple_births() {
Individual indi_child1 = new Individual();
indi_child1.setId("I01");
indi_child1.setName("child1");
indi_child1.setBirthDate("1 JAN 1980");
Individual indi_child2 = new Individual();
indi_child2.setId("I02");
indi_child2.setName("child2");
indi_child2.setBirthDate("1 JAN 1980");
Individual indi_child3 = new Individual();
indi_child3.setId("I03");
indi_child3.setName("child3");
indi_child3.setBirthDate("1 JAN 1980");
Individual indi_child4 = new Individual();
indi_child4.setId("I04");
indi_child4.setName("child4");
indi_child4.setBirthDate("1 JAN 1980");
Individual indi_child5 = new Individual();
indi_child5.setId("I05");
indi_child5.setName("child5");
indi_child5.setBirthDate("1 JAN 1980");
Individual indi_child6 = new Individual();
indi_child6.setId("I06");
indi_child6.setName("child6");
indi_child6.setBirthDate("1 JAN 1980");
ArrayList<Individual> children1 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
children1.add(indi_child6);
ArrayList<Individual> children2 = new ArrayList<Individual>();
children2.add(indi_child1);
children2.add(indi_child2);
children2.add(indi_child3);
children2.add(indi_child4);
children2.add(indi_child5);
assertNotEquals(US_CheckValidity.check_multiple_births(children1, "F01").size(), 0);
assertEquals(US_CheckValidity.check_multiple_births(children2, "F01").size(), 0);
}
@Test
public void test_check_male_last_name() {
Individual indi_father = new Individual();
indi_father.setId("F01");
indi_father.setName("father liu");
Individual indi_child1 = new Individual();
indi_child1.setId("I01");
indi_child1.setName("child1 liu");
indi_child1.setBirthDate("1 JAN 1980");
Individual indi_child2 = new Individual();
indi_child2.setId("I02");
indi_child2.setName("child2 liu");
indi_child2.setBirthDate("1 JAN 1980");
Individual indi_child3 = new Individual();
indi_child3.setId("I03");
indi_child3.setName("child3 liu");
indi_child3.setBirthDate("1 JAN 1980");
Individual indi_child4 = new Individual();
indi_child4.setId("I04");
indi_child4.setName("child4 liu");
indi_child4.setBirthDate("1 JAN 1980");
Individual indi_child5 = new Individual();
indi_child5.setId("I05");
indi_child5.setName("child5 liu");
indi_child5.setBirthDate("1 JAN 1980");
Individual indi_child6 = new Individual();
indi_child6.setId("I06");
indi_child6.setName("child6 li");
indi_child6.setBirthDate("1 JAN 1980");
ArrayList<Individual> children1 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
ArrayList<Individual> children2 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
children1.add(indi_child6);
assertNotEquals(US_CheckValidity.check_male_last_name(children1, indi_father, "F01").size(), 0);
assertEquals(US_CheckValidity.check_male_last_name(children2, indi_father, "F01").size(), 0);
}
@Test
public void test_check_unique_name_birthdate() {
HashMap<String, Individual> testIndividualMap1 = new HashMap<String, Individual>();
HashMap<String, Individual> testIndividualMap2 = new HashMap<String, Individual>();
HashMap<String, Individual> testIndividualMap3 = new HashMap<String, Individual>();
ArrayList<Family> testFamilyList = new ArrayList<Family>();
Individual indi1 = new Individual();
indi1.setId("F01");
indi1.setName("Jiayuan liu");
indi1.setBirthDate("1 JAN 1980");
testIndividualMap1.put("F01", indi1);
testIndividualMap2.put("F01", indi1);
testIndividualMap3.put("F01", indi1);
Individual indi2 = new Individual();
indi2.setId("F02");
indi2.setName("Jay Chou");
indi2.setBirthDate("1 JAN 1980");
testIndividualMap1.put("F02", indi2);
Individual indi3 = new Individual();
indi3.setId("F03");
indi3.setName("Jiayuan liu");
indi3.setBirthDate("1 JAN 1981");
testIndividualMap2.put("F03", indi3);
Individual indi4 = new Individual();
indi4.setId("F04");
indi4.setName("Jiayuan liu");
indi4.setBirthDate("1 JAN 1980");
testIndividualMap3.put("F04", indi4);
FamilyTreeParser Ftp1 = new FamilyTreeParser(testIndividualMap1, testFamilyList);
FamilyTreeParser Ftp2 = new FamilyTreeParser(testIndividualMap2, testFamilyList);
FamilyTreeParser Ftp3 = new FamilyTreeParser(testIndividualMap3, testFamilyList);
assertEquals(US_CheckValidity.check_unique_name_birthdate(Ftp1).size(), 0);
assertEquals(US_CheckValidity.check_unique_name_birthdate(Ftp2).size(), 0);
assertNotEquals(US_CheckValidity.check_unique_name_birthdate(Ftp3).size(), 0);
}
// @Test
// public void test_check_age() {
// // fail("Not yet implemented");
// assertFalse(CheckValidity.check_age(Age1));
// assertTrue(CheckValidity.check_age(Age2));
// assertTrue(CheckValidity.check_age(Age3));
// assertFalse(CheckValidity.check_age(Age4));
// assertTrue(CheckValidity.check_age(Age5));
// }
//
// @Test
// public void test_check_marriage_age() {
// // fail("Not yet implemented");
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age2));
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age3));
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age6));
// assertFalse(CheckValidity.check_marriage_age(SpouseID2, Age2));
// assertTrue(CheckValidity.check_marriage_age(SpouseID2, Age3));
// assertFalse(CheckValidity.check_marriage_age(SpouseID2, Age6));
// }
//
// @Test
// public void test_check_father_not_too_old() {
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge1, childAge1));
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge1, childAge2));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge1, childAge3));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge1, childAge4));
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge2, childAge1));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge2));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge3));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge4));
// }
//
// @Test
// public void test_check_mother_not_too_old() {
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge1, childAge1));
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge1, childAge2));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge1, childAge3));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge1, childAge4));
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge2, childAge1));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge2));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge3));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge4));
// }
//
// @Test
// public void test_check_father_no_marriages_to_children() {
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId1, childId1));
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId1, childId2));
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId2, childId1));
// assertFalse(CheckValidity.check_father_no_marriages_to_children(motherId2, childId2));
// }
//
// @Test
// public void test_check_mother_no_marriages_to_children() {
// assertFalse(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId1));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId2));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId2, childId1));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId2));
// }
//
}
| UTF-8 | Java | 13,305 | java | Test_US_CheckValidity.java | Java | [
{
"context": "di_husband.setId(\"I01\");\r\n\t\tindi_husband.setName(\"Husband\");\r\n\t\tindi_husband.setFamilySpouseId(\"F01\");\r\n\t\ti",
"end": 1613,
"score": 0.9988412857055664,
"start": 1606,
"tag": "NAME",
"value": "Husband"
},
{
"context": "\r\n\t\tindi_wife.setId(\"I02\");\r\n\t\tindi_wife.setName(\"Wife\");\r\n\t\tindi_wife.setFamilySpouseId(\"F01\");\r\n\t\tindi",
"end": 1802,
"score": 0.9990407824516296,
"start": 1798,
"tag": "NAME",
"value": "Wife"
},
{
"context": "\t\tindi_child.setId(\"I03\");\r\n\t\tindi_child.setName(\"Child\");\r\n\t\tindi_child.setFamilySpouseId(\"F01\");\r\n\t\tind",
"end": 1989,
"score": 0.8937293291091919,
"start": 1984,
"tag": "NAME",
"value": "Child"
},
{
"context": "di_husband.setId(\"I01\");\r\n\t\tindi_husband.setName(\"Husband\");\r\n\t\tindi_husband.setFamilySpouseId(\"F01\");\r\n\t\ti",
"end": 2825,
"score": 0.9995496869087219,
"start": 2818,
"tag": "NAME",
"value": "Husband"
},
{
"context": "\r\n\t\tindi_wife.setId(\"I02\");\r\n\t\tindi_wife.setName(\"Wife\");\r\n\t\tindi_wife.setFamilySpouseId(\"F01\");\r\n\t\tindi",
"end": 3014,
"score": 0.9995108842849731,
"start": 3010,
"tag": "NAME",
"value": "Wife"
},
{
"context": "\t\tindi_child.setId(\"I03\");\r\n\t\tindi_child.setName(\"Child\");\r\n\t\tindi_child.setFamilySpouseId(\"F01\");\r\n\t\tind",
"end": 3201,
"score": 0.9966270923614502,
"start": 3196,
"tag": "NAME",
"value": "Child"
},
{
"context": "di_husband.setId(\"I01\");\r\n\t\tindi_husband.setName(\"Husband\");\r\n\t\tindi_husband.setBirthDate(\"1 JAN 1901\");\r\n\t",
"end": 4203,
"score": 0.9995534420013428,
"start": 4196,
"tag": "NAME",
"value": "Husband"
},
{
"context": "\r\n\t\tindi_wife.setId(\"I02\");\r\n\t\tindi_wife.setName(\"Wife\");\r\n\t\tindi_wife.setDeathDate(\"1 JAN 1979\");\r\n\r\n\t\t",
"end": 4394,
"score": 0.9996271133422852,
"start": 4390,
"tag": "NAME",
"value": "Wife"
},
{
"context": "indi_father.setId(\"F01\");\r\n\t\tindi_father.setName(\"father liu\");\r\n\r\n\t\tIndividual indi_child1 = new Individual()",
"end": 6818,
"score": 0.9993302822113037,
"start": 6808,
"tag": "NAME",
"value": "father liu"
},
{
"context": "indi_child1.setId(\"I01\");\r\n\t\tindi_child1.setName(\"child1 liu\");\r\n\t\tindi_child1.setBirthDate(\"1 JAN 1980\");\r\n\r\n",
"end": 6933,
"score": 0.9970127940177917,
"start": 6923,
"tag": "NAME",
"value": "child1 liu"
},
{
"context": "d2.setId(\"I02\");\r\n\t\tindi_child2.setName(\"child2 liu\");\r\n\t\tindi_child2.setBirthDate(\"1 JAN 1980\");\r\n\r\n",
"end": 7091,
"score": 0.5063625574111938,
"start": 7090,
"tag": "NAME",
"value": "u"
},
{
"context": "hild3.setId(\"I03\");\r\n\t\tindi_child3.setName(\"child3 liu\");\r\n\t\tindi_child3.setBirthDate(\"1 JAN 1980\");\r\n\r\n",
"end": 7249,
"score": 0.50935959815979,
"start": 7246,
"tag": "NAME",
"value": "liu"
},
{
"context": "d4.setId(\"I04\");\r\n\t\tindi_child4.setName(\"child4 liu\");\r\n\t\tindi_child4.setBirthDate(\"1 JAN 1980\");\r\n\r\n",
"end": 7407,
"score": 0.514941394329071,
"start": 7406,
"tag": "NAME",
"value": "u"
},
{
"context": "hild5.setId(\"I05\");\r\n\t\tindi_child5.setName(\"child5 liu\");\r\n\t\tindi_child5.setBirthDate(\"1 JAN 1980\");\r\n\r\n",
"end": 7565,
"score": 0.5284662246704102,
"start": 7562,
"tag": "NAME",
"value": "liu"
},
{
"context": "idual();\r\n\t\tindi1.setId(\"F01\");\r\n\t\tindi1.setName(\"Jiayuan liu\");\r\n\t\tindi1.setBirthDate(\"1 JAN 1980\");\r\n\t\ttestIn",
"end": 8934,
"score": 0.9997747540473938,
"start": 8923,
"tag": "NAME",
"value": "Jiayuan liu"
},
{
"context": "idual();\r\n\t\tindi2.setId(\"F02\");\r\n\t\tindi2.setName(\"Jay Chou\");\r\n\t\tindi2.setBirthDate(\"1 JAN 1980\");\r\n\t\ttestIn",
"end": 9189,
"score": 0.9997663497924805,
"start": 9181,
"tag": "NAME",
"value": "Jay Chou"
},
{
"context": "idual();\r\n\t\tindi3.setId(\"F03\");\r\n\t\tindi3.setName(\"Jiayuan liu\");\r\n\t\tindi3.setBirthDate(\"1 JAN 1981\");\r\n\t\ttestIn",
"end": 9365,
"score": 0.999743640422821,
"start": 9354,
"tag": "NAME",
"value": "Jiayuan liu"
},
{
"context": "idual();\r\n\t\tindi4.setId(\"F04\");\r\n\t\tindi4.setName(\"Jiayuan liu\");\r\n\t\tindi4.setBirthDate(\"1 JAN 1980\");\r\n\t\ttestIn",
"end": 9541,
"score": 0.9997544288635254,
"start": 9530,
"tag": "NAME",
"value": "Jiayuan liu"
}
]
| null | []
| package gedcom;
import static org.junit.Assert.*;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import org.junit.*;
public class Test_US_CheckValidity {
//
// int Age1 = 151;
// int Age2 = 13;
// int Age3 = 30;
// int Age4 = 150;
// int Age5 = 149;
// int Age6 = 14;
// String SpouseID1 = null;
// String SpouseID2 = "F1";
//
// int fatherAge1 = 100;
// int fatherAge2 = 90;
// int motherAge1 = 80;
// int motherAge2 = 70;
// int childAge1 = 5;
// int childAge2 = 10;
// int childAge3 = 20;
// int childAge4 = 40;
//
// String fatherId1 = "bi00";
// String fatherId2 = "bi01";
// String motherId1 = "bi10";
// String motherId2 = "bi11";
// String childId1 = "bi00";
// String childId2 = "bi11";
@Test
public void test_check_age() {
Individual indi = new Individual();
indi.setId("I01");
indi.setName("XX");
indi.setBirthDate("1 JAN 1900");
assertNull(US_CheckValidity.check_age(indi));
indi.setBirthDate("1 JAN 1800");
assertNotNull(US_CheckValidity.check_age(indi));
}
@Test
public void test_check_marriage_age() {
Individual indi = new Individual();
indi.setId("I01");
indi.setName("XX");
indi.setFamilySpouseId("F01");
indi.setBirthDate("1 JAN 2010");
assertNotNull(US_CheckValidity.check_marriage_age(indi));
indi.setBirthDate("1 JAN 2000");
assertNull(US_CheckValidity.check_marriage_age(indi));
}
@Test
public void test_check_parents_not_too_old() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setFamilySpouseId("F01");
indi_husband.setBirthDate("1 JAN 1900");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setFamilySpouseId("F01");
indi_wife.setBirthDate("1 JAN 1900");
Individual indi_child = new Individual();
indi_child.setId("I03");
indi_child.setName("Child");
indi_child.setFamilySpouseId("F01");
indi_child.setBirthDate("1 JAN 2000");
ArrayList<Individual> indi_children = new ArrayList<Individual>();
indi_children.add(indi_child);
assertNotEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
indi_husband.setBirthDate("1 JAN 1950");
assertNotEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
indi_wife.setBirthDate("1 JAN 1970");
assertEquals(US_CheckValidity.check_parents_not_too_old(indi_husband, indi_wife, indi_children, "F1").size(),
0);
}
@Test
public void test_check_parents_no_marriages_to_children() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setFamilySpouseId("F01");
indi_husband.setBirthDate("1 JAN 1900");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setFamilySpouseId("F01");
indi_wife.setBirthDate("1 JAN 1900");
Individual indi_child = new Individual();
indi_child.setId("I03");
indi_child.setName("Child");
indi_child.setFamilySpouseId("F01");
indi_child.setBirthDate("1 JAN 2000");
ArrayList<Individual> indi_children1 = new ArrayList<Individual>();
indi_children1.add(indi_husband);
ArrayList<Individual> indi_children2 = new ArrayList<Individual>();
indi_children2.add(indi_wife);
ArrayList<Individual> indi_children3 = new ArrayList<Individual>();
indi_children3.add(indi_child);
assertNotEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children1, "F01").size(), 0);
assertNotEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children2, "F01").size(), 0);
assertEquals(US_CheckValidity
.check_parents_no_marriages_to_children(indi_husband, indi_wife, indi_children3, "F01").size(), 0);
}
@Test
public void test_check_divorce_before_death() {
Individual indi_husband = new Individual();
indi_husband.setId("I01");
indi_husband.setName("Husband");
indi_husband.setBirthDate("1 JAN 1901");
indi_husband.setDeathDate("1 JAN 1981");
Individual indi_wife = new Individual();
indi_wife.setId("I02");
indi_wife.setName("Wife");
indi_wife.setDeathDate("1 JAN 1979");
Family indi_family1 = new Family();
indi_family1.setId("F01");
indi_family1.setDivorceDate("1 JAN 1980");
Family indi_family2 = new Family();
indi_family2.setId("F01");
indi_family2.setDivorceDate("1 JAN 1970");
assertNotEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family1).size(), 0);
assertNotEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family1).size(), 0);
assertEquals(US_CheckValidity.check_divorce_before_death(indi_husband, indi_wife, indi_family2).size(), 0);
}
@Test
public void test_check_multiple_births() {
Individual indi_child1 = new Individual();
indi_child1.setId("I01");
indi_child1.setName("child1");
indi_child1.setBirthDate("1 JAN 1980");
Individual indi_child2 = new Individual();
indi_child2.setId("I02");
indi_child2.setName("child2");
indi_child2.setBirthDate("1 JAN 1980");
Individual indi_child3 = new Individual();
indi_child3.setId("I03");
indi_child3.setName("child3");
indi_child3.setBirthDate("1 JAN 1980");
Individual indi_child4 = new Individual();
indi_child4.setId("I04");
indi_child4.setName("child4");
indi_child4.setBirthDate("1 JAN 1980");
Individual indi_child5 = new Individual();
indi_child5.setId("I05");
indi_child5.setName("child5");
indi_child5.setBirthDate("1 JAN 1980");
Individual indi_child6 = new Individual();
indi_child6.setId("I06");
indi_child6.setName("child6");
indi_child6.setBirthDate("1 JAN 1980");
ArrayList<Individual> children1 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
children1.add(indi_child6);
ArrayList<Individual> children2 = new ArrayList<Individual>();
children2.add(indi_child1);
children2.add(indi_child2);
children2.add(indi_child3);
children2.add(indi_child4);
children2.add(indi_child5);
assertNotEquals(US_CheckValidity.check_multiple_births(children1, "F01").size(), 0);
assertEquals(US_CheckValidity.check_multiple_births(children2, "F01").size(), 0);
}
@Test
public void test_check_male_last_name() {
Individual indi_father = new Individual();
indi_father.setId("F01");
indi_father.setName("<NAME>");
Individual indi_child1 = new Individual();
indi_child1.setId("I01");
indi_child1.setName("<NAME>");
indi_child1.setBirthDate("1 JAN 1980");
Individual indi_child2 = new Individual();
indi_child2.setId("I02");
indi_child2.setName("child2 liu");
indi_child2.setBirthDate("1 JAN 1980");
Individual indi_child3 = new Individual();
indi_child3.setId("I03");
indi_child3.setName("child3 liu");
indi_child3.setBirthDate("1 JAN 1980");
Individual indi_child4 = new Individual();
indi_child4.setId("I04");
indi_child4.setName("child4 liu");
indi_child4.setBirthDate("1 JAN 1980");
Individual indi_child5 = new Individual();
indi_child5.setId("I05");
indi_child5.setName("child5 liu");
indi_child5.setBirthDate("1 JAN 1980");
Individual indi_child6 = new Individual();
indi_child6.setId("I06");
indi_child6.setName("child6 li");
indi_child6.setBirthDate("1 JAN 1980");
ArrayList<Individual> children1 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
ArrayList<Individual> children2 = new ArrayList<Individual>();
children1.add(indi_child1);
children1.add(indi_child2);
children1.add(indi_child3);
children1.add(indi_child4);
children1.add(indi_child5);
children1.add(indi_child6);
assertNotEquals(US_CheckValidity.check_male_last_name(children1, indi_father, "F01").size(), 0);
assertEquals(US_CheckValidity.check_male_last_name(children2, indi_father, "F01").size(), 0);
}
@Test
public void test_check_unique_name_birthdate() {
HashMap<String, Individual> testIndividualMap1 = new HashMap<String, Individual>();
HashMap<String, Individual> testIndividualMap2 = new HashMap<String, Individual>();
HashMap<String, Individual> testIndividualMap3 = new HashMap<String, Individual>();
ArrayList<Family> testFamilyList = new ArrayList<Family>();
Individual indi1 = new Individual();
indi1.setId("F01");
indi1.setName("<NAME>");
indi1.setBirthDate("1 JAN 1980");
testIndividualMap1.put("F01", indi1);
testIndividualMap2.put("F01", indi1);
testIndividualMap3.put("F01", indi1);
Individual indi2 = new Individual();
indi2.setId("F02");
indi2.setName("<NAME>");
indi2.setBirthDate("1 JAN 1980");
testIndividualMap1.put("F02", indi2);
Individual indi3 = new Individual();
indi3.setId("F03");
indi3.setName("<NAME>");
indi3.setBirthDate("1 JAN 1981");
testIndividualMap2.put("F03", indi3);
Individual indi4 = new Individual();
indi4.setId("F04");
indi4.setName("<NAME>");
indi4.setBirthDate("1 JAN 1980");
testIndividualMap3.put("F04", indi4);
FamilyTreeParser Ftp1 = new FamilyTreeParser(testIndividualMap1, testFamilyList);
FamilyTreeParser Ftp2 = new FamilyTreeParser(testIndividualMap2, testFamilyList);
FamilyTreeParser Ftp3 = new FamilyTreeParser(testIndividualMap3, testFamilyList);
assertEquals(US_CheckValidity.check_unique_name_birthdate(Ftp1).size(), 0);
assertEquals(US_CheckValidity.check_unique_name_birthdate(Ftp2).size(), 0);
assertNotEquals(US_CheckValidity.check_unique_name_birthdate(Ftp3).size(), 0);
}
// @Test
// public void test_check_age() {
// // fail("Not yet implemented");
// assertFalse(CheckValidity.check_age(Age1));
// assertTrue(CheckValidity.check_age(Age2));
// assertTrue(CheckValidity.check_age(Age3));
// assertFalse(CheckValidity.check_age(Age4));
// assertTrue(CheckValidity.check_age(Age5));
// }
//
// @Test
// public void test_check_marriage_age() {
// // fail("Not yet implemented");
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age2));
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age3));
// assertTrue(CheckValidity.check_marriage_age(SpouseID1, Age6));
// assertFalse(CheckValidity.check_marriage_age(SpouseID2, Age2));
// assertTrue(CheckValidity.check_marriage_age(SpouseID2, Age3));
// assertFalse(CheckValidity.check_marriage_age(SpouseID2, Age6));
// }
//
// @Test
// public void test_check_father_not_too_old() {
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge1, childAge1));
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge1, childAge2));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge1, childAge3));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge1, childAge4));
// assertFalse(CheckValidity.check_father_not_too_old(fatherAge2, childAge1));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge2));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge3));
// assertTrue(CheckValidity.check_father_not_too_old(fatherAge2, childAge4));
// }
//
// @Test
// public void test_check_mother_not_too_old() {
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge1, childAge1));
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge1, childAge2));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge1, childAge3));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge1, childAge4));
// assertFalse(CheckValidity.check_mother_not_too_old(motherAge2, childAge1));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge2));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge3));
// assertTrue(CheckValidity.check_mother_not_too_old(motherAge2, childAge4));
// }
//
// @Test
// public void test_check_father_no_marriages_to_children() {
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId1, childId1));
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId1, childId2));
// assertTrue(CheckValidity.check_father_no_marriages_to_children(motherId2, childId1));
// assertFalse(CheckValidity.check_father_no_marriages_to_children(motherId2, childId2));
// }
//
// @Test
// public void test_check_mother_no_marriages_to_children() {
// assertFalse(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId1));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId2));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId2, childId1));
// assertTrue(CheckValidity.check_mother_no_marriages_to_children(fatherId1, childId2));
// }
//
}
| 13,280 | 0.703269 | 0.659451 | 375 | 33.48 | 27.175262 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.384 | false | false | 0 |
56db03a19070da26f83090667a8847760126b17c | 29,892,972,433,495 | bf8699a5ff61052d96e9be426f8e599682abc1a3 | /src/main/java/com.bdqn.pojo/nafjdsafjkd.java | 3424da53eb3f48abe928e657ad00225f3a23c9ab | []
| no_license | LuoPeiDong/lpd | https://github.com/LuoPeiDong/lpd | 3857c37426342d4f6a3674e8b3ec8c2c12a0fac9 | 94fad0a2d764f76e99ce03ab765eea82f8fe0fc7 | refs/heads/master | 2021-07-19T12:34:01.298000 | 2019-11-08T13:03:51 | 2019-11-08T13:03:51 | 220,413,801 | 0 | 0 | null | false | 2020-10-13T17:18:28 | 2019-11-08T07:44:24 | 2019-11-08T13:05:18 | 2020-10-13T17:18:26 | 7 | 0 | 0 | 1 | Java | false | false | package com.bdqn.pojo;
public class nafjdsafjkd {
private String name;
private int a;
private String addd;
private String addds;
private String adddss;
private String adddsss;
}
| UTF-8 | Java | 204 | java | nafjdsafjkd.java | Java | []
| null | []
| package com.bdqn.pojo;
public class nafjdsafjkd {
private String name;
private int a;
private String addd;
private String addds;
private String adddss;
private String adddsss;
}
| 204 | 0.696078 | 0.696078 | 10 | 19.4 | 9.759098 | 27 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 0 |
ee788218a6ccf6aa0de8cf3586f3babcc514c7f2 | 8,950,711,850,274 | 95e0f0152b1b470bfb69c39b9a3123b1947bf8a6 | /app/src/main/java/com/app/superxlcr/mypaintboard/view/RegisterActivity.java | 6ff73e38593b40c15429312240cc1e6966736fdc | []
| no_license | wangbaochao/MyPaintBoard | https://github.com/wangbaochao/MyPaintBoard | 36ca4c86aad9cf91e4816ef66d283ef074ec334d | cf32cbbe6cace1f24d9f3615a2d13fc4373fc518 | refs/heads/master | 2021-06-15T18:37:20.872000 | 2017-04-14T12:50:36 | 2017-04-14T12:50:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.superxlcr.mypaintboard.view;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.app.superxlcr.mypaintboard.R;
import com.app.superxlcr.mypaintboard.controller.CommunicationController;
import com.app.superxlcr.mypaintboard.controller.UserController;
import com.app.superxlcr.mypaintboard.model.Protocol;
import com.app.superxlcr.mypaintboard.model.User;
import com.app.superxlcr.mypaintboard.utils.LoadingDialogUtils;
import com.app.superxlcr.mypaintboard.utils.MyLog;
import org.json.JSONArray;
import org.json.JSONException;
import java.lang.ref.SoftReference;
/**
* Created by superxlcr on 2017/1/10.
* 注册界面
*/
public class RegisterActivity extends BaseActivity {
private static String TAG = RegisterActivity.class.getSimpleName();
private MyHandler handler = new MyHandler();
private EditText accountEt;
private EditText passwordEt;
private EditText nicknameEt;
private Button confirmBtn;
private Button cancelBtn;
private Dialog dialog; // 等待进度条
private long time = 0; // 最后发送消息的时间
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
handler.setReference(new SoftReference<RegisterActivity>(this));
accountEt = (EditText) findViewById(R.id.account);
passwordEt = (EditText) findViewById(R.id.password);
nicknameEt = (EditText) findViewById(R.id.nickname);
confirmBtn = (Button) findViewById(R.id.confirm);
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 确认
if (checkInput()) {
String username = accountEt.getText().toString();
String password = passwordEt.getText().toString();
String nickname = nicknameEt.getText().toString();
// 更新发送时间
time = System.currentTimeMillis();
// 显示进度条,可以取消
dialog = LoadingDialogUtils.showDialog(RegisterActivity.this, "注册中...", true);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
// 发送时间加一,导致遗留协议失效
time += 1;
LoadingDialogUtils.closeDialog(dialog);
// 断线重连,清除登录状态
CommunicationController.getInstance(RegisterActivity.this).clearSocket();
CommunicationController.getInstance(RegisterActivity.this).connectServer();
}
});
if (UserController.getInstance().register(RegisterActivity.this, handler, time, username, password, nickname)) {
// 发送失败,关闭进度条
LoadingDialogUtils.closeDialog(dialog);
}
}
}
});
cancelBtn = (Button) findViewById(R.id.cancel);
cancelBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 取消,返回登录界面
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
});
}
@Override
public void onBackPressed() {
// 取消,返回登录界面
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
private boolean checkInput() {
if (accountEt != null && passwordEt != null && nicknameEt != null) {
String account = accountEt.getText().toString();
if (account.isEmpty()) {
Toast.makeText(this, "请填入您的账号", Toast.LENGTH_SHORT).show();
return false;
}
String password = passwordEt.getText().toString();
if (password.isEmpty()) {
Toast.makeText(this, "请填入您的密码", Toast.LENGTH_SHORT).show();
return false;
}
String nickname = nicknameEt.getText().toString();
if (nickname.isEmpty()) {
Toast.makeText(this, "请填入您的昵称", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
return false;
}
static class MyHandler extends Handler {
private SoftReference<RegisterActivity> reference;
public MyHandler() {
}
public void setReference(SoftReference<RegisterActivity> reference) {
this.reference = reference;
}
@Override
public void handleMessage(Message msg) {
RegisterActivity activity = reference.get();
if (activity != null && msg != null && msg.obj != null && msg.obj instanceof Protocol) {
Protocol protocol = (Protocol) msg.obj;
if (protocol.getOrder() == Protocol.REGISTER && activity.time <= protocol.getTime()) {
// 注册指令且消息时间有效
JSONArray content = protocol.getContent();
// 关闭等待进度条
LoadingDialogUtils.closeDialog(activity.dialog);
// 处理注册信息
try {
int stateCode = content.getInt(0);
switch (stateCode) {
case Protocol.REGISTER_REPEAT_NICKNAME: { // 昵称重复
showToast("您的昵称已被使用");
break;
}
case Protocol.REGISTER_REPEAT_USERNAME: { // 用户名重复
showToast("您的用户名已被使用");
break;
}
case Protocol.REGISTER_SUCCESS: { // 注册成功
// 保存用户数据
int id = content.getInt(1);
String username = content.getString(2);
String nickname = content.getString(3);
UserController.getInstance().setUser(new User(id, username, "*", nickname));
// 显示信息
showToast("注册成功");
// 界面跳转
Intent intent = new Intent(activity, MainActivity.class);
activity.startActivity(intent);
activity.finish();
}
case Protocol.REGISTER_UNKNOW_PRO: { // 未知错误
showToast("遇到未知错误");
}
}
} catch (JSONException e) {
MyLog.e(TAG, Log.getStackTraceString(e));
showToast("协议内容解析错误");
}
}
}
}
private void showToast(String msg) {
Toast.makeText(reference.get(), msg, Toast.LENGTH_SHORT).show();
}
}
}
| UTF-8 | Java | 8,076 | java | RegisterActivity.java | Java | [
{
"context": "rt java.lang.ref.SoftReference;\n\n/**\n * Created by superxlcr on 2017/1/10.\n * 注册界面\n */\n\npublic class RegisterA",
"end": 968,
"score": 0.9995882511138916,
"start": 959,
"tag": "USERNAME",
"value": "superxlcr"
},
{
"context": ".toString();\n String password = passwordEt.getText().toString();\n Strin",
"end": 2194,
"score": 0.8316136002540588,
"start": 2186,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "false;\n }\n String password = passwordEt.getText().toString();\n if (password.",
"end": 4438,
"score": 0.7567105889320374,
"start": 4430,
"tag": "PASSWORD",
"value": "password"
}
]
| null | []
| package com.app.superxlcr.mypaintboard.view;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.app.superxlcr.mypaintboard.R;
import com.app.superxlcr.mypaintboard.controller.CommunicationController;
import com.app.superxlcr.mypaintboard.controller.UserController;
import com.app.superxlcr.mypaintboard.model.Protocol;
import com.app.superxlcr.mypaintboard.model.User;
import com.app.superxlcr.mypaintboard.utils.LoadingDialogUtils;
import com.app.superxlcr.mypaintboard.utils.MyLog;
import org.json.JSONArray;
import org.json.JSONException;
import java.lang.ref.SoftReference;
/**
* Created by superxlcr on 2017/1/10.
* 注册界面
*/
public class RegisterActivity extends BaseActivity {
private static String TAG = RegisterActivity.class.getSimpleName();
private MyHandler handler = new MyHandler();
private EditText accountEt;
private EditText passwordEt;
private EditText nicknameEt;
private Button confirmBtn;
private Button cancelBtn;
private Dialog dialog; // 等待进度条
private long time = 0; // 最后发送消息的时间
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
handler.setReference(new SoftReference<RegisterActivity>(this));
accountEt = (EditText) findViewById(R.id.account);
passwordEt = (EditText) findViewById(R.id.password);
nicknameEt = (EditText) findViewById(R.id.nickname);
confirmBtn = (Button) findViewById(R.id.confirm);
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 确认
if (checkInput()) {
String username = accountEt.getText().toString();
String password = <PASSWORD>Et.getText().toString();
String nickname = nicknameEt.getText().toString();
// 更新发送时间
time = System.currentTimeMillis();
// 显示进度条,可以取消
dialog = LoadingDialogUtils.showDialog(RegisterActivity.this, "注册中...", true);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
// 发送时间加一,导致遗留协议失效
time += 1;
LoadingDialogUtils.closeDialog(dialog);
// 断线重连,清除登录状态
CommunicationController.getInstance(RegisterActivity.this).clearSocket();
CommunicationController.getInstance(RegisterActivity.this).connectServer();
}
});
if (UserController.getInstance().register(RegisterActivity.this, handler, time, username, password, nickname)) {
// 发送失败,关闭进度条
LoadingDialogUtils.closeDialog(dialog);
}
}
}
});
cancelBtn = (Button) findViewById(R.id.cancel);
cancelBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 取消,返回登录界面
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
});
}
@Override
public void onBackPressed() {
// 取消,返回登录界面
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
private boolean checkInput() {
if (accountEt != null && passwordEt != null && nicknameEt != null) {
String account = accountEt.getText().toString();
if (account.isEmpty()) {
Toast.makeText(this, "请填入您的账号", Toast.LENGTH_SHORT).show();
return false;
}
String password = <PASSWORD>Et.getText().toString();
if (password.isEmpty()) {
Toast.makeText(this, "请填入您的密码", Toast.LENGTH_SHORT).show();
return false;
}
String nickname = nicknameEt.getText().toString();
if (nickname.isEmpty()) {
Toast.makeText(this, "请填入您的昵称", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
return false;
}
static class MyHandler extends Handler {
private SoftReference<RegisterActivity> reference;
public MyHandler() {
}
public void setReference(SoftReference<RegisterActivity> reference) {
this.reference = reference;
}
@Override
public void handleMessage(Message msg) {
RegisterActivity activity = reference.get();
if (activity != null && msg != null && msg.obj != null && msg.obj instanceof Protocol) {
Protocol protocol = (Protocol) msg.obj;
if (protocol.getOrder() == Protocol.REGISTER && activity.time <= protocol.getTime()) {
// 注册指令且消息时间有效
JSONArray content = protocol.getContent();
// 关闭等待进度条
LoadingDialogUtils.closeDialog(activity.dialog);
// 处理注册信息
try {
int stateCode = content.getInt(0);
switch (stateCode) {
case Protocol.REGISTER_REPEAT_NICKNAME: { // 昵称重复
showToast("您的昵称已被使用");
break;
}
case Protocol.REGISTER_REPEAT_USERNAME: { // 用户名重复
showToast("您的用户名已被使用");
break;
}
case Protocol.REGISTER_SUCCESS: { // 注册成功
// 保存用户数据
int id = content.getInt(1);
String username = content.getString(2);
String nickname = content.getString(3);
UserController.getInstance().setUser(new User(id, username, "*", nickname));
// 显示信息
showToast("注册成功");
// 界面跳转
Intent intent = new Intent(activity, MainActivity.class);
activity.startActivity(intent);
activity.finish();
}
case Protocol.REGISTER_UNKNOW_PRO: { // 未知错误
showToast("遇到未知错误");
}
}
} catch (JSONException e) {
MyLog.e(TAG, Log.getStackTraceString(e));
showToast("协议内容解析错误");
}
}
}
}
private void showToast(String msg) {
Toast.makeText(reference.get(), msg, Toast.LENGTH_SHORT).show();
}
}
}
| 8,080 | 0.535994 | 0.534168 | 193 | 38.730572 | 26.695559 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.601036 | false | false | 0 |
c3b921f4154982118077edd9857860803c7b90c1 | 3,805,341,036,414 | 3bcb4aab1bee767034260ebf04b479314aba0df4 | /JAICore/jaicore-planning/src/main/java/jaicore/planning/hierarchical/algorithms/forwarddecomposition/ForwardDecompositionHTNPlannerBasedOnBestFirst.java | 04a365b803ba199e80a2ba0af5d74bc70bca799b | []
| no_license | AILibs-DyRaCo/AILibs | https://github.com/AILibs-DyRaCo/AILibs | 003de0c568530f2d079bc6199ef9328b5367763a | 7d8384bf4fb86c7ccbabca39ef00817dd08c6d5e | refs/heads/dev | 2020-04-09T12:42:36.426000 | 2019-04-02T22:15:17 | 2019-04-02T22:15:17 | 160,361,282 | 2 | 0 | null | true | 2019-04-01T23:02:58 | 2018-12-04T13:25:10 | 2019-04-01T02:16:12 | 2019-04-01T23:02:57 | 133,879 | 2 | 0 | 2 | Java | false | null | package jaicore.planning.hierarchical.algorithms.forwarddecomposition;
import jaicore.planning.hierarchical.algorithms.forwarddecomposition.graphgenerators.tfd.TFDNode;
import jaicore.planning.hierarchical.problems.htn.IHTNPlanningProblem;
import jaicore.search.algorithms.standard.bestfirst.BestFirstFactory;
import jaicore.search.algorithms.standard.bestfirst.nodeevaluation.INodeEvaluator;
import jaicore.search.probleminputs.GraphSearchWithSubpathEvaluationsInput;
import jaicore.search.probleminputs.builders.GraphSearchWithSubpathEvaluationsInputBuilder;
public class ForwardDecompositionHTNPlannerBasedOnBestFirst<IPlanning extends IHTNPlanningProblem, V extends Comparable<V>> extends ForwardDecompositionHTNPlanner<IPlanning, V, GraphSearchWithSubpathEvaluationsInput<TFDNode, String, V>> {
public ForwardDecompositionHTNPlannerBasedOnBestFirst(IPlanning problem, INodeEvaluator<TFDNode, V> nodeEvaluator) {
super(problem, new BestFirstFactory<>(), new GraphSearchWithSubpathEvaluationsInputBuilder<>(nodeEvaluator));
}
}
| UTF-8 | Java | 1,055 | java | ForwardDecompositionHTNPlannerBasedOnBestFirst.java | Java | []
| null | []
| package jaicore.planning.hierarchical.algorithms.forwarddecomposition;
import jaicore.planning.hierarchical.algorithms.forwarddecomposition.graphgenerators.tfd.TFDNode;
import jaicore.planning.hierarchical.problems.htn.IHTNPlanningProblem;
import jaicore.search.algorithms.standard.bestfirst.BestFirstFactory;
import jaicore.search.algorithms.standard.bestfirst.nodeevaluation.INodeEvaluator;
import jaicore.search.probleminputs.GraphSearchWithSubpathEvaluationsInput;
import jaicore.search.probleminputs.builders.GraphSearchWithSubpathEvaluationsInputBuilder;
public class ForwardDecompositionHTNPlannerBasedOnBestFirst<IPlanning extends IHTNPlanningProblem, V extends Comparable<V>> extends ForwardDecompositionHTNPlanner<IPlanning, V, GraphSearchWithSubpathEvaluationsInput<TFDNode, String, V>> {
public ForwardDecompositionHTNPlannerBasedOnBestFirst(IPlanning problem, INodeEvaluator<TFDNode, V> nodeEvaluator) {
super(problem, new BestFirstFactory<>(), new GraphSearchWithSubpathEvaluationsInputBuilder<>(nodeEvaluator));
}
}
| 1,055 | 0.863507 | 0.863507 | 16 | 63.9375 | 62.174622 | 238 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3125 | false | false | 15 |
d9c82cbe39b92b9fbfd00fbcc5e9d5da053172ef | 22,978,075,090,547 | ee8f2ec4baaf5e283b578040c5ba6c4317a99a5b | /app/src/main/java/com/visor24/androidgles/MainActivity.java | bc0ccf8e484811d4c4bea5acb66a02bcb72e8cef | []
| no_license | visor24/AndroidGLES | https://github.com/visor24/AndroidGLES | 8f29753185c42900d6d7f268b68411dbb079dd18 | e2cece08c02c99b5a0620575cd00e286a9cf3797 | refs/heads/master | 2019-09-01T07:45:57.475000 | 2017-11-21T12:23:17 | 2017-11-21T12:23:17 | 98,461,581 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.visor24.androidgles;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.PackageManager;
import android.opengl.GLSurfaceView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity
{
private GLSurfaceView m_glView;
private GLRendererWrapper m_glRenderer;
private boolean m_glViewSet = false;
private String m_apkPath;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getAPKPath();
LibJNIWrapper.initialize( m_apkPath );
setUIVisibility();
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2)
{
initGL();
setContentView(m_glView);
m_glViewSet = true;
}
}
@Override
protected void onPause()
{
super.onPause();
if (m_glViewSet)
m_glView.onPause();
}
@Override
protected void onResume()
{
super.onResume();
if (m_glViewSet)
m_glView.onResume();
}
@Override
protected void onDestroy()
{
LibJNIWrapper.onDestroy();
super.onDestroy();
}
@Override
public void onWindowFocusChanged( boolean hasFocus )
{
super.onWindowFocusChanged( hasFocus );
if ( hasFocus )
setUIVisibility();
}
protected void initGL()
{
m_glView = new GLSurfaceView(this);
m_glView.setEGLContextClientVersion(2);
//m_glView.setEGLConfigChooser(8,8,8,8,24,8);
m_glRenderer = new GLRendererWrapper();
m_glView.setRenderer(m_glRenderer);
//m_glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
m_glView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
protected void setUIVisibility()
{
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
public String getAPKPath()
{
if ( m_apkPath == null || m_apkPath.isEmpty() )
{
ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager();
try
{
appInfo = packMgmr.getApplicationInfo( "com.visor24.androidgles", 0 );
}
catch ( PackageManager.NameNotFoundException e )
{
e.printStackTrace();
throw new RuntimeException( "Unable to locate APK" );
}
m_apkPath = appInfo.sourceDir;
}
return m_apkPath;
}
}
| UTF-8 | Java | 3,008 | java | MainActivity.java | Java | [
{
"context": "package com.visor24.androidgles;\n\n\nimport android.app.ActivityManager",
"end": 19,
"score": 0.6450884938240051,
"start": 17,
"tag": "USERNAME",
"value": "24"
}
]
| null | []
| package com.visor24.androidgles;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.PackageManager;
import android.opengl.GLSurfaceView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity
{
private GLSurfaceView m_glView;
private GLRendererWrapper m_glRenderer;
private boolean m_glViewSet = false;
private String m_apkPath;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getAPKPath();
LibJNIWrapper.initialize( m_apkPath );
setUIVisibility();
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2)
{
initGL();
setContentView(m_glView);
m_glViewSet = true;
}
}
@Override
protected void onPause()
{
super.onPause();
if (m_glViewSet)
m_glView.onPause();
}
@Override
protected void onResume()
{
super.onResume();
if (m_glViewSet)
m_glView.onResume();
}
@Override
protected void onDestroy()
{
LibJNIWrapper.onDestroy();
super.onDestroy();
}
@Override
public void onWindowFocusChanged( boolean hasFocus )
{
super.onWindowFocusChanged( hasFocus );
if ( hasFocus )
setUIVisibility();
}
protected void initGL()
{
m_glView = new GLSurfaceView(this);
m_glView.setEGLContextClientVersion(2);
//m_glView.setEGLConfigChooser(8,8,8,8,24,8);
m_glRenderer = new GLRendererWrapper();
m_glView.setRenderer(m_glRenderer);
//m_glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
m_glView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
protected void setUIVisibility()
{
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
}
public String getAPKPath()
{
if ( m_apkPath == null || m_apkPath.isEmpty() )
{
ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager();
try
{
appInfo = packMgmr.getApplicationInfo( "com.visor24.androidgles", 0 );
}
catch ( PackageManager.NameNotFoundException e )
{
e.printStackTrace();
throw new RuntimeException( "Unable to locate APK" );
}
m_apkPath = appInfo.sourceDir;
}
return m_apkPath;
}
}
| 3,008 | 0.678524 | 0.67121 | 124 | 23.258064 | 22.201014 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false | 15 |
9975af80107cae3ff50a1dbf8815e3928fd09245 | 9,998,683,924,498 | ab605f33889d8bea07dac51ce43630c7e500c21b | /les03/main/HomeworkTask15.java | 9d3d46a1479a518e4d71046f07426d0d1c4cd081 | []
| no_license | RomaPan/jd1_ht1 | https://github.com/RomaPan/jd1_ht1 | 341166f0240a7001687c98e36ec7e81cfd758e31 | 30034ac76ed46fb67cdc8a49f5aa4c1281db8ee5 | refs/heads/master | 2020-05-29T22:57:24.376000 | 2019-05-31T17:04:32 | 2019-05-31T17:04:32 | 189,423,121 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.htp.les03.main;
import java.util.Scanner;
public class HomeworkTask15 {
// 15. Даны действительные числа х и у, не равные друг другу. Меньшее из этих двух чисел
// заменить половиной их суммы, а большее — их удвоенным произведением
public static void main(String[] args) {
int x;
int y;
int sum;
int multiply;
Scanner scan = new Scanner(System.in);
System.out.print("Please enter first integer number <x> : ");
x = scan.nextInt();
System.out.print("Please enter second integer number <y> : ");
y = scan.nextInt();
scan.close();
sum = x + y;
multiply = x * y;
if ( x < y ) {
x = sum / 2;
y = multiply * multiply;
System.out.println(" <x> = " + x + ", <y> = " + y);
} else if ( y < x) {
y = sum / 2;
x = multiply*multiply;
System.out.println(" <x> = " + x + ", <y> = " + y);
}
}
}
| WINDOWS-1251 | Java | 1,008 | java | HomeworkTask15.java | Java | []
| null | []
| package by.htp.les03.main;
import java.util.Scanner;
public class HomeworkTask15 {
// 15. Даны действительные числа х и у, не равные друг другу. Меньшее из этих двух чисел
// заменить половиной их суммы, а большее — их удвоенным произведением
public static void main(String[] args) {
int x;
int y;
int sum;
int multiply;
Scanner scan = new Scanner(System.in);
System.out.print("Please enter first integer number <x> : ");
x = scan.nextInt();
System.out.print("Please enter second integer number <y> : ");
y = scan.nextInt();
scan.close();
sum = x + y;
multiply = x * y;
if ( x < y ) {
x = sum / 2;
y = multiply * multiply;
System.out.println(" <x> = " + x + ", <y> = " + y);
} else if ( y < x) {
y = sum / 2;
x = multiply*multiply;
System.out.println(" <x> = " + x + ", <y> = " + y);
}
}
}
| 1,008 | 0.572881 | 0.563842 | 35 | 23.285715 | 22.468481 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.285714 | false | false | 15 |
7afe9b465127df4435bf33bd402d0d5d24139e73 | 4,045,859,260,397 | 78030ab7dc97294dfa37531f35714d82c137c266 | /Ambrosia_Android/src/hu/bestest/ambrosia/android/services/ReportUploadService.java | 9d85efe4dbdd875cab4fd29d6db5ef8628c79057 | []
| no_license | CAG12/ambrosia2 | https://github.com/CAG12/ambrosia2 | 5dd3b27269687cfddeb2c1acc39aa00fc7f9f659 | f05a042cfce5f7c613535d125d9848d3249bb60e | refs/heads/master | 2016-08-07T05:40:36.015000 | 2013-08-22T18:33:11 | 2013-08-22T18:33:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hu.bestest.ambrosia.android.services;
import hu.bestest.ambrosia.android.model.UploadableReport;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import android.graphics.Bitmap.CompressFormat;
import android.util.Log;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.HttpClient;
import ch.boye.httpclientandroidlib.client.methods.HttpPost;
import ch.boye.httpclientandroidlib.entity.mime.HttpMultipartMode;
import ch.boye.httpclientandroidlib.entity.mime.MultipartEntity;
import ch.boye.httpclientandroidlib.entity.mime.content.ByteArrayBody;
import ch.boye.httpclientandroidlib.entity.mime.content.StringBody;
import ch.boye.httpclientandroidlib.params.BasicHttpParams;
import ch.boye.httpclientandroidlib.params.HttpConnectionParams;
import ch.boye.httpclientandroidlib.params.HttpParams;
/**
*
* @author istvan benedek
*
*/
public class ReportUploadService {
private static final String UTF_8 = "UTF-8";
private static final int HTTP_RESPONSE_CLIENT_ERROR_UNAUTHORIZED = 401;
private static final int HTTP_RESPONSE_SUCCESS_CREATED = 201;
private static final String NEW_REPORT_URL_SUFFIX = "/v2/reportpost/";
private static final CompressFormat DEFAULT_COMPRESS_FORMAT = CompressFormat.JPEG;
private static final int DEFAULT_IMAGE_QUALITY = 100;
private static final String DEFAULT_IMAGE_MIME_TYPE = "image/jpg";
private static final String DEFAULT_ENCODING = UTF_8;
private static final String PARAM_FILENAME = "filename";
private static final String PARAM_CREATED = "created";
private static final String PARAM_PLATFORMVERSION = "platformversion";
private static final String PARAM_PLATFORM = "platform";
private static final String PARAM_MIME_TYPE = "mimeType";
private static final String PARAM_DEVICEID = "deviceid";
private static final String PARAM_COMMENT = "comment";
private static final String PARAM_LONGITUDE = "longitude";
private static final String PARAM_LATITUDE = "latitude";
private static final String PARAM_FILE = "file";
private static final String PARAM_DEVICENAME = "devicename";
private SettingsProvider settingsProvider;
public ReportUploadService(SettingsProvider settingsProvider) {
if (settingsProvider == null) {
throw new IllegalArgumentException();
}
this.settingsProvider = settingsProvider;
}
private static void printResponse(HttpResponse response) {
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(response
.getEntity().getContent(), DEFAULT_ENCODING));
String sResponse;
StringBuilder temp = new StringBuilder();
while ((sResponse = reader.readLine()) != null) {
temp = temp.append(sResponse);
}
Log.d(ReportUploadService.class.getSimpleName(), "Response: "
+ temp.toString());
} catch (Exception e) {
Log.e(ReportUploadService.class.getSimpleName(), e.getMessage());
}
}
public void upload(UploadableReport report) throws Exception {
HttpClient httpclient = new ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient();
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters,
DefaultReportProvider.DEFAULT_TIMEOUT_MILLISECONDS);
HttpPost postRequest = new HttpPost(this.settingsProvider.getSettings()
.getServerUrl() + NEW_REPORT_URL_SUFFIX);
postRequest.setParams(httpParameters);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
report.getBitmap().compress(DEFAULT_COMPRESS_FORMAT,
DEFAULT_IMAGE_QUALITY, bos);
byte[] data = bos.toByteArray();
ByteArrayBody bab = new ByteArrayBody(data, "ambrosia.jpg");
MultipartEntity reqEntity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart(PARAM_FILE, bab);
reqEntity.addPart(PARAM_LATITUDE,
new StringBody(String.valueOf(report.getLatitude())));
reqEntity.addPart(PARAM_LONGITUDE,
new StringBody(String.valueOf(report.getLongitude())));
reqEntity.addPart(PARAM_COMMENT, new StringBody(report.getComment(), Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_DEVICEID, new StringBody(settingsProvider
.getSettings().getDeviceID()));
reqEntity.addPart(PARAM_MIME_TYPE, new StringBody(
DEFAULT_IMAGE_MIME_TYPE));
reqEntity.addPart(PARAM_PLATFORM, new StringBody(report.getPlatform(),Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_PLATFORMVERSION,
new StringBody(report.getPlatformVersion(),Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_CREATED, new StringBody(report.getCreated()));
reqEntity.addPart(PARAM_FILENAME, new StringBody(PARAM_FILENAME,Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_DEVICENAME,
new StringBody(report.getDeviceName()));
postRequest.setEntity(reqEntity);
HttpResponse response = httpclient.execute(postRequest);
if (response.getStatusLine().getStatusCode() == HTTP_RESPONSE_SUCCESS_CREATED) {
return;
}
printResponse(response);
if (response.getStatusLine().getStatusCode() == HTTP_RESPONSE_CLIENT_ERROR_UNAUTHORIZED) {
throw new UnAuthorizedUserException();
}
}
}
| UTF-8 | Java | 5,212 | java | ReportUploadService.java | Java | [
{
"context": "tandroidlib.params.HttpParams;\n\n/**\n * \n * @author istvan benedek\n *\n */\npublic class ReportUploadService {\n\n\tprivat",
"end": 967,
"score": 0.9855610132217407,
"start": 953,
"tag": "NAME",
"value": "istvan benedek"
}
]
| null | []
| package hu.bestest.ambrosia.android.services;
import hu.bestest.ambrosia.android.model.UploadableReport;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import android.graphics.Bitmap.CompressFormat;
import android.util.Log;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.HttpClient;
import ch.boye.httpclientandroidlib.client.methods.HttpPost;
import ch.boye.httpclientandroidlib.entity.mime.HttpMultipartMode;
import ch.boye.httpclientandroidlib.entity.mime.MultipartEntity;
import ch.boye.httpclientandroidlib.entity.mime.content.ByteArrayBody;
import ch.boye.httpclientandroidlib.entity.mime.content.StringBody;
import ch.boye.httpclientandroidlib.params.BasicHttpParams;
import ch.boye.httpclientandroidlib.params.HttpConnectionParams;
import ch.boye.httpclientandroidlib.params.HttpParams;
/**
*
* @author <NAME>
*
*/
public class ReportUploadService {
private static final String UTF_8 = "UTF-8";
private static final int HTTP_RESPONSE_CLIENT_ERROR_UNAUTHORIZED = 401;
private static final int HTTP_RESPONSE_SUCCESS_CREATED = 201;
private static final String NEW_REPORT_URL_SUFFIX = "/v2/reportpost/";
private static final CompressFormat DEFAULT_COMPRESS_FORMAT = CompressFormat.JPEG;
private static final int DEFAULT_IMAGE_QUALITY = 100;
private static final String DEFAULT_IMAGE_MIME_TYPE = "image/jpg";
private static final String DEFAULT_ENCODING = UTF_8;
private static final String PARAM_FILENAME = "filename";
private static final String PARAM_CREATED = "created";
private static final String PARAM_PLATFORMVERSION = "platformversion";
private static final String PARAM_PLATFORM = "platform";
private static final String PARAM_MIME_TYPE = "mimeType";
private static final String PARAM_DEVICEID = "deviceid";
private static final String PARAM_COMMENT = "comment";
private static final String PARAM_LONGITUDE = "longitude";
private static final String PARAM_LATITUDE = "latitude";
private static final String PARAM_FILE = "file";
private static final String PARAM_DEVICENAME = "devicename";
private SettingsProvider settingsProvider;
public ReportUploadService(SettingsProvider settingsProvider) {
if (settingsProvider == null) {
throw new IllegalArgumentException();
}
this.settingsProvider = settingsProvider;
}
private static void printResponse(HttpResponse response) {
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(response
.getEntity().getContent(), DEFAULT_ENCODING));
String sResponse;
StringBuilder temp = new StringBuilder();
while ((sResponse = reader.readLine()) != null) {
temp = temp.append(sResponse);
}
Log.d(ReportUploadService.class.getSimpleName(), "Response: "
+ temp.toString());
} catch (Exception e) {
Log.e(ReportUploadService.class.getSimpleName(), e.getMessage());
}
}
public void upload(UploadableReport report) throws Exception {
HttpClient httpclient = new ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient();
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters,
DefaultReportProvider.DEFAULT_TIMEOUT_MILLISECONDS);
HttpPost postRequest = new HttpPost(this.settingsProvider.getSettings()
.getServerUrl() + NEW_REPORT_URL_SUFFIX);
postRequest.setParams(httpParameters);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
report.getBitmap().compress(DEFAULT_COMPRESS_FORMAT,
DEFAULT_IMAGE_QUALITY, bos);
byte[] data = bos.toByteArray();
ByteArrayBody bab = new ByteArrayBody(data, "ambrosia.jpg");
MultipartEntity reqEntity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart(PARAM_FILE, bab);
reqEntity.addPart(PARAM_LATITUDE,
new StringBody(String.valueOf(report.getLatitude())));
reqEntity.addPart(PARAM_LONGITUDE,
new StringBody(String.valueOf(report.getLongitude())));
reqEntity.addPart(PARAM_COMMENT, new StringBody(report.getComment(), Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_DEVICEID, new StringBody(settingsProvider
.getSettings().getDeviceID()));
reqEntity.addPart(PARAM_MIME_TYPE, new StringBody(
DEFAULT_IMAGE_MIME_TYPE));
reqEntity.addPart(PARAM_PLATFORM, new StringBody(report.getPlatform(),Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_PLATFORMVERSION,
new StringBody(report.getPlatformVersion(),Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_CREATED, new StringBody(report.getCreated()));
reqEntity.addPart(PARAM_FILENAME, new StringBody(PARAM_FILENAME,Charset.forName(UTF_8)));
reqEntity.addPart(PARAM_DEVICENAME,
new StringBody(report.getDeviceName()));
postRequest.setEntity(reqEntity);
HttpResponse response = httpclient.execute(postRequest);
if (response.getStatusLine().getStatusCode() == HTTP_RESPONSE_SUCCESS_CREATED) {
return;
}
printResponse(response);
if (response.getStatusLine().getStatusCode() == HTTP_RESPONSE_CLIENT_ERROR_UNAUTHORIZED) {
throw new UnAuthorizedUserException();
}
}
}
| 5,204 | 0.77053 | 0.767268 | 145 | 34.944828 | 28.334888 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.951724 | false | false | 15 |
5414aed44ee62881d450a3aa855bc691bfd30118 | 10,831,907,540,942 | f61973469fb2296a48ed0ce29274b24ebaed9fb1 | /matte-web/src-ma1/magoffin/matt/ma/servlet/action/album/AddItemsToAlbumAction.java | 8cd9d62b85b96cee7f4ed79b423eeb44245ffce7 | []
| no_license | msqr/matte | https://github.com/msqr/matte | 95e0fb45ad162bf3915e5346c186bd691084d401 | 2d50d284c80e853a55c78eb31bd4757d8bee348e | refs/heads/master | 2023-07-06T09:56:09.371000 | 2023-06-25T22:15:28 | 2023-06-25T22:15:28 | 28,728,512 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* ===================================================================
* AddItemsToAlbumAction.java
*
* Created Jun 14, 2004 7:57:53 AM
*
* Copyright (c) 2004 Matt Magoffin (spamsqr@msqr.us)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ===================================================================
* $Id: AddItemsToAlbumAction.java,v 1.1 2006/06/03 22:26:18 matt Exp $
* ===================================================================
*/
package magoffin.matt.ma.servlet.action.album;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import magoffin.matt.ma.ApplicationConstants;
import magoffin.matt.ma.biz.AlbumBiz;
import magoffin.matt.ma.biz.BizConstants;
import magoffin.matt.ma.servlet.ActionResult;
import magoffin.matt.ma.servlet.UserSessionData;
import magoffin.matt.ma.servlet.action.AbstractAction;
import magoffin.matt.ma.servlet.formbean.MultiItemsForm;
import magoffin.matt.ma.servlet.struts.StrutsConstants;
import magoffin.matt.ma.xsd.Album;
/**
* Action to add media items to an album.
*
* @author Matt Magoffin (spamsqr@msqr.us)
* @version $Revision: 1.1 $ $Date: 2006/06/03 22:26:18 $
*/
public class AddItemsToAlbumAction extends AbstractAction
{
/* (non-Javadoc)
* @see magoffin.matt.ma.servlet.action.AbstractAction#go(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, magoffin.matt.ma.servlet.ActionResult)
*/
protected void go(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response,
ActionResult result) throws Exception
{
UserSessionData usd = getUserSessionData(request,ANONYMOUS_USER_NOT_OK);
MultiItemsForm dForm = (MultiItemsForm)form;
Integer albumId = dForm.getActionId();
Integer[] itemIds = dForm.getMitems();
AlbumBiz albumBiz = (AlbumBiz)getBiz(BizConstants.ALBUM_BIZ);
albumBiz.addMediaItemsToAlbum(albumId,itemIds,usd.getUser());
Album album = albumBiz.getAlbumById(albumId,usd.getUser(),
ApplicationConstants.CACHED_OBJECT_ALLOWED);
addActionMessage(request,ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("mod.items.added.to.album",
new Object[] {album.getName()}));
result.setForward(mapping.findForward(StrutsConstants.DEFAULT_OK_FORWARD));
}
}
| UTF-8 | Java | 3,218 | java | AddItemsToAlbumAction.java | Java | [
{
"context": " Jun 14, 2004 7:57:53 AM\n * \n * Copyright (c) 2004 Matt Magoffin (spamsqr@msqr.us)\n * \n * This program is free sof",
"end": 179,
"score": 0.9998481869697571,
"start": 166,
"tag": "NAME",
"value": "Matt Magoffin"
},
{
"context": "57:53 AM\n * \n * Copyright (c) 2004 Matt Magoffin (spamsqr@msqr.us)\n * \n * This program is free software; you can re",
"end": 196,
"score": 0.9999332427978516,
"start": 181,
"tag": "EMAIL",
"value": "spamsqr@msqr.us"
},
{
"context": "ion to add media items to an album.\n * \n * @author Matt Magoffin (spamsqr@msqr.us)\n * @version $Revision: 1.1 $ $D",
"end": 1973,
"score": 0.9998862147331238,
"start": 1960,
"tag": "NAME",
"value": "Matt Magoffin"
},
{
"context": " items to an album.\n * \n * @author Matt Magoffin (spamsqr@msqr.us)\n * @version $Revision: 1.1 $ $Date: 2006/06/03 2",
"end": 1990,
"score": 0.9999303817749023,
"start": 1975,
"tag": "EMAIL",
"value": "spamsqr@msqr.us"
}
]
| null | []
| /* ===================================================================
* AddItemsToAlbumAction.java
*
* Created Jun 14, 2004 7:57:53 AM
*
* Copyright (c) 2004 <NAME> (<EMAIL>)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ===================================================================
* $Id: AddItemsToAlbumAction.java,v 1.1 2006/06/03 22:26:18 matt Exp $
* ===================================================================
*/
package magoffin.matt.ma.servlet.action.album;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import magoffin.matt.ma.ApplicationConstants;
import magoffin.matt.ma.biz.AlbumBiz;
import magoffin.matt.ma.biz.BizConstants;
import magoffin.matt.ma.servlet.ActionResult;
import magoffin.matt.ma.servlet.UserSessionData;
import magoffin.matt.ma.servlet.action.AbstractAction;
import magoffin.matt.ma.servlet.formbean.MultiItemsForm;
import magoffin.matt.ma.servlet.struts.StrutsConstants;
import magoffin.matt.ma.xsd.Album;
/**
* Action to add media items to an album.
*
* @author <NAME> (<EMAIL>)
* @version $Revision: 1.1 $ $Date: 2006/06/03 22:26:18 $
*/
public class AddItemsToAlbumAction extends AbstractAction
{
/* (non-Javadoc)
* @see magoffin.matt.ma.servlet.action.AbstractAction#go(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, magoffin.matt.ma.servlet.ActionResult)
*/
protected void go(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response,
ActionResult result) throws Exception
{
UserSessionData usd = getUserSessionData(request,ANONYMOUS_USER_NOT_OK);
MultiItemsForm dForm = (MultiItemsForm)form;
Integer albumId = dForm.getActionId();
Integer[] itemIds = dForm.getMitems();
AlbumBiz albumBiz = (AlbumBiz)getBiz(BizConstants.ALBUM_BIZ);
albumBiz.addMediaItemsToAlbum(albumId,itemIds,usd.getUser());
Album album = albumBiz.getAlbumById(albumId,usd.getUser(),
ApplicationConstants.CACHED_OBJECT_ALLOWED);
addActionMessage(request,ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("mod.items.added.to.album",
new Object[] {album.getName()}));
result.setForward(mapping.findForward(StrutsConstants.DEFAULT_OK_FORWARD));
}
}
| 3,188 | 0.725606 | 0.706339 | 80 | 39.224998 | 35.019985 | 252 | false | false | 0 | 0 | 0 | 0 | 68 | 0.063393 | 1.025 | false | false | 15 |
14efe96235ee987b8b4abeabe92f472413c77b47 | 12,180,527,271,171 | 31da51b0512ab1017246f9b32cfe6e106e01b116 | /xlbase/src/test/java/com/xl/base/design/proxy/MyInvocationHandler.java | 562372f95a2b5ae3d028135dfd9ee5e242d6fa5f | []
| no_license | XLjavaHome/XLjavaHome | https://github.com/XLjavaHome/XLjavaHome | a00e3f7d5cd36e4e9296b9b4cb34901fb35fe52f | 2139c6f02f2ed4a7951a934788682fc1567acec1 | refs/heads/master | 2022-05-29T11:11:14.446000 | 2021-12-10T01:24:17 | 2021-12-10T01:24:17 | 50,363,552 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xl.base.design.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;
import lombok.extern.log4j.Log4j;
/**
* Created with IntelliJ IDEA.
*
* @author 徐立
* @Date: 2018-04-13
* @Time: 16:30
* To change this template use File | Settings | File Templates.
*/
@Log4j
public class MyInvocationHandler implements InvocationHandler {
private Object obj = null;
/**
* 代理对象传class不行,必须传对象
*
* @param obj
* @return
*/
public Object bind(Object obj) {
this.obj = obj;
log.info("开始代理");
return java.lang.reflect.Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), this);
}
/**
* 调用代理的方法所执行的方法
* 1.如果在方法之前返回则不调用目标方法,会返回返回值
*
* @param proxy
* @param method
* @param args
* @return
* @throws Throwable
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
long start = System.currentTimeMillis();
log.info("代理执行方法前");
//获取参数
log.info("参数是" + Arrays.toString(args));
Object temp = null;
try {
temp = method.invoke(this.obj, args);
} catch (Exception e) {
log.error("这是代理异常");
}
long end = System.currentTimeMillis();
log.info("代理执行方法后");
log.info("方法执行时长" + (end - start) + "毫秒");
return temp;
}
}
| UTF-8 | Java | 1,670 | java | MyInvocationHandler.java | Java | [
{
"context": "\n/**\n * Created with IntelliJ IDEA.\n *\n * @author 徐立\n * @Date: 2018-04-13\n * @Time: 16:30\n * To change",
"end": 223,
"score": 0.9995679259300232,
"start": 221,
"tag": "NAME",
"value": "徐立"
}
]
| null | []
| package com.xl.base.design.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;
import lombok.extern.log4j.Log4j;
/**
* Created with IntelliJ IDEA.
*
* @author 徐立
* @Date: 2018-04-13
* @Time: 16:30
* To change this template use File | Settings | File Templates.
*/
@Log4j
public class MyInvocationHandler implements InvocationHandler {
private Object obj = null;
/**
* 代理对象传class不行,必须传对象
*
* @param obj
* @return
*/
public Object bind(Object obj) {
this.obj = obj;
log.info("开始代理");
return java.lang.reflect.Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), this);
}
/**
* 调用代理的方法所执行的方法
* 1.如果在方法之前返回则不调用目标方法,会返回返回值
*
* @param proxy
* @param method
* @param args
* @return
* @throws Throwable
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
long start = System.currentTimeMillis();
log.info("代理执行方法前");
//获取参数
log.info("参数是" + Arrays.toString(args));
Object temp = null;
try {
temp = method.invoke(this.obj, args);
} catch (Exception e) {
log.error("这是代理异常");
}
long end = System.currentTimeMillis();
log.info("代理执行方法后");
log.info("方法执行时长" + (end - start) + "毫秒");
return temp;
}
}
| 1,670 | 0.592617 | 0.581879 | 59 | 24.254238 | 22.365677 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457627 | false | false | 15 |
6aaff77476ad2aabf70e5cf91a18621339f22202 | 12,180,527,272,704 | 474da294f10bc519182d4f01cf9aeacf6804d4c2 | /TestGiu-master/src/testgui/TestGui.java | 8c6d0d1924e45834c86ee3c817f746871af188c2 | []
| no_license | geraldo1993/Java-Codes | https://github.com/geraldo1993/Java-Codes | 10728e2fab4341081005f08118598af26ca85c47 | dffafe201ec93cafc24cf37fabacc064bede5bf7 | refs/heads/master | 2020-07-18T02:41:56.206000 | 2016-09-14T16:48:41 | 2016-09-14T16:48:41 | 67,901,128 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testgui;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Geraldo
*/
public class TestGui extends JFrame {
private JButton button;
private JLabel label;
private JTextField textfield;
/**
* @param args the command line arguments
*/
public TestGui(){
setLayout(new FlowLayout());
label=new JLabel("welcome to our program");
add(label);
textfield=new JTextField(15);
add(textfield);
button=new JButton("click me ");
add(button);
}
public static void main(String[] args) {
// TODO code application logic here
TestGui gui= new TestGui();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setTitle("GIU");
gui.setSize(450,450);
gui.setVisible(true);
}
}
| UTF-8 | Java | 1,076 | java | TestGui.java | Java | [
{
"context": "awt.*;\r\nimport javax.swing.*;\r\n/**\r\n *\r\n * @author Geraldo\r\n */\r\npublic class TestGui extends JFrame {\r\nprivat",
"end": 278,
"score": 0.9233098030090332,
"start": 271,
"tag": "NAME",
"value": "Geraldo"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testgui;
import java.awt.*;
import javax.swing.*;
/**
*
* @author Geraldo
*/
public class TestGui extends JFrame {
private JButton button;
private JLabel label;
private JTextField textfield;
/**
* @param args the command line arguments
*/
public TestGui(){
setLayout(new FlowLayout());
label=new JLabel("welcome to our program");
add(label);
textfield=new JTextField(15);
add(textfield);
button=new JButton("click me ");
add(button);
}
public static void main(String[] args) {
// TODO code application logic here
TestGui gui= new TestGui();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setTitle("GIU");
gui.setSize(450,450);
gui.setVisible(true);
}
}
| 1,076 | 0.58829 | 0.580855 | 43 | 22.930233 | 19.008438 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.511628 | false | false | 15 |
8321de918a48737299ca7d14d27a4a5d09ec3246 | 10,831,907,575,067 | 34dcc9e734519d7f9a1a67b47dd1cc263924d09d | /app/src/main/java/com/example/domin/ega_premium_store/BasketFragment.java | 0ff623927ab77836fa652f13a19c655aac8ef153 | []
| no_license | DominikZycinski/Ega_Premium_Store | https://github.com/DominikZycinski/Ega_Premium_Store | dad402b33bf2d0fae30f1fbc20f8347d1bbcfe43 | 738535e9261d2c388d869311e0b2ebcbdf597702 | refs/heads/master | 2020-03-18T11:58:49.553000 | 2018-06-05T09:16:00 | 2018-06-05T09:16:00 | 134,701,943 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.domin.ega_premium_store;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.domin.ega_premium_store.DBFlow.MobUser;
import com.raizlabs.android.dbflow.sql.language.SQLite;
import java.util.List;
public class BasketFragment extends Fragment {
TextView showData;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_basket, container, false);
View v = inflater.inflate(R.layout.fragment_basket, container,false);
showData = v.findViewById(R.id.showData2);
List<MobUser> UserList = SQLite.select().
from(MobUser.class).queryList();
String DBname;
int DBage;
showData.setText("Twoj koszyk jest pusty!");
int i = 0;
int j = 0;
for( MobUser mu : UserList ){
i++;
if(i ==1){
showData.setText("");
}
DBname = mu.GetName();
DBage = mu.GetAge();
showData.append( "Arykuł: \t"+DBname+ "\nIlosc: "+Global.amount[j] +"\t \nCena: "+DBage * Global.amount[j] +".00 zł \n\n\n" );
j++;
}
return v;
}
}
| UTF-8 | Java | 1,538 | java | BasketFragment.java | Java | []
| null | []
| package com.example.domin.ega_premium_store;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.domin.ega_premium_store.DBFlow.MobUser;
import com.raizlabs.android.dbflow.sql.language.SQLite;
import java.util.List;
public class BasketFragment extends Fragment {
TextView showData;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_basket, container, false);
View v = inflater.inflate(R.layout.fragment_basket, container,false);
showData = v.findViewById(R.id.showData2);
List<MobUser> UserList = SQLite.select().
from(MobUser.class).queryList();
String DBname;
int DBage;
showData.setText("Twoj koszyk jest pusty!");
int i = 0;
int j = 0;
for( MobUser mu : UserList ){
i++;
if(i ==1){
showData.setText("");
}
DBname = mu.GetName();
DBage = mu.GetAge();
showData.append( "Arykuł: \t"+DBname+ "\nIlosc: "+Global.amount[j] +"\t \nCena: "+DBage * Global.amount[j] +".00 zł \n\n\n" );
j++;
}
return v;
}
}
| 1,538 | 0.639974 | 0.635417 | 52 | 28.538462 | 29.660555 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673077 | false | false | 15 |
b472fed16e99040ef89a8ba03c391b137df54876 | 29,085,518,562,972 | 7f78dee52fd11ac16808bb5edcaeb96eceae3eec | /eic-registry/src/main/java/eu/einfracentral/service/search/AbstractSearchService.java | 4a8c9fee74a4d13bdad187d70bd7c2fbb84b9e63 | [
"Apache-2.0"
]
| permissive | madgeek-arc/resource-catalogue | https://github.com/madgeek-arc/resource-catalogue | 35cb07edda905e9fcad8096a3354b65ea378277c | 21f022f8ceff23a65d6707678cd612cee7cbdfdc | refs/heads/master | 2023-08-31T09:30:22.175000 | 2023-08-31T07:58:53 | 2023-08-31T07:58:53 | 153,264,425 | 5 | 3 | Apache-2.0 | false | 2023-09-08T12:04:56 | 2018-10-16T10:06:46 | 2023-01-20T13:37:07 | 2023-09-08T12:04:55 | 5,778 | 4 | 4 | 3 | Java | false | false | package eu.einfracentral.service.search;
import eu.einfracentral.utils.FacetFilterUtils;
import eu.openminted.registry.core.domain.FacetFilter;
import eu.openminted.registry.core.service.SearchService;
import eu.openminted.registry.core.service.SearchServiceImpl;
import org.bouncycastle.util.Strings;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.DisMaxQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import java.util.*;
import java.util.stream.Collectors;
import static org.elasticsearch.index.query.QueryBuilders.*;
public abstract class AbstractSearchService extends SearchServiceImpl implements SearchService {
public AbstractSearchService(RestHighLevelClient client) {
super(client);
}
/**
* User can define custom logic for filtering resources based on the filters provided. The custom queries must be
* applied on the existing {@param qBuilder} that is given.
*
* @param qBuilder Accepts the {@link BoolQueryBuilder} object used to search.
* @param allFilters Filters provided.
* @return
*/
public abstract BoolQueryBuilder customFilters(BoolQueryBuilder qBuilder, Map<String, List<Object>> allFilters);
@Override
public BoolQueryBuilder createQueryBuilder(FacetFilter filter) {
BoolQueryBuilder qBuilder = new BoolQueryBuilder();
// retrieve filters from FacetFilter object
Map<String, List<Object>> allFilters = FacetFilterUtils.getFacetFilterFilters(filter);
List<Object> searchFields = allFilters.remove(FacetFilterUtils.SEARCH_FIELDS);
if (searchFields == null || searchFields.isEmpty()) {
searchFields = Arrays.asList("resource_internal_id", "name", "title");
// TODO: enable when searchable_area is configurable
// searchFields = Collections.singletonList(FacetFilterUtils.SEARCHABLE_AREA);
}
if (filter.getKeyword() != null && !filter.getKeyword().equals("")) {
String keyword = filter.getKeyword();
List<String> phrases = new ArrayList<>();
// find quoted terms and keep them as is
List<String> parts = Arrays.stream(Strings.split(keyword, '"')).collect(Collectors.toList());
if (parts.size() > 1 && parts.size() % 2 == 1) {
for (int i = 0; i < parts.size(); i++) {
if (i % 2 == 1) {
phrases.add(parts.get(i));
}
}
}
keyword = keyword.replace("\"", "");
phrases.add(keyword);
// create phrase query to match search phrase and quoted phrases
qBuilder.should(createPhraseQuery(searchFields, phrases, 4f, 1f));
// split search phrase to keywords using delimiters
List<String> longKeywords = new ArrayList<>();
List<String> shortKeywords = new ArrayList<>();
if (keyword.split("[\\s-_,./;:'\\[\\]]").length == 1) {
qBuilder.should(createMatchQuery(searchFields, Collections.singletonList(keyword), 1f, 0.5f));
} else {
for (char delimiter : " -_,./;:'[]".toCharArray()) {
if (keyword.contains("" + delimiter)) {
for (String word : keyword.split(String.format("\\%s", delimiter))) {
if (word.length() > 4) {
longKeywords.add(word);
} else {
shortKeywords.add(word);
}
}
}
}
}
// create fuzzy query for long keywords
if (!longKeywords.isEmpty()) {
qBuilder.should(createMatchQuery(searchFields, longKeywords, 1f, 0.2f));
}
// create fuzzy query for short keywords
if (!shortKeywords.isEmpty()) {
qBuilder.should(createMatchQuery(searchFields, shortKeywords, 0.2f, 0.1f));
}
qBuilder.minimumShouldMatch(1);
} else {
qBuilder.must(QueryBuilders.matchAllQuery());
}
// Custom Filters
qBuilder = customFilters(qBuilder, allFilters);
return qBuilder;
}
protected DisMaxQueryBuilder createDisMaxQuery(String key, List<Object> filters) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object f : filters) {
qb.add(termQuery(key, (String) f));
}
qb.boost(2f);
qb.tieBreaker(0.7f);
return qb;
}
/**
* Creates a query for the keywords in all given search fields.
*
* @param fields The search fields.
* @param keywords The search keywords.
* @param boost A multiplier for the score of the query (parameter of the {@link DisMaxQueryBuilder}).
* @param tieBreaker (parameter of the {@link DisMaxQueryBuilder})
* @return {@link DisMaxQueryBuilder}
*/
protected DisMaxQueryBuilder createMatchQuery(List<Object> fields, List<String> keywords, Float boost, Float tieBreaker) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object field : fields) {
for (String keyword : keywords) {
/*for (int i = 0; i < keyword.length(); i++) {
String nextLetter = String.valueOf(keyword.charAt(i));
String possibleInput = keyword.replace(nextLetter, "[^\\s\\p{L}\\p{N}]");
qb.add(regexpQuery((String) field, ".*" + possibleInput + ".*"));
}*/
qb.add(matchQuery((String) field, keyword.toLowerCase()));
qb.add(matchQuery((String) field, keyword.toUpperCase()));
qb.add(regexpQuery((String) field, ".*" + keyword + ".*"));
qb.add(regexpQuery((String) field, ".*" + keyword.toLowerCase() + ".*"));
qb.add(regexpQuery((String) field, ".*" + keyword.toUpperCase() + ".*"));
// Create Camel Case query
keyword = keyword.substring(0, 1).toUpperCase() + keyword.substring(1).toLowerCase();
qb.add(matchQuery((String) field, keyword));
qb.add(regexpQuery((String) field, ".*" + keyword + ".*"));
}
}
qb.boost(boost);
qb.tieBreaker(tieBreaker);
return qb;
}
/**
* Creates a phrase query for all the given phrases in all the given search fields.
*
* @param fields The search fields.
* @param phrases The search phrases.
* @param boost A multiplier for the score of the query (parameter of the {@link DisMaxQueryBuilder}).
* @param tieBreaker (parameter of the {@link DisMaxQueryBuilder})
* @return {@link DisMaxQueryBuilder}
*/
protected DisMaxQueryBuilder createPhraseQuery(List<Object> fields, List<String> phrases, Float boost, Float tieBreaker) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object field : fields) {
for (String phrase : phrases) {
qb.add(matchPhraseQuery((String) field, phrase));
}
}
qb.boost(boost);
qb.tieBreaker(tieBreaker);
return qb;
}
} | UTF-8 | Java | 7,404 | java | AbstractSearchService.java | Java | []
| null | []
| package eu.einfracentral.service.search;
import eu.einfracentral.utils.FacetFilterUtils;
import eu.openminted.registry.core.domain.FacetFilter;
import eu.openminted.registry.core.service.SearchService;
import eu.openminted.registry.core.service.SearchServiceImpl;
import org.bouncycastle.util.Strings;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.DisMaxQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import java.util.*;
import java.util.stream.Collectors;
import static org.elasticsearch.index.query.QueryBuilders.*;
public abstract class AbstractSearchService extends SearchServiceImpl implements SearchService {
public AbstractSearchService(RestHighLevelClient client) {
super(client);
}
/**
* User can define custom logic for filtering resources based on the filters provided. The custom queries must be
* applied on the existing {@param qBuilder} that is given.
*
* @param qBuilder Accepts the {@link BoolQueryBuilder} object used to search.
* @param allFilters Filters provided.
* @return
*/
public abstract BoolQueryBuilder customFilters(BoolQueryBuilder qBuilder, Map<String, List<Object>> allFilters);
@Override
public BoolQueryBuilder createQueryBuilder(FacetFilter filter) {
BoolQueryBuilder qBuilder = new BoolQueryBuilder();
// retrieve filters from FacetFilter object
Map<String, List<Object>> allFilters = FacetFilterUtils.getFacetFilterFilters(filter);
List<Object> searchFields = allFilters.remove(FacetFilterUtils.SEARCH_FIELDS);
if (searchFields == null || searchFields.isEmpty()) {
searchFields = Arrays.asList("resource_internal_id", "name", "title");
// TODO: enable when searchable_area is configurable
// searchFields = Collections.singletonList(FacetFilterUtils.SEARCHABLE_AREA);
}
if (filter.getKeyword() != null && !filter.getKeyword().equals("")) {
String keyword = filter.getKeyword();
List<String> phrases = new ArrayList<>();
// find quoted terms and keep them as is
List<String> parts = Arrays.stream(Strings.split(keyword, '"')).collect(Collectors.toList());
if (parts.size() > 1 && parts.size() % 2 == 1) {
for (int i = 0; i < parts.size(); i++) {
if (i % 2 == 1) {
phrases.add(parts.get(i));
}
}
}
keyword = keyword.replace("\"", "");
phrases.add(keyword);
// create phrase query to match search phrase and quoted phrases
qBuilder.should(createPhraseQuery(searchFields, phrases, 4f, 1f));
// split search phrase to keywords using delimiters
List<String> longKeywords = new ArrayList<>();
List<String> shortKeywords = new ArrayList<>();
if (keyword.split("[\\s-_,./;:'\\[\\]]").length == 1) {
qBuilder.should(createMatchQuery(searchFields, Collections.singletonList(keyword), 1f, 0.5f));
} else {
for (char delimiter : " -_,./;:'[]".toCharArray()) {
if (keyword.contains("" + delimiter)) {
for (String word : keyword.split(String.format("\\%s", delimiter))) {
if (word.length() > 4) {
longKeywords.add(word);
} else {
shortKeywords.add(word);
}
}
}
}
}
// create fuzzy query for long keywords
if (!longKeywords.isEmpty()) {
qBuilder.should(createMatchQuery(searchFields, longKeywords, 1f, 0.2f));
}
// create fuzzy query for short keywords
if (!shortKeywords.isEmpty()) {
qBuilder.should(createMatchQuery(searchFields, shortKeywords, 0.2f, 0.1f));
}
qBuilder.minimumShouldMatch(1);
} else {
qBuilder.must(QueryBuilders.matchAllQuery());
}
// Custom Filters
qBuilder = customFilters(qBuilder, allFilters);
return qBuilder;
}
protected DisMaxQueryBuilder createDisMaxQuery(String key, List<Object> filters) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object f : filters) {
qb.add(termQuery(key, (String) f));
}
qb.boost(2f);
qb.tieBreaker(0.7f);
return qb;
}
/**
* Creates a query for the keywords in all given search fields.
*
* @param fields The search fields.
* @param keywords The search keywords.
* @param boost A multiplier for the score of the query (parameter of the {@link DisMaxQueryBuilder}).
* @param tieBreaker (parameter of the {@link DisMaxQueryBuilder})
* @return {@link DisMaxQueryBuilder}
*/
protected DisMaxQueryBuilder createMatchQuery(List<Object> fields, List<String> keywords, Float boost, Float tieBreaker) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object field : fields) {
for (String keyword : keywords) {
/*for (int i = 0; i < keyword.length(); i++) {
String nextLetter = String.valueOf(keyword.charAt(i));
String possibleInput = keyword.replace(nextLetter, "[^\\s\\p{L}\\p{N}]");
qb.add(regexpQuery((String) field, ".*" + possibleInput + ".*"));
}*/
qb.add(matchQuery((String) field, keyword.toLowerCase()));
qb.add(matchQuery((String) field, keyword.toUpperCase()));
qb.add(regexpQuery((String) field, ".*" + keyword + ".*"));
qb.add(regexpQuery((String) field, ".*" + keyword.toLowerCase() + ".*"));
qb.add(regexpQuery((String) field, ".*" + keyword.toUpperCase() + ".*"));
// Create Camel Case query
keyword = keyword.substring(0, 1).toUpperCase() + keyword.substring(1).toLowerCase();
qb.add(matchQuery((String) field, keyword));
qb.add(regexpQuery((String) field, ".*" + keyword + ".*"));
}
}
qb.boost(boost);
qb.tieBreaker(tieBreaker);
return qb;
}
/**
* Creates a phrase query for all the given phrases in all the given search fields.
*
* @param fields The search fields.
* @param phrases The search phrases.
* @param boost A multiplier for the score of the query (parameter of the {@link DisMaxQueryBuilder}).
* @param tieBreaker (parameter of the {@link DisMaxQueryBuilder})
* @return {@link DisMaxQueryBuilder}
*/
protected DisMaxQueryBuilder createPhraseQuery(List<Object> fields, List<String> phrases, Float boost, Float tieBreaker) {
DisMaxQueryBuilder qb = QueryBuilders.disMaxQuery();
for (Object field : fields) {
for (String phrase : phrases) {
qb.add(matchPhraseQuery((String) field, phrase));
}
}
qb.boost(boost);
qb.tieBreaker(tieBreaker);
return qb;
}
} | 7,404 | 0.592518 | 0.588736 | 172 | 42.052326 | 32.54697 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.656977 | false | false | 15 |
470231f01fb143db84df85db598ff3683995808d | 20,615,843,022,580 | 9f341ea6c55dc912c3c015e21e9cc9c0e3954e2c | /Java Swing/src/az/orient/course/gui/NewStudentFrame.java | 25e0d0dde728bbbe668df5a7c3c524994caebd8c | []
| no_license | hikmatasgarli/myJavaSwingProject | https://github.com/hikmatasgarli/myJavaSwingProject | 807ab1becf6211cf0c26b3ea1eaa571727388851 | 4a97791bcdbb4a3db80f4f618799c1072af2a77e | refs/heads/master | 2020-12-19T21:20:41.724000 | 2020-01-23T18:35:55 | 2020-01-23T18:35:55 | 235,855,320 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package az.orient.course.gui;
import az.orient.course.model.Student;
import az.orient.course.service.CourseService;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Ideas.az
*/
public class NewStudentFrame extends javax.swing.JFrame {
private CourseService courseService;
public NewStudentFrame() {
initComponents();
}
public NewStudentFrame(CourseService courseService) {
initComponents();
this.courseService = courseService;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
nameTxt = new javax.swing.JTextField();
surnameTxt = new javax.swing.JTextField();
addressTxt = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
phoneTxt = new javax.swing.JTextField();
saveBtn = new javax.swing.JButton();
clearBtn = new javax.swing.JButton();
birthdateTxt = new com.toedter.calendar.JDateChooser();
jButton2.setText("jButton2");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setText("Name");
jLabel2.setText("Surname");
jLabel3.setText("Address");
jLabel4.setText("Birthdate");
jLabel5.setText("Phone");
saveBtn.setText("Save");
saveBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveBtnActionPerformed(evt);
}
});
clearBtn.setText("Clear");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(56, 56, 56)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(nameTxt)
.addComponent(surnameTxt)
.addComponent(addressTxt)
.addComponent(phoneTxt)
.addComponent(birthdateTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(saveBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(clearBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(47, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(nameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(jLabel2))
.addComponent(surnameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(addressTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(44, 44, 44)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(birthdateTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(phoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(saveBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)
.addComponent(clearBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(33, 33, 33))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed
try {
String name = nameTxt.getText();
String surname = surnameTxt.getText();
String address = addressTxt.getText();
String phone = phoneTxt.getText();
Date dob = birthdateTxt.getDate();
Student student = new Student();
student.setName(name);
student.setSurname(surname);
student.setAddress(address);
student.setPhone(phone);
student.setDob(dob);
boolean isAdded = courseService.addStudent(student);
if (isAdded) {
JOptionPane.showMessageDialog(null, "Student has been successfully added!");
this.dispose();
} else {
JOptionPane.showMessageDialog(null, "Problem! Student has not been successfully added!","Error",JOptionPane.ERROR_MESSAGE);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}//GEN-LAST:event_saveBtnActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField addressTxt;
private com.toedter.calendar.JDateChooser birthdateTxt;
private javax.swing.JButton clearBtn;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField nameTxt;
private javax.swing.JTextField phoneTxt;
private javax.swing.JButton saveBtn;
private javax.swing.JTextField surnameTxt;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 8,473 | java | NewStudentFrame.java | Java | [
{
"context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author Ideas.az\n */\npublic class NewStudentFrame extends javax.sw",
"end": 449,
"score": 0.9973573684692383,
"start": 441,
"tag": "NAME",
"value": "Ideas.az"
},
{
"context": "dent = new Student();\n student.setName(name);\n student.setSurname(surname);\n ",
"end": 7101,
"score": 0.9926786422729492,
"start": 7097,
"tag": "NAME",
"value": "name"
},
{
"context": "ent.setName(name);\n student.setSurname(surname);\n student.setAddress(address);\n ",
"end": 7142,
"score": 0.9910048246383667,
"start": 7135,
"tag": "NAME",
"value": "surname"
}
]
| null | []
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package az.orient.course.gui;
import az.orient.course.model.Student;
import az.orient.course.service.CourseService;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Ideas.az
*/
public class NewStudentFrame extends javax.swing.JFrame {
private CourseService courseService;
public NewStudentFrame() {
initComponents();
}
public NewStudentFrame(CourseService courseService) {
initComponents();
this.courseService = courseService;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
nameTxt = new javax.swing.JTextField();
surnameTxt = new javax.swing.JTextField();
addressTxt = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
phoneTxt = new javax.swing.JTextField();
saveBtn = new javax.swing.JButton();
clearBtn = new javax.swing.JButton();
birthdateTxt = new com.toedter.calendar.JDateChooser();
jButton2.setText("jButton2");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setText("Name");
jLabel2.setText("Surname");
jLabel3.setText("Address");
jLabel4.setText("Birthdate");
jLabel5.setText("Phone");
saveBtn.setText("Save");
saveBtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveBtnActionPerformed(evt);
}
});
clearBtn.setText("Clear");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(60, 60, 60)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(56, 56, 56)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(nameTxt)
.addComponent(surnameTxt)
.addComponent(addressTxt)
.addComponent(phoneTxt)
.addComponent(birthdateTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(saveBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(clearBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(47, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(nameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(jLabel2))
.addComponent(surnameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(40, 40, 40)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(addressTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(44, 44, 44)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(birthdateTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(phoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(saveBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)
.addComponent(clearBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(33, 33, 33))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed
try {
String name = nameTxt.getText();
String surname = surnameTxt.getText();
String address = addressTxt.getText();
String phone = phoneTxt.getText();
Date dob = birthdateTxt.getDate();
Student student = new Student();
student.setName(name);
student.setSurname(surname);
student.setAddress(address);
student.setPhone(phone);
student.setDob(dob);
boolean isAdded = courseService.addStudent(student);
if (isAdded) {
JOptionPane.showMessageDialog(null, "Student has been successfully added!");
this.dispose();
} else {
JOptionPane.showMessageDialog(null, "Problem! Student has not been successfully added!","Error",JOptionPane.ERROR_MESSAGE);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}//GEN-LAST:event_saveBtnActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField addressTxt;
private com.toedter.calendar.JDateChooser birthdateTxt;
private javax.swing.JButton clearBtn;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField nameTxt;
private javax.swing.JTextField phoneTxt;
private javax.swing.JButton saveBtn;
private javax.swing.JTextField surnameTxt;
// End of variables declaration//GEN-END:variables
}
| 8,473 | 0.63307 | 0.62174 | 181 | 45.812153 | 36.622128 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.712707 | false | false | 15 |
a8152b8aa926a7ffa719688a029e77d64d2edbc7 | 20,899,310,885,324 | 5b07cc61d2d06a43794cd1b89ff3649dade91424 | /app/src/main/java/com/example/playandroid/website/WebsiteInterface.java | 2a993467d525f903d2070c988994259ae3387fb7 | []
| no_license | SometingP/PlayAndroid | https://github.com/SometingP/PlayAndroid | 3d473452398946aaa2604c66b6aa0955d5652c58 | 755a4a15c1e187fdcccf771ce3d3fd16118796b0 | refs/heads/master | 2020-04-25T21:55:13.051000 | 2019-05-22T14:34:16 | 2019-05-22T14:34:16 | 173,067,786 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.playandroid.website;
import com.example.corelib.entity.WebsiteEntity;
public interface WebsiteInterface {
public void setWebsites(WebsiteEntity entity);
}
| UTF-8 | Java | 181 | java | WebsiteInterface.java | Java | []
| null | []
| package com.example.playandroid.website;
import com.example.corelib.entity.WebsiteEntity;
public interface WebsiteInterface {
public void setWebsites(WebsiteEntity entity);
}
| 181 | 0.81768 | 0.81768 | 7 | 24.857143 | 21.728378 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 15 |
d00095077f6705107393b8bcdd8b7c30b27a8900 | 17,695,265,299,558 | 712dcb411d89a3d32beb24cf5791227230254a89 | /bindings/java/Liblucene4J/src/liblucene/liblucene4j/document/Document.java | 7f652e59bb7acd7da9d7e2f81886c606eb7efa08 | []
| no_license | rokirx/lucino | https://github.com/rokirx/lucino | a78bad75402386da012848b3bc54b903227e31ec | 57a982dba0be6480ee97cd3dc21e51bdfc09bbea | refs/heads/master | 2020-04-06T06:50:24.720000 | 2013-08-26T23:25:56 | 2013-08-26T23:25:56 | 6,422,163 | 2 | 1 | null | false | 2018-01-17T15:35:34 | 2012-10-27T22:25:14 | 2014-08-23T08:37:44 | 2013-08-26T23:26:23 | 1,841 | 2 | 2 | 1 | C | false | null | package liblucene.liblucene4j.document;
import liblucene.liblucene4j.jni.LibluceneJNI;
/**
*
* <p></p>
*
* <p></p>
*
* <p>Copyright: Liblucene project (c) 2006</p>
*
* <p><a href="http://liblucene.sf.net">http://liblucene.sf.net</a></p>
*
* @author V. Klein
* @version 1.0
*/
public class Document {
/**
*
* @param pool int
*/
public void create(int pool) {
LibluceneJNI.getInstance().documentCreate(this, pool);
}
public void addField(Field field, int pool) {
LibluceneJNI.getInstance().documentAddField(this, field, pool);
}
public void freeDocument() {
LibluceneJNI.getInstance().documentFree(this);
}
protected void finalize() {
LibluceneJNI.getInstance().poolDestroy(this.nativePool);
}
public int nativeDocument;
public int nativePool;
}
| UTF-8 | Java | 854 | java | Document.java | Java | [
{
"context": "net\">http://liblucene.sf.net</a></p>\n *\n * @author V. Klein\n * @version 1.0\n */\npublic class Document {\n /",
"end": 269,
"score": 0.999859631061554,
"start": 261,
"tag": "NAME",
"value": "V. Klein"
}
]
| null | []
| package liblucene.liblucene4j.document;
import liblucene.liblucene4j.jni.LibluceneJNI;
/**
*
* <p></p>
*
* <p></p>
*
* <p>Copyright: Liblucene project (c) 2006</p>
*
* <p><a href="http://liblucene.sf.net">http://liblucene.sf.net</a></p>
*
* @author <NAME>
* @version 1.0
*/
public class Document {
/**
*
* @param pool int
*/
public void create(int pool) {
LibluceneJNI.getInstance().documentCreate(this, pool);
}
public void addField(Field field, int pool) {
LibluceneJNI.getInstance().documentAddField(this, field, pool);
}
public void freeDocument() {
LibluceneJNI.getInstance().documentFree(this);
}
protected void finalize() {
LibluceneJNI.getInstance().poolDestroy(this.nativePool);
}
public int nativeDocument;
public int nativePool;
}
| 852 | 0.626464 | 0.617096 | 42 | 19.333334 | 21.971481 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 15 |
91de335fd5eb276298d301ff75c1f83777b0fb48 | 12,489,764,913,119 | b9cba660b9bd10c228eee9cc15e256c2f43f2921 | /week6/TrinomialDP.java | 73c73431a8d989a81ffb6ae56ccd19f1f6e5d8af | []
| no_license | aidinbii/Computer-Science-Programming-with-a-Purpose | https://github.com/aidinbii/Computer-Science-Programming-with-a-Purpose | 22ab1e826228752c57e37a90b19d7f017022d779 | 4bb55b6258cf1beb4c097e611f99f47f603ffcd4 | refs/heads/master | 2022-04-18T00:07:36.819000 | 2020-04-12T16:55:01 | 2020-04-12T16:55:01 | 255,125,872 | 10 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class TrinomialDP {
// Returns the trinomial coefficient T(n, k).
public static long trinomial(int n, int k) {
if (k < -n || k > n)
return 0;
else {
long[][] t = new long[n + 1][2 * n + 3];
int m = t[0].length;
t[0][m / 2] = 1;
for (int i = 1; i <= n; i++)
for (int j = -i; j <= i; j++)
t[i][m / 2 + j] = t[i - 1][m / 2 + j - 1] +
t[i - 1][m / 2 + j] + t[i - 1][m / 2 + j + 1];
return t[n][m / 2 + k];
}
}
// Takes two integer command-line arguments n and k and prints T(n, k).
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
int k = Integer.parseInt(args[1]);
System.out.print(trinomial(n, k));
}
}
| UTF-8 | Java | 841 | java | TrinomialDP.java | Java | []
| null | []
| public class TrinomialDP {
// Returns the trinomial coefficient T(n, k).
public static long trinomial(int n, int k) {
if (k < -n || k > n)
return 0;
else {
long[][] t = new long[n + 1][2 * n + 3];
int m = t[0].length;
t[0][m / 2] = 1;
for (int i = 1; i <= n; i++)
for (int j = -i; j <= i; j++)
t[i][m / 2 + j] = t[i - 1][m / 2 + j - 1] +
t[i - 1][m / 2 + j] + t[i - 1][m / 2 + j + 1];
return t[n][m / 2 + k];
}
}
// Takes two integer command-line arguments n and k and prints T(n, k).
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
int k = Integer.parseInt(args[1]);
System.out.print(trinomial(n, k));
}
}
| 841 | 0.418549 | 0.393579 | 25 | 32.639999 | 21.338942 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.76 | false | false | 15 |
c15d10518a77c1714d76b3021a5cbe43f148deca | 26,104,811,262,621 | eb2e7779c8398cb73d0c74b545c056ace79c51f2 | /app/src/main/java/com/uni/pano/event/ConnectEvent.java | c3a995eea628e336818d6a1a2fd330c5c0c306ba | []
| no_license | misback/panoplay | https://github.com/misback/panoplay | ec99791ba667938752d6fc3d580534d3b7f4122e | 9c6e66cb3f5d369c6fc344733c611d04880ed922 | refs/heads/master | 2020-12-30T15:30:15.962000 | 2017-05-13T05:04:30 | 2017-05-13T05:04:30 | 91,150,201 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.uni.pano.event;
import com.uni.pano.config.EnumElement;
/**
* Created by DELL on 2017/3/22.
*/
public class ConnectEvent {
public EnumElement.CONNECT_RESULT connect_result;
public ConnectEvent(EnumElement.CONNECT_RESULT connectResult){
connect_result = connectResult;
}
}
| UTF-8 | Java | 309 | java | ConnectEvent.java | Java | [
{
"context": "om.uni.pano.config.EnumElement;\n\n/**\n * Created by DELL on 2017/3/22.\n */\n\npublic class ConnectEvent {\n ",
"end": 92,
"score": 0.9966406226158142,
"start": 88,
"tag": "USERNAME",
"value": "DELL"
}
]
| null | []
| package com.uni.pano.event;
import com.uni.pano.config.EnumElement;
/**
* Created by DELL on 2017/3/22.
*/
public class ConnectEvent {
public EnumElement.CONNECT_RESULT connect_result;
public ConnectEvent(EnumElement.CONNECT_RESULT connectResult){
connect_result = connectResult;
}
}
| 309 | 0.724919 | 0.702265 | 14 | 21.071428 | 21.575331 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 15 |
7bf951d59e2115bef5b43eeb2e09655550f208a1 | 25,649,544,693,992 | 15ef3a490a5fd0960b6050d12997e17e4529cc5f | /src/step19/Exam101_1.java | 737d85f0cc514b48cd8e873c1a3b930b171c29df | []
| no_license | joelweon/java01 | https://github.com/joelweon/java01 | e51b98641e550dd1a6111c2cbea615edf056c9e8 | d0af6666b9888573900f6811ba458ff51eee1e64 | refs/heads/master | 2020-06-29T13:44:46.453000 | 2017-02-06T06:16:29 | 2017-02-06T06:16:29 | 74,125,124 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package step19;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Exam101_1 {
public static void main(String[] args) throws Exception {
FileInputStream in = new FileInputStream("src/basic/Exam001.java");
InputStreamReader adapter = new InputStreamReader(in, "UTF-8");
BufferedReader in2 = new BufferedReader(adapter);
String line;
while ((line = in2.readLine()) != null) {
System.out.println(line);
}
in2.close();
adapter.close();
in.close();
}
} | UTF-8 | Java | 606 | java | Exam101_1.java | Java | []
| null | []
| package step19;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Exam101_1 {
public static void main(String[] args) throws Exception {
FileInputStream in = new FileInputStream("src/basic/Exam001.java");
InputStreamReader adapter = new InputStreamReader(in, "UTF-8");
BufferedReader in2 = new BufferedReader(adapter);
String line;
while ((line = in2.readLine()) != null) {
System.out.println(line);
}
in2.close();
adapter.close();
in.close();
}
} | 606 | 0.673267 | 0.651815 | 23 | 24.434782 | 21.594738 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.608696 | false | false | 15 |
dfb3e353d780529e69a8e59f4687515ecfb04a31 | 18,751,827,229,335 | 8e67fdab6f3a030f38fa127a79050b8667259d01 | /JavaStudyHalUk/src/TECHNOSTUDY_ISMETBY/Gun53AbstractClass/Ornek3/YemekDunyasiMain.java | 805ebccd3b15b93ad8e1556583a7ae95f8fa6ac8 | []
| no_license | mosmant/JavaStudyHalUk | https://github.com/mosmant/JavaStudyHalUk | 07e38ade6c7a31d923519a267a63318263c5910f | a41e16cb91ef307b50cfc497535126aa1e4035e5 | refs/heads/master | 2023-07-27T13:31:11.004000 | 2021-09-12T14:59:25 | 2021-09-12T14:59:25 | 405,671,965 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package TECHNOSTUDY_ISMETBY.Gun53AbstractClass.Ornek3;
public class YemekDunyasiMain {
public static void main(String[] args) {
Baklava bklv = new Baklava();
bklv.madeIn();
bklv.taste();
CheeseCake chc = new CheeseCake();
chc.madeIn();
chc.taste();
SezarSalad sld = new SezarSalad();
sld.madeIn();
sld.taste();
}
}
| UTF-8 | Java | 400 | java | YemekDunyasiMain.java | Java | []
| null | []
| package TECHNOSTUDY_ISMETBY.Gun53AbstractClass.Ornek3;
public class YemekDunyasiMain {
public static void main(String[] args) {
Baklava bklv = new Baklava();
bklv.madeIn();
bklv.taste();
CheeseCake chc = new CheeseCake();
chc.madeIn();
chc.taste();
SezarSalad sld = new SezarSalad();
sld.madeIn();
sld.taste();
}
}
| 400 | 0.58 | 0.5725 | 19 | 20.052631 | 17.324986 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 15 |
32d8273ce28cbb2ff876c98802cea328ef64225e | 23,880,018,194,561 | d9f3d1172891f6cb413e3a6b36dc7827fe4b7603 | /src/main/java/br/com/caelum/fj36/rest/authors/create/CreateAuthorListener.java | feb8e05bbafef8af85337a8cd8b14b5f4ae8dd43 | []
| no_license | fwfurtado/fj36-rest | https://github.com/fwfurtado/fj36-rest | 13ab30f975bbc4ef409cf0d9e27b2081ebf4f5b1 | e769f0fa084616df153d604543035b2fe400ba0a | refs/heads/master | 2020-04-21T22:08:34.749000 | 2019-02-25T13:35:39 | 2019-02-25T13:35:39 | 169,900,781 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.caelum.fj36.rest.authors.create;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
public class CreateAuthorListener {
@EventListener
public void createdAuthor(CreatedAuthor event) {
System.out.println(event);
Thread thread = Thread.currentThread();
System.out.println("\n\n\n\n");
System.out.println(String.format("[LISTENER] Thread '%s' with id '%s'", thread.getName(), thread.getId()));
System.out.println("\n\n\n\n");
}
}
| UTF-8 | Java | 564 | java | CreateAuthorListener.java | Java | []
| null | []
| package br.com.caelum.fj36.rest.authors.create;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
public class CreateAuthorListener {
@EventListener
public void createdAuthor(CreatedAuthor event) {
System.out.println(event);
Thread thread = Thread.currentThread();
System.out.println("\n\n\n\n");
System.out.println(String.format("[LISTENER] Thread '%s' with id '%s'", thread.getName(), thread.getId()));
System.out.println("\n\n\n\n");
}
}
| 564 | 0.693262 | 0.689716 | 19 | 28.68421 | 28.942871 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 15 |
b49bf1a43e08cdfd859587fb5cb76742b43daa5f | 14,173,392,089,512 | f6def7e69fa72f9e9d350c91dc1f35f65c372f43 | /src/less11/Clothes/Clothes.java | 3fe2b507e484d96505f24c87b0e85571ccf4dc35 | []
| no_license | Creativexi/Home | https://github.com/Creativexi/Home | 689003c6bf9e8d9280c6da1fdab6ed8040e29028 | d5c9348820fd58c8d32b532f4000d90d2d0ce373 | refs/heads/master | 2020-12-30T13:29:16.676000 | 2017-07-04T21:02:06 | 2017-07-04T21:02:06 | 91,226,100 | 0 | 1 | null | false | 2017-05-23T18:31:52 | 2017-05-14T07:05:22 | 2017-05-14T07:05:59 | 2017-05-23T18:31:52 | 88 | 0 | 1 | 3 | Java | null | null | package less11.Clothes;
public abstract class Clothes {
Size size;
int price;
String colour;
public Clothes(Size size, String colour, int price) {
this.size = size;
this.colour = colour;
this.price = price;
}
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Clothes clothes = (Clothes) o;
if (price != clothes.price) return false;
if (size != clothes.size) return false;
return colour != null ? colour.equals(clothes.colour) : clothes.colour == null;
}
@Override
public int hashCode() {
int result = size != null ? size.hashCode() : 0;
result = 31 * result + price;
result = 31 * result + (colour != null ? colour.hashCode() : 0);
return result;
}
}
| UTF-8 | Java | 1,284 | java | Clothes.java | Java | []
| null | []
| package less11.Clothes;
public abstract class Clothes {
Size size;
int price;
String colour;
public Clothes(Size size, String colour, int price) {
this.size = size;
this.colour = colour;
this.price = price;
}
public Size getSize() {
return size;
}
public void setSize(Size size) {
this.size = size;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Clothes clothes = (Clothes) o;
if (price != clothes.price) return false;
if (size != clothes.size) return false;
return colour != null ? colour.equals(clothes.colour) : clothes.colour == null;
}
@Override
public int hashCode() {
int result = size != null ? size.hashCode() : 0;
result = 31 * result + price;
result = 31 * result + (colour != null ? colour.hashCode() : 0);
return result;
}
}
| 1,284 | 0.55919 | 0.55296 | 57 | 21.526316 | 20.366901 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 15 |
ec54d850d9378793d8332a90ca31ea3857e3193e | 15,874,199,149,425 | 1cd3756ddff6941db363c9d770553487356cbd85 | /poseidon-system/src/main/java/com/muggle/poseidon/core/interceptor/RequestLogInterceptor.java | 573f79e1a19595e521d73df6eadb93dbb4018219 | [
"Apache-2.0"
]
| permissive | vipadm/poseidon | https://github.com/vipadm/poseidon | e5ef8c1ef329fc869242da56e3210b02046468f7 | bdc69cdd50561ac5cd08d74ed07784edbd5aba56 | refs/heads/master | 2020-07-01T11:18:55.455000 | 2019-07-11T08:54:01 | 2019-07-11T08:54:01 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package com.muggle.poseidon.core.interceptor;
//
//import com.alibaba.fastjson.JSONObject;
//import com.muggle.poseidon.base.PoseidonException;
//import com.muggle.poseidon.entity.PoseidonBlackList;
//import com.muggle.poseidon.service.PoseidonBlackListService;
//import com.muggle.poseidon.manager.UserInfoManagerImpl;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.text.SimpleDateFormat;
//import java.util.Map;
//
//import com.muggle.poseidon.core.properties.PoseidonProperties;
//import com.muggle.poseidon.utils.RequestUtils;
//
///**
// * @Description: 请求日志记录
// * @Param:
// * @return:
// * @Author: muggle
// * @Date:
// */
//public class RequestLogInterceptor implements HandlerInterceptor {
// private final static Logger log = LoggerFactory.getLogger("requestLog");
// private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();
// PoseidonBlackListService blackListService;
//
// public RequestLogInterceptor(PoseidonBlackListService blackListService) {
// this.blackListService = blackListService;
// }
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// String ipAddr = RequestUtils.getIpAddr(request);
// String id = UserInfoManagerImpl.getUserId();
// PoseidonBlackList byUserId = new PoseidonBlackList();
// PoseidonBlackList byIpAddr = new PoseidonBlackList();
// byUserId.setStatus(1).setUserId(id);
// byIpAddr.setStatus(1).setRemark(ipAddr);
// long userId = 0;
//// todo redis 缓存
// if (!id.equals("-1")) {
// userId = blackListService.count(byUserId);
// }
// long ip = blackListService.count(byIpAddr);
// if (ip > 0 || userId > 0) {
// throw new PoseidonException("黑名单用户", PoseidonProperties.BLACK_LIST_USER);
// }
// long beginTime = System.currentTimeMillis();
// // 线程绑定变量(该数据只有当前请求的线程可见)
// threadLocal.set(beginTime);
// log.info("请求开始时间:{} --用户id: {}", new SimpleDateFormat("HH:mm:ss.SSS").format(beginTime),id);
// return true;
// }
//
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// }
//
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// Long beginTime = threadLocal.get();
// if (beginTime == null) {
//// 请求转发直接return
// return;
// }
// long endTime = System.currentTimeMillis();
// Map<String, String[]> parameterMap = request.getParameterMap();
// String requestMap = JSONObject.toJSONString(parameterMap);
// String method = request.getMethod();
// log.info("请求时长:{}ms --URI:{} --请求者ip地址:{} --请求参数:{}", endTime - beginTime, method + ":" + request.getRequestURI(), RequestUtils.getIpAddr(request), requestMap);
// threadLocal.remove();
// }
//
//}
| UTF-8 | Java | 3,458 | java | RequestLogInterceptor.java | Java | [
{
"context": "n: 请求日志记录\n// * @Param:\n// * @return:\n// * @Author: muggle\n// * @Date:\n// */\n//public class RequestLogInterc",
"end": 859,
"score": 0.9996783137321472,
"start": 853,
"tag": "USERNAME",
"value": "muggle"
}
]
| null | []
| //package com.muggle.poseidon.core.interceptor;
//
//import com.alibaba.fastjson.JSONObject;
//import com.muggle.poseidon.base.PoseidonException;
//import com.muggle.poseidon.entity.PoseidonBlackList;
//import com.muggle.poseidon.service.PoseidonBlackListService;
//import com.muggle.poseidon.manager.UserInfoManagerImpl;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.text.SimpleDateFormat;
//import java.util.Map;
//
//import com.muggle.poseidon.core.properties.PoseidonProperties;
//import com.muggle.poseidon.utils.RequestUtils;
//
///**
// * @Description: 请求日志记录
// * @Param:
// * @return:
// * @Author: muggle
// * @Date:
// */
//public class RequestLogInterceptor implements HandlerInterceptor {
// private final static Logger log = LoggerFactory.getLogger("requestLog");
// private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();
// PoseidonBlackListService blackListService;
//
// public RequestLogInterceptor(PoseidonBlackListService blackListService) {
// this.blackListService = blackListService;
// }
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// String ipAddr = RequestUtils.getIpAddr(request);
// String id = UserInfoManagerImpl.getUserId();
// PoseidonBlackList byUserId = new PoseidonBlackList();
// PoseidonBlackList byIpAddr = new PoseidonBlackList();
// byUserId.setStatus(1).setUserId(id);
// byIpAddr.setStatus(1).setRemark(ipAddr);
// long userId = 0;
//// todo redis 缓存
// if (!id.equals("-1")) {
// userId = blackListService.count(byUserId);
// }
// long ip = blackListService.count(byIpAddr);
// if (ip > 0 || userId > 0) {
// throw new PoseidonException("黑名单用户", PoseidonProperties.BLACK_LIST_USER);
// }
// long beginTime = System.currentTimeMillis();
// // 线程绑定变量(该数据只有当前请求的线程可见)
// threadLocal.set(beginTime);
// log.info("请求开始时间:{} --用户id: {}", new SimpleDateFormat("HH:mm:ss.SSS").format(beginTime),id);
// return true;
// }
//
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// }
//
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// Long beginTime = threadLocal.get();
// if (beginTime == null) {
//// 请求转发直接return
// return;
// }
// long endTime = System.currentTimeMillis();
// Map<String, String[]> parameterMap = request.getParameterMap();
// String requestMap = JSONObject.toJSONString(parameterMap);
// String method = request.getMethod();
// log.info("请求时长:{}ms --URI:{} --请求者ip地址:{} --请求参数:{}", endTime - beginTime, method + ":" + request.getRequestURI(), RequestUtils.getIpAddr(request), requestMap);
// threadLocal.remove();
// }
//
//}
| 3,458 | 0.679064 | 0.676665 | 80 | 40.674999 | 34.375053 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 15 |
27239ae04945dbe8de672b0e5f97970a18542ba8 | 33,535,104,653,206 | 85ec99eac93877ee3c0f8d413517d7a5df3c36a2 | /src/main/java/AuthClient/ASAuthToTGSAuth.java | 35726d08b6b196009bd3818c35fdaa71ec63a171 | []
| no_license | huangenqi/YaoHomeWork | https://github.com/huangenqi/YaoHomeWork | 61d2f77750b4107761243cdfa64ca5e216f21a33 | 1ede267dcee57f204153b780123965f33b0054fd | refs/heads/master | 2023-05-14T02:43:21.712000 | 2021-05-28T07:15:28 | 2021-05-28T07:15:28 | 371,601,717 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package AuthClient;
import Communication.Communication;
import Tool.AddByte;
import StateMachine.IStateChange;
import Tool.DataTypeChange;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ASAuthToTGSAuth implements IStateChange {
public void StateChange(Object data){ //message+uid+idv
Object[] data1= (Object[]) data;
long uid= (long) data1[1];
int IDv= (int) data1[2];
byte[] message= (byte[]) data1[0]; //byte[4]+long+long+byte[40]+byte[8] IPtgs+TS2+LT2+Ticket+KEY(c,tgs)
byte[] IPtgs= AddByte.subBytes(message,1,4);
byte[] Ticket=AddByte.subBytes(message,21,40);
byte[] key=AddByte.subBytes(message,61,8);
//IDc+IPc+TS3+Ticket+IDv long+byte[4]+long+byte[40]+int
InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
byte[] IP=DataTypeChange.stringToBytes(addr.getHostAddress());
byte[] message2= new byte[1];;
message2[0]= DataTypeChange.IntToUnsignedByte(3);
message2=AddByte.addBytes(message2,DataTypeChange.longToBytes(uid));
message2= AddByte.addBytes(message2,IP);
//byte[] message = new byte[21];
// message[0]= DataTypeChange.IntToUnsignedByte(1);
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long TG3= System.currentTimeMillis();
message2=AddByte.addBytes(message2,DataTypeChange.longToBytes(TG3));
message2=AddByte.addBytes(message2,Ticket);
message2=AddByte.addBytes(message2,DataTypeChange.intToBytes(IDv));
try {
Socket socket=new Socket(DataTypeChange.bytesToString(IP),9699);
Communication.getInstance().getSocketObject(socket);
Communication.getInstance().getDesKey(key);
Communication.getInstance().send(message2);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 2,136 | java | ASAuthToTGSAuth.java | Java | []
| null | []
| package AuthClient;
import Communication.Communication;
import Tool.AddByte;
import StateMachine.IStateChange;
import Tool.DataTypeChange;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class ASAuthToTGSAuth implements IStateChange {
public void StateChange(Object data){ //message+uid+idv
Object[] data1= (Object[]) data;
long uid= (long) data1[1];
int IDv= (int) data1[2];
byte[] message= (byte[]) data1[0]; //byte[4]+long+long+byte[40]+byte[8] IPtgs+TS2+LT2+Ticket+KEY(c,tgs)
byte[] IPtgs= AddByte.subBytes(message,1,4);
byte[] Ticket=AddByte.subBytes(message,21,40);
byte[] key=AddByte.subBytes(message,61,8);
//IDc+IPc+TS3+Ticket+IDv long+byte[4]+long+byte[40]+int
InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
byte[] IP=DataTypeChange.stringToBytes(addr.getHostAddress());
byte[] message2= new byte[1];;
message2[0]= DataTypeChange.IntToUnsignedByte(3);
message2=AddByte.addBytes(message2,DataTypeChange.longToBytes(uid));
message2= AddByte.addBytes(message2,IP);
//byte[] message = new byte[21];
// message[0]= DataTypeChange.IntToUnsignedByte(1);
//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long TG3= System.currentTimeMillis();
message2=AddByte.addBytes(message2,DataTypeChange.longToBytes(TG3));
message2=AddByte.addBytes(message2,Ticket);
message2=AddByte.addBytes(message2,DataTypeChange.intToBytes(IDv));
try {
Socket socket=new Socket(DataTypeChange.bytesToString(IP),9699);
Communication.getInstance().getSocketObject(socket);
Communication.getInstance().getDesKey(key);
Communication.getInstance().send(message2);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 2,136 | 0.664794 | 0.640449 | 68 | 30.411764 | 26.571344 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.779412 | false | false | 15 |
1132d76284418510d182face07ce4721fc57351c | 20,916,490,733,439 | 840c385ff8911d8f8782933d662c3e17a0c99ce1 | /Loader/src/com/example/loader/display/BitmapDisplayer.java | 43e7f4b998382c7b6fc25e83dba39fe0d51bedbc | []
| no_license | qmc000/QpTest | https://github.com/qmc000/QpTest | dcec8fc4494cd55cf59b710244c0e748293e082f | be700e06a5932a5c488d20aff235043fa8e6cfda | refs/heads/master | 2018-01-10T21:10:45.874000 | 2015-12-03T02:48:18 | 2015-12-03T02:48:18 | 44,524,358 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.loader.display;
import android.graphics.Bitmap;
import android.widget.ImageView;
public interface BitmapDisplayer {
public Bitmap display(Bitmap bitmap, ImageView imageView);
} | UTF-8 | Java | 199 | java | BitmapDisplayer.java | Java | []
| null | []
| package com.example.loader.display;
import android.graphics.Bitmap;
import android.widget.ImageView;
public interface BitmapDisplayer {
public Bitmap display(Bitmap bitmap, ImageView imageView);
} | 199 | 0.824121 | 0.824121 | 8 | 24 | 20.124611 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 15 |
fceb13edb7bed48cc06c5a5896fee9736d7bfd75 | 24,670,292,161,476 | c7772dd35626b343dd2ed40518340aa80b9f618d | /src/main/java/uk/gov/justice/digital/delius/data/api/Court.java | 6e5a178fdcc5bb1edfc0757957daea8544932419 | [
"MIT"
]
| permissive | ollietreend/community-api | https://github.com/ollietreend/community-api | 666cab98571160f155bef04ce1703026854f8494 | 9431b03e93d7540bba2a3b1dfafc5983750d68f1 | refs/heads/main | 2023-04-17T06:03:18.650000 | 2021-04-22T08:32:58 | 2021-04-22T08:32:58 | 360,905,069 | 0 | 0 | MIT | true | 2021-04-23T14:07:45 | 2021-04-23T14:07:44 | 2021-04-22T08:33:01 | 2021-04-23T12:43:53 | 8,816 | 0 | 0 | 0 | null | false | false | package uk.gov.justice.digital.delius.data.api;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Court {
private Long courtId;
private String code;
private Boolean selectable;
private String courtName;
private String telephoneNumber;
private String fax;
private String buildingName;
private String street;
private String locality;
private String town;
private String county;
private String postcode;
private String country;
private Long courtTypeId;
private LocalDateTime createdDatetime;
private LocalDateTime lastUpdatedDatetime;
private Long probationAreaId;
private String secureEmailAddress;
}
| UTF-8 | Java | 834 | java | Court.java | Java | []
| null | []
| package uk.gov.justice.digital.delius.data.api;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Court {
private Long courtId;
private String code;
private Boolean selectable;
private String courtName;
private String telephoneNumber;
private String fax;
private String buildingName;
private String street;
private String locality;
private String town;
private String county;
private String postcode;
private String country;
private Long courtTypeId;
private LocalDateTime createdDatetime;
private LocalDateTime lastUpdatedDatetime;
private Long probationAreaId;
private String secureEmailAddress;
}
| 834 | 0.769784 | 0.769784 | 33 | 24.272728 | 12.456647 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 15 |
c92fc199b0cd21648016deb7b44457f1091930b3 | 111,669,156,462 | e680ae27d0eade2ca3f4f3c30f2bfae094030a61 | /src/Models/Edge.java | f8dada55bb7065fbfcdf2a58a6a272c1b2c95abf | []
| no_license | bambusa/IM_Challenge | https://github.com/bambusa/IM_Challenge | 096172f423b1ccd0b27e833acba8b8c947a5b95e | 7666478d0715c01a04cff7ccbc0fe572221eaded | refs/heads/master | 2021-01-10T20:07:57.486000 | 2015-11-11T18:53:49 | 2015-11-11T18:53:49 | 38,927,380 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Models;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by BSD on 10.07.2015.
*/
public class Edge {
private final String id; // Departure ID + Arrival ID
private final Vertex departure;
private final Vertex arrival;
private Map<Integer, ArrayList<Trip>> trips;
private Trip activeTrip = null;
public Edge (String id, Vertex departure, Vertex arrival) {
this.id = id;
this.departure = departure;
this.arrival = arrival;
trips = new HashMap<>();
}
public Edge (Edge lastEdge) {
id = lastEdge.getId();
departure = lastEdge.getDeparture();
arrival = lastEdge.getArrival();
trips = new HashMap<>(lastEdge.getTripMap());
activeTrip = lastEdge.getActiveTrip();
}
/**
* Trip Array should be [departure, arrival, length, line]
*/
public void addTrip(Trip trip) {
ArrayList<Trip> tripArray = null;
if (trips.containsKey(trip.getDeparture())) {
tripArray = trips.get(trip.getDeparture());
} else {
tripArray = new ArrayList<>();
}
tripArray.add(trip);
trips.put(trip.getDepartureTime(), tripArray);
}
public boolean containsTrips(int departure) {
return trips.containsKey(departure);
}
public ArrayList<Trip> getTrips(int departure) {
return trips.get(departure);
}
public Map<Integer, ArrayList<Trip>> getTripMap() {
return trips;
}
public String getId() {
return id;
}
public Vertex getDeparture() {
return departure;
}
public Vertex getArrival() {
return arrival;
}
private void log(String message) {
System.out.println("[Edge] " + message);
}
public Trip getActiveTrip() {
return activeTrip;
}
public void setActiveTrip(Trip activeTrip) {
this.activeTrip = activeTrip;
}
public String toString() {
return "[EDGE " + departure.getId() + " -> " + arrival.getId() + " | " + departure.getName() + " -> " + arrival.getName() + "]";
}
}
| UTF-8 | Java | 2,172 | java | Edge.java | Java | [
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by BSD on 10.07.2015.\n */\npublic class Edge {\n\n priva",
"end": 138,
"score": 0.9339583516120911,
"start": 135,
"tag": "USERNAME",
"value": "BSD"
}
]
| null | []
| package Models;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by BSD on 10.07.2015.
*/
public class Edge {
private final String id; // Departure ID + Arrival ID
private final Vertex departure;
private final Vertex arrival;
private Map<Integer, ArrayList<Trip>> trips;
private Trip activeTrip = null;
public Edge (String id, Vertex departure, Vertex arrival) {
this.id = id;
this.departure = departure;
this.arrival = arrival;
trips = new HashMap<>();
}
public Edge (Edge lastEdge) {
id = lastEdge.getId();
departure = lastEdge.getDeparture();
arrival = lastEdge.getArrival();
trips = new HashMap<>(lastEdge.getTripMap());
activeTrip = lastEdge.getActiveTrip();
}
/**
* Trip Array should be [departure, arrival, length, line]
*/
public void addTrip(Trip trip) {
ArrayList<Trip> tripArray = null;
if (trips.containsKey(trip.getDeparture())) {
tripArray = trips.get(trip.getDeparture());
} else {
tripArray = new ArrayList<>();
}
tripArray.add(trip);
trips.put(trip.getDepartureTime(), tripArray);
}
public boolean containsTrips(int departure) {
return trips.containsKey(departure);
}
public ArrayList<Trip> getTrips(int departure) {
return trips.get(departure);
}
public Map<Integer, ArrayList<Trip>> getTripMap() {
return trips;
}
public String getId() {
return id;
}
public Vertex getDeparture() {
return departure;
}
public Vertex getArrival() {
return arrival;
}
private void log(String message) {
System.out.println("[Edge] " + message);
}
public Trip getActiveTrip() {
return activeTrip;
}
public void setActiveTrip(Trip activeTrip) {
this.activeTrip = activeTrip;
}
public String toString() {
return "[EDGE " + departure.getId() + " -> " + arrival.getId() + " | " + departure.getName() + " -> " + arrival.getName() + "]";
}
}
| 2,172 | 0.600368 | 0.596685 | 83 | 25.168674 | 22.482025 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.518072 | false | false | 15 |
cbfc3126ed3d970dd6f7910607ac2a91eabb5247 | 10,995,116,290,668 | 0f8d6310db4e42219e1eda21162280cc97c39e8c | /src/test/java/weather/BaseWeatherSystem.java | 718bc2c89f61cdaeb7b82f168ad15bb0a813f3d4 | []
| no_license | ChaitaliN/openweathermap-api-automation | https://github.com/ChaitaliN/openweathermap-api-automation | 32ed69794349170029037807f14deb87160b55ca | 0e6c46a22070edd9b20742e26f2db5e1fbce8006 | refs/heads/master | 2022-12-26T00:17:34.664000 | 2020-05-10T10:51:54 | 2020-05-10T10:51:54 | 262,762,859 | 0 | 1 | null | false | 2020-10-13T21:52:47 | 2020-05-10T10:32:04 | 2020-05-10T10:52:20 | 2020-10-13T21:52:46 | 6 | 0 | 0 | 1 | Java | false | false | package weather;
import io.restassured.RestAssured;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Properties;
public class BaseWeatherSystem {
final private String propFileName = "test.config.properties";
private Properties prop;
public BaseWeatherSystem() {
try {
// Load properties
this.loadProperties();
} catch (Exception e) {
e.printStackTrace();
}
RestAssured.baseURI = prop.getProperty("api");
}
private void loadProperties() throws Exception {
prop = new Properties();
InputStream inputStream;
try {
inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
if (inputStream != null) {
this.prop.load(inputStream);
inputStream.close();
} else {
throw new FileNotFoundException("Property file '" + propFileName + "' not found in the classpath");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,109 | java | BaseWeatherSystem.java | Java | []
| null | []
| package weather;
import io.restassured.RestAssured;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Properties;
public class BaseWeatherSystem {
final private String propFileName = "test.config.properties";
private Properties prop;
public BaseWeatherSystem() {
try {
// Load properties
this.loadProperties();
} catch (Exception e) {
e.printStackTrace();
}
RestAssured.baseURI = prop.getProperty("api");
}
private void loadProperties() throws Exception {
prop = new Properties();
InputStream inputStream;
try {
inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
if (inputStream != null) {
this.prop.load(inputStream);
inputStream.close();
} else {
throw new FileNotFoundException("Property file '" + propFileName + "' not found in the classpath");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| 1,109 | 0.595131 | 0.595131 | 41 | 26.04878 | 24.189245 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.414634 | false | false | 15 |
f913a550325feea75a1e59d0eab930b597f3eb9f | 12,859,132,097,964 | 2ae405b317600adfe29525af6b1399dda7b21791 | /MARS_ROVERS/src/main/java/mars/rovers/model/DirectionModel.java | 0289148d2f129aca2a31b16b25e707589a3be6c7 | []
| no_license | Xiang-Ji615/MarsRovers | https://github.com/Xiang-Ji615/MarsRovers | 9c815326483d31fed26b3c0d253e5178f58425a1 | ff185158ce74f4e60907f660c677ecdd0964f9b4 | refs/heads/master | 2020-04-03T01:30:25.308000 | 2018-10-27T06:47:05 | 2018-10-27T06:47:05 | 154,932,786 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.java.mars.rovers.model;
public class DirectionModel {
char val;
DirectionModel prev;
DirectionModel next;
public DirectionModel(char val) {
super();
this.val = val;
}
public char getVal() {
return val;
}
public void setVal(char val) {
this.val = val;
}
public DirectionModel getPrev() {
return prev;
}
public void setPrev(DirectionModel prev) {
this.prev = prev;
}
public DirectionModel getNext() {
return next;
}
public void setNext(DirectionModel next) {
this.next = next;
}
}
| UTF-8 | Java | 573 | java | DirectionModel.java | Java | []
| null | []
| package main.java.mars.rovers.model;
public class DirectionModel {
char val;
DirectionModel prev;
DirectionModel next;
public DirectionModel(char val) {
super();
this.val = val;
}
public char getVal() {
return val;
}
public void setVal(char val) {
this.val = val;
}
public DirectionModel getPrev() {
return prev;
}
public void setPrev(DirectionModel prev) {
this.prev = prev;
}
public DirectionModel getNext() {
return next;
}
public void setNext(DirectionModel next) {
this.next = next;
}
}
| 573 | 0.638743 | 0.638743 | 38 | 13.078947 | 13.826713 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.184211 | false | false | 15 |
7196f83b2a13741450571f8e4e9778e4ca264bb2 | 15,633,680,972,723 | b32c05b77aa51c6ae612d440583b90164c0daf2f | /2021.09.06~2021.09.12/2133_ROH.java | 0fb4f39a6ff43b837e48acc49156256e2d709873 | []
| no_license | pinggooo/algorithms-study | https://github.com/pinggooo/algorithms-study | 38ab09a128ff146017847840b2d8a15a19ddfdc0 | bcb63693f8f152f2e466d7214de4de56799f997d | refs/heads/main | 2023-07-27T17:49:38.705000 | 2021-09-13T13:57:39 | 2021-09-13T13:57:39 | 394,300,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.util.StringTokenizer;
public class 2133_ROH {
static int ans = 0;
static int[] dp = new int[31];
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int N = Integer.parseInt(br.readLine());
dp[0] = 1;
dp[2] = 3;
for(int i = 4; i<=N; i++) {
if(N%2 == 1) dp[N] = 0;
else {
dp[i] = dp[i-2]*3;
for(int j = 4; j<=i; j+=2) {
dp[i] += dp[i-j]*2;
}
}
}
System.out.println(dp[N]);
}
}
| UTF-8 | Java | 722 | java | 2133_ROH.java | Java | []
| null | []
| import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.util.StringTokenizer;
public class 2133_ROH {
static int ans = 0;
static int[] dp = new int[31];
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int N = Integer.parseInt(br.readLine());
dp[0] = 1;
dp[2] = 3;
for(int i = 4; i<=N; i++) {
if(N%2 == 1) dp[N] = 0;
else {
dp[i] = dp[i-2]*3;
for(int j = 4; j<=i; j+=2) {
dp[i] += dp[i-j]*2;
}
}
}
System.out.println(dp[N]);
}
}
| 722 | 0.581717 | 0.554017 | 28 | 23.785715 | 20.077274 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.428571 | false | false | 15 |
7948ef054564ae322fae80fac8bf5e29c722f7b5 | 26,302,379,733,712 | 6dd13be155b79995065bcf194c00915a2144c0aa | /app/src/main/java/com/bian/dan/blr/activity/main/sales/AddContractActivity.java | c0babc7f55433ffebc8eecd8d3db96e45c17310e | []
| no_license | qijiuyu/BoLaiRong | https://github.com/qijiuyu/BoLaiRong | cabcfa2feec1bdb6e4fa6aad4163275f781a52c3 | 2a2041b42167ae84fb51444047c6216ea63c8e72 | refs/heads/master | 2023-04-08T18:36:18.820000 | 2020-07-13T06:36:21 | 2020-07-13T06:36:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bian.dan.blr.activity.main.sales;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.TextView;
import com.bian.dan.blr.R;
import com.bian.dan.blr.adapter.sales.GridViewImgAdapter;
import com.bian.dan.blr.persenter.sales.AddContractPersenter;
import com.bian.dan.blr.utils.SelectPhoto;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.entity.LocalMedia;
import com.zxdc.utils.library.base.BaseActivity;
import com.zxdc.utils.library.bean.ConstractDetails;
import com.zxdc.utils.library.bean.Customer;
import com.zxdc.utils.library.bean.FileBean;
import com.zxdc.utils.library.bean.parameter.AddContractP;
import com.zxdc.utils.library.bean.parameter.FileList;
import com.zxdc.utils.library.util.ToastUtil;
import com.zxdc.utils.library.view.MyGridView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* 新增合同
*/
public class AddContractActivity extends BaseActivity {
@BindView(R.id.tv_head)
TextView tvHead;
@BindView(R.id.et_code)
EditText etCode;
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.tv_sign_time)
TextView tvSignTime;
@BindView(R.id.et_money)
EditText etMoney;
@BindView(R.id.tv_pay_type)
TextView tvPayType;
@BindView(R.id.tv_invoice)
TextView tvInvoice;
@BindView(R.id.tv_company)
TextView tvCompany;
@BindView(R.id.tv_office)
TextView tvOffice;
@BindView(R.id.gridView)
MyGridView gridView;
private AddContractPersenter addContractPersenter;
//选择的照片
private List<FileBean> imgList=new ArrayList<>();
private GridViewImgAdapter gridViewImgAdapter;
//合同详情对象
private ConstractDetails constractDetails;
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contract);
ButterKnife.bind(this);
initView();
//编辑前显示对应的数据
showData();
}
/**
* 初始化
*/
private void initView(){
addContractPersenter=new AddContractPersenter(this);
tvHead.setText("新增合同");
constractDetails= (ConstractDetails) getIntent().getSerializableExtra("constractDetails");
gridViewImgAdapter=new GridViewImgAdapter(this,imgList);
gridView.setAdapter(gridViewImgAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(position==imgList.size()){
addContractPersenter.SelectPhoto();
}
}
});
}
/**
* 按钮点击事件
* @param view
*/
@OnClick({R.id.lin_back,R.id.tv_name,R.id.tv_sign_time,R.id.tv_pay_type,R.id.tv_invoice,R.id.tv_company,R.id.tv_office,R.id.tv_submit})
public void onViewClicked(View view) {
Intent intent=new Intent();
switch (view.getId()) {
case R.id.lin_back:
finish();
break;
//选择客户名称
case R.id.tv_name:
intent.setClass(this,SelectCustomerActivity.class);
startActivityForResult(intent,100);
break;
//签订时间
case R.id.tv_sign_time:
addContractPersenter.selectTime(tvSignTime);
break;
//支付方式
case R.id.tv_pay_type:
addContractPersenter.selectText(tvPayType,1);
break;
//是否开票
case R.id.tv_invoice:
addContractPersenter.selectText(tvInvoice,2);
break;
//售卖公司
case R.id.tv_company:
addContractPersenter.selectText(tvCompany,3);
break;
//指派内勤
case R.id.tv_office:
addContractPersenter.selectOffice(tvOffice);
break;
//提交
case R.id.tv_submit:
String code=etCode.getText().toString().trim();
String name=tvName.getText().toString().trim();
String signTime=tvSignTime.getText().toString().trim();
String money=etMoney.getText().toString().trim();
String payType=tvPayType.getText().toString().trim();
String invoice=tvInvoice.getText().toString().trim();
String company=tvCompany.getText().toString().trim();
String office=tvOffice.getText().toString().trim();
if(TextUtils.isEmpty(code)){
ToastUtil.showLong("请输入合同编号");
return;
}
if(TextUtils.isEmpty(name)){
ToastUtil.showLong("请选择客户名称");
return;
}
if(TextUtils.isEmpty(signTime)){
ToastUtil.showLong("请选择签订时间");
return;
}
if(TextUtils.isEmpty(money)){
ToastUtil.showLong("请输入订单金额");
return;
}
if(TextUtils.isEmpty(payType)){
ToastUtil.showLong("请选择支付方式");
return;
}
if(TextUtils.isEmpty(invoice)){
ToastUtil.showLong("请选择是否开票");
return;
}
if(TextUtils.isEmpty(company)){
ToastUtil.showLong("请选择售卖公司");
return;
}
AddContractP addContractP=new AddContractP();
addContractP.setProp2(code);
addContractP.setCustomerId((int)tvName.getTag());
addContractP.setSignedTime(signTime);
addContractP.setAmount(Double.parseDouble(money));
if(!TextUtils.isEmpty(office)){
addContractP.setAssignerId((int)tvOffice.getTag());
}
if(payType.equals("全款")){
addContractP.setPayType(1);
}else{
addContractP.setPayType(2);
}
if(invoice.equals("是")){
addContractP.setInvoice(1);
}else{
addContractP.setInvoice(0);
}
if(company.equals("博徕荣")){
addContractP.setSellers(1);
}else{
addContractP.setSellers(2);
}
//解析要提交的图片链接
if(constractDetails==null) {
List<FileList> list=new ArrayList<>();
for (int i = 0; i < imgList.size(); i++) {
FileList fileList=new FileList();
fileList.setUrl(imgList.get(i).getUrl());
list.add(fileList);
}
addContractP.setFileList(list);
}
if(constractDetails==null){
//校验合同编码唯一性
addContractPersenter.checkCode(addContractP);
}else{
addContractP.setId(constractDetails.getContract().getId());
addContractPersenter.editContract(addContractP);
}
break;
default:
break;
}
}
/**
* 编辑前显示对应的数据
*/
private void showData(){
if(constractDetails==null){
return;
}
tvHead.setText("编辑合同");
ConstractDetails.DetailsBean detailsBean=constractDetails.getContract();
if(detailsBean==null){
return;
}
//禁止修改合同编码
etCode.setEnabled(false);
etCode.setTextColor(getResources().getColor(R.color.color_999999));
etCode.setText(detailsBean.getProp2());
tvName.setText(detailsBean.getCustomerName());
tvName.setTag(detailsBean.getCustomerId());
tvSignTime.setText(detailsBean.getSignedTime());
etMoney.setText(String.valueOf(detailsBean.getAmount()));
if(detailsBean.getPayType()==1){
tvPayType.setText("全款");
}else{
tvPayType.setText("分期");
}
if(detailsBean.getInvoice()==0){
tvInvoice.setText("否");
}else{
tvInvoice.setText("是");
}
if(detailsBean.getSellers()==1){
tvCompany.setText("博徕荣");
}else{
tvCompany.setText("立钻");
}
tvOffice.setText(detailsBean.getAssignerName());
tvOffice.setTag(detailsBean.getAssignerId());
/**
* 显示图片
*/
imgList.addAll(detailsBean.getFileList());
gridViewImgAdapter=new GridViewImgAdapter(this,imgList);
gridView.setAdapter(gridViewImgAdapter);
}
/**
* 编辑的时候删除图片
*/
public void deleteImg(FileBean fileBean){
addContractPersenter.deleteFile(String.valueOf(fileBean.getId()));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
//返回拍照图片
case SelectPhoto.CODE_CAMERA_REQUEST:
if (resultCode == RESULT_OK) {
File tempFile = new File(SelectPhoto.pai);
if (tempFile.isFile()) {
List<LocalMedia> list=new ArrayList<>();
LocalMedia localMedia=new LocalMedia();
localMedia.setCompressPath(SelectPhoto.pai);
list.add(localMedia);
if(constractDetails==null){
//增加合同-上传图片
addContractPersenter.uploadFile(list);
}else{
//编辑合同-上传图片
addContractPersenter.uploadByFileAndTypeAndFid(constractDetails.getContract().getId(),list);
}
}
}
break;
//返回相册选择图片
case PictureConfig.CHOOSE_REQUEST:
List<LocalMedia> list= PictureSelector.obtainMultipleResult(data);
if(list.size()==0){
return;
}
if(constractDetails==null){
//增加合同-上传图片
addContractPersenter.uploadFile(list);
}else{
//编辑合同-上传图片
addContractPersenter.uploadByFileAndTypeAndFid(constractDetails.getContract().getId(),list);
}
break;
//回执客户信息
case 100:
if(data==null){
return;
}
Customer customer = (Customer) data.getSerializableExtra("customer");
tvName.setText(customer.getCustomerName());
tvName.setTag(customer.getId());
break;
default:
break;
}
}
/**
* 图片上传成功
* @param path
*/
public void uploadSuccess(final String path, final int pid){
runOnUiThread(new Runnable() {
public void run() {
FileBean fileBean;
fileBean = new FileBean(pid,path);
imgList.add(fileBean);
gridViewImgAdapter=new GridViewImgAdapter(activity,imgList);
gridView.setAdapter(gridViewImgAdapter);
}
});
}
}
| UTF-8 | Java | 12,428 | java | AddContractActivity.java | Java | []
| null | []
| package com.bian.dan.blr.activity.main.sales;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.TextView;
import com.bian.dan.blr.R;
import com.bian.dan.blr.adapter.sales.GridViewImgAdapter;
import com.bian.dan.blr.persenter.sales.AddContractPersenter;
import com.bian.dan.blr.utils.SelectPhoto;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.entity.LocalMedia;
import com.zxdc.utils.library.base.BaseActivity;
import com.zxdc.utils.library.bean.ConstractDetails;
import com.zxdc.utils.library.bean.Customer;
import com.zxdc.utils.library.bean.FileBean;
import com.zxdc.utils.library.bean.parameter.AddContractP;
import com.zxdc.utils.library.bean.parameter.FileList;
import com.zxdc.utils.library.util.ToastUtil;
import com.zxdc.utils.library.view.MyGridView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* 新增合同
*/
public class AddContractActivity extends BaseActivity {
@BindView(R.id.tv_head)
TextView tvHead;
@BindView(R.id.et_code)
EditText etCode;
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.tv_sign_time)
TextView tvSignTime;
@BindView(R.id.et_money)
EditText etMoney;
@BindView(R.id.tv_pay_type)
TextView tvPayType;
@BindView(R.id.tv_invoice)
TextView tvInvoice;
@BindView(R.id.tv_company)
TextView tvCompany;
@BindView(R.id.tv_office)
TextView tvOffice;
@BindView(R.id.gridView)
MyGridView gridView;
private AddContractPersenter addContractPersenter;
//选择的照片
private List<FileBean> imgList=new ArrayList<>();
private GridViewImgAdapter gridViewImgAdapter;
//合同详情对象
private ConstractDetails constractDetails;
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contract);
ButterKnife.bind(this);
initView();
//编辑前显示对应的数据
showData();
}
/**
* 初始化
*/
private void initView(){
addContractPersenter=new AddContractPersenter(this);
tvHead.setText("新增合同");
constractDetails= (ConstractDetails) getIntent().getSerializableExtra("constractDetails");
gridViewImgAdapter=new GridViewImgAdapter(this,imgList);
gridView.setAdapter(gridViewImgAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(position==imgList.size()){
addContractPersenter.SelectPhoto();
}
}
});
}
/**
* 按钮点击事件
* @param view
*/
@OnClick({R.id.lin_back,R.id.tv_name,R.id.tv_sign_time,R.id.tv_pay_type,R.id.tv_invoice,R.id.tv_company,R.id.tv_office,R.id.tv_submit})
public void onViewClicked(View view) {
Intent intent=new Intent();
switch (view.getId()) {
case R.id.lin_back:
finish();
break;
//选择客户名称
case R.id.tv_name:
intent.setClass(this,SelectCustomerActivity.class);
startActivityForResult(intent,100);
break;
//签订时间
case R.id.tv_sign_time:
addContractPersenter.selectTime(tvSignTime);
break;
//支付方式
case R.id.tv_pay_type:
addContractPersenter.selectText(tvPayType,1);
break;
//是否开票
case R.id.tv_invoice:
addContractPersenter.selectText(tvInvoice,2);
break;
//售卖公司
case R.id.tv_company:
addContractPersenter.selectText(tvCompany,3);
break;
//指派内勤
case R.id.tv_office:
addContractPersenter.selectOffice(tvOffice);
break;
//提交
case R.id.tv_submit:
String code=etCode.getText().toString().trim();
String name=tvName.getText().toString().trim();
String signTime=tvSignTime.getText().toString().trim();
String money=etMoney.getText().toString().trim();
String payType=tvPayType.getText().toString().trim();
String invoice=tvInvoice.getText().toString().trim();
String company=tvCompany.getText().toString().trim();
String office=tvOffice.getText().toString().trim();
if(TextUtils.isEmpty(code)){
ToastUtil.showLong("请输入合同编号");
return;
}
if(TextUtils.isEmpty(name)){
ToastUtil.showLong("请选择客户名称");
return;
}
if(TextUtils.isEmpty(signTime)){
ToastUtil.showLong("请选择签订时间");
return;
}
if(TextUtils.isEmpty(money)){
ToastUtil.showLong("请输入订单金额");
return;
}
if(TextUtils.isEmpty(payType)){
ToastUtil.showLong("请选择支付方式");
return;
}
if(TextUtils.isEmpty(invoice)){
ToastUtil.showLong("请选择是否开票");
return;
}
if(TextUtils.isEmpty(company)){
ToastUtil.showLong("请选择售卖公司");
return;
}
AddContractP addContractP=new AddContractP();
addContractP.setProp2(code);
addContractP.setCustomerId((int)tvName.getTag());
addContractP.setSignedTime(signTime);
addContractP.setAmount(Double.parseDouble(money));
if(!TextUtils.isEmpty(office)){
addContractP.setAssignerId((int)tvOffice.getTag());
}
if(payType.equals("全款")){
addContractP.setPayType(1);
}else{
addContractP.setPayType(2);
}
if(invoice.equals("是")){
addContractP.setInvoice(1);
}else{
addContractP.setInvoice(0);
}
if(company.equals("博徕荣")){
addContractP.setSellers(1);
}else{
addContractP.setSellers(2);
}
//解析要提交的图片链接
if(constractDetails==null) {
List<FileList> list=new ArrayList<>();
for (int i = 0; i < imgList.size(); i++) {
FileList fileList=new FileList();
fileList.setUrl(imgList.get(i).getUrl());
list.add(fileList);
}
addContractP.setFileList(list);
}
if(constractDetails==null){
//校验合同编码唯一性
addContractPersenter.checkCode(addContractP);
}else{
addContractP.setId(constractDetails.getContract().getId());
addContractPersenter.editContract(addContractP);
}
break;
default:
break;
}
}
/**
* 编辑前显示对应的数据
*/
private void showData(){
if(constractDetails==null){
return;
}
tvHead.setText("编辑合同");
ConstractDetails.DetailsBean detailsBean=constractDetails.getContract();
if(detailsBean==null){
return;
}
//禁止修改合同编码
etCode.setEnabled(false);
etCode.setTextColor(getResources().getColor(R.color.color_999999));
etCode.setText(detailsBean.getProp2());
tvName.setText(detailsBean.getCustomerName());
tvName.setTag(detailsBean.getCustomerId());
tvSignTime.setText(detailsBean.getSignedTime());
etMoney.setText(String.valueOf(detailsBean.getAmount()));
if(detailsBean.getPayType()==1){
tvPayType.setText("全款");
}else{
tvPayType.setText("分期");
}
if(detailsBean.getInvoice()==0){
tvInvoice.setText("否");
}else{
tvInvoice.setText("是");
}
if(detailsBean.getSellers()==1){
tvCompany.setText("博徕荣");
}else{
tvCompany.setText("立钻");
}
tvOffice.setText(detailsBean.getAssignerName());
tvOffice.setTag(detailsBean.getAssignerId());
/**
* 显示图片
*/
imgList.addAll(detailsBean.getFileList());
gridViewImgAdapter=new GridViewImgAdapter(this,imgList);
gridView.setAdapter(gridViewImgAdapter);
}
/**
* 编辑的时候删除图片
*/
public void deleteImg(FileBean fileBean){
addContractPersenter.deleteFile(String.valueOf(fileBean.getId()));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
//返回拍照图片
case SelectPhoto.CODE_CAMERA_REQUEST:
if (resultCode == RESULT_OK) {
File tempFile = new File(SelectPhoto.pai);
if (tempFile.isFile()) {
List<LocalMedia> list=new ArrayList<>();
LocalMedia localMedia=new LocalMedia();
localMedia.setCompressPath(SelectPhoto.pai);
list.add(localMedia);
if(constractDetails==null){
//增加合同-上传图片
addContractPersenter.uploadFile(list);
}else{
//编辑合同-上传图片
addContractPersenter.uploadByFileAndTypeAndFid(constractDetails.getContract().getId(),list);
}
}
}
break;
//返回相册选择图片
case PictureConfig.CHOOSE_REQUEST:
List<LocalMedia> list= PictureSelector.obtainMultipleResult(data);
if(list.size()==0){
return;
}
if(constractDetails==null){
//增加合同-上传图片
addContractPersenter.uploadFile(list);
}else{
//编辑合同-上传图片
addContractPersenter.uploadByFileAndTypeAndFid(constractDetails.getContract().getId(),list);
}
break;
//回执客户信息
case 100:
if(data==null){
return;
}
Customer customer = (Customer) data.getSerializableExtra("customer");
tvName.setText(customer.getCustomerName());
tvName.setTag(customer.getId());
break;
default:
break;
}
}
/**
* 图片上传成功
* @param path
*/
public void uploadSuccess(final String path, final int pid){
runOnUiThread(new Runnable() {
public void run() {
FileBean fileBean;
fileBean = new FileBean(pid,path);
imgList.add(fileBean);
gridViewImgAdapter=new GridViewImgAdapter(activity,imgList);
gridView.setAdapter(gridViewImgAdapter);
}
});
}
}
| 12,428 | 0.541792 | 0.539447 | 338 | 34.325443 | 22.467083 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571006 | false | false | 15 |
7855444f75845a5dca82850a1c51d2bde0c26a90 | 17,360,257,848,699 | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/CodeJamData/17/32/7.java | 606a9a5d9289a277b71483f6051a8ffe83c61aa9 | []
| no_license | Kawser-nerd/CLCDSA | https://github.com/Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588000 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | null | null | null | null | null | null | null | null | null | import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
@SuppressWarnings("unused")
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
private void run() throws IOException {
if (new File("input.txt").exists())
in = new BufferedReader(new FileReader("input.txt"));
else
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter("output.txt");
// out = new PrintWriter(System.out);
solve();
in.close();
out.close();
}
final int N = 1440;
final int M = N / 2;
final int INF = Integer.MAX_VALUE / 2;
private void solve() throws IOException {
int T = nextInt();
for (int t = 0; t < T; t++) {
int n = nextInt();
int m = nextInt();
boolean a[] = new boolean[N];
boolean b[] = new boolean[N];
for (int i = 0; i < n; i++) {
int l = nextInt();
int r = nextInt();
for (int j = l; j < r; j++)
a[j] = true;
}
for (int i = 0; i < m; i++) {
int l = nextInt();
int r = nextInt();
for (int j = l; j < r; j++)
b[j] = true;
}
int d[][][] = new int[4][N + 1][M + 1];
for (int i = 1; i <= M; i++) {
for (int j = 0; j < 4; j++)
d[j][0][i] = INF;
d[1][0][0] = d[2][0][0] = INF;
}
for (int i = 1; i <= N; i++) {
for (int k = 0; k <= M; k++) {
for (int j = 0; j < 4; j++) {
d[j][i][k] = INF;
}
if (k > 0 && !a[i - 1]) {
d[0][i][k] = min(d[0][i][k], d[0][i - 1][k - 1]);
d[1][i][k] = min(d[1][i][k], d[0][i - 1][k - 1] + 1);
d[2][i][k] = min(d[2][i][k], d[2][i - 1][k - 1]);
d[3][i][k] = min(d[3][i][k], d[2][i - 1][k - 1] + 1);
}
if (!b[i - 1]) {
d[1][i][k] = min(d[1][i][k], d[1][i - 1][k]);
d[0][i][k] = min(d[0][i][k], d[1][i - 1][k] + 1);
d[3][i][k] = min(d[3][i][k], d[3][i - 1][k]);
d[2][i][k] = min(d[2][i][k], d[3][i - 1][k] + 1);
}
}
}
int ans = min(d[0][N][M], d[3][N][M]);
// double ans = 0;
// ans += PI * a[0].r * a[0].r;
// for (int i = 0; i < k; i++) {
// ans += a[i].r * 2. * PI * a[i].h;
// }
out.printf(Locale.US, "Case #%d: %d\n", t + 1, ans);
}
}
class P implements Comparable<P> {
int r;
int h;
P(int r, int h) {
this.r = r;
this.h = h;
}
@Override
public int compareTo(P o) {
if (this.r != o.r)
return o.r - this.r;
return this.r - o.r;
}
}
void chk(boolean b) {
if (b)
return;
System.out.println(new Error().getStackTrace()[1]);
exit(999);
}
void deb(String fmt, Object... args) {
System.out.printf(Locale.US, fmt + "%n", args);
}
String nextToken() throws IOException {
while (!st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
String nextLine() throws IOException {
st = new StringTokenizer("");
return in.readLine();
}
boolean EOF() throws IOException {
while (!st.hasMoreTokens()) {
String s = in.readLine();
if (s == null)
return true;
st = new StringTokenizer(s);
}
return false;
}
}
| UTF-8 | Java | 3,810 | java | 7.java | Java | []
| null | []
| import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
@SuppressWarnings("unused")
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
private void run() throws IOException {
if (new File("input.txt").exists())
in = new BufferedReader(new FileReader("input.txt"));
else
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter("output.txt");
// out = new PrintWriter(System.out);
solve();
in.close();
out.close();
}
final int N = 1440;
final int M = N / 2;
final int INF = Integer.MAX_VALUE / 2;
private void solve() throws IOException {
int T = nextInt();
for (int t = 0; t < T; t++) {
int n = nextInt();
int m = nextInt();
boolean a[] = new boolean[N];
boolean b[] = new boolean[N];
for (int i = 0; i < n; i++) {
int l = nextInt();
int r = nextInt();
for (int j = l; j < r; j++)
a[j] = true;
}
for (int i = 0; i < m; i++) {
int l = nextInt();
int r = nextInt();
for (int j = l; j < r; j++)
b[j] = true;
}
int d[][][] = new int[4][N + 1][M + 1];
for (int i = 1; i <= M; i++) {
for (int j = 0; j < 4; j++)
d[j][0][i] = INF;
d[1][0][0] = d[2][0][0] = INF;
}
for (int i = 1; i <= N; i++) {
for (int k = 0; k <= M; k++) {
for (int j = 0; j < 4; j++) {
d[j][i][k] = INF;
}
if (k > 0 && !a[i - 1]) {
d[0][i][k] = min(d[0][i][k], d[0][i - 1][k - 1]);
d[1][i][k] = min(d[1][i][k], d[0][i - 1][k - 1] + 1);
d[2][i][k] = min(d[2][i][k], d[2][i - 1][k - 1]);
d[3][i][k] = min(d[3][i][k], d[2][i - 1][k - 1] + 1);
}
if (!b[i - 1]) {
d[1][i][k] = min(d[1][i][k], d[1][i - 1][k]);
d[0][i][k] = min(d[0][i][k], d[1][i - 1][k] + 1);
d[3][i][k] = min(d[3][i][k], d[3][i - 1][k]);
d[2][i][k] = min(d[2][i][k], d[3][i - 1][k] + 1);
}
}
}
int ans = min(d[0][N][M], d[3][N][M]);
// double ans = 0;
// ans += PI * a[0].r * a[0].r;
// for (int i = 0; i < k; i++) {
// ans += a[i].r * 2. * PI * a[i].h;
// }
out.printf(Locale.US, "Case #%d: %d\n", t + 1, ans);
}
}
class P implements Comparable<P> {
int r;
int h;
P(int r, int h) {
this.r = r;
this.h = h;
}
@Override
public int compareTo(P o) {
if (this.r != o.r)
return o.r - this.r;
return this.r - o.r;
}
}
void chk(boolean b) {
if (b)
return;
System.out.println(new Error().getStackTrace()[1]);
exit(999);
}
void deb(String fmt, Object... args) {
System.out.printf(Locale.US, fmt + "%n", args);
}
String nextToken() throws IOException {
while (!st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
String nextLine() throws IOException {
st = new StringTokenizer("");
return in.readLine();
}
boolean EOF() throws IOException {
while (!st.hasMoreTokens()) {
String s = in.readLine();
if (s == null)
return true;
st = new StringTokenizer(s);
}
return false;
}
}
| 3,810 | 0.507612 | 0.486352 | 153 | 22.90196 | 17.17947 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.143791 | false | false | 15 |
d5f3d8fdf5470cf20a024a33ca1fd477ab4504d9 | 17,884,243,852,286 | 08bdd164c174d24e69be25bf952322b84573f216 | /opencores/client/foundation classes/j2sdk-sec-1_4_2-src-scsl/jgss1.4.2-src/src/share/classes/sun/security/krb5/internal/Ticket.java | 22f56d863032f4b35fa4504d8a84c94efbd81d60 | []
| no_license | hagyhang/myforthprocessor | https://github.com/hagyhang/myforthprocessor | 1861dcabcf2aeccf0ab49791f510863d97d89a77 | 210083fe71c39fa5d92f1f1acb62392a7f77aa9e | refs/heads/master | 2021-05-28T01:42:50.538000 | 2014-07-17T14:14:33 | 2014-07-17T14:14:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* @(#)Ticket.java 1.8 03/06/24
*
* Portions Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
* ===========================================================================
* IBM Confidential
* OCO Source Materials
* Licensed Materials - Property of IBM
*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright Office.
*
* Copyright 1997 The Open Group Research Institute. All rights reserved.
* ===========================================================================
*
*/
package sun.security.krb5.internal;
import sun.security.krb5.PrincipalName;
import sun.security.krb5.EncryptedData;
import sun.security.krb5.Asn1Exception;
import sun.security.krb5.Realm;
import sun.security.krb5.RealmException;
import sun.security.util.*;
import java.io.IOException;
import java.math.BigInteger;
/**
* Implements the ASN.1 Ticket type.
*
* <xmp>
* Ticket ::= [APPLICATION 1] SEQUENCE {
* tkt-vno[0] INTEGER,
* realm[1] Realm,
* sname[2] PrincipalName,
* enc-part[3] EncryptedData
* }
* </xmp>
*
* <p>
* This definition reflects the Network Working Group RFC 1510
* specifications dated September 1993 and available at
* <a href="http://www.ietf.org/rfc/rfc1510.txt">http://www.ietf.org/rfc/rfc1510.txt</a>.
*/
public class Ticket implements Cloneable {
public int tkt_vno;
public Realm realm;
public PrincipalName sname;
public EncryptedData encPart;
private Ticket() {
}
public Object clone() {
Ticket new_ticket = new Ticket();
new_ticket.realm = (Realm)realm.clone();
new_ticket.sname = (PrincipalName)sname.clone();
new_ticket.encPart = (EncryptedData)encPart.clone();
new_ticket.tkt_vno = tkt_vno;
return new_ticket;
}
public Ticket(
Realm new_realm,
PrincipalName new_sname,
EncryptedData new_encPart
) {
tkt_vno = Krb5.TICKET_VNO;
realm = new_realm;
sname = new_sname;
encPart = new_encPart;
}
public Ticket(byte[] data) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
init(new DerValue(data));
}
public Ticket(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
init(encoding);
}
/**
* Initializes a Ticket object.
* @param encoding a single DER-encoded value.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
* @exception KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
* @exception RealmException if an error occurs while parsing a Realm object.
*/
private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
DerValue der;
DerValue subDer;
if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
|| (encoding.isApplication() != true)
|| (encoding.isConstructed() != true))
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
der = encoding.getData().getDerValue();
if (der.getTag() != DerValue.tag_Sequence)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
subDer = der.getData().getDerValue();
if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
tkt_vno = subDer.getData().getBigInteger().intValue();
if (tkt_vno != Krb5.TICKET_VNO)
throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
realm = Realm.parse(der.getData(), (byte)0x01, false);
sname = PrincipalName.parse(der.getData(), (byte)0x02, false);
encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
if (der.getData().available() > 0)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
/**
* Encodes a Ticket object.
* @return byte array of encoded ticket object.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
*/
public byte[] asn1Encode() throws Asn1Exception, IOException {
DerOutputStream bytes = new DerOutputStream();
DerOutputStream temp = new DerOutputStream();
DerValue der[] = new DerValue[4];
temp.putInteger(BigInteger.valueOf(tkt_vno));
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), realm.asn1Encode());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), sname.asn1Encode());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), encPart.asn1Encode());
temp = new DerOutputStream();
temp.write(DerValue.tag_Sequence, bytes);
DerOutputStream ticket = new DerOutputStream();
ticket.write(DerValue.createTag(DerValue.TAG_APPLICATION, true, (byte)0x01), temp);
return ticket.toByteArray();
}
/**
* Parse (unmarshal) a Ticket from a DER input stream. This form
* parsing might be used when expanding a value which is part of
* a constructed sequence and uses explicitly tagged type.
*
* @exception Asn1Exception on error.
* @param data the Der input stream value, which contains one or more marshaled value.
* @param explicitTag tag number.
* @param optional indicate if this data field is optional
* @return an instance of Ticket.
*/
public static Ticket parse(DerInputStream data, byte explicitTag, boolean optional) throws Asn1Exception, IOException, RealmException, KrbApErrException {
if ((optional) && (((byte)data.peekByte() & (byte)0x1F)!= explicitTag))
return null;
DerValue der = data.getDerValue();
if (explicitTag != (der.getTag() & (byte)0x1F)) {
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
else {
DerValue subDer = der.getData().getDerValue();
return new Ticket(subDer);
}
}
}
| UTF-8 | Java | 6,240 | java | Ticket.java | Java | []
| null | []
| /*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* @(#)Ticket.java 1.8 03/06/24
*
* Portions Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
* ===========================================================================
* IBM Confidential
* OCO Source Materials
* Licensed Materials - Property of IBM
*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright Office.
*
* Copyright 1997 The Open Group Research Institute. All rights reserved.
* ===========================================================================
*
*/
package sun.security.krb5.internal;
import sun.security.krb5.PrincipalName;
import sun.security.krb5.EncryptedData;
import sun.security.krb5.Asn1Exception;
import sun.security.krb5.Realm;
import sun.security.krb5.RealmException;
import sun.security.util.*;
import java.io.IOException;
import java.math.BigInteger;
/**
* Implements the ASN.1 Ticket type.
*
* <xmp>
* Ticket ::= [APPLICATION 1] SEQUENCE {
* tkt-vno[0] INTEGER,
* realm[1] Realm,
* sname[2] PrincipalName,
* enc-part[3] EncryptedData
* }
* </xmp>
*
* <p>
* This definition reflects the Network Working Group RFC 1510
* specifications dated September 1993 and available at
* <a href="http://www.ietf.org/rfc/rfc1510.txt">http://www.ietf.org/rfc/rfc1510.txt</a>.
*/
public class Ticket implements Cloneable {
public int tkt_vno;
public Realm realm;
public PrincipalName sname;
public EncryptedData encPart;
private Ticket() {
}
public Object clone() {
Ticket new_ticket = new Ticket();
new_ticket.realm = (Realm)realm.clone();
new_ticket.sname = (PrincipalName)sname.clone();
new_ticket.encPart = (EncryptedData)encPart.clone();
new_ticket.tkt_vno = tkt_vno;
return new_ticket;
}
public Ticket(
Realm new_realm,
PrincipalName new_sname,
EncryptedData new_encPart
) {
tkt_vno = Krb5.TICKET_VNO;
realm = new_realm;
sname = new_sname;
encPart = new_encPart;
}
public Ticket(byte[] data) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
init(new DerValue(data));
}
public Ticket(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
init(encoding);
}
/**
* Initializes a Ticket object.
* @param encoding a single DER-encoded value.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
* @exception KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
* @exception RealmException if an error occurs while parsing a Realm object.
*/
private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
DerValue der;
DerValue subDer;
if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
|| (encoding.isApplication() != true)
|| (encoding.isConstructed() != true))
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
der = encoding.getData().getDerValue();
if (der.getTag() != DerValue.tag_Sequence)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
subDer = der.getData().getDerValue();
if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
tkt_vno = subDer.getData().getBigInteger().intValue();
if (tkt_vno != Krb5.TICKET_VNO)
throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
realm = Realm.parse(der.getData(), (byte)0x01, false);
sname = PrincipalName.parse(der.getData(), (byte)0x02, false);
encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
if (der.getData().available() > 0)
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
/**
* Encodes a Ticket object.
* @return byte array of encoded ticket object.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
*/
public byte[] asn1Encode() throws Asn1Exception, IOException {
DerOutputStream bytes = new DerOutputStream();
DerOutputStream temp = new DerOutputStream();
DerValue der[] = new DerValue[4];
temp.putInteger(BigInteger.valueOf(tkt_vno));
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x00), temp);
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), realm.asn1Encode());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x02), sname.asn1Encode());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x03), encPart.asn1Encode());
temp = new DerOutputStream();
temp.write(DerValue.tag_Sequence, bytes);
DerOutputStream ticket = new DerOutputStream();
ticket.write(DerValue.createTag(DerValue.TAG_APPLICATION, true, (byte)0x01), temp);
return ticket.toByteArray();
}
/**
* Parse (unmarshal) a Ticket from a DER input stream. This form
* parsing might be used when expanding a value which is part of
* a constructed sequence and uses explicitly tagged type.
*
* @exception Asn1Exception on error.
* @param data the Der input stream value, which contains one or more marshaled value.
* @param explicitTag tag number.
* @param optional indicate if this data field is optional
* @return an instance of Ticket.
*/
public static Ticket parse(DerInputStream data, byte explicitTag, boolean optional) throws Asn1Exception, IOException, RealmException, KrbApErrException {
if ((optional) && (((byte)data.peekByte() & (byte)0x1F)!= explicitTag))
return null;
DerValue der = data.getDerValue();
if (explicitTag != (der.getTag() & (byte)0x1F)) {
throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
else {
DerValue subDer = der.getData().getDerValue();
return new Ticket(subDer);
}
}
}
| 6,240 | 0.684776 | 0.665064 | 174 | 34.862068 | 28.648352 | 158 | false | false | 0 | 0 | 0 | 0 | 76 | 0.024359 | 1.011494 | false | false | 15 |
dd9125e9a6b79b1c85c7ce25d12cc63d7eac41b7 | 17,884,243,852,417 | 8f38ae81673d10c79b0c8381b85aabd8b6ace336 | /car_app/src/main/java/com/app/model/Car.java | d3f308830f0cf3e4ad886fa5beecc035c541ff3b | [
"LicenseRef-scancode-public-domain"
]
| permissive | jamesolas/project0 | https://github.com/jamesolas/project0 | f222dde3142aac5382804f61d2ae17daf1ce2ac5 | 3fa29f139533b4e5465cfdd3c803158b673f9320 | refs/heads/master | 2023-03-09T08:29:37.774000 | 2021-02-26T18:11:15 | 2021-02-26T18:11:15 | 333,997,825 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.model;
public class Car {
private int carId;
private String make;
private String model;
private String status;
private int userId;
public Car() {
super();
}
public Car(String make, String model) {
super();
this.make = make;
this.model = model;
}
public Car(int carId, String make, String model, String status, int userId) {
super();
this.carId = carId;
this.make = make;
this.model = model;
this.status = status;
this.userId = userId;
}
public int getCarId() {
return carId;
}
public void setCarId(int carId) {
this.carId = carId;
}
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + carId;
result = prime * result + ((make == null) ? 0 : make.hashCode());
result = prime * result + ((model == null) ? 0 : model.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + userId;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Car other = (Car) obj;
if (carId != other.carId)
return false;
if (make == null) {
if (other.make != null)
return false;
} else if (!make.equals(other.make))
return false;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (userId != other.userId)
return false;
return true;
}
@Override
public String toString() {
return "Car [carId=" + carId + ", make=" + make + ", model=" + model + ", status=" + status + ", userId="
+ userId + "]";
}
} | UTF-8 | Java | 2,441 | java | Car.java | Java | []
| null | []
| package com.app.model;
public class Car {
private int carId;
private String make;
private String model;
private String status;
private int userId;
public Car() {
super();
}
public Car(String make, String model) {
super();
this.make = make;
this.model = model;
}
public Car(int carId, String make, String model, String status, int userId) {
super();
this.carId = carId;
this.make = make;
this.model = model;
this.status = status;
this.userId = userId;
}
public int getCarId() {
return carId;
}
public void setCarId(int carId) {
this.carId = carId;
}
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + carId;
result = prime * result + ((make == null) ? 0 : make.hashCode());
result = prime * result + ((model == null) ? 0 : model.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + userId;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Car other = (Car) obj;
if (carId != other.carId)
return false;
if (make == null) {
if (other.make != null)
return false;
} else if (!make.equals(other.make))
return false;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (userId != other.userId)
return false;
return true;
}
@Override
public String toString() {
return "Car [carId=" + carId + ", make=" + make + ", model=" + model + ", status=" + status + ", userId="
+ userId + "]";
}
} | 2,441 | 0.583777 | 0.581319 | 136 | 15.963235 | 17.398617 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.720588 | false | false | 15 |
208618898b95e5a4b4ab379c6fdbdbd5936457ee | 17,884,243,848,990 | c91ef390d1de8aa0514ae7b8492357cf2c3d5ed3 | /01. Java Advanced/Java Advanced Retake Exam 03 Jan 2018/src/p04_TheSwanStation.java | c33df953cac51e541aec519651cadce263829c40 | []
| no_license | did0sh/Java-Development | https://github.com/did0sh/Java-Development | ad8778fdc3691e7e68b38742dee463018a95284c | 6e333f4daa5658f9124f6a145146b337888cfe58 | refs/heads/master | 2020-03-17T15:02:18.644000 | 2019-03-16T12:38:05 | 2019-03-16T12:38:05 | 133,696,032 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
public class p04_TheSwanStation {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
List<Integer> numbers = Arrays.stream(reader.readLine().split("\\s+")).map(Integer::parseInt).collect(Collectors.toList());
ArrayList<Integer> results = new ArrayList<>();
String[] input = reader.readLine().split("\\s+");
ArrayList<Integer> queue = new ArrayList<>();
for (String s : input) {
queue.add(Integer.parseInt(s));
}
while (numbers.size() != 0) {
for (int i = 0; i < queue.size(); i++) {
int currentInteger = queue.get(i);
if (currentInteger % numbers.get(0) == 0) {
results.add(currentInteger);
numbers.remove(0);
if (numbers.size() == 0){
break;
}
queue.remove(i);
i--;
} else {
queue.remove(i);
queue.add(queue.size(), currentInteger + 1);
i--;
}
}
}
System.out.println(results.toString().replaceAll("[\\[\\]]", ""));
}
}
| UTF-8 | Java | 1,494 | java | p04_TheSwanStation.java | Java | []
| null | []
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
public class p04_TheSwanStation {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
List<Integer> numbers = Arrays.stream(reader.readLine().split("\\s+")).map(Integer::parseInt).collect(Collectors.toList());
ArrayList<Integer> results = new ArrayList<>();
String[] input = reader.readLine().split("\\s+");
ArrayList<Integer> queue = new ArrayList<>();
for (String s : input) {
queue.add(Integer.parseInt(s));
}
while (numbers.size() != 0) {
for (int i = 0; i < queue.size(); i++) {
int currentInteger = queue.get(i);
if (currentInteger % numbers.get(0) == 0) {
results.add(currentInteger);
numbers.remove(0);
if (numbers.size() == 0){
break;
}
queue.remove(i);
i--;
} else {
queue.remove(i);
queue.add(queue.size(), currentInteger + 1);
i--;
}
}
}
System.out.println(results.toString().replaceAll("[\\[\\]]", ""));
}
}
| 1,494 | 0.495984 | 0.48996 | 41 | 34.439026 | 26.495327 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.609756 | false | false | 15 |
cd4c1ebf9dde4bd112089653d019b62044813057 | 1,030,792,212,536 | 22d5275045f04cf416e971701372a272c8b6dd73 | /src/main/java/com/daimacankao/kxenglish/domain/GlobalConstant.java | a3324bd2531ab22fa3d3cba42903c80ac5bfd159 | []
| no_license | fanjiehao886/UserSystem | https://github.com/fanjiehao886/UserSystem | c755f94d7cf19673b611f6aac6ab7795146559b5 | 593bfa5abc046c375969b1ddf8e7bb07b5ea6cc0 | refs/heads/master | 2020-07-25T12:57:28.661000 | 2019-11-07T06:54:27 | 2019-11-07T06:54:27 | 208,297,424 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.daimacankao.kxenglish.domain;
public class GlobalConstant {
public final static int SUCCESS = 1;
}
| UTF-8 | Java | 113 | java | GlobalConstant.java | Java | []
| null | []
| package com.daimacankao.kxenglish.domain;
public class GlobalConstant {
public final static int SUCCESS = 1;
}
| 113 | 0.787611 | 0.778761 | 5 | 21.6 | 17.658993 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 15 |
17de7caf12c24bc1cb2c53e02cc5690f428529f7 | 31,095,563,285,220 | 823d345f8cfafcfa8dc0712a7552e476b7ce50ea | /src/jreepad/editor/TableViewer.java | 4db08b0a1523a01a801c0b93abd21c7429d78934 | []
| no_license | KSE2/jreepad | https://github.com/KSE2/jreepad | c46c0616f777f1d1198c67e4a3e97a85cd2c87f0 | fca4b0f5cbe1bb2339b18beafd0c96f739985e69 | refs/heads/master | 2021-01-16T17:40:15.854000 | 2012-05-20T12:40:36 | 2012-05-20T12:40:36 | 4,960,991 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
Jreepad - personal information manager.
Copyright (C) 2004 Dan Stowell
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The full license can be read online here:
http://www.gnu.org/copyleft/gpl.html
*/
package jreepad.editor;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import jreepad.JreepadArticle;
import jreepad.JreepadPrefs;
import jreepad.JreepadView;
import jreepad.ui.FontHelper;
/**
* The table view pane.
* Converts CSV content to table view.
*/
public class TableViewer extends AbstractArticleView
{
private JTable table;
public TableViewer(JreepadArticle article)
{
super(article);
table = new JTable(getTableModel(article));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setGridColor(Color.GRAY);
table.setShowGrid(true);
table.setShowVerticalLines(true);
table.setShowHorizontalLines(true);
}
public void updateFont(int direction) {
FontHelper.updateFont(getComponent(), direction);
}
public JComponent getComponent()
{
return table;
}
public void reloadArticle()
{
table.setModel(getTableModel(article));
}
private static TableModel getTableModel(JreepadArticle a)
{
String[][] rowData = a.interpretContentAsCsv();
String[] columnNames = new String[rowData[0].length];
for (int i = 0; i < columnNames.length; i++)
columnNames[i] = " ";
return new ArticleTableModel(rowData, columnNames);
}
public String getText()
{
int w = table.getColumnCount();
int h = table.getRowCount();
StringBuffer csv = new StringBuffer();
String quoteMark = getPrefs().addQuotesToCsvOutput ? "\"" : "";
for (int i = 0; i < h; i++)
{
for (int j = 0; j < (w - 1); j++)
csv.append(quoteMark + (String) table.getValueAt(i, j) + quoteMark + ",");
csv.append(quoteMark + (String) table.getValueAt(i, w - 1) + quoteMark + "\n");
}
return csv.toString();
}
public String getSelectedText()
{
int x = table.getSelectedColumn();
int y = table.getSelectedRow();
if(x==-1 || y ==-1)
return "";
return table.getValueAt(y,x).toString();
}
public static JreepadPrefs getPrefs()
{
return JreepadView.getPrefs();
}
private static class ArticleTableModel extends DefaultTableModel
{
public ArticleTableModel(Object[][] data, Object[] columnNames)
{
super(data, columnNames);
}
public ArticleTableModel()
{
super();
}
public boolean isCellEditable(int row, int col)
{
return false;
}
} // End of: class ArticleTableModel
}
| UTF-8 | Java | 3,063 | java | TableViewer.java | Java | [
{
"context": " personal information manager.\n Copyright (C) 2004 Dan Stowell\n\n This program is free software; you can redistri",
"end": 75,
"score": 0.9985871315002441,
"start": 64,
"tag": "NAME",
"value": "Dan Stowell"
}
]
| null | []
| /*
Jreepad - personal information manager.
Copyright (C) 2004 <NAME>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The full license can be read online here:
http://www.gnu.org/copyleft/gpl.html
*/
package jreepad.editor;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import jreepad.JreepadArticle;
import jreepad.JreepadPrefs;
import jreepad.JreepadView;
import jreepad.ui.FontHelper;
/**
* The table view pane.
* Converts CSV content to table view.
*/
public class TableViewer extends AbstractArticleView
{
private JTable table;
public TableViewer(JreepadArticle article)
{
super(article);
table = new JTable(getTableModel(article));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setGridColor(Color.GRAY);
table.setShowGrid(true);
table.setShowVerticalLines(true);
table.setShowHorizontalLines(true);
}
public void updateFont(int direction) {
FontHelper.updateFont(getComponent(), direction);
}
public JComponent getComponent()
{
return table;
}
public void reloadArticle()
{
table.setModel(getTableModel(article));
}
private static TableModel getTableModel(JreepadArticle a)
{
String[][] rowData = a.interpretContentAsCsv();
String[] columnNames = new String[rowData[0].length];
for (int i = 0; i < columnNames.length; i++)
columnNames[i] = " ";
return new ArticleTableModel(rowData, columnNames);
}
public String getText()
{
int w = table.getColumnCount();
int h = table.getRowCount();
StringBuffer csv = new StringBuffer();
String quoteMark = getPrefs().addQuotesToCsvOutput ? "\"" : "";
for (int i = 0; i < h; i++)
{
for (int j = 0; j < (w - 1); j++)
csv.append(quoteMark + (String) table.getValueAt(i, j) + quoteMark + ",");
csv.append(quoteMark + (String) table.getValueAt(i, w - 1) + quoteMark + "\n");
}
return csv.toString();
}
public String getSelectedText()
{
int x = table.getSelectedColumn();
int y = table.getSelectedRow();
if(x==-1 || y ==-1)
return "";
return table.getValueAt(y,x).toString();
}
public static JreepadPrefs getPrefs()
{
return JreepadView.getPrefs();
}
private static class ArticleTableModel extends DefaultTableModel
{
public ArticleTableModel(Object[][] data, Object[] columnNames)
{
super(data, columnNames);
}
public ArticleTableModel()
{
super();
}
public boolean isCellEditable(int row, int col)
{
return false;
}
} // End of: class ArticleTableModel
}
| 3,058 | 0.70617 | 0.701926 | 122 | 24.106558 | 22.293058 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.401639 | false | false | 15 |
7e048a8683acaad43def7dfeac7b562300772d86 | 32,152,125,211,001 | cec70e8179f80cb290dbe90d50d83c120a0c7984 | /ch04_proj3_TipCalculator/src/TipCalculator.java | 0674a1f32571cec6a623159a6806e282d13a2040 | []
| no_license | Matthew-Burkard/java-tutorials | https://github.com/Matthew-Burkard/java-tutorials | a4c3f1e69facdf5bbbc6f806d4cf0a905fd7515f | 00ffc922edafd660956e79509f958b7e355d0db7 | refs/heads/master | 2020-03-13T21:22:11.862000 | 2018-04-27T13:23:08 | 2018-04-27T13:23:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Scanner;
public class TipCalculator {
public static void main(String[] args) {
System.out.println("Tip Calculator\n");
Scanner sc = new Scanner(System.in);
String choice = "y";
while(choice.equalsIgnoreCase("y")) {
System.out.print("Cost of meal: ");
BigDecimal cost = new BigDecimal(sc.nextLine());
NumberFormat currency = NumberFormat.getCurrencyInstance();
NumberFormat percent = NumberFormat.getPercentInstance();
System.out.println("");
for (int i=15;i<=25;i+=5) {
BigDecimal tip = new BigDecimal(i*.01);
BigDecimal tipAmount = cost.multiply(tip);
System.out.print(percent.format(tip) + "\n");
System.out.println("Tip amount: " + currency.format(tipAmount));
System.out.println("Total amount: " + currency.format(cost.add(tipAmount)) + "\n");
}
System.out.print("Continue (y/n): ");
choice = sc.next();
System.out.println();
}
sc.close();
}
}
| UTF-8 | Java | 1,011 | java | TipCalculator.java | Java | []
| null | []
| import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Scanner;
public class TipCalculator {
public static void main(String[] args) {
System.out.println("Tip Calculator\n");
Scanner sc = new Scanner(System.in);
String choice = "y";
while(choice.equalsIgnoreCase("y")) {
System.out.print("Cost of meal: ");
BigDecimal cost = new BigDecimal(sc.nextLine());
NumberFormat currency = NumberFormat.getCurrencyInstance();
NumberFormat percent = NumberFormat.getPercentInstance();
System.out.println("");
for (int i=15;i<=25;i+=5) {
BigDecimal tip = new BigDecimal(i*.01);
BigDecimal tipAmount = cost.multiply(tip);
System.out.print(percent.format(tip) + "\n");
System.out.println("Tip amount: " + currency.format(tipAmount));
System.out.println("Total amount: " + currency.format(cost.add(tipAmount)) + "\n");
}
System.out.print("Continue (y/n): ");
choice = sc.next();
System.out.println();
}
sc.close();
}
}
| 1,011 | 0.665678 | 0.658754 | 33 | 29.636364 | 22.357723 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.636364 | false | false | 15 |
20c25f945a7f1f8cbae9acae7260aab2314a0050 | 20,143,396,680,522 | 4eb618e0e8db2365cf07e5fddf718de92f0354ad | /files/pact-gui/src/main/java/eu/stratosphere/pact/gui/designer/client/event/PactProgramPropertyChangeEvent.java | 3653875d022c961ebfaff1e91791a931d60a39aa | []
| no_license | madmaxmatze/academia | https://github.com/madmaxmatze/academia | 61185392d9294a3fd5452cd8eddfed78ce918a3c | 39613d8977f4271539315d95754b4028a80abdef | refs/heads/main | 2023-04-24T04:54:34.865000 | 2021-05-10T09:50:38 | 2021-05-10T09:50:38 | 340,182,563 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package eu.stratosphere.pact.gui.designer.client.event;
import com.google.gwt.event.shared.GwtEvent;
import eu.stratosphere.pact.gui.designer.shared.model.PactProgram;
/**
* Event fired over the event bus when properties of pact program are updated
*/
public class PactProgramPropertyChangeEvent extends GwtEvent<PactProgramPropertyChangeEventHandler> {
public static final Type<PactProgramPropertyChangeEventHandler> TYPE = new Type<PactProgramPropertyChangeEventHandler>();
private PactProgram pactProgram;
public PactProgramPropertyChangeEvent(PactProgram pactProgram) {
this.pactProgram = pactProgram;
}
@Override
public Type<PactProgramPropertyChangeEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(PactProgramPropertyChangeEventHandler handler) {
handler.onPactProgramPropertyChange(this);
}
public PactProgram getPactProgram() {
return pactProgram;
}
@Override
public String toString() {
return "PactProgramPropertyChangeEvent";
}
} | UTF-8 | Java | 1,058 | java | PactProgramPropertyChangeEvent.java | Java | []
| null | []
| package eu.stratosphere.pact.gui.designer.client.event;
import com.google.gwt.event.shared.GwtEvent;
import eu.stratosphere.pact.gui.designer.shared.model.PactProgram;
/**
* Event fired over the event bus when properties of pact program are updated
*/
public class PactProgramPropertyChangeEvent extends GwtEvent<PactProgramPropertyChangeEventHandler> {
public static final Type<PactProgramPropertyChangeEventHandler> TYPE = new Type<PactProgramPropertyChangeEventHandler>();
private PactProgram pactProgram;
public PactProgramPropertyChangeEvent(PactProgram pactProgram) {
this.pactProgram = pactProgram;
}
@Override
public Type<PactProgramPropertyChangeEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(PactProgramPropertyChangeEventHandler handler) {
handler.onPactProgramPropertyChange(this);
}
public PactProgram getPactProgram() {
return pactProgram;
}
@Override
public String toString() {
return "PactProgramPropertyChangeEvent";
}
} | 1,058 | 0.775047 | 0.775047 | 37 | 26.648649 | 32.26178 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.864865 | false | false | 15 |
b78b031d36f14402b5c71e0a4b60d525bfa1b9c2 | 21,878,563,422,158 | b47445f6eed3d52c817ae65f61e47f0733b498fb | /Bitcamp/src/main/java/com/bitcamp/web/enums/Action.java | b27267168b020a248ebd4b4198d4032c59bfd6f6 | []
| no_license | ivorymood/SpringBitcamp | https://github.com/ivorymood/SpringBitcamp | c3716435bf348c47cacc33eeb39121562728ae8c | 33f743a33768ab93ea6ada07997daca80d0cf44b | refs/heads/master | 2021-04-28T01:57:15.271000 | 2018-02-21T04:06:46 | 2018-02-21T04:06:46 | 122,290,363 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bitcamp.web.enums;
public enum Action {
MOVE, LOGIN, JOIN, SEARCH, UPDATE, CREATE, CHANGE_PASS, DELETE,
LOGOUT, OPEN_ACCOUNT, SELECT_ACCOUNT, CREATE_NUMBER, MYPAGE,
VIEW{
@Override
public String toString() {
// TODO Auto-generated method stub
return "/WEB-INF/view/";
}
},
EXTENSION{
@Override
public String toString() {
// TODO Auto-generated method stub
return ".jsp";
}
},
SEPARATOR{
@Override
public String toString() {
// TODO Auto-generated method stub
return "/";
}
}
}
| UTF-8 | Java | 564 | java | Action.java | Java | []
| null | []
| package com.bitcamp.web.enums;
public enum Action {
MOVE, LOGIN, JOIN, SEARCH, UPDATE, CREATE, CHANGE_PASS, DELETE,
LOGOUT, OPEN_ACCOUNT, SELECT_ACCOUNT, CREATE_NUMBER, MYPAGE,
VIEW{
@Override
public String toString() {
// TODO Auto-generated method stub
return "/WEB-INF/view/";
}
},
EXTENSION{
@Override
public String toString() {
// TODO Auto-generated method stub
return ".jsp";
}
},
SEPARATOR{
@Override
public String toString() {
// TODO Auto-generated method stub
return "/";
}
}
}
| 564 | 0.62766 | 0.62766 | 28 | 18.142857 | 17.181208 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.285714 | false | false | 15 |
28ec67fa7169294e34e29f51a37eee3b8271977d | 3,367,254,426,670 | a3b9c10e9c3fe0f1a6c5a150f396aa2f628410e9 | /src/main/java/cn/bulletjet/headline/util/JedisAdapter.java | 3ad1db6bb1785621a9dd90b6f33fde7e04a98dff | []
| no_license | yhl2580890135/headline | https://github.com/yhl2580890135/headline | 81141da29153a25b6e27f51b9285d804b4c98ae7 | aaa0a1fecdaebcd70c893aa3f9f26a326acd95c6 | refs/heads/master | 2021-01-21T13:29:39.681000 | 2017-10-13T09:25:24 | 2017-10-13T09:25:24 | 102,130,544 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.bulletjet.headline.util;
import cn.bulletjet.headline.service.QiniuService;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import redis.clients.jedis.BinaryClient;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.Tuple;
import java.util.List;
@Service
public class JedisAdapter implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(JedisAdapter.class);
public static void print(int index, Object objet) {
System.out.println(String.format("%d,%s", index, objet.toString()));
}
public static void main(String[] args) {
Jedis jedis = new Jedis();
jedis.flushAll();
jedis.set("hello", "world");
print(1, jedis.get("hello"));
jedis.rename("hello", "newhello");
print(1, jedis.get("newhello"));
jedis.setex("yhl", 15, "wzj");
jedis.set("pv", "100");
jedis.incr("pv");
print(2, jedis.get("pv"));
jedis.incrBy("pv", 12);
print(2, jedis.get("pv"));
String listname = "listA";
for (int i = 0; i < 10; i++) {
jedis.lpush(listname, String.valueOf(i));
}
print(3, jedis.lrange(listname, 0, -1));
print(4, jedis.lindex(listname, 3));
jedis.linsert(listname, BinaryClient.LIST_POSITION.AFTER, "9", "10");
jedis.linsert(listname, BinaryClient.LIST_POSITION.BEFORE, "0", "nn");
print(5, jedis.lrange(listname, 0, -1));
String userKey = "user1";
jedis.hset(userKey, "name", "yhl");
jedis.hset(userKey, "password", "123456");
print(6, jedis.hget(userKey, "name"));
print(7, jedis.hgetAll(userKey));
print(8, jedis.hkeys(userKey));
print(9, jedis.hvals(userKey));
print(10, jedis.hexists(userKey, "email"));
print(10, jedis.hexists(userKey, "name"));
String likekeys = "likes";
String likekeys1 = "likes2";
for (int i = 0; i < 10; i++) {
jedis.sadd(likekeys, String.valueOf(i));
jedis.sadd(likekeys1, String.valueOf(i * 2));
}
print(11, jedis.smembers(likekeys));
print(12, jedis.smembers(likekeys1));
print(13, jedis.sinter(likekeys, likekeys1));
print(14, jedis.sunion(likekeys, likekeys1));
print(15, jedis.sdiff(likekeys, likekeys1));
jedis.srem(likekeys, "5");
print(12, jedis.smembers(likekeys));
jedis.scard(likekeys);
jedis.smove(likekeys1, likekeys, "14");
print(16, jedis.scard(likekeys));
print(16, jedis.smembers(likekeys));
String rankkey = "rankkey";
jedis.zadd(rankkey, 15, "jim");
jedis.zadd(rankkey, 55, "tom");
jedis.zadd(rankkey, 100, "yhl");
jedis.zadd(rankkey, 95, "wzj");
print(17, jedis.zcard(rankkey));
print(18, jedis.zcount(rankkey, 15, 95));
print(19, jedis.zscore(rankkey, "yhl"));
jedis.zincrby(rankkey, 2, "wzj");
jedis.zincrby(rankkey, 80, "www");
print(20, jedis.zcount(rankkey, 0, 100));
print(21, jedis.zrange(rankkey, 0, 4));
print(22, jedis.zrevrange(rankkey, 2, 4));
for (Tuple tuple : jedis.zrangeByScoreWithScores(rankkey, "0", "100")) {
print(23, tuple.getElement() + ";" + String.valueOf(tuple.getScore()));
}
print(23, jedis.zrank(rankkey, "yhl"));
print(23, jedis.zrevrank(rankkey, "yhl"));
JedisPool jedisPool = new JedisPool();
for (int i = 0; i < 100; i++) {
Jedis j = jedisPool.getResource();
j.get("hello");
System.out.println("pool" + i);
j.close();
}
}
private Jedis jedis = null;
private JedisPool pool = null;
@Override
public void afterPropertiesSet() throws Exception {
pool = new JedisPool();
System.out.println();
}
private Jedis getJedis() {
return pool.getResource();
}
public String get(String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return getJedis().get(key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return null;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void set(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.set(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public long sadd(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.sadd(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public long srem(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.srem(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public boolean sismember(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.sismember(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return false;
} finally {
if (jedis != null)
jedis.close();
}
}
public long scard(String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.scard(key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public void setex(String key, String value) {
// 验证码, 防机器注册,记录上次注册时间,有效期3天
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.setex(key, 10, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public long lpush(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.lpush(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public List<String> brpop(int timeout, String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.brpop(timeout, key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return null;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void setObject(String key, Object obj) {
set(key, JSON.toJSONString(obj));
}
public <T> T getObject(String key, Class<T> clazz) {
String value = get(key);
if (value != null) {
return JSON.parseObject(value, clazz);
}
return null;
}
}
| UTF-8 | Java | 8,101 | java | JedisAdapter.java | Java | [
{
"context": "ange(listname, 0, -1));\n String userKey = \"user1\";\n jedis.hset(userKey, \"name\", \"yhl\");\n ",
"end": 1733,
"score": 0.7945470213890076,
"start": 1728,
"tag": "KEY",
"value": "user1"
},
{
"context": " = \"user1\";\n jedis.hset(userKey, \"name\", \"yhl\");\n jedis.hset(userKey, \"password\", \"12345",
"end": 1776,
"score": 0.5573861598968506,
"start": 1774,
"tag": "USERNAME",
"value": "hl"
},
{
"context": " \"yhl\");\n jedis.hset(userKey, \"password\", \"123456\");\n\n print(6, jedis.hget(userKey, \"name\"))",
"end": 1827,
"score": 0.9993443489074707,
"start": 1821,
"tag": "PASSWORD",
"value": "123456"
}
]
| null | []
| package cn.bulletjet.headline.util;
import cn.bulletjet.headline.service.QiniuService;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import redis.clients.jedis.BinaryClient;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.Tuple;
import java.util.List;
@Service
public class JedisAdapter implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(JedisAdapter.class);
public static void print(int index, Object objet) {
System.out.println(String.format("%d,%s", index, objet.toString()));
}
public static void main(String[] args) {
Jedis jedis = new Jedis();
jedis.flushAll();
jedis.set("hello", "world");
print(1, jedis.get("hello"));
jedis.rename("hello", "newhello");
print(1, jedis.get("newhello"));
jedis.setex("yhl", 15, "wzj");
jedis.set("pv", "100");
jedis.incr("pv");
print(2, jedis.get("pv"));
jedis.incrBy("pv", 12);
print(2, jedis.get("pv"));
String listname = "listA";
for (int i = 0; i < 10; i++) {
jedis.lpush(listname, String.valueOf(i));
}
print(3, jedis.lrange(listname, 0, -1));
print(4, jedis.lindex(listname, 3));
jedis.linsert(listname, BinaryClient.LIST_POSITION.AFTER, "9", "10");
jedis.linsert(listname, BinaryClient.LIST_POSITION.BEFORE, "0", "nn");
print(5, jedis.lrange(listname, 0, -1));
String userKey = "user1";
jedis.hset(userKey, "name", "yhl");
jedis.hset(userKey, "password", "<PASSWORD>");
print(6, jedis.hget(userKey, "name"));
print(7, jedis.hgetAll(userKey));
print(8, jedis.hkeys(userKey));
print(9, jedis.hvals(userKey));
print(10, jedis.hexists(userKey, "email"));
print(10, jedis.hexists(userKey, "name"));
String likekeys = "likes";
String likekeys1 = "likes2";
for (int i = 0; i < 10; i++) {
jedis.sadd(likekeys, String.valueOf(i));
jedis.sadd(likekeys1, String.valueOf(i * 2));
}
print(11, jedis.smembers(likekeys));
print(12, jedis.smembers(likekeys1));
print(13, jedis.sinter(likekeys, likekeys1));
print(14, jedis.sunion(likekeys, likekeys1));
print(15, jedis.sdiff(likekeys, likekeys1));
jedis.srem(likekeys, "5");
print(12, jedis.smembers(likekeys));
jedis.scard(likekeys);
jedis.smove(likekeys1, likekeys, "14");
print(16, jedis.scard(likekeys));
print(16, jedis.smembers(likekeys));
String rankkey = "rankkey";
jedis.zadd(rankkey, 15, "jim");
jedis.zadd(rankkey, 55, "tom");
jedis.zadd(rankkey, 100, "yhl");
jedis.zadd(rankkey, 95, "wzj");
print(17, jedis.zcard(rankkey));
print(18, jedis.zcount(rankkey, 15, 95));
print(19, jedis.zscore(rankkey, "yhl"));
jedis.zincrby(rankkey, 2, "wzj");
jedis.zincrby(rankkey, 80, "www");
print(20, jedis.zcount(rankkey, 0, 100));
print(21, jedis.zrange(rankkey, 0, 4));
print(22, jedis.zrevrange(rankkey, 2, 4));
for (Tuple tuple : jedis.zrangeByScoreWithScores(rankkey, "0", "100")) {
print(23, tuple.getElement() + ";" + String.valueOf(tuple.getScore()));
}
print(23, jedis.zrank(rankkey, "yhl"));
print(23, jedis.zrevrank(rankkey, "yhl"));
JedisPool jedisPool = new JedisPool();
for (int i = 0; i < 100; i++) {
Jedis j = jedisPool.getResource();
j.get("hello");
System.out.println("pool" + i);
j.close();
}
}
private Jedis jedis = null;
private JedisPool pool = null;
@Override
public void afterPropertiesSet() throws Exception {
pool = new JedisPool();
System.out.println();
}
private Jedis getJedis() {
return pool.getResource();
}
public String get(String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return getJedis().get(key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return null;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void set(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.set(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public long sadd(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.sadd(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public long srem(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.srem(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public boolean sismember(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.sismember(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return false;
} finally {
if (jedis != null)
jedis.close();
}
}
public long scard(String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.scard(key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null)
jedis.close();
}
}
public void setex(String key, String value) {
// 验证码, 防机器注册,记录上次注册时间,有效期3天
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.setex(key, 10, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public long lpush(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.lpush(key, value);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return 0;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public List<String> brpop(int timeout, String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.brpop(timeout, key);
} catch (Exception e) {
logger.error("发生异常" + e.getMessage());
return null;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void setObject(String key, Object obj) {
set(key, JSON.toJSONString(obj));
}
public <T> T getObject(String key, Class<T> clazz) {
String value = get(key);
if (value != null) {
return JSON.parseObject(value, clazz);
}
return null;
}
}
| 8,105 | 0.528992 | 0.512586 | 261 | 29.59387 | 18.33103 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.992337 | false | false | 15 |
0c2a1f21cf1a5be484c0fab2ebc6ccc509b43f0e | 3,161,095,954,465 | 08b0cab5ec543cec4e124a54f0fbfef39bde6fc5 | /src/com/pavel/textparser/splitter/ParagraphSplitter.java | 15f8b263018e917ebf0956a3c3a89520aba42b06 | []
| no_license | PavelKastrykin/TextParser | https://github.com/PavelKastrykin/TextParser | d41a51f872faef804f0209a86c95d1a7908b6e2a | 5c12d534f64ee5bf55eb31f9251db188de6d409a | refs/heads/master | 2020-05-17T03:57:30.417000 | 2015-03-01T19:33:22 | 2015-03-01T19:33:22 | 31,424,304 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pavel.textparser.splitter;
import com.pavel.textparser.entity.Sentence;
import com.pavel.textparser.entity.TextDividable;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class ParagraphSplitter {
public List<TextDividable> splitText(String string){
List<TextDividable> arrayOfSentences = new ArrayList<TextDividable>();
while (string.length() > 0){
String textPart = string.substring(0, RegExp.matcherPatternIndex(string, RegExp.SENTENCE_END_PATTERN) + 1);
arrayOfSentences.add(new Sentence(textPart));
string = string.replaceFirst(Pattern.quote(textPart), "");
}
return arrayOfSentences;
}
}
| UTF-8 | Java | 727 | java | ParagraphSplitter.java | Java | []
| null | []
| package com.pavel.textparser.splitter;
import com.pavel.textparser.entity.Sentence;
import com.pavel.textparser.entity.TextDividable;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class ParagraphSplitter {
public List<TextDividable> splitText(String string){
List<TextDividable> arrayOfSentences = new ArrayList<TextDividable>();
while (string.length() > 0){
String textPart = string.substring(0, RegExp.matcherPatternIndex(string, RegExp.SENTENCE_END_PATTERN) + 1);
arrayOfSentences.add(new Sentence(textPart));
string = string.replaceFirst(Pattern.quote(textPart), "");
}
return arrayOfSentences;
}
}
| 727 | 0.713893 | 0.709766 | 21 | 33.619049 | 30.237907 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 15 |
2360a3cf561849f631dcd0c0a7edf981bbf0ba76 | 28,192,165,389,981 | 699a68c38b34f86d8b8c9b6fbc3e482fe33a6392 | /chatapp/src/main/java/interfaces/InterfazBorrarMensaje.java | 6ed3cf4908e2465597b7688e5f62f497078acb0c | []
| no_license | jma96x/Whatsapp-web-Jesus-Arturo | https://github.com/jma96x/Whatsapp-web-Jesus-Arturo | 97ee18f376a055d27a12c2bad216170210f503bc | 11487190b3e68b196d0518a700b4e0c5acff8c8a | refs/heads/master | 2022-04-14T21:19:14.086000 | 2020-02-04T11:46:35 | 2020-02-04T11:46:35 | 215,052,943 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package interfaces;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import controlador.ControladorChat;
import dominio.Mensaje;
@SuppressWarnings("serial")
public class InterfazBorrarMensaje extends JFrame {
private int x;
private int y;
private MainView mainView;
DefaultListModel<Mensaje> listModel = new DefaultListModel<Mensaje>();
/**
* Create the application.
*/
public InterfazBorrarMensaje(int x, int y, MainView mainWindow) {
this.x = x;
this.y = y;
initialize();
this.mainView = mainWindow;
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
setBounds(x, y, 600, 650);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setTitle("Borrar Mensaje");
JPanel panelArriba = new JPanel();
panelArriba.setPreferredSize(new Dimension(600, 50));
getContentPane().add(panelArriba, BorderLayout.NORTH);
panelArriba.setLayout(null);
JLabel lblMensajesDelUsuario = new JLabel("MENSAJES DEL USUARIO");
lblMensajesDelUsuario.setHorizontalAlignment(SwingConstants.CENTER);
lblMensajesDelUsuario.setBounds(164, 11, 242, 28);
panelArriba.add(lblMensajesDelUsuario);
JPanel panelMensajes = new JPanel();
panelMensajes.setBounds(new Rectangle(0, 0, 400, 450));
panelMensajes.setMinimumSize(new Dimension(400, 550));
panelMensajes.setSize(new Dimension(400, 450));
panelMensajes.setPreferredSize(new Dimension(400, 450));
panelMensajes.setMaximumSize(new Dimension(400, 550));
getContentPane().add(panelMensajes, BorderLayout.CENTER);
JPanel contenedorMensajes = new JPanel();
FlowLayout flowLayout = (FlowLayout) contenedorMensajes.getLayout();
flowLayout.setAlignment(FlowLayout.LEFT);
contenedorMensajes.setBackground(Color.WHITE);
flowLayout.setVgap(0);
flowLayout.setHgap(0);
contenedorMensajes.setPreferredSize(new Dimension(32576, 32576));
JScrollPane scrollMensajes = new JScrollPane(contenedorMensajes);
scrollMensajes.setBounds(42, 0, 500, 400);
final JList<Mensaje> listMensajes = new JList<Mensaje>(listModel);
panelMensajes.setLayout(null);
contenedorMensajes.add(listMensajes);
scrollMensajes.setPreferredSize(new Dimension(500, 400));
panelMensajes.add(scrollMensajes);
List<Mensaje> mensajes = ControladorChat.getUnicaInstancia().getMisMensajesConversacionContactoActual();
for (Mensaje m : mensajes) {
listModel.addElement(m);
}
JButton btnAceptar = new JButton("Aceptar");
btnAceptar.setBackground(Color.GREEN);
btnAceptar.setBounds(135, 466, 89, 23);
panelMensajes.add(btnAceptar);
btnAceptar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Mensaje mensaje = (Mensaje) listMensajes.getSelectedValue();
if (mensaje == null)
return;
ControladorChat.getUnicaInstancia().eliminarMensaje(mensaje, false);
mainView.actualizarContacto();
mainView.actualizarListaContactos();
dispose();
}
});
JButton btnCancelar = new JButton("Cancelar");
btnCancelar.setBackground(Color.RED);
btnCancelar.setBounds(344, 466, 89, 23);
btnCancelar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panelMensajes.add(btnCancelar);
}
}
| UTF-8 | Java | 3,651 | java | InterfazBorrarMensaje.java | Java | [
{
"context": "l);\n\n\t\tJLabel lblMensajesDelUsuario = new JLabel(\"MENSAJES DEL USUARIO\");\n\t\tlblMensajesDelUsuario.setHorizontalAlignment",
"end": 1391,
"score": 0.7588084936141968,
"start": 1371,
"tag": "NAME",
"value": "MENSAJES DEL USUARIO"
}
]
| null | []
| package interfaces;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import controlador.ControladorChat;
import dominio.Mensaje;
@SuppressWarnings("serial")
public class InterfazBorrarMensaje extends JFrame {
private int x;
private int y;
private MainView mainView;
DefaultListModel<Mensaje> listModel = new DefaultListModel<Mensaje>();
/**
* Create the application.
*/
public InterfazBorrarMensaje(int x, int y, MainView mainWindow) {
this.x = x;
this.y = y;
initialize();
this.mainView = mainWindow;
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
setBounds(x, y, 600, 650);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setTitle("Borrar Mensaje");
JPanel panelArriba = new JPanel();
panelArriba.setPreferredSize(new Dimension(600, 50));
getContentPane().add(panelArriba, BorderLayout.NORTH);
panelArriba.setLayout(null);
JLabel lblMensajesDelUsuario = new JLabel("<NAME>");
lblMensajesDelUsuario.setHorizontalAlignment(SwingConstants.CENTER);
lblMensajesDelUsuario.setBounds(164, 11, 242, 28);
panelArriba.add(lblMensajesDelUsuario);
JPanel panelMensajes = new JPanel();
panelMensajes.setBounds(new Rectangle(0, 0, 400, 450));
panelMensajes.setMinimumSize(new Dimension(400, 550));
panelMensajes.setSize(new Dimension(400, 450));
panelMensajes.setPreferredSize(new Dimension(400, 450));
panelMensajes.setMaximumSize(new Dimension(400, 550));
getContentPane().add(panelMensajes, BorderLayout.CENTER);
JPanel contenedorMensajes = new JPanel();
FlowLayout flowLayout = (FlowLayout) contenedorMensajes.getLayout();
flowLayout.setAlignment(FlowLayout.LEFT);
contenedorMensajes.setBackground(Color.WHITE);
flowLayout.setVgap(0);
flowLayout.setHgap(0);
contenedorMensajes.setPreferredSize(new Dimension(32576, 32576));
JScrollPane scrollMensajes = new JScrollPane(contenedorMensajes);
scrollMensajes.setBounds(42, 0, 500, 400);
final JList<Mensaje> listMensajes = new JList<Mensaje>(listModel);
panelMensajes.setLayout(null);
contenedorMensajes.add(listMensajes);
scrollMensajes.setPreferredSize(new Dimension(500, 400));
panelMensajes.add(scrollMensajes);
List<Mensaje> mensajes = ControladorChat.getUnicaInstancia().getMisMensajesConversacionContactoActual();
for (Mensaje m : mensajes) {
listModel.addElement(m);
}
JButton btnAceptar = new JButton("Aceptar");
btnAceptar.setBackground(Color.GREEN);
btnAceptar.setBounds(135, 466, 89, 23);
panelMensajes.add(btnAceptar);
btnAceptar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Mensaje mensaje = (Mensaje) listMensajes.getSelectedValue();
if (mensaje == null)
return;
ControladorChat.getUnicaInstancia().eliminarMensaje(mensaje, false);
mainView.actualizarContacto();
mainView.actualizarListaContactos();
dispose();
}
});
JButton btnCancelar = new JButton("Cancelar");
btnCancelar.setBackground(Color.RED);
btnCancelar.setBounds(344, 466, 89, 23);
btnCancelar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panelMensajes.add(btnCancelar);
}
}
| 3,637 | 0.761161 | 0.733772 | 119 | 29.680672 | 22.483955 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.352941 | false | false | 15 |
e21b304bb90010b4c70effb9f41bf455e457f035 | 20,607,253,114,995 | b13f42aca91d6db207091327408d7fc2e70231e1 | /src/main/java/com/example/demo/controllers/RentController.java | 83ae46dfb328ac9cbd2f70ea5b4e11e27565da37 | []
| no_license | wesleylq/DACA | https://github.com/wesleylq/DACA | 63d941f79d141eeffac8aa981d86203e9ddbaada | 2f5e4aa010043ccf45f9e45765a2faaf04aa2cf9 | refs/heads/master | 2020-07-10T18:50:41.797000 | 2019-12-05T16:47:21 | 2019-12-05T16:47:21 | 200,898,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.controllers;
import java.time.LocalDate;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.models.Rent;
import com.example.demo.services.RentService;
@RestController
public class RentController {
@Autowired
private RentService rentService;
@RequestMapping("/rents")
public List<Rent> getRents(){
return rentService.getRents();
}
@RequestMapping("/rents/{id}")
public Rent getRent(@PathVariable String id){
return rentService.getRent(id);
}
@RequestMapping(value = "/rents", method = RequestMethod.POST)
public ResponseEntity<Rent> addRent(@RequestBody Rent rent) {
if((!this.checkRent(rent.getDress().getId(),rent.getDateInit(), rent.getDateEnd()))
|| rent.getDateInit().isAfter(rent.getDateEnd())) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(null);
}
rentService.addRent(rent);
return ResponseEntity.status(HttpStatus.OK).body(rent);
}
@RequestMapping(value = "/rent/{id}", method = RequestMethod.DELETE)
public void deleteArtista(@PathVariable int id) {
rentService.deleteRent(id);
}
public boolean checkRent(int dressId, LocalDate dateInit, LocalDate dateEnd) {
for (Rent rent : rentService.getRents() ) {
if(rent.getDress().getId() == dressId &&
(
(dateInit.isAfter(rent.getDateInit()) && dateInit.isBefore(rent.getDateEnd())) ||
(dateEnd.isAfter(rent.getDateInit()) && dateEnd.isBefore(rent.getDateEnd())) ||
(dateEnd.isEqual(rent.getDateInit()) || dateEnd.isEqual(rent.getDateEnd()) ||
dateInit.isEqual(rent.getDateInit()) || dateInit.isEqual(rent.getDateEnd()))
)
){
return false;
}
}
return true;
}
}
| UTF-8 | Java | 2,174 | java | RentController.java | Java | []
| null | []
| package com.example.demo.controllers;
import java.time.LocalDate;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.models.Rent;
import com.example.demo.services.RentService;
@RestController
public class RentController {
@Autowired
private RentService rentService;
@RequestMapping("/rents")
public List<Rent> getRents(){
return rentService.getRents();
}
@RequestMapping("/rents/{id}")
public Rent getRent(@PathVariable String id){
return rentService.getRent(id);
}
@RequestMapping(value = "/rents", method = RequestMethod.POST)
public ResponseEntity<Rent> addRent(@RequestBody Rent rent) {
if((!this.checkRent(rent.getDress().getId(),rent.getDateInit(), rent.getDateEnd()))
|| rent.getDateInit().isAfter(rent.getDateEnd())) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(null);
}
rentService.addRent(rent);
return ResponseEntity.status(HttpStatus.OK).body(rent);
}
@RequestMapping(value = "/rent/{id}", method = RequestMethod.DELETE)
public void deleteArtista(@PathVariable int id) {
rentService.deleteRent(id);
}
public boolean checkRent(int dressId, LocalDate dateInit, LocalDate dateEnd) {
for (Rent rent : rentService.getRents() ) {
if(rent.getDress().getId() == dressId &&
(
(dateInit.isAfter(rent.getDateInit()) && dateInit.isBefore(rent.getDateEnd())) ||
(dateEnd.isAfter(rent.getDateInit()) && dateEnd.isBefore(rent.getDateEnd())) ||
(dateEnd.isEqual(rent.getDateInit()) || dateEnd.isEqual(rent.getDateEnd()) ||
dateInit.isEqual(rent.getDateInit()) || dateInit.isEqual(rent.getDateEnd()))
)
){
return false;
}
}
return true;
}
}
| 2,174 | 0.725391 | 0.725391 | 69 | 30.47826 | 28.134567 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 15 |
08e122042aaa69bfe77260202821e16db1c01ce7 | 2,937,757,676,731 | 8c967844ec078cb8bf0bb7705863332902535035 | /saturn-server/saturn-engine/src/main/java/edu/ccut/saturn/core/IConstants.java | 61c41e83a4128de8b763ffa63748b1bd3f2a8be0 | [
"Apache-2.0"
]
| permissive | libiao92/saturn-platform | https://github.com/libiao92/saturn-platform | 18f6b23b66f3bb785992701a2fa008355c51ad30 | 52586d3d48aae108345e7e3902b870760150cbdd | refs/heads/master | 2016-09-05T08:50:11.847000 | 2015-09-11T18:02:23 | 2015-09-11T18:02:23 | 42,323,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.ccut.saturn.core;
/**
* Saturn常量
*
* @author LeslieGu,TonyYan
*
*/
public interface IConstants {
/**
* 服务器位置的关键字
*/
public static final String SATURN_SERVER_LOCATION = "saturn.home";
/**
* 服务器jsp缓存位置
*/
public static final String SATURN_WEB_CONTAINER_JSP_CACHE_LOCATION = "__SATURN_WEB_CONTAINER_JSP_CACHE_LOCATION__";
public static final String SATURN_WEBSERVICE_MANAGER = "__SATURN_WEBSERVICE_MANAGER__";
public static final String SATURN_COMPONENTINFO_LOADER_INSTRUCTION = "__SATURN_COMPONENTINFO_LOADER_INSTRUCTION__";
public static final String SATURN_COMPONENTINFO_CACHE_INSTRUCTION = "__SATURN_COMPONENTINFO_CACHE_INSTRUCTION__";
public static final String SATURN_BUNDLES_HOME = "__SATURN_BUNDLES_HOME__";
public static final String SATURN_CONFIG_LOCATION = "__SATURN_CONFIG_LOCATION__";
}
| UTF-8 | Java | 919 | java | IConstants.java | Java | [
{
"context": ".saturn.core;\r\n\r\n/**\r\n * Saturn常量\r\n * \r\n * @author LeslieGu,TonyYan\r\n * \r\n */\r\npublic interface IConstants {\r",
"end": 75,
"score": 0.9884303212165833,
"start": 67,
"tag": "NAME",
"value": "LeslieGu"
},
{
"context": "re;\r\n\r\n/**\r\n * Saturn常量\r\n * \r\n * @author LeslieGu,TonyYan\r\n * \r\n */\r\npublic interface IConstants {\r\n\r\n\t/**\r",
"end": 83,
"score": 0.9997700452804565,
"start": 76,
"tag": "NAME",
"value": "TonyYan"
}
]
| null | []
| package edu.ccut.saturn.core;
/**
* Saturn常量
*
* @author LeslieGu,TonyYan
*
*/
public interface IConstants {
/**
* 服务器位置的关键字
*/
public static final String SATURN_SERVER_LOCATION = "saturn.home";
/**
* 服务器jsp缓存位置
*/
public static final String SATURN_WEB_CONTAINER_JSP_CACHE_LOCATION = "__SATURN_WEB_CONTAINER_JSP_CACHE_LOCATION__";
public static final String SATURN_WEBSERVICE_MANAGER = "__SATURN_WEBSERVICE_MANAGER__";
public static final String SATURN_COMPONENTINFO_LOADER_INSTRUCTION = "__SATURN_COMPONENTINFO_LOADER_INSTRUCTION__";
public static final String SATURN_COMPONENTINFO_CACHE_INSTRUCTION = "__SATURN_COMPONENTINFO_CACHE_INSTRUCTION__";
public static final String SATURN_BUNDLES_HOME = "__SATURN_BUNDLES_HOME__";
public static final String SATURN_CONFIG_LOCATION = "__SATURN_CONFIG_LOCATION__";
}
| 919 | 0.704675 | 0.704675 | 31 | 26.290323 | 38.611542 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.83871 | false | false | 15 |
bb608b9805ebe72f0f6ee8f9f2cff2d394669118 | 18,571,438,638,028 | 9a9fcafa9bbc28c9f1930e01c46af8f023955aea | /JavaEE就业班多线程和数据库/作业题1/就业班JavaSE--day02【方法重写、this、super、抽象类】/示例/day02_homework/src/com/itheima/level03_03/Tutor.java | d6a7770d76b0b2c2bdf7a7befb585897ed650306 | []
| no_license | zhengbingyanbj/JavaSE | https://github.com/zhengbingyanbj/JavaSE | 84cd450ef5525050809c78a8b6660b9495c072db | 671ac02dcafe81d425c3c191c313b6040e8ae557 | refs/heads/master | 2021-09-01T18:20:49.082000 | 2017-12-28T07:13:30 | 2017-12-28T07:13:30 | 115,139,599 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itheima.level03_03;
/*
5.定义助教(Tutor)类继承研部员工(Teacher)类
a)提供无参和带参的构造方法
b)实现抽象方法: void work();
i.输出格式: 工号为 668的助教 顾棋 在帮助学生解决问题
*/
public class Tutor extends Teacher{
// a)提供无参和带参的构造方法
public Tutor() {
super();
}
public Tutor(String id, String name) {
super(id, name);
}
// b)实现抽象方法: void work();
// i.输出格式: 工号为 668的助教 顾棋 在帮助学生解决问题
public void work() {
System.out.println("工号为 "+getId()+"的助教 "+getName()+" 在帮助学生解决问题");
}
}
| GB18030 | Java | 666 | java | Tutor.java | Java | []
| null | []
| package com.itheima.level03_03;
/*
5.定义助教(Tutor)类继承研部员工(Teacher)类
a)提供无参和带参的构造方法
b)实现抽象方法: void work();
i.输出格式: 工号为 668的助教 顾棋 在帮助学生解决问题
*/
public class Tutor extends Teacher{
// a)提供无参和带参的构造方法
public Tutor() {
super();
}
public Tutor(String id, String name) {
super(id, name);
}
// b)实现抽象方法: void work();
// i.输出格式: 工号为 668的助教 顾棋 在帮助学生解决问题
public void work() {
System.out.println("工号为 "+getId()+"的助教 "+getName()+" 在帮助学生解决问题");
}
}
| 666 | 0.663717 | 0.639381 | 23 | 18.652174 | 16.572918 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.217391 | false | false | 15 |
978f568af3c01dad6097d1024f3e604d70c99b0d | 16,097,537,479,642 | cf9b1c763bf8a6803d10f08691a23c984c794679 | /src/main/java/com/elifes/hsj/impl/DefaultHSJManager.java | 7d6e2e42d4a4d7b40ae8f177ef06d64d3c7a6479 | []
| no_license | easysg/hsj | https://github.com/easysg/hsj | 5a5ba2a7f25827f42911d65af1b94a0f269e4f4a | 5f64c8303ed9865285f7f4cfca570fdfbec43db4 | refs/heads/master | 2017-04-26T16:42:39.131000 | 2012-08-25T14:42:38 | 2012-08-25T14:42:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 2011-2015 1lifes.com
* HSJ java-handlersocket
* Id: DefaultHSJManager.java
*/
package com.elifes.hsj.impl;
import java.sql.ResultSet;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;
import com.elifes.hsj.HSJManager;
import com.elifes.hsj.IDBConfigLoader;
import com.elifes.hsj.IDBLookupStrategy;
import com.elifes.hsj.client.HSJClient;
import com.elifes.hsj.client.HSJClientFactory;
import com.elifes.hsj.exception.HSJException;
import com.elifes.hsj.model.CompareOperator;
import com.elifes.hsj.model.DBConfig;
import com.elifes.hsj.model.TableConfig;
import com.elifes.hsj.util.Constants;
/**
* 描述:
* @author yangqiang
* @createtime 2011-11-12下午12:40:13
*
*/
public class DefaultHSJManager implements HSJManager {
private static final Logger logger = Logger.getLogger(DefaultHSJManager.class);
private static DefaultHSJManager self = new DefaultHSJManager();
private ConcurrentMap<String, Channel> connectionMap = new ConcurrentHashMap<String, Channel>();
private ConcurrentMap<TableConfig, String> indexIdMap = new ConcurrentHashMap<TableConfig, String>();
//ThreadLocal<OpenIndexContext> ctx;
//private IDBLookupStrategy dbLookupStrategy;
private String encoding = Constants.DEFAULT_ENCODING;
private TableConfig tableConfig;
// static{
// init();
// }
public static DefaultHSJManager getInstance(){
return self;
}
public String init(IDBLookupStrategy dbLookupStrategy) throws HSJException {
tableConfig = dbLookupStrategy.lookup(null);
String indexId = null;
if(!indexIdMap.containsKey(tableConfig)){
indexId = openIndex(tableConfig);
indexIdMap.putIfAbsent(tableConfig, indexId);
}
return indexId;
}
private HSJClient getClient(){
HSJClientFactory hsjClientFactory = HSJClientFactory.getInstance();
hsjClientFactory.setEncoding(encoding);
hsjClientFactory.setTableConfig(tableConfig);
return hsjClientFactory.createClient(tableConfig.getDbConfig().getIp(), tableConfig.getDbConfig().getPort());
}
public String openIndex(TableConfig tableConfig) throws HSJException {
return openIndex(
tableConfig.getDbConfig().getDbName(),
tableConfig.getTblName(), tableConfig.getIndexName(),
tableConfig.getColumnNames());
}
public String openIndex(String dbName, String tblName, String indexName,
List<String> columnNames) throws HSJException {
return getClient().requsetOpenIndex(dbName, tblName, indexName, columnNames);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#openIndex(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.List)
*/
// public String openIndex(String indexId, String dbName, String tblName,
// String indexName, List<String> columnNames) {
//
// return getClient().requsetOpenIndex(indexId, dbName, tblName, indexName, columnNames);
// }
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#auth(java.lang.String, java.lang.String)
*/
public void auth(String authType, String authKey) throws HSJException {
getClient().requsetAuth(authType, authKey);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#insert(java.lang.String, java.util.List)
*/
public void insert(String indexId, List<String> values) throws HSJException {
getClient().requsetInsert(indexId, values);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#find(java.lang.String, com.elifes.hsj.model.CompareOperator, java.lang.String[], int, int, java.lang.String[])
*/
public ResultSet find(String id, CompareOperator operator,
String[] filterValues, int limit, int offset,
String[] filterColumnNames) {
return getClient().requsetFind(id, operator, filterValues, limit, offset, filterColumnNames);
}
public void insert(List<String> values) {
// TODO Auto-generated method stub
}
public ResultSet find(CompareOperator operator, String[] filterValues,
int limit, int offset, String[] filterColumnNames) {
// TODO Auto-generated method stub
return null;
}
}
| UTF-8 | Java | 4,228 | java | DefaultHSJManager.java | Java | [
{
"context": "/**\r\n * Copyright (c) 2011-2015 1lifes.com\r\n * HSJ java-handlersocket\r\n * Id: DefaultHSJMana",
"end": 42,
"score": 0.6867730021476746,
"start": 32,
"tag": "EMAIL",
"value": "1lifes.com"
},
{
"context": "fes.hsj.util.Constants;\r\n\r\n/**\r\n * 描述:\r\n * @author yangqiang\r\n * @createtime 2011-11-12下午12:40:13\r\n *\r\n */\r\npu",
"end": 815,
"score": 0.9066973328590393,
"start": 806,
"tag": "USERNAME",
"value": "yangqiang"
}
]
| null | []
| /**
* Copyright (c) 2011-2015 <EMAIL>
* HSJ java-handlersocket
* Id: DefaultHSJManager.java
*/
package com.elifes.hsj.impl;
import java.sql.ResultSet;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;
import com.elifes.hsj.HSJManager;
import com.elifes.hsj.IDBConfigLoader;
import com.elifes.hsj.IDBLookupStrategy;
import com.elifes.hsj.client.HSJClient;
import com.elifes.hsj.client.HSJClientFactory;
import com.elifes.hsj.exception.HSJException;
import com.elifes.hsj.model.CompareOperator;
import com.elifes.hsj.model.DBConfig;
import com.elifes.hsj.model.TableConfig;
import com.elifes.hsj.util.Constants;
/**
* 描述:
* @author yangqiang
* @createtime 2011-11-12下午12:40:13
*
*/
public class DefaultHSJManager implements HSJManager {
private static final Logger logger = Logger.getLogger(DefaultHSJManager.class);
private static DefaultHSJManager self = new DefaultHSJManager();
private ConcurrentMap<String, Channel> connectionMap = new ConcurrentHashMap<String, Channel>();
private ConcurrentMap<TableConfig, String> indexIdMap = new ConcurrentHashMap<TableConfig, String>();
//ThreadLocal<OpenIndexContext> ctx;
//private IDBLookupStrategy dbLookupStrategy;
private String encoding = Constants.DEFAULT_ENCODING;
private TableConfig tableConfig;
// static{
// init();
// }
public static DefaultHSJManager getInstance(){
return self;
}
public String init(IDBLookupStrategy dbLookupStrategy) throws HSJException {
tableConfig = dbLookupStrategy.lookup(null);
String indexId = null;
if(!indexIdMap.containsKey(tableConfig)){
indexId = openIndex(tableConfig);
indexIdMap.putIfAbsent(tableConfig, indexId);
}
return indexId;
}
private HSJClient getClient(){
HSJClientFactory hsjClientFactory = HSJClientFactory.getInstance();
hsjClientFactory.setEncoding(encoding);
hsjClientFactory.setTableConfig(tableConfig);
return hsjClientFactory.createClient(tableConfig.getDbConfig().getIp(), tableConfig.getDbConfig().getPort());
}
public String openIndex(TableConfig tableConfig) throws HSJException {
return openIndex(
tableConfig.getDbConfig().getDbName(),
tableConfig.getTblName(), tableConfig.getIndexName(),
tableConfig.getColumnNames());
}
public String openIndex(String dbName, String tblName, String indexName,
List<String> columnNames) throws HSJException {
return getClient().requsetOpenIndex(dbName, tblName, indexName, columnNames);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#openIndex(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.List)
*/
// public String openIndex(String indexId, String dbName, String tblName,
// String indexName, List<String> columnNames) {
//
// return getClient().requsetOpenIndex(indexId, dbName, tblName, indexName, columnNames);
// }
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#auth(java.lang.String, java.lang.String)
*/
public void auth(String authType, String authKey) throws HSJException {
getClient().requsetAuth(authType, authKey);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#insert(java.lang.String, java.util.List)
*/
public void insert(String indexId, List<String> values) throws HSJException {
getClient().requsetInsert(indexId, values);
}
/* (non-Javadoc)
* @see com.elifes.hsj.HSJManager#find(java.lang.String, com.elifes.hsj.model.CompareOperator, java.lang.String[], int, int, java.lang.String[])
*/
public ResultSet find(String id, CompareOperator operator,
String[] filterValues, int limit, int offset,
String[] filterColumnNames) {
return getClient().requsetFind(id, operator, filterValues, limit, offset, filterColumnNames);
}
public void insert(List<String> values) {
// TODO Auto-generated method stub
}
public ResultSet find(CompareOperator operator, String[] filterValues,
int limit, int offset, String[] filterColumnNames) {
// TODO Auto-generated method stub
return null;
}
}
| 4,225 | 0.739213 | 0.733523 | 128 | 30.953125 | 30.924267 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false | 15 |
5ab11c9b5b389a1b04c22b1787efd8f7ef4dac65 | 11,089,605,627,246 | b8a07782a8ad8cbe15577f45672f2ceb9ec3645a | /sprint06/task01.java | 75f804edde5865a45c4e12af15dca773e66b5740 | []
| no_license | SlobodianBohdan/java-online-marathon-one | https://github.com/SlobodianBohdan/java-online-marathon-one | 876a231df4572e6c783ee492a97ebc4f960d1482 | 03b4ef87751482cf215c4880a6c1eb6a65ab8066 | refs/heads/master | 2023-04-02T04:14:00.847000 | 2021-04-14T19:34:10 | 2021-04-14T19:34:10 | 250,472,966 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Create next types: Person (field String name), Student (fields String studyPlace, int studyYears) and Worker (fields String workPosition, int experienceYears). Classes Student and Worker are derived from class Person. All classes have getters to return fields.
// Create a maxDuration() method of the MyUtils class to return a list of Students with maximum duration of study and Workers with maximum experience.
// For example, for a given list
// [Person [name=Ivan], Student [name=Petro, studyPlace=University, studyYears=3], Worker [name=Andriy, workPosition=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Worker [name=Ira, workPosition=Manager, experienceYears=8], Student [name=Ihor, studyPlace=University, studyYears=4]]
// you should get
// [Worker [name=Andriy, workPosition=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Student [name=Ihor, studyPlace=University, studyYears=4]]
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class Person {
// Code
private String name;
public Person() {
}
public String getName() {
return name;
}
public Person(String name) {
this.name = name;
}
@Override
public String toString() {
return "Person{" +
"name='" + name + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
if (name == null) return false;
Person person = (Person) o;
return getName().equals(person.getName());
}
@Override
public int hashCode() {
return super.hashCode();
}
}
class Student extends Person {
// Code
private String studyPlace;
private int studyYears;
public Student() {
}
public Student(String name, String studyPlace, int studyYears) {
super(name);
this.studyPlace = studyPlace;
this.studyYears = studyYears;
}
public String getStudyPlace() {
return studyPlace;
}
public int getStudyYears() {
return studyYears;
}
@Override
public String toString() {
return "Student{" + "'" + getName() + '\'' +
", studyPlace='" + studyPlace + '\'' +
", studyYears=" + studyYears +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Student)) return false;
if (!super.equals(o)) return false;
if (studyYears == 0) return false;
if (studyPlace == null) return false;
Student student = (Student) o;
return getName().equals(student.getName()) &&
getStudyYears() == student.getStudyYears() &&
getStudyPlace().equals(student.getStudyPlace());
}
@Override
public int hashCode() {
return ((getName().length()+getStudyYears()+getStudyPlace().length()))*31;
}
}
class Worker extends Person {
// Code
private String workPosition;
private int experienceYears;
public Worker() {
}
public Worker(String name, String workPosition, int experienceYears) {
super(name);
this.workPosition = workPosition;
this.experienceYears = experienceYears;
}
public String getWorkPosition() {
return workPosition;
}
public int getExperienceYears() {
return experienceYears;
}
@Override
public String toString() {
return "Worker{" +
"name=" + "'" + getName() + '\'' +
", workPosition='" + workPosition + '\'' +
", experienceYears=" + experienceYears +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Worker)) return false;
if (!super.equals(o)) return false;
if (experienceYears == 0) return false;
if (workPosition == null) return false;
Worker worker = (Worker) o;
return getName().equals(worker.getName()) &&
getExperienceYears() == worker.getExperienceYears() &&
getWorkPosition().equals(worker.getWorkPosition());
}
@Override
public int hashCode() {
return (getName().length()+getExperienceYears()+ getWorkPosition().length())*31;
}
}
class MyUtils {
public List<Person> maxDuration(List<Person> persons) {
List<Person> list = new ArrayList<>();
Person worker = new Worker();
Person student = new Student();
if (persons.isEmpty() || persons.get(0) == null){
return list;
}
for (Person p : persons) {
if (p instanceof Student) {
if (((Student) p).getStudyYears() > ((Student)student).getStudyYears() && !student.equals(p)) {
student = (Student) p;
}
}
if (p instanceof Worker){
if (((Worker) p).getExperienceYears() > ((Worker)worker).getExperienceYears() && !worker.equals(p)) {
worker = (Worker) p;
}
}
}
if (student.getName() == null || worker.getName() == null){
return list;
}
list.add(student);
list.add(worker);
for (Person p : persons) {
if (p instanceof Student) {
if (((Student) p).getStudyYears() == ((Student)student).getStudyYears() && !student.equals(p)) {
list.add(p);
}
}
if (p instanceof Worker) {
if (((Worker) p).getExperienceYears() == ((Worker)worker).getExperienceYears() && !worker.equals(p)) {
list.add(p);
}
}
}
return list;
}
}
| UTF-8 | Java | 6,015 | java | task01.java | Java | [
{
"context": "// For example, for a given list\n// [Person [name=Ivan], Student [name=Petro, studyPlace=University, stu",
"end": 469,
"score": 0.9997919797897339,
"start": 465,
"tag": "NAME",
"value": "Ivan"
},
{
"context": " given list\n// [Person [name=Ivan], Student [name=Petro, studyPlace=University, studyYears=3], Worker [na",
"end": 491,
"score": 0.9997854232788086,
"start": 486,
"tag": "NAME",
"value": "Petro"
},
{
"context": "tudyPlace=University, studyYears=3], Worker [name=Andriy, workPosition=Developer, experienceYears=12], Stu",
"end": 550,
"score": 0.9997775554656982,
"start": 544,
"tag": "NAME",
"value": "Andriy"
},
{
"context": "ion=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Worker [name=",
"end": 617,
"score": 0.9997934103012085,
"start": 611,
"tag": "NAME",
"value": "Stepan"
},
{
"context": ", studyPlace=College, studyYears=4], Worker [name=Ira, workPosition=Manager, experienceYears=8], Studen",
"end": 670,
"score": 0.9998012781143188,
"start": 667,
"tag": "NAME",
"value": "Ira"
},
{
"context": "sition=Manager, experienceYears=8], Student [name=Ihor, studyPlace=University, studyYears=4]]\n// you sho",
"end": 732,
"score": 0.9998312592506409,
"start": 728,
"tag": "NAME",
"value": "Ihor"
},
{
"context": "studyYears=4]]\n// you should get\n// [Worker [name=Andriy, workPosition=Developer, experienceYears=12], Stu",
"end": 813,
"score": 0.9997575879096985,
"start": 807,
"tag": "NAME",
"value": "Andriy"
},
{
"context": "ion=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Student [name",
"end": 880,
"score": 0.9998008012771606,
"start": 874,
"tag": "NAME",
"value": "Stepan"
},
{
"context": " studyPlace=College, studyYears=4], Student [name=Ihor, studyPlace=University, studyYears=4]]\n\nimport ja",
"end": 935,
"score": 0.9998067021369934,
"start": 931,
"tag": "NAME",
"value": "Ihor"
}
]
| null | []
| // Create next types: Person (field String name), Student (fields String studyPlace, int studyYears) and Worker (fields String workPosition, int experienceYears). Classes Student and Worker are derived from class Person. All classes have getters to return fields.
// Create a maxDuration() method of the MyUtils class to return a list of Students with maximum duration of study and Workers with maximum experience.
// For example, for a given list
// [Person [name=Ivan], Student [name=Petro, studyPlace=University, studyYears=3], Worker [name=Andriy, workPosition=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Worker [name=Ira, workPosition=Manager, experienceYears=8], Student [name=Ihor, studyPlace=University, studyYears=4]]
// you should get
// [Worker [name=Andriy, workPosition=Developer, experienceYears=12], Student [name=Stepan, studyPlace=College, studyYears=4], Student [name=Ihor, studyPlace=University, studyYears=4]]
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class Person {
// Code
private String name;
public Person() {
}
public String getName() {
return name;
}
public Person(String name) {
this.name = name;
}
@Override
public String toString() {
return "Person{" +
"name='" + name + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
if (name == null) return false;
Person person = (Person) o;
return getName().equals(person.getName());
}
@Override
public int hashCode() {
return super.hashCode();
}
}
class Student extends Person {
// Code
private String studyPlace;
private int studyYears;
public Student() {
}
public Student(String name, String studyPlace, int studyYears) {
super(name);
this.studyPlace = studyPlace;
this.studyYears = studyYears;
}
public String getStudyPlace() {
return studyPlace;
}
public int getStudyYears() {
return studyYears;
}
@Override
public String toString() {
return "Student{" + "'" + getName() + '\'' +
", studyPlace='" + studyPlace + '\'' +
", studyYears=" + studyYears +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Student)) return false;
if (!super.equals(o)) return false;
if (studyYears == 0) return false;
if (studyPlace == null) return false;
Student student = (Student) o;
return getName().equals(student.getName()) &&
getStudyYears() == student.getStudyYears() &&
getStudyPlace().equals(student.getStudyPlace());
}
@Override
public int hashCode() {
return ((getName().length()+getStudyYears()+getStudyPlace().length()))*31;
}
}
class Worker extends Person {
// Code
private String workPosition;
private int experienceYears;
public Worker() {
}
public Worker(String name, String workPosition, int experienceYears) {
super(name);
this.workPosition = workPosition;
this.experienceYears = experienceYears;
}
public String getWorkPosition() {
return workPosition;
}
public int getExperienceYears() {
return experienceYears;
}
@Override
public String toString() {
return "Worker{" +
"name=" + "'" + getName() + '\'' +
", workPosition='" + workPosition + '\'' +
", experienceYears=" + experienceYears +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Worker)) return false;
if (!super.equals(o)) return false;
if (experienceYears == 0) return false;
if (workPosition == null) return false;
Worker worker = (Worker) o;
return getName().equals(worker.getName()) &&
getExperienceYears() == worker.getExperienceYears() &&
getWorkPosition().equals(worker.getWorkPosition());
}
@Override
public int hashCode() {
return (getName().length()+getExperienceYears()+ getWorkPosition().length())*31;
}
}
class MyUtils {
public List<Person> maxDuration(List<Person> persons) {
List<Person> list = new ArrayList<>();
Person worker = new Worker();
Person student = new Student();
if (persons.isEmpty() || persons.get(0) == null){
return list;
}
for (Person p : persons) {
if (p instanceof Student) {
if (((Student) p).getStudyYears() > ((Student)student).getStudyYears() && !student.equals(p)) {
student = (Student) p;
}
}
if (p instanceof Worker){
if (((Worker) p).getExperienceYears() > ((Worker)worker).getExperienceYears() && !worker.equals(p)) {
worker = (Worker) p;
}
}
}
if (student.getName() == null || worker.getName() == null){
return list;
}
list.add(student);
list.add(worker);
for (Person p : persons) {
if (p instanceof Student) {
if (((Student) p).getStudyYears() == ((Student)student).getStudyYears() && !student.equals(p)) {
list.add(p);
}
}
if (p instanceof Worker) {
if (((Worker) p).getExperienceYears() == ((Worker)worker).getExperienceYears() && !worker.equals(p)) {
list.add(p);
}
}
}
return list;
}
}
| 6,015 | 0.573067 | 0.570241 | 195 | 29.846153 | 38.313377 | 323 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.507692 | false | false | 15 |
c86623407b2cbcc230bb7ff5e7068a96297f2cc5 | 14,663,018,409,050 | 64434bd8f365886c560d4dc828aa0a4459f57756 | /app/src/main/java/com/goodweather/app/util/VolleyUtil.java | d6699c5fb581cd5515c3348bb0b4d78d8726e03a | [
"Apache-2.0"
]
| permissive | AlbertKidd/goodweather | https://github.com/AlbertKidd/goodweather | 012e737a17b005e78de09a0b94822ceef6d4a560 | bfc9e7dc2d01a1600f8f4d4bb593a52b5e706c55 | refs/heads/master | 2020-04-10T10:10:15.017000 | 2016-12-01T09:37:56 | 2016-12-01T09:37:56 | 50,756,229 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.goodweather.app.util;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
/**
* Created by niuwa on 2016/5/22.
*/
public class VolleyUtil {
private static RequestQueue mRequestQueue = Volley.newRequestQueue(MyApplication.getContext());
public static RequestQueue getRequestQueue(){
return mRequestQueue;
}
}
| UTF-8 | Java | 374 | java | VolleyUtil.java | Java | [
{
"context": ".android.volley.toolbox.Volley;\n\n/**\n * Created by niuwa on 2016/5/22.\n */\npublic class VolleyUtil {\n p",
"end": 141,
"score": 0.9996868968009949,
"start": 136,
"tag": "USERNAME",
"value": "niuwa"
}
]
| null | []
| package com.goodweather.app.util;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
/**
* Created by niuwa on 2016/5/22.
*/
public class VolleyUtil {
private static RequestQueue mRequestQueue = Volley.newRequestQueue(MyApplication.getContext());
public static RequestQueue getRequestQueue(){
return mRequestQueue;
}
}
| 374 | 0.751337 | 0.73262 | 14 | 25.714285 | 26.504524 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 15 |
77e17fe8d1b6d382415fbf3e243f7817788aebf3 | 28,527,172,829,556 | 9a1afaa3768108843f59e3980054bda3d4a7c43f | /app/src/main/java/dev/ldev/gpsicon/notify/NotifyIconProviderDirector.java | 9e8fa6e52c07011f40d94fcd504b48871fa9aa18 | []
| no_license | test-acc-vaccym/GpsIcon | https://github.com/test-acc-vaccym/GpsIcon | db4e1e31b73de95b487a2d1b77502da4db5d197c | 4c03175ef118a3069a139eafc2389ddd3157ec22 | refs/heads/master | 2021-05-09T23:46:08.929000 | 2018-01-14T20:42:50 | 2018-01-14T20:42:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dev.ldev.gpsicon.notify;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import dev.ldev.gpsicon.C;
public class NotifyIconProviderDirector {
private static String _iconProviderName;
private static INotifyIconProvider _iconProvider;
private Context _context;
public NotifyIconProviderDirector(Context context) {
_context = context;
}
public static void switchIconProvider(String iconProviderName) {
_iconProviderName = iconProviderName;
_iconProvider = null;
}
public INotifyIconProvider getGpsIconManager() {
INotifyIconProvider iconProvider = _iconProvider;
if (iconProvider == null) {
if (_iconProviderName == null) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
String iconType = prefs.getString(C.NOTIFY_ICON_TYPE_KEY, NotifyIconTypes.BLINK);
iconProvider = getIconProvider(iconType);
} else {
iconProvider = getIconProvider(_iconProviderName);
}
_iconProvider = iconProvider;
}
return iconProvider;
}
private INotifyIconProvider getIconProvider(String name) {
if (name.equals(NotifyIconTypes.BU)) {
return new BuNotifyIconProvider(_context);
}
return new BlinkNotifyIconProvider();
}
}
| UTF-8 | Java | 1,518 | java | NotifyIconProviderDirector.java | Java | []
| null | []
| package dev.ldev.gpsicon.notify;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import dev.ldev.gpsicon.C;
public class NotifyIconProviderDirector {
private static String _iconProviderName;
private static INotifyIconProvider _iconProvider;
private Context _context;
public NotifyIconProviderDirector(Context context) {
_context = context;
}
public static void switchIconProvider(String iconProviderName) {
_iconProviderName = iconProviderName;
_iconProvider = null;
}
public INotifyIconProvider getGpsIconManager() {
INotifyIconProvider iconProvider = _iconProvider;
if (iconProvider == null) {
if (_iconProviderName == null) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
String iconType = prefs.getString(C.NOTIFY_ICON_TYPE_KEY, NotifyIconTypes.BLINK);
iconProvider = getIconProvider(iconType);
} else {
iconProvider = getIconProvider(_iconProviderName);
}
_iconProvider = iconProvider;
}
return iconProvider;
}
private INotifyIconProvider getIconProvider(String name) {
if (name.equals(NotifyIconTypes.BU)) {
return new BuNotifyIconProvider(_context);
}
return new BlinkNotifyIconProvider();
}
}
| 1,518 | 0.651515 | 0.651515 | 49 | 28.979591 | 26.216906 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.