| | |
| | | package com.java110.api.importData.adapt; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.components.ValueUtil; |
| | | import com.java110.api.importData.DefaultImportDataAdapt; |
| | | import com.java110.api.importData.IImportDataCleaningAdapt; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | Map waterType = new HashMap(); |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | if (osIndex < 9) { |
| | | if (osIndex < 8) { |
| | | continue; |
| | | } |
| | | Object[] os = oList.get(osIndex); |
| | |
| | | continue; |
| | | } |
| | | |
| | | // if (ValueUtil.defaultValue(os[22]).equals("") || ValueUtil.defaultValue(os[23]).equals("")) { |
| | | // if (Vtil.defaultValue(os[22]).equals("") || Vtil.defaultValue(os[23]).equals("")) { |
| | | // throw new IllegalArgumentException((osIndex + 1) + "行请填写本期度数和上期度数"); |
| | | // } |
| | | MeterWaterPo po = new MeterWaterPo(); |
| | | setCommunityId(po, os, maps); |
| | | po.setConfigId(ValueUtil.defaultValue(paramIn.getString("configId"),"922026011955390006")); |
| | | po.setFeeTypeCd(ValueUtil.defaultValue(paramIn.getString("feeTypeCd"),"630000007")); |
| | | po.setConfigId(Vtil.defaultValue(paramIn.getString("configId"),"922026011955390006")); |
| | | po.setFeeTypeCd(Vtil.defaultValue(paramIn.getString("feeTypeCd"),"630000007")); |
| | | po.setbId("-1"); |
| | | // po.setMeterType(ValueUtil.defaultValue(os[3])); |
| | | // po.setMeterType(Vtil.defaultValue(os[3])); |
| | | po.setObjType("3333"); |
| | | setRoomDto(po, os); |
| | | po.setPreDegrees(ValueUtil.defaultValueToNull(os[22])); |
| | | po.setPreDegrees(Vtil.defaultValue(os[22], null)); |
| | | // po.setMeterType("102025090794960328"); |
| | | |
| | | setMeterType(os, po, waterType); |
| | | po.setCurDegrees(ValueUtil.defaultValueToNull(os[23])); |
| | | po.setCurDegrees(Vtil.defaultValue(os[23], null)); |
| | | Date date = new Date(); |
| | | date.setYear(defaultInteger(os[18]) - 1900); |
| | | date.setMonth(defaultInteger(os[19])); |
| | |
| | | po.setCurReadingTime(Vtil.processDateEnhanced(DateUtil.getDateFromStringA(po.getPreReadingTime()), "end", DateUtil.DATE_FORMATE_STRING_A, null ,null)); |
| | | po.setStatusCd("0"); |
| | | po.setUserId(paramIn.getString("userId")); |
| | | po.setRemark(ValueUtil.defaultValue(os[28])); |
| | | po.setCommunityCode(Vtil.appendHyphenToRight(ValueUtil.defaultValue(os[0]))); |
| | | po.setCommunityName(ValueUtil.defaultValue(os[1])); |
| | | po.setRemark(Vtil.defaultValue(os[28])); |
| | | po.setCommunityCode(Vtil.appendHyphenToRight(Vtil.defaultValue(os[0]))); |
| | | po.setCommunityName(Vtil.defaultValue(os[1])); |
| | | try { |
| | | po.setPrice(Vtil.defaultDouble(os[26])); |
| | | } catch (Exception e) { |
| | | po.setRemark(po.getRemark() + ";双电费:" + Vtil.defaultValue(os[26])); |
| | | } |
| | | po.setPowerSupplyBureau(ValueUtil.defaultValue(os[4])); |
| | | po.setHouseholdName(ValueUtil.defaultValue(os[5])); |
| | | po.setHouseholdNumber(ValueUtil.defaultValue(os[6])); |
| | | po.setElectricMeterId(ValueUtil.defaultValue(os[7])); |
| | | po.setHandler(ValueUtil.defaultValue(os[8])); |
| | | po.setIsTransferred(ValueUtil.defaultValue(os[9])); |
| | | po.setCompanyNameAfterTransfer(ValueUtil.defaultValue(os[10])); |
| | | po.setTransferDate(ValueUtil.defaultValue(os[11])); |
| | | po.setCorrespondingHouseholdCount(ValueUtil.defaultValue(os[17])); |
| | | po.setLastPaymentDate(ValueUtil.defaultValue(os[20])); |
| | | po.setReadingType(ValueUtil.defaultValue(os[21])); |
| | | po.setMultiplyingFactor(ValueUtil.defaultValue(os[24])); |
| | | po.setUnitPrice(ValueUtil.defaultValue(os[27])); |
| | | po.setInvoiceAmount(ValueUtil.defaultValue(os[29])); |
| | | po.setAmountDifference(ValueUtil.defaultValue(os[31])); |
| | | po.setAutoDeduction(ValueUtil.defaultValue(os[32])); |
| | | po.setRemark2(ValueUtil.defaultValue(os[34])); |
| | | po.setAddress(ValueUtil.defaultValue(os[16])); |
| | | po.setWriter(ValueUtil.defaultValue(os[35])); |
| | | po.setWriteTime(ValueUtil.defaultValue(os,36)); |
| | | po.setAuditUserName(ValueUtil.defaultValue(os,37)); |
| | | try { |
| | | po.setCreateTime(DateUtil.getDateFromStringB(ValueUtil.defaultValue(os[38]))); |
| | | po.setPowerSupplyBureau(Vtil.defaultValue(os[4])); |
| | | po.setHouseholdName(Vtil.defaultValue(os[5])); |
| | | po.setHouseholdNumber(Vtil.defaultValue(os[6])); |
| | | po.setElectricMeterId(Vtil.defaultValue(os[7])); |
| | | po.setHandler(Vtil.defaultValue(os[8])); |
| | | po.setIsTransferred(Vtil.defaultValue(os[9])); |
| | | po.setCompanyNameAfterTransfer(Vtil.defaultValue(os[10])); |
| | | po.setTransferDate(Vtil.defaultValue(os[11])); |
| | | po.setCorrespondingHouseholdCount(Vtil.defaultValue(os[17])); |
| | | po.setLastPaymentDate(Vtil.defaultValue(os[20])); |
| | | po.setReadingType(Vtil.defaultValue(os[21])); |
| | | po.setMultiplyingFactor(Vtil.defaultValue(os[24])); |
| | | po.setUnitPrice(Vtil.defaultValue(os[27])); |
| | | po.setInvoiceAmount(Vtil.defaultValue(os[29])); |
| | | po.setAmountDifference(Vtil.defaultValue(os[31])); |
| | | po.setAutoDeduction(Vtil.defaultValue(os[32])); |
| | | po.setRemark2(Vtil.defaultValue(os[34])); |
| | | po.setAddress(Vtil.defaultValue(os[16])); |
| | | po.setWriter(Vtil.defaultValue(os[35])); |
| | | po.setWriteTime(Vtil.defaultValue(os[36])); |
| | | po.setPayDate(Vtil.defaultValue(os[33])); |
| | | po.setAuditUserName(Vtil.defaultValue(os[37])); |
| | | } catch (ArrayIndexOutOfBoundsException e) { |
| | | //防止下标溢出 |
| | | } |
| | | try { |
| | | po.setCreateTime(DateUtil.getDateFromStringB(Vtil.defaultValue(os[38]))); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | po.setPayDate(ValueUtil.defaultValue(os[33])); |
| | | meterWaterPoList.add(po); |
| | | } |
| | | return meterWaterPoList; |
| | |
| | | |
| | | private void setMeterType(Object[] os, MeterWaterPo po, Map waterType) { |
| | | MeterTypeDto meterTypeDto = new MeterTypeDto(); |
| | | meterTypeDto.setTypeName(Vtil.defaultValue(os[7],"导入水费")); |
| | | meterTypeDto.setTypeName(Vtil.defaultValue(os[3],"导入电费")); |
| | | meterTypeDto.setCommunityId(po.getCommunityId()); |
| | | Object orDefault = waterType.getOrDefault(meterTypeDto.getTypeName(), "无数据"); |
| | | if (!orDefault.equals("无数据")){ |
| | |
| | | } |
| | | |
| | | private void setRoomDto(MeterWaterPo po, Object[] os) { |
| | | po.setRoadName(ValueUtil.defaultValue(os[12])); |
| | | po.setFloorNum(ValueUtil.defaultValue(os[13])); |
| | | po.setUnitNum(ValueUtil.defaultValue(os[14])); |
| | | po.setRoomNum(ValueUtil.defaultValue(os[15])); |
| | | po.setRoadName(Vtil.defaultValue(os[12])); |
| | | po.setFloorNum(Vtil.defaultValue(os[13])); |
| | | po.setUnitNum(Vtil.defaultValue(os[14])); |
| | | po.setRoomNum(Vtil.defaultValue(os[15])); |
| | | po.setObjName(po.getRoadName() + "-" + po.getFloorNum() + "-" + po.getUnitNum() + "-" + po.getRoomNum()); |
| | | } |
| | | |
| | | |
| | | public void setCommunityId(MeterWaterPo po, Object[] os, List<Map<String, Object>> maps) { |
| | | for (Map<String, Object> map : maps) { |
| | | if (ValueUtil.defaultValue(os[0]).isEmpty() && ValueUtil.defaultValue(os[1]).isEmpty()){ |
| | | if (Vtil.defaultValue(os[0])== null && Vtil.defaultValue(os[1])== null){ |
| | | throw new IllegalArgumentException("小区名称和小区编号均为空"); |
| | | } |
| | | if (ValueUtil.defaultValue(os[0]).isEmpty()) { |
| | | if (Vtil.defaultValue(map.get("name")).contains(ValueUtil.defaultValue(os[1]))) { |
| | | if (Vtil.defaultValue(os[0])== null) { |
| | | if (Vtil.defaultValue(map.get("name")).contains(Vtil.defaultValue(os[1]))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } else if (ValueUtil.defaultValue(os[1]).isEmpty()){ |
| | | if (Vtil.defaultValue(map.get("communityCode")).equals(ValueUtil.defaultValue(os[0]))) { |
| | | } else if (Vtil.defaultValue(os[1])== null){ |
| | | if (Vtil.defaultValue(map.get("communityCode")).equals(Vtil.defaultValue(os[0]))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } else { |
| | | if (Vtil.defaultValue(map.get("communityCode")).equals(ValueUtil.defaultValue(os[0])) && Vtil.defaultValue(map.get("name")).contains(ValueUtil.defaultValue(os[1]))) { |
| | | if (Vtil.defaultValue(map.get("communityCode")).equals(Vtil.defaultValue(os[0])) && Vtil.defaultValue(map.get("name")).contains(Vtil.defaultValue(os[1]))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | po.setCommunityId(null); |
| | | po.setCommunityCode(ValueUtil.defaultValue(os[0])); |
| | | po.setCommunityName(ValueUtil.defaultValue(os[1])); |
| | | po.setCommunityCode(Vtil.defaultValue(os[0])); |
| | | po.setCommunityName(Vtil.defaultValue(os[1])); |
| | | } |
| | | } |