新增能耗补录接口

master
FCD 3 days ago
parent b170e910a5
commit e8df7cd4f6

@ -13,11 +13,13 @@ import com.op.energy.base.utils.ExportExcelUtil;
import com.op.energy.base.utils.SpringUtils;
import com.op.energy.report.domain.ExportReport;
import com.op.energy.report.domain.ReportOrderEnergyDTO;
import com.op.energy.report.domain.ReportPointDnb;
import com.op.energy.report.service.IDataAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
@ -280,4 +282,24 @@ public class dataAnalysisController extends BaseController {
util.exportExcel(response, orderEnergyList, "单耗统计数据");
}
/**
*
* **/
@PostMapping("/energyTemplate")
public void energyTemplate(HttpServletResponse response) {
ExcelUtil<ReportPointDnb> util = new ExcelUtil<>(ReportPointDnb.class);
util.importTemplateExcel(response, "能耗补录-导入模板");
}
/**
*
* **/
@PostMapping("/energyImport")
public AjaxResult energyImport(MultipartFile file) throws Exception {
ExcelUtil<ReportPointDnb> util = new ExcelUtil<>(ReportPointDnb.class);
List<ReportPointDnb> list = util.importExcel(file.getInputStream());
return AjaxResult.success(dataAnalysisService.importReportPointDnb(list));
}
}

@ -56,7 +56,7 @@ public class ReportPointDnb extends BaseEntity {
/**
*
*/
@Excel(name = "计量设备位置")
@Excel(name = "计量设备位置", type = Excel.Type.EXPORT)
private String address;
/**
@ -68,7 +68,7 @@ public class ReportPointDnb extends BaseEntity {
/**
*
*/
@Excel(name = "价格")
@Excel(name = "价格", type = Excel.Type.EXPORT)
private BigDecimal price;
/**
@ -95,7 +95,7 @@ public class ReportPointDnb extends BaseEntity {
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
private Date recordTime;
/**

@ -4,6 +4,7 @@ package com.op.energy.report.mapper;
import com.op.energy.report.domain.ReportOrderEnergyDTO;
import com.op.energy.report.domain.ReportPointDnb;
import com.op.energy.report.domain.ReportPointDnbDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -90,4 +91,10 @@ public interface ReportPointDnbMapper {
List<ReportPointDnb> selectPointDnbGroupList(ReportPointDnb pointDnb);
List<Map<String, String>> datePointDnbGroupList(ReportPointDnb lineDnb);
Integer fixWwEnergyData(@Param("params") Map<String,String> params);
int batchInsertReportPointDnb(@Param("list") List<ReportPointDnb> list);
}

@ -3,6 +3,7 @@ package com.op.energy.report.service;
import com.op.energy.base.domain.BaseLineLoss;
import com.op.energy.report.domain.ExportReport;
import com.op.energy.report.domain.ReportOrderEnergyDTO;
import com.op.energy.report.domain.ReportPointDnb;
import java.util.List;
import java.util.Map;
@ -108,4 +109,6 @@ public interface IDataAnalysisService {
List<ExportReport> classificationExportReport(Map paramMap);
public List<ReportOrderEnergyDTO> OrderEnergyList(ReportOrderEnergyDTO reportOrderEnergyDTO);
String importReportPointDnb(List<ReportPointDnb> list);
}

@ -22,6 +22,7 @@ import com.op.energy.report.domain.ReportPointWater;
import com.op.energy.report.mapper.ReportPointDnbMapper;
import com.op.energy.report.mapper.ReportPointWaterMapper;
import com.op.energy.report.service.IDataAnalysisService;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -1047,4 +1048,15 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
return reportOrderEnergyDTOList;
}
@Override
@DS("#header.poolName")
public String importReportPointDnb(List<ReportPointDnb> importList) {
if (importList.isEmpty()){
throw new RuntimeException("导入数据为空");
}
int successCount = reportPointDnbMapper.batchInsertReportPointDnb(importList);
return String.format("导入成功。上传数量:%d导入数量%d", importList.size(), successCount);
}
}

Loading…
Cancel
Save