Skip to content

Instantly share code, notes, and snippets.

@EvgenJin
Last active July 20, 2020 19:23
Show Gist options
  • Save EvgenJin/efba98538f9cbf9585a122c472700d8f to your computer and use it in GitHub Desktop.
Save EvgenJin/efba98538f9cbf9585a122c472700d8f to your computer and use it in GitHub Desktop.
#коллекция
allDocs = [:]
model.documents.each{
allDocs.put(it.code, it.count)
}
params.add(new SimpleDateFormat("dd/MM/yyyy").format(new Date()))
def jms = new XmlSlurper().parseText(payload)
def request_id = jms.'@ParentID'.text()
def nameSpacesMap = [
soapenv: 'http://schemas.xmlsoap.org/soap/envelope/',
exp: 'http://export.credit.gpb.ru'
]
def builder = new StreamingMarkupBuilder()
builder.encoding = 'utf-8'
def soapRequest = builder.bind {
mkp.xmlDeclaration()
namespaces << nameSpacesMap
soapenv.Envelope {
soapenv.Body {
exp.exportRequest {
exp.appName(flowVars["variable"])
exp.id(request_id)
}
}
}
}
#CDATA
payload = ru.gpb.mule.util.Utils.makeString(payload)
def response = new XmlSlurper().parseText(payload)
def cdata = response.Body.methodResponse.return.text()
def reestr = new XmlSlurper().parseText(cdata)
.findAll{!it.data.srcId.isEmpty()}
#массив для цикла
def Integer counts = xml.Order.size()
def orderList = []
if (counts > 0) {
1.upto(counts, {
orderList.add(it)
})
}
def addMonths(months) {
def today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()-1)
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd")
SimpleDateFormat sdf_out = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")
Calendar c = Calendar.getInstance()
c.setTime(sdf.parse(today))
c.add(Calendar.MONTH, months)
res = sdf_out.format(c.getTime())
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment