|
@@ -6,18 +6,19 @@ import java.io.OutputStream;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.minpay.common.util.*;
|
|
|
import com.minpay.db.table.mapper.*;
|
|
|
import com.minpay.db.table.model.*;
|
|
|
+import com.minpay.db.table.own.mapper.IReportBatchMapper;
|
|
|
import org.apache.commons.fileupload.FileItem;
|
|
|
import org.apache.ibatis.transaction.Transaction;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
@@ -28,10 +29,6 @@ import com.minpay.common.constant.Constant;
|
|
|
import com.minpay.common.format.IFormatService;
|
|
|
import com.minpay.common.service.IDianwangService;
|
|
|
import com.minpay.common.service.IPropertiesService;
|
|
|
-import com.minpay.common.util.CommonUtil;
|
|
|
-import com.minpay.common.util.ExportExcelUtil;
|
|
|
-import com.minpay.common.util.FilesUtil;
|
|
|
-import com.minpay.common.util.ListUtil;
|
|
|
import com.minpay.db.table.own.mapper.DataWareManageMapper;
|
|
|
import com.minpay.db.table.own.mapper.SequenceMapper;
|
|
|
import com.startup.minpay.frame.business.IMINAction;
|
|
@@ -49,6 +46,7 @@ import com.startup.minpay.frame.target.MINComponent;
|
|
|
import com.startup.minpay.frame.target.MINParam;
|
|
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@MINComponent
|
|
|
public class DataWareManageAction implements IMINAction {
|
|
@@ -176,7 +174,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
@MINParam(key = "fileType") String fileType,
|
|
|
@MINParam(key = "chongfuFlag") boolean chongfuFlag,
|
|
|
MINSession session
|
|
|
- ) throws MINBusinessException, InvalidFormatException, IOException {
|
|
|
+ ) throws MINBusinessException, InvalidFormatException, IOException, ParseException {
|
|
|
MINActionResult res = new MINActionResult();
|
|
|
db = Service.lookup(IMINDataBaseService.class);
|
|
|
|
|
@@ -311,6 +309,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileDetail02.setFileId(fileId);
|
|
|
db.insertSelective(DwFileDetail02Mapper.class, fileDetail02);
|
|
|
}
|
|
|
+ //低电压
|
|
|
} else if(Constant.FILE_DETAIL_TYPE_03.equals(fileType)) {
|
|
|
String[] titleKey = new String[]{"no","sgsmc","xgsmc","bdzmc","xlmc","tqid","byqmc","yhgldw1","yhid","yhmc","yhgldw2","dymax","dymin","dyhgl","csxl","cxxl","dysc","gdlx","ljts","sjrq","gddw"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 3);
|
|
@@ -333,8 +332,6 @@ public class DataWareManageAction implements IMINAction {
|
|
|
}
|
|
|
} catch (Exception ex) {
|
|
|
}
|
|
|
-// DateFormat formater = new SimpleDateFormat("yyyyMMdd");
|
|
|
-// String sjrq = formater.format(excelMap.get("sjrq"));
|
|
|
DwFileDetail03 fileDetail03 = new DwFileDetail03();
|
|
|
fileDetail03.setId(fileDetailId);
|
|
|
fileDetail03.setNo(excelMap.get("no"));
|
|
@@ -361,6 +358,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileDetail03.setFileId(fileId);
|
|
|
db.insertSelective(DwFileDetail03Mapper.class, fileDetail03);
|
|
|
}
|
|
|
+ //过电压
|
|
|
} else if(Constant.FILE_DETAIL_TYPE_04.equals(fileType)) {
|
|
|
String[] titleKey = new String[]{"no","sgsmc","xgsmc","bdzmc","xlmc","tqid","byqmc","yhgldw1","yhid","yhmc","yhgldw2","dymax","dymin","dyhgl","csxl","cxxl","gdysc","gdlx","ljts","gddw","sjrq"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
@@ -416,7 +414,6 @@ public class DataWareManageAction implements IMINAction {
|
|
|
String[] titleKey = new String[]{"NO","GDBH","GWGDBH","ZT","YWLX","DQBZ","SLRY","SLSJ","SLLR","YHBH","YHMC","LXDZ","LXDH","HFNR","YJFL","EJFL",
|
|
|
"YWZL","SJDW","GDDW","CBD","CLJG","CLDW","CLBM","GLGD","WTYYFL","GDFJ","ZRBM","GDSJ","GQSJ","GQYY","FWQD","SJHTZRYY"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
-
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
@@ -459,6 +456,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileDetail05.setFileId(fileId);
|
|
|
db.insertSelective(DwFileDetail05Mapper.class, fileDetail05);
|
|
|
}
|
|
|
+ //计停非计停
|
|
|
}else if(Constant.FILE_DETAIL_TYPE_06.equals(fileType)) {
|
|
|
String[] titleKey = new String[]{"NO","TYPE","UNIT","DEVICE","TIME","EVENTTYPE","FA","TRIPTYPE","CAUSE","CHZDZQK","HANDLE","ERROBRIEF"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
@@ -485,6 +483,197 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileDetail07.setErrobrief(excelMap.get("ERROBRIEF"));
|
|
|
db.insertSelective(DwFileDetail07Mapper.class, fileDetail07);
|
|
|
}
|
|
|
+ //客户信息明细
|
|
|
+ }else if(Constant.FILE_DETAIL_TYPE_07.equals(fileType)){
|
|
|
+ //标题对应key
|
|
|
+ String[] titleKey = new String[]{
|
|
|
+ };
|
|
|
+ String[] titleValue = new String[]{
|
|
|
+ "所属文件id"
|
|
|
+ };
|
|
|
+ //验证模板是否正确
|
|
|
+ Map<String,Object> header = new HashMap<String, Object>();
|
|
|
+ List<String[]> headerTitle = new ArrayList<String[]>();
|
|
|
+ headerTitle.add(titleKey);
|
|
|
+ headerTitle.add(titleValue);
|
|
|
+ if(headerTitle == null || headerTitle.isEmpty()){
|
|
|
+ System.out.println("标题列为空");
|
|
|
+ } else {
|
|
|
+ header.put("headerRows",headerTitle.size() - 1);
|
|
|
+ header.put("header",headerTitle);
|
|
|
+ header.put("cols",headerTitle.get(headerTitle.size() -1).length);
|
|
|
+ boolean b = ExcelTemplateUtil.verificationExcelHeadLine(fileItem,header);
|
|
|
+ if (!b) {
|
|
|
+ System.out.println("导入模板不一致");
|
|
|
+ }
|
|
|
+ //读取excel数据
|
|
|
+ list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
+ // 详情数据存入数据库
|
|
|
+ for (Map<String,String> excelMap : list) {
|
|
|
+ String fileDetailId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_DETAIL_05_NO");
|
|
|
+ DwFileDetail07 fileDetail07 = new DwFileDetail07();
|
|
|
+ fileDetail07.setId(fileDetailId);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //配变过重载
|
|
|
+ }else if(Constant.FILE_DETAIL_TYPE_08.equals(fileType)){
|
|
|
+ //标题对应key
|
|
|
+ String[] titleKey = new String[]{"SEQU","MONTH","UNIT","BZMC","GBMC","XLMC","FZL","ZDFZL","ZDFZLFSSK","EDRL","GZZYYFL","JTYY",
|
|
|
+ "JJCSFL","JTJJCS","WCSJ","SXBPHL","AXDL","BXDL","CXDL","GZSC","YHSL","ZZSC","PMSID","YXID"};
|
|
|
+ String[] titleValue = new String[]{
|
|
|
+ "序号","月份","单位","维护班组","所属线路","公变名称","负载率(%)",
|
|
|
+ "最大负载率(%)","最大负载率发生时刻时间","额定容量(kVA)","重载原因分类",
|
|
|
+ "具体原因\n" +
|
|
|
+ "(详细说明原因情况)","解决措施分类","具体解决措施\n" +
|
|
|
+ "(详细说明解决措施)",
|
|
|
+ "完成时间\n" +
|
|
|
+ "(格式:2020/01/01)","三相不平衡率(%)(最大负荷)","A相电流(A)","B相电流(A)",
|
|
|
+ "C相电流(A)","用户数量","过载时长","重载时长","PMSID","营销ID"
|
|
|
+ };
|
|
|
+ //验证模板是否正确
|
|
|
+ Map<String,Object> header = new HashMap<String, Object>();
|
|
|
+ List<String[]> headerTitle = new ArrayList<String[]>();
|
|
|
+ headerTitle.add(titleValue);
|
|
|
+ if(headerTitle == null || headerTitle.isEmpty()){
|
|
|
+ System.out.println("标题列为空");
|
|
|
+ } else {
|
|
|
+ header.put("headerRows",headerTitle.size() - 1);
|
|
|
+ header.put("header",headerTitle);
|
|
|
+ header.put("cols",headerTitle.get(headerTitle.size() -1).length);
|
|
|
+ boolean b = ExcelTemplateUtil.verificationExcelHeadLine(fileItem,header);
|
|
|
+ if (!b) {
|
|
|
+ throw new MINBusinessException("导入模板不一致,请使用正确模板");//无数据,请添加数据
|
|
|
+ }
|
|
|
+ //读取excel数据
|
|
|
+ list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
+ System.out.println("");
|
|
|
+ throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
+ }
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//注意月份是MM
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
|
|
+ DateTimeFormatter fa = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ List<DwFileDetail09> ll = new ArrayList<DwFileDetail09>();
|
|
|
+ // 详情数据存入数据库
|
|
|
+ for (Map<String,String> excelMap : list) {
|
|
|
+ DwFileDetail09 fileDetail09 = new DwFileDetail09();
|
|
|
+ fileDetail09.setSequ(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("SEQU"))));
|
|
|
+ fileDetail09.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ fileDetail09.setMonth(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("MONTH"))));
|
|
|
+ fileDetail09.setUnit(excelMap.get("UNIT"));
|
|
|
+ fileDetail09.setBzmc(excelMap.get("BZMC"));
|
|
|
+ fileDetail09.setGbmc(excelMap.get("GBMC"));
|
|
|
+ fileDetail09.setXlmc(excelMap.get("XLMC"));
|
|
|
+ fileDetail09.setFzl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("FZL"))));
|
|
|
+ fileDetail09.setZdfzl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("ZDFZL"))));
|
|
|
+ fileDetail09.setZdfzlfssk(excelMap.get("ZDFZLFSSK"));
|
|
|
+ fileDetail09.setEdrl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("EDRL"))));
|
|
|
+ fileDetail09.setGzzyyfl(excelMap.get("GZZYYFL"));
|
|
|
+ fileDetail09.setJtyy(excelMap.get("JTYY"));
|
|
|
+ fileDetail09.setJjcsfl(excelMap.get("JJCSFL"));
|
|
|
+ fileDetail09.setJtjjcs(excelMap.get("JTJJCS"));
|
|
|
+ String wcsj = excelMap.get("WCSJ");
|
|
|
+ if(wcsj != null && !"".equals(wcsj)){
|
|
|
+ LocalDateTime ldt = LocalDateTime.parse(wcsj,dtf);
|
|
|
+ String datetime = ldt.format(fa);
|
|
|
+ fileDetail09.setWcsj(simpleDateFormat.parse(datetime.replaceAll("/","-")));
|
|
|
+ }
|
|
|
+ fileDetail09.setSxbphl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("SXBPHL"))));
|
|
|
+ fileDetail09.setAxdl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("AXDL"))));
|
|
|
+ fileDetail09.setBxdl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("BXDL"))));
|
|
|
+ fileDetail09.setCxdl(Float.valueOf(StringUtil.ObjToInt(excelMap.get("CXDL"))));
|
|
|
+ fileDetail09.setGzsc(Float.valueOf(StringUtil.ObjToInt(excelMap.get("GZSC"))));
|
|
|
+ fileDetail09.setYhsl(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("YHSL"))));
|
|
|
+ fileDetail09.setZzsc(Float.valueOf(StringUtil.ObjToInt(excelMap.get("ZZSC"))));
|
|
|
+ fileDetail09.setYxid(excelMap.get("YXID"));
|
|
|
+ fileDetail09.setPmsid(excelMap.get("PMSID"));
|
|
|
+ fileDetail09.setFileId(fileId);
|
|
|
+ ll.add(fileDetail09);
|
|
|
+ }
|
|
|
+ this.batchReportData(ll,1);
|
|
|
+ }
|
|
|
+ //线路过重载
|
|
|
+ }else if(Constant.FILE_DETAIL_TYPE_09.equals(fileType)){
|
|
|
+ //标题对应key
|
|
|
+ String[] titleKey = new String[]{
|
|
|
+ "SEQU","MONTH","XGSMC","BZMC","BDZMC","XLMC","EDDL","FZL","GZZYY",
|
|
|
+ "GZZJTYY","JJCSFL","JTJJCS","WCSJ","GZSC","YXDL",
|
|
|
+ "FSSK","ZDDL","ZDZFSSK","PBSL","PBRL","SFZDH","PMSID"};
|
|
|
+ String[] titleValue = new String[]{
|
|
|
+ "序号","月份","所属县公司","管理班组","变电站名称",
|
|
|
+ "线路名称","额定电流(A)","负载率","过载原因分类","具体原因\n" +
|
|
|
+ "(详细说明原因情况)",
|
|
|
+ "解决措施分类","具体解决措施\n" +
|
|
|
+ "(详细说明解决措施)","完成时间\n" +
|
|
|
+ "(格式:2020/01/01)",
|
|
|
+ "过载时长(小时)","运行电流(A)","发生时刻","最大电流(A)","最大值发生时刻",
|
|
|
+ "配变数量(台)","配变容量(kVA)","是否自动化","PMSID"
|
|
|
+ };
|
|
|
+ //验证模板是否正确
|
|
|
+ Map<String,Object> header = new HashMap<String, Object>();
|
|
|
+ List<String[]> headerTitle = new ArrayList<String[]>();
|
|
|
+ headerTitle.add(titleValue);
|
|
|
+ if(headerTitle == null || headerTitle.isEmpty()){
|
|
|
+ System.out.println("标题列为空");
|
|
|
+ } else {
|
|
|
+ header.put("headerRows",headerTitle.size() - 1);
|
|
|
+ header.put("header",headerTitle);
|
|
|
+ header.put("cols",headerTitle.get(headerTitle.size() -1).length);
|
|
|
+ boolean b = ExcelTemplateUtil.verificationExcelHeadLine(fileItem,header);
|
|
|
+ if (!b) {
|
|
|
+ throw new MINBusinessException("导入模板不一致,请使用正确模板");//无数据,请添加数据
|
|
|
+ }
|
|
|
+ //读取excel数据
|
|
|
+ list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
+ throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
+ }
|
|
|
+ List<DwFileDetail10> ll = new ArrayList<DwFileDetail10>();
|
|
|
+ // 详情数据存入数据库
|
|
|
+ for (Map<String,String> excelMap : list) {
|
|
|
+ DwFileDetail10 fileDetail10 = new DwFileDetail10();
|
|
|
+ fileDetail10.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ fileDetail10.setSequ(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("SEQU"))));
|
|
|
+ fileDetail10.setMonth(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("MONTH"))));
|
|
|
+ fileDetail10.setXgsmc(excelMap.get("XGSMC"));
|
|
|
+ fileDetail10.setBzmc(excelMap.get("BZMC"));
|
|
|
+ fileDetail10.setBdzmc(excelMap.get("BDZMC"));
|
|
|
+ fileDetail10.setXlmc(excelMap.get("XLMC"));
|
|
|
+ fileDetail10.setEddl(Float.valueOf(StringUtil.ObjToFloat(excelMap.get("EDDL"))));
|
|
|
+ fileDetail10.setFzl(Float.valueOf(StringUtil.ObjToFloat(excelMap.get("FZL"))));
|
|
|
+ fileDetail10.setGzzyy(excelMap.get("GZZYY"));
|
|
|
+ fileDetail10.setGzzjtyy(excelMap.get("GZZJTYY"));
|
|
|
+ fileDetail10.setJjcsfl(excelMap.get("JJCSFL"));
|
|
|
+ fileDetail10.setJtjjcs(excelMap.get("JTJJCS"));
|
|
|
+ String wcsj = excelMap.get("WCSJ");
|
|
|
+ if(wcsj != null && !"".equals(wcsj)){
|
|
|
+ fileDetail10.setWcsj(StringUtil.ObjToDate(wcsj,"1"));
|
|
|
+ }
|
|
|
+ fileDetail10.setGzsc(Float.valueOf(StringUtil.ObjToFloat(excelMap.get("GZSC"))));
|
|
|
+ fileDetail10.setYxdl(Float.valueOf(StringUtil.ObjToFloat(excelMap.get("YXDL"))));
|
|
|
+ String fssk = excelMap.get("FSSK");
|
|
|
+ if(fssk != null && !"".equals(fssk)){
|
|
|
+ fileDetail10.setFssk(StringUtil.ObjToDate(fssk,"2"));
|
|
|
+ }
|
|
|
+ fileDetail10.setZddl(Float.valueOf(StringUtil.ObjToFloat(excelMap.get("ZDDL"))));
|
|
|
+ String zdzfssk = excelMap.get("ZDZFSSK");
|
|
|
+ if(zdzfssk != null && !"".equals(zdzfssk)){
|
|
|
+ fileDetail10.setZdzfssk(StringUtil.ObjToDate(zdzfssk,"2"));
|
|
|
+ }
|
|
|
+ fileDetail10.setPbsl(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("PBSL"))));
|
|
|
+ fileDetail10.setPbrl(Integer.valueOf(StringUtil.ObjToInt(excelMap.get("PBRL"))));
|
|
|
+ fileDetail10.setSfzdh(excelMap.get("SFZDH"));
|
|
|
+ fileDetail10.setPmsid(excelMap.get("PMSID"));
|
|
|
+ fileDetail10.setFileId(fileId);
|
|
|
+
|
|
|
+ ll.add(fileDetail10);
|
|
|
+ }
|
|
|
+ this.batchXlgzzReportData(ll,2);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 文件名
|
|
@@ -513,7 +702,75 @@ public class DataWareManageAction implements IMINAction {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
+ * 批处理-配变过重载
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ protected void batchReportData(List<DwFileDetail09> list,int type) throws MINBusinessException {
|
|
|
+ if(list != null && list.size() > 0){
|
|
|
+ List<DwFileDetail09> tempList = new ArrayList<DwFileDetail09>();
|
|
|
+ int cou = 0;
|
|
|
+ for (int i = 0; i < list.size() ; i++) {
|
|
|
+ if((list.size() - i) >= 1000){
|
|
|
+ tempList.add( list.get(i));
|
|
|
+ cou += 1;
|
|
|
+ if(cou == 1000){
|
|
|
+ try {
|
|
|
+ db.getMybatisMapper(IReportBatchMapper.class).insertPbgzzReport(tempList);
|
|
|
+ } catch (MINBusinessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ cou = 0;
|
|
|
+ tempList = new ArrayList<DwFileDetail09>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if((list.size() - i) < 1000){
|
|
|
+ tempList.add(list.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ db.getMybatisMapper(IReportBatchMapper.class).insertPbgzzReport(tempList);
|
|
|
+ } catch (MINBusinessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 批处理 线路过重载
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ protected void batchXlgzzReportData(List<DwFileDetail10> list,int type) throws MINBusinessException {
|
|
|
+ if(list != null && list.size() > 0){
|
|
|
+ List<DwFileDetail10> tempList = new ArrayList<DwFileDetail10>();
|
|
|
+ int cou = 0;
|
|
|
+ for (int i = 0; i < list.size() ; i++) {
|
|
|
+ if((list.size() - i) >= 1000){
|
|
|
+ tempList.add( list.get(i));
|
|
|
+ cou += 1;
|
|
|
+ if(cou == 1000){
|
|
|
+ try {
|
|
|
+ db.getMybatisMapper(IReportBatchMapper.class).insertXlgzzReport(tempList);
|
|
|
+ } catch (MINBusinessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ cou = 0;
|
|
|
+ tempList = new ArrayList<DwFileDetail10>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if((list.size() - i) < 1000){
|
|
|
+ tempList.add(list.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ db.getMybatisMapper(IReportBatchMapper.class).insertXlgzzReport(tempList);
|
|
|
+ } catch (MINBusinessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 原始数据文件下载
|
|
|
* @param fileId
|
|
|
* @param response
|
|
@@ -597,12 +854,79 @@ public class DataWareManageAction implements IMINAction {
|
|
|
example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
List<DwFileDetail07> selectByExample = db.getMybatisMapper(DwFileDetail07Mapper.class).selectByExample(example);
|
|
|
ExportExcelUtil<DwFileDetail07> util = new ExportExcelUtil<DwFileDetail07>();
|
|
|
- String[] header = {"系统编号","原EXCEL编号","类型","单位","设备名称","发生时间","事项类型","馈线自动化动作情况","跳闸类型","故障原因","重合闸动作情况","处理纪事","异常概况","所属文件id"};
|
|
|
+ String[] header = {"系统编号","类型","单位","设备名称","发生时间","事项类型","馈线自动化动作情况","跳闸类型","故障原因","重合闸动作情况","处理纪事","异常概况","所属文件id","原EXCEL编号"};
|
|
|
util.exportExcel("计停非计停数据", selectByExample, os, "2007", header);
|
|
|
- }
|
|
|
+ }else if (Constant.FILE_DETAIL_TYPE_07.equals(type)) {//客户明细
|
|
|
+
|
|
|
+ }else if (Constant.FILE_DETAIL_TYPE_08.equals(type)) {//配变过重载
|
|
|
+ response.setContentType("application/application/vnd.ms-excel");
|
|
|
+ response.setHeader("Content-disposition","attachment;filename=" + URLEncoder.encode("配变过重载数据.xls", "UTF-8"));
|
|
|
+ DwFileDetail09Example example = new DwFileDetail09Example();
|
|
|
+ example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ example.setOrderByClause("dfd9_sequ");
|
|
|
+ List<DwFileDetail09> selectByExample = db.getMybatisMapper(DwFileDetail09Mapper.class).selectByExample(example);
|
|
|
+ ExportExcelUtil<DwFileDetail09> util = new ExportExcelUtil<DwFileDetail09>();
|
|
|
+ String[] header = {"系统编号","月份",
|
|
|
+ "单位",
|
|
|
+ "班组名称",
|
|
|
+ "公变名称",
|
|
|
+ "线路名称",
|
|
|
+ "负载率(%) ",
|
|
|
+ "最大负载率(%)",
|
|
|
+ "最大负载率发生时刻时间",
|
|
|
+ "额定容量(kVA) ",
|
|
|
+ "过(重)载原因分类 ",
|
|
|
+ "具体原因(详细说明原因情况)",
|
|
|
+ "解决措施分类 ",
|
|
|
+ "具体解决措施(详细说明解决措施)",
|
|
|
+ "完成时间",
|
|
|
+ "三相不平衡率(%)(最大负荷) ",
|
|
|
+ "A相电流(A)",
|
|
|
+ "B相电流(A)",
|
|
|
+ "C相电流(A)",
|
|
|
+ "过载时长(小时)",
|
|
|
+ "用户数量",
|
|
|
+ "重载时长",
|
|
|
+ "营销ID",
|
|
|
+ "PMSID",
|
|
|
+ "所属文件ID","","原EXCEL编号"};
|
|
|
+ util.exportExcel("配变过重载数据", selectByExample, os, "2007", header);
|
|
|
+ }else if (Constant.FILE_DETAIL_TYPE_09.equals(type)) {//线路过重载
|
|
|
+ response.setContentType("application/application/vnd.ms-excel");
|
|
|
+ response.setHeader("Content-disposition","attachment;filename=" + URLEncoder.encode("线路过重载数据.xls", "UTF-8"));
|
|
|
+ DwFileDetail10Example example = new DwFileDetail10Example();
|
|
|
+ example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ example.setOrderByClause("dfd10_sequ");
|
|
|
+ List<DwFileDetail10> selectByExample = db.getMybatisMapper(DwFileDetail10Mapper.class).selectByExample(example);
|
|
|
+ ExportExcelUtil<DwFileDetail10> util = new ExportExcelUtil<DwFileDetail10>();
|
|
|
+ String[] header = {"系统编号","月份",
|
|
|
+ "所属县公司",
|
|
|
+ "班组名称 ",
|
|
|
+ "变电站名称",
|
|
|
+ "线路名称 ",
|
|
|
+ "额定电流(A)",
|
|
|
+ "负载率(%) ",
|
|
|
+ "过(重)载原因分类",
|
|
|
+ "具体原因(详细说明原因情况) ",
|
|
|
+ "解决措施分类 ",
|
|
|
+ "具体解决措施(详细说明解决措施) ",
|
|
|
+ "完成时间 ",
|
|
|
+ "过载时长(小时) ",
|
|
|
+ "运行电流(A)",
|
|
|
+ "发生时刻 ",
|
|
|
+ "最大电流(A)",
|
|
|
+ "最大值发生时刻",
|
|
|
+ "配变数量(台)",
|
|
|
+ "配变容量(kVA)",
|
|
|
+ "是否自动化",
|
|
|
+ "PMSID",
|
|
|
+ "所属文件ID",
|
|
|
+ "",
|
|
|
+ "原EXCEL编号"};
|
|
|
+ util.exportExcel("线路过重载数据", selectByExample, os, "2007", header);
|
|
|
+ }
|
|
|
return response;
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 原始文件删除
|
|
|
* @param fileId
|
|
@@ -617,22 +941,49 @@ public class DataWareManageAction implements IMINAction {
|
|
|
) throws MINBusinessException {
|
|
|
MINActionResult res = new MINActionResult();
|
|
|
db = Service.lookup(IMINDataBaseService.class);
|
|
|
- // 删除原始文件
|
|
|
+ // 删除原始文件--逻辑删除
|
|
|
DwFileInf fileInf = new DwFileInf();
|
|
|
fileInf.setState(Constant.FILE_INF_STATE_1);
|
|
|
fileInf.setId(fileId);
|
|
|
db.updateByPrimaryKeySelective(DwFileInfMapper.class, fileInf);
|
|
|
|
|
|
/** 删除明细 */
|
|
|
- // 台区停电
|
|
|
- if (Constant.FILE_DETAIL_TYPE_00.equals(fileType)) {
|
|
|
+ if (Constant.FILE_DETAIL_TYPE_00.equals(fileType)) {// 台区停电
|
|
|
DwFileDetail00Example fileDetail00Example = new DwFileDetail00Example();
|
|
|
fileDetail00Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
db.deleteByExample(DwFileDetail00Mapper.class, fileDetail00Example);
|
|
|
- // 低电压
|
|
|
- } else if (Constant.FILE_DETAIL_TYPE_01.equals(fileType)) {
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ } else if (Constant.FILE_DETAIL_TYPE_01.equals(fileType)) {// 低电压
|
|
|
+
|
|
|
+ } else if (Constant.FILE_DETAIL_TYPE_02.equals(fileType)) {
|
|
|
+
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_03.equals(fileType)){//低电压
|
|
|
+ DwFileDetail03Example DwFileDetail03Example = new DwFileDetail03Example();
|
|
|
+ DwFileDetail03Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail03Mapper.class,DwFileDetail03Example);
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_04.equals(fileType)){//过电压
|
|
|
+ DwFileDetail04Example DwFileDetail04Example = new DwFileDetail04Example();
|
|
|
+ DwFileDetail04Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail04Mapper.class,DwFileDetail04Example);
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_05.equals(fileType)){//95598工单
|
|
|
+ DwFileDetail05Example DwFileDetail05Example = new DwFileDetail05Example();
|
|
|
+ DwFileDetail05Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail05Mapper.class,DwFileDetail05Example);
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_06.equals(fileType)){//计停非计停
|
|
|
+ DwFileDetail07Example DwFileDetail07Example = new DwFileDetail07Example();
|
|
|
+ DwFileDetail07Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail07Mapper.class,DwFileDetail07Example);
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_07.equals(fileType)){//客户信息明细
|
|
|
+
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_08.equals(fileType)){//配变过重载
|
|
|
+ DwFileDetail09Example DwFileDetail09Example = new DwFileDetail09Example();
|
|
|
+ DwFileDetail09Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail09Mapper.class,DwFileDetail09Example);
|
|
|
+ } else if(Constant.FILE_DETAIL_TYPE_09.equals(fileType)){//线路过重载
|
|
|
+ DwFileDetail10Example DwFileDetail10Example = new DwFileDetail10Example();
|
|
|
+ DwFileDetail10Example.createCriteria().andFileIdEqualTo(fileId);
|
|
|
+ db.deleteByExample(DwFileDetail10Mapper.class,DwFileDetail10Example);
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -670,7 +1021,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
|
|
|
/**
|
|
|
* 原始数据文件下载
|
|
|
- * @param fileId
|
|
|
+ * @param type
|
|
|
* @param response
|
|
|
* @return
|
|
|
* @throws MINBusinessException
|