Skip to content

Instantly share code, notes, and snippets.

package com.intime.opc.tools
import groovy.transform.CompileStatic
import org.apache.http.HttpResponse
import org.apache.http.HttpStatus
import org.apache.http.client.HttpClient
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils
@houdq
houdq / mybatis-date
Last active April 3, 2018 04:46
mybatis-date
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@houdq
houdq / beanCopy.java
Created July 10, 2017 09:54
java/groovy bean copy
@CompileStatic
class BeanUtil {
static def copyProperties(source, target) {
this.copyProperties(source, target, [] as String[])
}
static def copyProperties(source, target, String[] ex) {
def exludeList = ['class', 'metaClass']
exludeList.addAll(ex)
source.properties.each { key, value ->
使用xattr -c 文件名 可以去除@
@houdq
houdq / test.groovy
Last active June 2, 2017 02:47
Remove null items from a list in Groovy
def list = []
class A {
String a
}
list.add(new A(a: "a"))
list.add(new A(a: "b"))
list.add(new A(a: null))
list.add(new A())
import com.sun.org.apache.xml.internal.utils.StopParseException
import java.lang.reflect.UndeclaredThrowableException
class ThirdException extends Exception {
public ThirdException(String msg) {
super(msg)
}
@houdq
houdq / mac defualt jdk
Created April 18, 2017 01:50
mac defualt jdk
export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
export PATH=$JAVA_HOME/bin:$PATH
@houdq
houdq / gist:3f9d4bd0a9748b647b20a0e25fbd5979
Created February 9, 2017 03:33
spock 单元测试 免 runapp
@CompileStatic
@ActiveProfiles(value = "testing")
@ContextConfiguration(loader = SpringBootContextLoader, classes = [InvestmentApplication])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@houdq
houdq / uuid_grails.md
Last active December 21, 2016 06:15
gails id use uuid
class User {

    String id = UUID.randomUUID().toString()

    static mapping = {
        id generator:'assigned'
    }
}
@houdq
houdq / export.md
Last active December 21, 2016 02:38
grails 导出 excel

引入插件

compile ":excel-export:0.2.1"

导出方法

/**     * 导出Excel     * */    
def export(){