|
@@ -11,6 +11,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
+import org.apache.commons.fileupload.FileItem;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
|
|
|
@@ -21,6 +22,7 @@ import com.minpay.common.service.IDianwangService;
|
|
|
import com.minpay.common.service.IReportService;
|
|
import com.minpay.common.service.IReportService;
|
|
|
import com.minpay.common.util.CommonUtil;
|
|
import com.minpay.common.util.CommonUtil;
|
|
|
import com.minpay.common.util.DateUtil;
|
|
import com.minpay.common.util.DateUtil;
|
|
|
|
|
+import com.minpay.common.util.FilesUtil;
|
|
|
import com.minpay.db.table.mapper.DwBranchReportTypeMapper;
|
|
import com.minpay.db.table.mapper.DwBranchReportTypeMapper;
|
|
|
import com.minpay.db.table.mapper.DwDdyFxbDetailMapper;
|
|
import com.minpay.db.table.mapper.DwDdyFxbDetailMapper;
|
|
|
import com.minpay.db.table.mapper.DwDdyFxbMapper;
|
|
import com.minpay.db.table.mapper.DwDdyFxbMapper;
|
|
@@ -100,6 +102,9 @@ public class ReportManageAction implements IMINAction {
|
|
|
/** 低电压分析表下载*/
|
|
/** 低电压分析表下载*/
|
|
|
public final static String DDY_REPORT_INF_DOWNLOAD = "ddyReportInfDownload";
|
|
public final static String DDY_REPORT_INF_DOWNLOAD = "ddyReportInfDownload";
|
|
|
|
|
|
|
|
|
|
+ /** 低电压分析表上传*/
|
|
|
|
|
+ public final static String DDY_REPORT_INF_UPLOAD = "ddyReportInfUpload";
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 报表查询
|
|
* 报表查询
|
|
|
* @param page
|
|
* @param page
|
|
@@ -778,23 +783,24 @@ public class ReportManageAction implements IMINAction {
|
|
|
String beginTime = reportInf.getDayInterval().split("-")[0];
|
|
String beginTime = reportInf.getDayInterval().split("-")[0];
|
|
|
String endTime = reportInf.getDayInterval().split("-")[1];
|
|
String endTime = reportInf.getDayInterval().split("-")[1];
|
|
|
int dayNum = DateUtil.diffDate(beginTime, endTime);
|
|
int dayNum = DateUtil.diffDate(beginTime, endTime);
|
|
|
- String[] excelHeader = new String[dayNum + 15];
|
|
|
|
|
- excelHeader[0] = "县公司名称#xgsmc";
|
|
|
|
|
- excelHeader[1] = "用户管理单位名称#yhgldwmc";
|
|
|
|
|
- excelHeader[2] = "线路名称#xlmc";
|
|
|
|
|
- excelHeader[3] = "台区ID#tqid";
|
|
|
|
|
- excelHeader[4] = "变压器名称#byqmc";
|
|
|
|
|
- excelHeader[5] = "用户编号#yhbh";
|
|
|
|
|
- excelHeader[6] = "低电压时长#ddysj";
|
|
|
|
|
- excelHeader[7] = "累计天数#ljts";
|
|
|
|
|
- excelHeader[8] = "低电压主要原因#ddyzymc";
|
|
|
|
|
- excelHeader[9] = "具体原因#jtyy";
|
|
|
|
|
- excelHeader[10] = "治理措施#zlcs";
|
|
|
|
|
- excelHeader[11] = "是否治理#sfzl";
|
|
|
|
|
- excelHeader[12] = "治理完成时间#zlwcsj";
|
|
|
|
|
- excelHeader[13] = "是否消除#sfxc";
|
|
|
|
|
|
|
+ String[] excelHeader = new String[dayNum + 16];
|
|
|
|
|
+ excelHeader[0] = "系统编号#id";
|
|
|
|
|
+ excelHeader[1] = "县公司名称#xgsmc";
|
|
|
|
|
+ excelHeader[2] = "用户管理单位名称#yhgldwmc";
|
|
|
|
|
+ excelHeader[3] = "线路名称#xlmc";
|
|
|
|
|
+ excelHeader[4] = "台区ID#tqid";
|
|
|
|
|
+ excelHeader[5] = "变压器名称#byqmc";
|
|
|
|
|
+ excelHeader[6] = "用户编号#yhbh";
|
|
|
|
|
+ excelHeader[7] = "低电压时长#ddysj";
|
|
|
|
|
+ excelHeader[8] = "累计天数#ljts";
|
|
|
|
|
+ excelHeader[9] = "低电压主要原因#ddyzymc";
|
|
|
|
|
+ excelHeader[10] = "具体原因#jtyy";
|
|
|
|
|
+ excelHeader[11] = "治理措施#zlcs";
|
|
|
|
|
+ excelHeader[12] = "是否治理#sfzl";
|
|
|
|
|
+ excelHeader[13] = "治理完成时间#zlwcsj";
|
|
|
|
|
+ excelHeader[14] = "是否消除#sfxc";
|
|
|
|
|
|
|
|
- int index = 14;
|
|
|
|
|
|
|
+ int index = 15;
|
|
|
while (CommonUtil.compare(endTime, beginTime) != -1) {
|
|
while (CommonUtil.compare(endTime, beginTime) != -1) {
|
|
|
excelHeader[index] = endTime + "#" + endTime;
|
|
excelHeader[index] = endTime + "#" + endTime;
|
|
|
index ++;
|
|
index ++;
|
|
@@ -813,4 +819,38 @@ public class ReportManageAction implements IMINAction {
|
|
|
|
|
|
|
|
return response;
|
|
return response;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @MINAction(value = DDY_REPORT_INF_UPLOAD)
|
|
|
|
|
+ public MINActionResult ddyReportInfUpload(
|
|
|
|
|
+ MINHttpServletRequestContext request,
|
|
|
|
|
+ @MINParam(key = "id") String id,
|
|
|
|
|
+ MINSession session
|
|
|
|
|
+ ) throws MINBusinessException, InvalidFormatException, IOException {
|
|
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
|
|
+ db = Service.lookup(IMINDataBaseService.class);
|
|
|
|
|
+ // 获取文件
|
|
|
|
|
+ FileItem fileItem = request.getFile("file");
|
|
|
|
|
+ String fileName = fileItem.getName();
|
|
|
|
|
+ if (!fileName.endsWith(".xlsx") && !fileName.endsWith(".xls")) {
|
|
|
|
|
+ throw new MINBusinessException("文件格式错误!");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取表格信息
|
|
|
|
|
+ String[] titleKey = new String[]{"NO","ID","XGSMC","YHGLDWMC", "XLMC","TQID","BYQMC","YHBH","DDYSJ","LJTS","DDYZYMC","JTYY","ZLCS","SFZL","ZLWCSJ","SFXC"};
|
|
|
|
|
+ List<Map<String,String>> list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < list.size(); i ++) {
|
|
|
|
|
+ Map<String, String> map = list.get(i);
|
|
|
|
|
+ DwDdyFxb ddyFxb = new DwDdyFxb();
|
|
|
|
|
+ ddyFxb.setId(map.get("ID"));
|
|
|
|
|
+ ddyFxb.setDdyzymc(map.get("DDYZYMC"));
|
|
|
|
|
+ ddyFxb.setJtyy(map.get("JTYY"));
|
|
|
|
|
+ ddyFxb.setZlcs(map.get("ZLCS"));
|
|
|
|
|
+ ddyFxb.setSfzl(map.get("SFZL"));
|
|
|
|
|
+ ddyFxb.setZlwcsj(map.get("ZLWCSJ"));
|
|
|
|
|
+ ddyFxb.setSfxc(map.get("SFXC"));
|
|
|
|
|
+ db.updateByPrimaryKeySelective(DwDdyFxbMapper.class, ddyFxb);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return res;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|