|
|
@@ -54,37 +54,37 @@ public class DataWareManageAction implements IMINAction {
|
|
|
private IMINDataBaseService db;
|
|
|
/** 原始数据查询 */
|
|
|
public final static String FILE_INF_QUERY = "fileInfQuery";
|
|
|
-
|
|
|
+
|
|
|
/** 原始文件上传 */
|
|
|
public final static String FILE_INF_UPLOAD = "fileInfUpload";
|
|
|
-
|
|
|
+
|
|
|
/** 原始文件下载 */
|
|
|
public final static String FILE_INF_DOWNLOAD = "fileInfDownload";
|
|
|
-
|
|
|
+
|
|
|
/** 原始文件删除 */
|
|
|
public final static String FILE_INF_DELETE = "fileInfDelete";
|
|
|
-
|
|
|
+
|
|
|
/** 原始文件详情 */
|
|
|
public final static String FILE_INF_DETAIL = "fileInfDetail";
|
|
|
-
|
|
|
+
|
|
|
/** 原始数据下载 */
|
|
|
public final static String FILE_DATA_DOWNLOAD = "fileDataDownload";
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 原始数据查询
|
|
|
+ * 原始数据查询
|
|
|
* @param page
|
|
|
* @param limit
|
|
|
* @param date
|
|
|
* @param fileName
|
|
|
* @return
|
|
|
* @throws MINBusinessException
|
|
|
- * @throws InvocationTargetException
|
|
|
- * @throws IllegalArgumentException
|
|
|
- * @throws IllegalAccessException
|
|
|
- * @throws SecurityException
|
|
|
- * @throws NoSuchMethodException
|
|
|
- * @throws InstantiationException
|
|
|
+ * @throws InvocationTargetException
|
|
|
+ * @throws IllegalArgumentException
|
|
|
+ * @throws IllegalAccessException
|
|
|
+ * @throws SecurityException
|
|
|
+ * @throws NoSuchMethodException
|
|
|
+ * @throws InstantiationException
|
|
|
*/
|
|
|
@MINAction(value = FILE_INF_QUERY)
|
|
|
public MINActionResult fileInfQuery(
|
|
|
@@ -103,11 +103,11 @@ public class DataWareManageAction implements IMINAction {
|
|
|
MINRowBounds rows = new MINRowBounds(page, limit);
|
|
|
rows.setSeparateSql(true);
|
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
|
-
|
|
|
+
|
|
|
param.put("date", StringUtil.ObjectToString(date).replaceAll("-",""));
|
|
|
param.put("fileName", fileName);
|
|
|
param.put("type", type);
|
|
|
-
|
|
|
+
|
|
|
if (!CommonUtil.isEmpty(notInData)) {
|
|
|
JSONArray notInArray = JSONArray.fromObject(notInData);
|
|
|
if (notInArray.size() != 0) {
|
|
|
@@ -123,40 +123,40 @@ public class DataWareManageAction implements IMINAction {
|
|
|
param.put("fileTypeArray", selectByExample);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
User user = session.getUser();
|
|
|
String roleId = user.getRoleId();
|
|
|
-
|
|
|
+
|
|
|
// 非系统管理员
|
|
|
if (!Constant.ROLE_ID.equals(roleId)) {
|
|
|
param.put("branchId", user.getBranchid());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<Map<String, String>> list = db.getMybatisMapper(DataWareManageMapper.class)
|
|
|
.selectFileInf(param, rows);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<String> creatUserIdList = CommonUtil.getIdFromList(list, "creatUser");
|
|
|
ImUserExample userExam = new ImUserExample();
|
|
|
userExam.createCriteria().andIdIn(creatUserIdList);
|
|
|
List<ImUser> userList = db.selectByExample(ImUserMapper.class, userExam);
|
|
|
-
|
|
|
+
|
|
|
String[] str1 = {"creatUser"};
|
|
|
String[] str2 = {"id"};
|
|
|
String[] str3 = {"name"};
|
|
|
String[] str4 = {"userName"};
|
|
|
list = ListUtil.mergeList(list, userList, str1, str2, str3, str4);
|
|
|
-
|
|
|
+
|
|
|
list = Service.lookup(IFormatService.class).formatDate(list, "uploadDate");
|
|
|
// 设置返回值
|
|
|
res.set(IMINBusinessConstant.F_PAGING_LAY, list);
|
|
|
res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 上传原始文件
|
|
|
* @param request
|
|
|
@@ -177,14 +177,14 @@ public class DataWareManageAction implements IMINAction {
|
|
|
) throws MINBusinessException, InvalidFormatException, IOException, ParseException {
|
|
|
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 fileId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_INF_NO");
|
|
|
List<Map<String,String>> list = null;
|
|
|
// 台区停电
|
|
|
@@ -192,18 +192,18 @@ public class DataWareManageAction implements IMINAction {
|
|
|
// 获取表格信息
|
|
|
String[] titleKey = new String[]{"number","addressNum","addressName","date", "area","comonpanyName","terminalName","terminalNum","terminalAddress","startTime","endTime"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 详情数据存入数据库
|
|
|
for (Map<String,String> excelMap : list) {
|
|
|
// 日期
|
|
|
String date = excelMap.get("date").replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "").substring(0,8);
|
|
|
String startTime = excelMap.get("startTime").replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");
|
|
|
String endTime = excelMap.get("endTime").replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");
|
|
|
-
|
|
|
+
|
|
|
// 页面确认有重复数据,且点击确认上传,不再判断数据库是否有数据
|
|
|
if (!chongfuFlag) {
|
|
|
// 验证是否有重复数据
|
|
|
@@ -223,7 +223,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
throw new MINBusinessException("chongfu|" + selectByExample.get(0).getAddressNum() + "|" + selectByExample.get(0).getAddressName() + "|" + selectByExample.get(0).getDate());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
String fileDetailId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_DETAIL_00_NO");
|
|
|
DwFileDetail00 fileDetail00 = new DwFileDetail00();
|
|
|
fileDetail00.setId(fileDetailId);
|
|
|
@@ -245,11 +245,11 @@ public class DataWareManageAction implements IMINAction {
|
|
|
} else if (Constant.FILE_DETAIL_TYPE_01.equals(fileType)) {
|
|
|
String[] titleKey = new String[]{"id","tname","cmode","value", "facname","type","fdid","yxstatus","tytime"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 详情数据存入数据库
|
|
|
for (Map<String,String> excelMap : list) {
|
|
|
DwFileDetail01Example dwFileDetail01 = new DwFileDetail01Example();
|
|
|
@@ -285,11 +285,11 @@ public class DataWareManageAction implements IMINAction {
|
|
|
} else if (Constant.FILE_DETAIL_TYPE_02.equals(fileType)) {
|
|
|
String[] titleKey = new String[]{"no","beginTime","endTime","gdlx", "cxbdz","xlmc","xllx","qdfa","gzqjpd","gzqhdhf","gzgl"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 详情数据存入数据库
|
|
|
for (Map<String,String> excelMap : list) {
|
|
|
String fileDetailId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_DETAIL_02_NO");
|
|
|
@@ -311,9 +311,9 @@ public class DataWareManageAction implements IMINAction {
|
|
|
}
|
|
|
//低电压
|
|
|
} 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"};
|
|
|
+ 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);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
|
@@ -360,9 +360,9 @@ public class DataWareManageAction implements IMINAction {
|
|
|
}
|
|
|
//过电压
|
|
|
} 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"};
|
|
|
+ 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);
|
|
|
-
|
|
|
+
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
}
|
|
|
@@ -412,7 +412,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
// 95598工单原始数据上传
|
|
|
} else if(Constant.FILE_DETAIL_TYPE_05.equals(fileType)) {
|
|
|
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"};
|
|
|
+ "YWZL","SJDW","GDDW","CBD","CLJG","CLDW","CLBM","HDS","BZ","GLGD","WTYYFL","GDFJ","ZRBM","GDSJ","GQSJ","GQYY","FWQD","SJHTZRYY"};
|
|
|
list = FilesUtil.readExecleasy(fileItem, titleKey, 1);
|
|
|
if (list.size() == 0) {
|
|
|
throw new MINBusinessException("无数据,请添加数据");//无数据,请添加数据
|
|
|
@@ -445,6 +445,8 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileDetail05.setCljg(excelMap.get("CLJG"));
|
|
|
fileDetail05.setCldw(excelMap.get("CLDW"));
|
|
|
fileDetail05.setClbm(excelMap.get("CLBM"));
|
|
|
+ fileDetail05.setGds(excelMap.get("GDS"));
|
|
|
+ fileDetail05.setBz(excelMap.get("BZ"));
|
|
|
fileDetail05.setGlgd(excelMap.get("GLGD"));
|
|
|
fileDetail05.setWtyyfl(excelMap.get("WTYYFL"));
|
|
|
fileDetail05.setGdfj(excelMap.get("GDFJ"));
|
|
|
@@ -677,13 +679,13 @@ public class DataWareManageAction implements IMINAction {
|
|
|
this.batchXlgzzReportData(ll,2);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 文件名
|
|
|
String filePath = Service.lookup(IPropertiesService.class).getSystemProperties().get("FILE_SERVER_BASE_PATH").getKey();
|
|
|
String saveName = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
String[] fileNameArray = fileName.split("\\.");
|
|
|
saveName = saveName + "." + fileNameArray[fileNameArray.length - 1];
|
|
|
-
|
|
|
+
|
|
|
// 保存文件数据
|
|
|
String currentDate = DateUtil.getCurrentDateString();
|
|
|
User user = (User)session.getUser();
|
|
|
@@ -697,10 +699,10 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileInf.setType(fileType);
|
|
|
fileInf.setSavePath(filePath + saveName);
|
|
|
db.insertSelective(DwFileInfMapper.class, fileInf);
|
|
|
-
|
|
|
+
|
|
|
// 保存文件到本地
|
|
|
FilesUtil.uploadFile(fileItem, filePath, "", saveName, 0);
|
|
|
-
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -778,7 +780,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
* @param response
|
|
|
* @return
|
|
|
* @throws MINBusinessException
|
|
|
- * @throws IOException
|
|
|
+ * @throws IOException
|
|
|
*/
|
|
|
@MINAction(value = FILE_INF_DOWNLOAD)
|
|
|
public HttpServletResponse fileInfDownload(
|
|
|
@@ -789,7 +791,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
DwFileInf fileInf = db.selectByPrimaryKey(DwFileInfMapper.class, fileId);
|
|
|
String type = fileInf.getType();
|
|
|
// FilesUtil.writeFile2Response(response, fileInf.getSavePath(), fileInf.getFileName());
|
|
|
-
|
|
|
+
|
|
|
OutputStream os = null;
|
|
|
ServletOutputStream ros = null;
|
|
|
ros = response.getOutputStream();
|
|
|
@@ -948,7 +950,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
fileInf.setState(Constant.FILE_INF_STATE_1);
|
|
|
fileInf.setId(fileId);
|
|
|
db.updateByPrimaryKeySelective(DwFileInfMapper.class, fileInf);
|
|
|
-
|
|
|
+
|
|
|
/** 删除明细 */
|
|
|
if (Constant.FILE_DETAIL_TYPE_00.equals(fileType)) {// 台区停电
|
|
|
DwFileDetail00Example fileDetail00Example = new DwFileDetail00Example();
|
|
|
@@ -988,7 +990,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 原始文件明细查询
|
|
|
* @param fileId
|
|
|
@@ -1009,7 +1011,7 @@ public class DataWareManageAction implements IMINAction {
|
|
|
db = Service.lookup(IMINDataBaseService.class);
|
|
|
MINRowBounds rows = new MINRowBounds(page, limit);
|
|
|
rows.setSeparateSql(true);
|
|
|
-
|
|
|
+
|
|
|
Map<String, String> param = new HashMap<String, String>();
|
|
|
param.put("fileId", fileId);
|
|
|
param.put("fileIdListStr", fileIdListStr);
|
|
|
@@ -1020,14 +1022,14 @@ public class DataWareManageAction implements IMINAction {
|
|
|
res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 原始数据文件下载
|
|
|
* @param type
|
|
|
* @param response
|
|
|
* @return
|
|
|
* @throws MINBusinessException
|
|
|
- * @throws IOException
|
|
|
+ * @throws IOException
|
|
|
*/
|
|
|
@MINAction(value = FILE_DATA_DOWNLOAD)
|
|
|
public HttpServletResponse fileDataDownload(
|
|
|
@@ -1038,9 +1040,9 @@ public class DataWareManageAction implements IMINAction {
|
|
|
db = Service.lookup(IMINDataBaseService.class);
|
|
|
date = date.replaceAll(" ", "");
|
|
|
date = date.replaceAll("-", "");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
OutputStream os = null;
|
|
|
ServletOutputStream ros = null;
|
|
|
ros = response.getOutputStream();
|