Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File
- class Example {
- static void main(String[] args) {
- new File("/tmp/csv/SIR_STAT_59.PROC_STEP.2017.08.12.FULL.001_1 - копия.csv").eachLine {
- line ->
- //intln "line : $line";
- def colCount = line.split(',').length // кол-во столбцов
- def rows = line.replaceAll("'", '')
- def row = rows.split(',')
- println row[1];
- /*
- for (int i = 1; i < colCount; i++) {
- def row = line.split(',')
- println row[0]
- }*/
- subjectName = FilterGroup.single('ID_PROC_STEP', FilterElement.FilterOperator.contains, [row[0].toDouble()])
- subject = externalDataSource.getObjectList('ARM_Static_PROC_STEP_SIR', null, subjectName, null, null, null, null)
- // println 'из сущности: ' + subject[0].properties.id
- //obj = externalDataSource.getNewObject('A9_PROC_STEP_SIR')
- if (subject[0] != null) {
- obj = subject[0]
- } else if (subject[0] == null) {
- obj = externalDataSource.getNewObject('ARM_Static_PROC_STEP_SIR')
- }
- obj.fields.ID_PROC_STEP.value = row[0].toDouble()
- obj.fields.PROC_INSTANCE_ID.value = row[1].toDouble()
- obj.fields.cSTEP_NAME.value = row[2]
- obj.fields.cASSIGNEE.value = row[4]
- if (row[6] != null && row[6] != '') {
- Date d4 = Date.parse("yyyy-MM-dd HH:mm:ss", row[6])
- obj.fields.dSTEP_START.value = d4
- } else {
- def d4 = null
- }
- if (row[7] != '' && row[7] != null) {
- Date d5 = Date.parse("yyyy-MM-dd HH:mm:ss", row[7])
- obj.fields.dSTEP_FINISH.value = d5
- } else {
- def d5 = null
- }
- obj.fields.CMODIFIED.value = row[10]
- obj.fields.Code.value = row[11]
- tenant = 0
- externalDataSource.updateObject(obj)
- tenant = securityDataProvider.getTenant(arr[i][11].toString().trim())
- externalDataSource.source.query().update('update "ARM_Static_PROC_STEP_SIR" set "Sys_owner" = :code where "Id" = :id').namedParams([code:tenant.id, id:obj.id as Integer]).run()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement