| | |
| | | DEFAULT_TIME |
| | | } |
| | | |
| | | NCHttpService.getFile(timeStr)?.forEach {e -> |
| | | if (e.isJsonObject) { |
| | | val vo = e.asJsonObject |
| | | val nightConstruction = NightConstruction().apply { |
| | | ncNum = vo["nightallnum"].asString |
| | | ncItemName = vo["itemName"].asString |
| | | ncItemUnit = vo["itemUnit"].asString |
| | | ncConstructionUnit = vo["constructionUnit"].asString |
| | | ncPerson = vo["person"].asString |
| | | ncApplyContent = vo["applyContent"].asString |
| | | ncStartDate = dateUtil.StringToDate(vo["startDate"].asString) |
| | | ncEndDate = dateUtil.StringToDate(vo["endDate"].asString) |
| | | ncFileName = vo["filename"].asString |
| | | ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString) |
| | | ncUrl = vo["url"].asString |
| | | |
| | | ncProvinceCode = PROVINCE_CODE |
| | | ncProvinceName = PROVINCE_NAME |
| | | ncCityCode = CITY_CODE |
| | | ncCityName = CITY_NAME |
| | | ncDistrictCode = DISTRICT_CODE |
| | | ncDistrictName = DISTRICT_NAME |
| | | } |
| | | nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncNum", nightConstruction.ncNum) |
| | | }).run { |
| | | nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName) |
| | | }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r-> |
| | | nightConstruction.ncUserId = r.ncUserId |
| | | nightConstruction.ncSceneId = r.ncSceneId |
| | | try { |
| | | NCHttpService.getFile(timeStr)?.forEach {e -> |
| | | if (e.isJsonObject) { |
| | | val vo = e.asJsonObject |
| | | val nightConstruction = NightConstruction().apply { |
| | | ncNum = vo["nightallnum"].asString |
| | | ncItemName = vo["itemName"].asString |
| | | ncItemUnit = vo["itemUnit"].asString |
| | | ncConstructionUnit = vo["constructionUnit"].asString |
| | | ncPerson = vo["person"].asString |
| | | ncApplyContent = vo["applyContent"].asString |
| | | ncStartDate = dateUtil.StringToDate(vo["startDate"].asString) |
| | | ncEndDate = dateUtil.StringToDate(vo["endDate"].asString) |
| | | ncFileName = vo["filename"].asString |
| | | ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString) |
| | | ncUrl = vo["url"].asString |
| | | |
| | | ncProvinceCode = PROVINCE_CODE |
| | | ncProvinceName = PROVINCE_NAME |
| | | ncCityCode = CITY_CODE |
| | | ncCityName = CITY_NAME |
| | | ncDistrictCode = DISTRICT_CODE |
| | | ncDistrictName = DISTRICT_NAME |
| | | } |
| | | if (isEmpty()) { |
| | | nightConstructionMapper.insert(nightConstruction) |
| | | nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncNum", nightConstruction.ncNum) |
| | | }).run { |
| | | nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply { |
| | | createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName) |
| | | }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r-> |
| | | nightConstruction.ncUserId = r.ncUserId |
| | | nightConstruction.ncSceneId = r.ncSceneId |
| | | } |
| | | if (isEmpty()) { |
| | | nightConstructionMapper.insert(nightConstruction) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |
| | | } |
| | | } |