| | |
| | | private String receivedAmountSwitch; |
| | | |
| | | private String squarePrice; |
| | | private String mwPrice; |
| | | private String additionalAmount; |
| | | private String state; |
| | | private String stateName; |
| | |
| | | public void setComputingFormulaText(String computingFormulaText) { |
| | | this.computingFormulaText = computingFormulaText; |
| | | } |
| | | |
| | | public String getMwPrice() { |
| | | return mwPrice; |
| | | } |
| | | |
| | | public void setMwPrice(String mwPrice) { |
| | | this.mwPrice = mwPrice; |
| | | } |
| | | } |
| | |
| | | private String floorNum; |
| | | private String unitNum; |
| | | private String roomNum; |
| | | private double price; |
| | | |
| | | |
| | | public String getRemark() { |
| | |
| | | public void setRoomNum(String roomNum) { |
| | | this.roomNum = roomNum; |
| | | } |
| | | |
| | | public double getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(double price) { |
| | | this.price = price; |
| | | } |
| | | } |
| | |
| | | private String communityId; |
| | | private String objType; |
| | | private String feeId; |
| | | private double price; |
| | | |
| | | |
| | | private Date createTime; |
| | |
| | | public void setObjName(String objName) { |
| | | this.objName = objName; |
| | | } |
| | | |
| | | |
| | | public double getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(double price) { |
| | | this.price = price; |
| | | } |
| | | } |
| | |
| | | private String configId; |
| | | |
| | | private String squarePrice; |
| | | private String mwPrice; |
| | | private String additionalAmount; |
| | | private String additionalAmountText; |
| | | private String state; |
| | |
| | | public void setAdditionalAmountText(String additionalAmountText) { |
| | | this.additionalAmountText = additionalAmountText; |
| | | } |
| | | |
| | | public String getMwPrice() { |
| | | return mwPrice; |
| | | } |
| | | |
| | | public void setMwPrice(String mwPrice) { |
| | | this.mwPrice = mwPrice; |
| | | } |
| | | } |
| | |
| | | private String communityId; |
| | | private String objType; |
| | | private String feeId; |
| | | private double price; |
| | | private Date createTime; |
| | | |
| | | public String getRemark() { |
| | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public double getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(double price) { |
| | | this.price = price; |
| | | } |
| | | } |
| | |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feeReceiptDetailPo.setArea(roomDtos.get(0).getBuiltUpArea()); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText()); |
| | | }else if ("9009".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | | } else { |
| | | } |
| | | } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//车位相关 |
| | |
| | | } |
| | | feeReceiptDetailPo.setArea(parkingSpaceDtos.get(0).getArea()); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText()); |
| | | } else { |
| | | } else if ("9009".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | feeReceiptDetailPo.setArea(sub.doubleValue() + ""); |
| | | feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount()); |
| | | } |
| | | }else { |
| | | } |
| | | } |
| | | } |
| | |
| | | feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeRoomCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportRoomDto, RoomDto.class)); |
| | | }else if ("9009".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | |
| | | feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount())); |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeCarCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportCarDto, OwnerCarDto.class)); |
| | | }else if ("9009".equals(computingFormula)) { |
| | | if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) { |
| | | throw new IllegalArgumentException("抄表数据异常"); |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | |
| | | feePrice = computeRoomCustomizeFormula(feeDto, roomDto); |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | } else if ("7007".equals(computingFormula)) { //自定义公式 |
| | | feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0)); |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | |
| | | feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos); |
| | | } else if ("8008".equals(computingFormula)) { //手动动态费用 |
| | | feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount())); |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | //throw new IllegalArgumentException("抄表数据异常"); |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException("暂不支持该类公式"); |
| | | } |
| | |
| | | configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name |
| | | billTypeName,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees curDegrees,mw.pre_degrees |
| | | preDegrees, |
| | | mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime |
| | | mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price mwPrice |
| | | from pay_fee t |
| | | INNER join pay_fee_config pfc on t.config_id = pfc.config_id and |
| | | pfc.status_cd = '0' |
| | |
| | | <insert id="saveBusinessMeterWaterInfo" parameterType="Map"> |
| | | insert into business_meter_water( |
| | | remark,cur_reading_time,water_id,cur_degrees,operate,meter_type,pre_degrees,obj_id,pre_reading_time, |
| | | b_id,community_id,obj_type,fee_id,obj_name |
| | | b_id,community_id,obj_type,fee_id,obj_name,price |
| | | ) values ( |
| | | #{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{meterType},#{preDegrees},#{objId}, |
| | | #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId},#{objName} |
| | | #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId},#{objName},#{price} |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,t.meter_type,t.meter_type |
| | | meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id |
| | | objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id |
| | | communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName |
| | | communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price |
| | | from business_meter_water t |
| | | where 1 =1 |
| | | <if test="remark !=null and remark != ''"> |
| | |
| | | <insert id="saveMeterWaterInfoInstance" parameterType="Map"> |
| | | insert into meter_water( |
| | | remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id, |
| | | community_id,obj_type,fee_id,obj_name |
| | | community_id,obj_type,fee_id,obj_name,price |
| | | ) select |
| | | t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.meter_type,t.pre_degrees,t.obj_id, |
| | | t.pre_reading_time,t.b_id,t.community_id,t.obj_type,t.fee_id,t.obj_name |
| | | t.pre_reading_time,t.b_id,t.community_id,t.obj_type,t.fee_id,t.obj_name,t.price |
| | | from business_meter_water t where 1=1 |
| | | <if test="remark !=null and remark != ''"> |
| | | and t.remark= #{remark} |
| | |
| | | curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.create_time,t.create_time |
| | | createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id |
| | | objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id |
| | | communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName |
| | | communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price |
| | | from meter_water t |
| | | left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' |
| | | where 1 =1 |
| | |
| | | <insert id="insertMeterWaters" parameterType="Map"> |
| | | insert into meter_water |
| | | (remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id, |
| | | community_id,obj_type,fee_id,obj_name) |
| | | community_id,obj_type,fee_id,obj_name,price) |
| | | VALUES |
| | | <foreach collection="meterWaterPos" item="item" separator=","> |
| | | (#{item.remark},'0',#{item.curReadingTime},#{item.waterId},#{item.curDegrees},#{item.meterType},#{item.preDegrees}, |
| | | #{item.objId},#{item.preReadingTime},'-1',#{item.communityId},#{item.objType},#{item.feeId},#{item.objName}) |
| | | #{item.objId},#{item.preReadingTime},'-1',#{item.communityId},#{item.objType},#{item.feeId},#{item.objName},#{price}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | storeTypeCd, |
| | | t.community_id communityId,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees |
| | | curDegrees,mw.pre_degrees preDegrees, |
| | | mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime |
| | | mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price mwPrice |
| | | from pay_fee t |
| | | INNER JOIN pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' |
| | | left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0' |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class QueryOweFeeImpl implements IQueryOweFee { |
| | |
| | | int threadNum = Java110ThreadPoolFactory.JAVA110_DEFAULT_THREAD_NUM; |
| | | |
| | | tempRooms.addAll(doGetTmpRoomDto(roomDtos, feeDto, threadNum)); |
| | | for(RoomDto tmpRoomDto:tempRooms){ |
| | | if(tmpRoomDto == null){ |
| | | for (RoomDto tmpRoomDto : tempRooms) { |
| | | if (tmpRoomDto == null) { |
| | | continue; |
| | | } |
| | | tmpRoomDtos.add(tmpRoomDto); |
| | |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { //(本期度数-上期度数)*动态单价+附加费 |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | feePrice = -1.00; |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else { |
| | | feePrice = 0.00; |
| | | } |
| | |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else if ("9009".equals(computingFormula)) { |
| | | |
| | | if (StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | feePrice = -1.00; |
| | | } else { |
| | | BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees())); |
| | | BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees())); |
| | | BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice())); |
| | | BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); |
| | | BigDecimal sub = curDegree.subtract(preDegree); |
| | | feePrice = sub.multiply(squarePrice) |
| | | .add(additionalAmount) |
| | | .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } else { |
| | | feePrice = 0.00; |
| | | } |
| | |
| | | return targetEndDateAndOweMonth; |
| | | } |
| | | if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { |
| | | if(feeDto.getDeadlineTime() != null){ |
| | | if (feeDto.getDeadlineTime() != null) { |
| | | targetEndDate = feeDto.getDeadlineTime(); |
| | | }else if(!StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | } else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) { |
| | | targetEndDate = feeDto.getCurReadingTime(); |
| | | } else if (feeDto.getImportFeeEndTime() == null) { |
| | | targetEndDate = feeDto.getConfigEndTime(); |
| | |
| | | importExportMeterWaterDto = BeanConvertUtil.covertBean(tmpRoomDto, ImportExportMeterWaterDto.class); |
| | | String preDegree = "0"; |
| | | String preReadTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B); |
| | | double price = 0; |
| | | if (meterWaterDtos != null && meterWaterDtos.size() > 0) { |
| | | preDegree = meterWaterDtos.get(0).getCurDegrees(); |
| | | preReadTime = DateUtil.dateTimeToDate(meterWaterDtos.get(0).getCurReadingTime()); |
| | | price = meterWaterDtos.get(0).getPrice(); |
| | | } |
| | | importExportMeterWaterDto.setPreDegrees(preDegree); |
| | | importExportMeterWaterDto.setPreReadingTime(preReadTime); |
| | | importExportMeterWaterDto.setPrice(price); |
| | | importExportMeterWaterDtos.add(importExportMeterWaterDto); |
| | | } |
| | | return ResultVo.createResponseEntity(1, importExportMeterWaterDtos.size(), importExportMeterWaterDtos); |
| | |
| | | |
| | | if ("1010".equals(importExportMeterWaterDto.getMeterType())) { |
| | | feeName += "水费"; |
| | | } else { |
| | | } else if("2020".equals(importExportMeterWaterDto.getMeterType())) { |
| | | feeName += "电费"; |
| | | }else{ |
| | | feeName += "燃气费"; |
| | | } |
| | | feeAttrPo.setValue(feeName); |
| | | feeAttrPo.setFeeId(payFeePo.getFeeId()); |
| | |
| | | meterWaterPo.setPreReadingTime(importExportMeterWaterDto.getPreReadingTime()); |
| | | meterWaterPo.setWaterId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_waterId)); |
| | | meterWaterPo.setRemark(importExportMeterWaterDto.getRemark()); |
| | | meterWaterPo.setPrice(importExportMeterWaterDto.getPrice()); |
| | | meterWaterPos.add(meterWaterPo); |
| | | } |
| | | |
| | |
| | | */ |
| | | public ResponseEntity<Object> exportData2(IPageData pd) throws Exception { |
| | | |
| | | return exportMeterWaterSMOImpl.exportExcelData(pd); |
| | | return exportMeterWaterSMOImpl.exportExcelData2(pd); |
| | | } |
| | | |
| | | |
| | |
| | | //工作表 |
| | | workbook = new XSSFWorkbook(); |
| | | //获取楼信息 |
| | | getMeterWater(pd, result, workbook); |
| | | getMeterWater2(pd, result, workbook); |
| | | |
| | | |
| | | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
| | | MultiValueMap headers = new HttpHeaders(); |
| | | headers.add("content-type", "application/octet-stream;charset=UTF-8"); |
| | | headers.add("Content-Disposition", "attachment;filename=meteWaterImport_" + DateUtil.getyyyyMMddhhmmssDateString() + ".xlsx"); |
| | | headers.add("Content-Disposition", "attachment;filename=meteWaterImport2_" + DateUtil.getyyyyMMddhhmmssDateString() + ".xlsx"); |
| | | headers.add("Pargam", "no-cache"); |
| | | headers.add("Cache-Control", "no-cache"); |
| | | //headers.add("Content-Disposition", "attachment; filename=" + outParam.getString("fileName")); |
| | |
| | | return new ResponseEntity<Object>(context, headers, HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 获取 房屋信息 |
| | | * |
| | | * @param componentValidateResult |
| | | * @param workbook |
| | | */ |
| | | private void getMeterWater2(IPageData pd, ComponentValidateResult componentValidateResult, Workbook workbook) { |
| | | JSONObject reqJson = JSONObject.parseObject(pd.getReqData()); |
| | | Sheet sheet = workbook.createSheet("房屋费用信息"); |
| | | Row row = sheet.createRow(0); |
| | | Cell cell0 = row.createCell(0); |
| | | cell0.setCellValue("上期度数: 请填写上期表读数 ;\n上期读表时间: " + |
| | | "格式为YYYY-MM-DD; \n本期度数: 本次表读数;\n本期读表时间: 格式为YYYY-MM-DD; " + |
| | | "\n注意:所有单元格式为文本"); |
| | | CellStyle cs = workbook.createCellStyle(); |
| | | cs.setWrapText(true); //关键 |
| | | cell0.setCellStyle(cs); |
| | | row.setHeight((short) (200 * 10)); |
| | | row = sheet.createRow(1); |
| | | row.createCell(0).setCellValue("楼栋编号"); |
| | | row.createCell(1).setCellValue("单元编号"); |
| | | row.createCell(2).setCellValue("房屋编码"); |
| | | row.createCell(3).setCellValue("费用类型"); |
| | | row.createCell(4).setCellValue("单价"); |
| | | row.createCell(5).setCellValue("上期度数"); |
| | | row.createCell(6).setCellValue("上期读表时间"); |
| | | row.createCell(7).setCellValue("本期度数"); |
| | | row.createCell(8).setCellValue("本期读表时间"); |
| | | row.createCell(9).setCellValue("备注"); |
| | | |
| | | //查询楼栋信息 |
| | | JSONArray rooms = this.getExistsRoom(pd, componentValidateResult); |
| | | if (rooms == null) { |
| | | CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6); |
| | | sheet.addMergedRegion(region); |
| | | return; |
| | | } |
| | | |
| | | for (int roomIndex = 0; roomIndex < rooms.size(); roomIndex++) { |
| | | row = sheet.createRow(roomIndex + 2); |
| | | row.createCell(0).setCellValue(rooms.getJSONObject(roomIndex).getString("floorNum")); |
| | | row.createCell(1).setCellValue(rooms.getJSONObject(roomIndex).getString("unitNum")); |
| | | row.createCell(2).setCellValue(rooms.getJSONObject(roomIndex).getString("roomNum")); |
| | | row.createCell(3).setCellValue(reqJson.getString("feeName")); |
| | | row.createCell(4).setCellValue(rooms.getJSONObject(roomIndex).getString("price")); |
| | | row.createCell(5).setCellValue(rooms.getJSONObject(roomIndex).getString("preDegrees")); |
| | | row.createCell(6).setCellValue(rooms.getJSONObject(roomIndex).getString("preReadingTime")); |
| | | row.createCell(7).setCellValue(""); |
| | | row.createCell(8).setCellValue(""); |
| | | row.createCell(9).setCellValue(""); |
| | | } |
| | | |
| | | CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6); |
| | | sheet.addMergedRegion(region); |
| | | } |
| | | |
| | | public RestTemplate getRestTemplate() { |
| | | return restTemplate; |
| | | } |
| | |
| | | List<ImportExportMeterWaterDto> rooms = new ArrayList<ImportExportMeterWaterDto>(); |
| | | |
| | | //获取楼信息 |
| | | getRooms(workbook, rooms); |
| | | getRooms2(workbook, rooms); |
| | | // 保存数据 |
| | | return dealExcelData(pd, rooms, result); |
| | | } catch (Exception e) { |
| | |
| | | importRoomFee.setPreReadingTime(startTime); |
| | | importRoomFee.setCurDegrees(os[5].toString()); |
| | | importRoomFee.setCurReadingTime(endTime); |
| | | importRoomFee.setPrice(-1); |
| | | rooms.add(importRoomFee); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取 房屋信息 |
| | | * |
| | | * @param workbook |
| | | * @param rooms |
| | | */ |
| | | private void getRooms2(Workbook workbook, List<ImportExportMeterWaterDto> rooms) { |
| | | Sheet sheet = null; |
| | | sheet = ImportExcelUtils.getSheet(workbook, "房屋费用信息"); |
| | | List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet); |
| | | ImportExportMeterWaterDto importRoomFee = null; |
| | | for (int osIndex = 0; osIndex < oList.size(); osIndex++) { |
| | | Object[] os = oList.get(osIndex); |
| | | if (osIndex == 0 || osIndex == 1) { // 第一行是 头部信息 直接跳过 |
| | | continue; |
| | | } |
| | | if (StringUtil.isNullOrNone(os[0])) { |
| | | continue; |
| | | } |
| | | Assert.hasValue(os[1], (osIndex + 1) + "单元编号不能为空"); |
| | | Assert.hasValue(os[2], (osIndex + 1) + "房屋编号不能为空"); |
| | | Assert.hasValue(os[4], (osIndex + 1) + "单价不能为空"); |
| | | Assert.hasValue(os[5], (osIndex + 1) + "上期度数不能为空"); |
| | | Assert.hasValue(os[6], (osIndex + 1) + "上期度数时间不能为空"); |
| | | Assert.hasValue(os[7], (osIndex + 1) + "本期度数不能为空"); |
| | | Assert.hasValue(os[8], (osIndex + 1) + "本期度数时间不能为空"); |
| | | |
| | | // |
| | | |
| | | String startTime = excelDoubleToDate(os[6].toString()); |
| | | String endTime = excelDoubleToDate(os[8].toString()); |
| | | Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD 文本格式"); |
| | | Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD 文本格式"); |
| | | |
| | | |
| | | importRoomFee = new ImportExportMeterWaterDto(); |
| | | importRoomFee.setFloorNum(os[0].toString()); |
| | | importRoomFee.setUnitNum(os[1].toString()); |
| | | importRoomFee.setRoomNum(os[2].toString()); |
| | | importRoomFee.setPrice(Double.parseDouble(os[4].toString())); |
| | | importRoomFee.setPreDegrees(os[5].toString()); |
| | | importRoomFee.setPreReadingTime(startTime); |
| | | importRoomFee.setCurDegrees(os[7].toString()); |
| | | importRoomFee.setCurReadingTime(endTime); |
| | | rooms.add(importRoomFee); |
| | | } |
| | | } |