| | |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.po.meter.MeterWaterPo; |
| | | import com.java110.po.payFee.PayFeeAuditPo; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.ImportExcelUtils; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.utils.util.*; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 水电抄表 |
| | |
| | | @Override |
| | | public List analysisExcel(Workbook workbook, JSONObject paramIn, ComponentValidateResult result) throws Exception { |
| | | List<MeterWaterPo> meterWaterPoList = new ArrayList<MeterWaterPo>(); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(new CommunityDto()); |
| | | List<Map<String, Object>> maps = BeanConvertUtil.beanCovertMapListC(communityInnerServiceSMOImpl.queryCommunitys(new CommunityDto())); |
| | | |
| | | |
| | | Sheet sheet = null; |
| | |
| | | } |
| | | |
| | | MeterWaterPo po = new MeterWaterPo(); |
| | | setCommunityId(po, os); |
| | | setCommunityId(po, os, maps); |
| | | po.setbId("-1"); |
| | | po.setMeterType(Vtil.defaultValue(os[7])); |
| | | po.setObjType("3333"); |
| | |
| | | Date date = new Date(); |
| | | date.setYear(defaultInteger(os[18]) - 1900); |
| | | date.setMonth(defaultInteger(os[19])); |
| | | po.setCurReadingTime(defaultInteger(os[18]) + "-" + defaultInteger(os[19]) + "-01 00:00:00"); |
| | | po.setPreReadingTime(DateUtil.getAddMonthStringA(DateUtil.getDateFromStringA(po.getCurReadingTime()), -1)); |
| | | po.setPreReadingTime(defaultInteger(os[18]) + "-" + defaultInteger(os[19]) + "-01 00:00:00"); |
| | | po.setCurReadingTime(Vtil.processDateEnhanced(DateUtil.getDateFromStringA(po.getPreReadingTime()), "end", DateUtil.DATE_FORMATE_STRING_A, null ,null)); |
| | | po.setStatusCd("0"); |
| | | po.setUserId(ValueUtil.defaultValue(paramIn.getString("userId"))); |
| | | po.setConfigId(ValueUtil.defaultValue(paramIn.getString("configId"),"9220260120546511533")); |
| | |
| | | po.setObjName(po.getRoadName() + "-" + po.getFloorNum() + "-" + po.getUnitNum() + "-" + po.getRoomNum()); |
| | | } |
| | | |
| | | public void setCommunityId(MeterWaterPo po, Object[] os) { |
| | | CommunityDto d = new CommunityDto(); |
| | | d.setCommunityCode(Vtil.defaultValue(os[0])); |
| | | d.setName(Vtil.defaultValue(os[1])); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(d); |
| | | if (communityDtos.isEmpty()) { |
| | | throw new IllegalArgumentException("未查询到小区:" + d.getCommunityCode() + d.getName()); |
| | | public void setCommunityId(MeterWaterPo po, Object[] os, List<Map<String, Object>> maps) { |
| | | for (Map<String, Object> map : maps) { |
| | | if (ValueUtil.defaultValue(os[0]).isEmpty()) { |
| | | if (ValueUtil.defaultValue(os[1]).equals(map.get("name"))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } else if (ValueUtil.defaultValue(os[1]).isEmpty()){ |
| | | if (ValueUtil.defaultValue(os[0]).equals(map.get("communityCode"))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } else { |
| | | if (ValueUtil.defaultValue(os[0]).equals(map.get("communityCode")) && ValueUtil.defaultValue(os[1]).equals(map.get("name"))) { |
| | | po.setCommunityId(map.get("communityId").toString()); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | else if (communityDtos.size() > 1) { |
| | | throw new IllegalArgumentException("查询小区异常:存在多个符合条件的小区:" + d.getCommunityCode() + d.getName()); |
| | | } |
| | | po.setCommunityId(communityDtos.get(0).getCommunityId()); |
| | | po.setCommunityCode(Vtil.defaultValue(os[0])); |
| | | po.setCommunityName(Vtil.defaultValue(os[1])); |
| | | po.setCommunityId(null); |
| | | } |
| | | } |