|
@@ -26,7 +26,6 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
|
-import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -71,8 +70,7 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
* @return 大屏通知计划
|
|
* @return 大屏通知计划
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public LabNotifyplanVO selectLabNotifyplanById(Long id)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public LabNotifyplanVO selectLabNotifyplanById(Long id) {
|
|
|
LabNotifyplanVO labNotifyplanVO = labNotifyplanMapper.selectLabNotifyplanById(id);
|
|
LabNotifyplanVO labNotifyplanVO = labNotifyplanMapper.selectLabNotifyplanById(id);
|
|
|
|
|
|
|
|
//数据为 工作计划类型时
|
|
//数据为 工作计划类型时
|
|
@@ -81,17 +79,15 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
//url不为空时解析
|
|
//url不为空时解析
|
|
|
if(labNotifyplanVO.getContentUrl()!=null){
|
|
if(labNotifyplanVO.getContentUrl()!=null){
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
- ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
|
|
|
|
|
+ ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<>(LabNotifyplanExcelVO.class);
|
|
|
|
|
|
|
|
InputStream intstream = null;
|
|
InputStream intstream = null;
|
|
|
intstream = new URL(labNotifyplanVO.getContentUrl()).openStream();
|
|
intstream = new URL(labNotifyplanVO.getContentUrl()).openStream();
|
|
|
List<LabNotifyplanExcelVO> excelList = null;
|
|
List<LabNotifyplanExcelVO> excelList = null;
|
|
|
excelList = util.importExcel(intstream);
|
|
excelList = util.importExcel(intstream);
|
|
|
- /*labNotifyplanVO.setContent(excelList.get(0).getContent());
|
|
|
|
|
- labNotifyplanVO.setCompany(excelList.get(0).getCompany());*/
|
|
|
|
|
|
|
+
|
|
|
labNotifyplanVO.setExcelList(excelList);
|
|
labNotifyplanVO.setExcelList(excelList);
|
|
|
- //Date date = (Date) sdf.parse(excelList.get(0).getCreateDate());
|
|
|
|
|
- //labNotifyplanVO.setCreateTime(date);
|
|
|
|
|
|
|
+
|
|
|
labNotifyplanVO.setExcelList(excelList);
|
|
labNotifyplanVO.setExcelList(excelList);
|
|
|
intstream.close();
|
|
intstream.close();
|
|
|
}
|
|
}
|
|
@@ -113,8 +109,7 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
* @return 大屏通知计划
|
|
* @return 大屏通知计划
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<LabNotifyplan> selectLabNotifyplanList(LabNotifyplan labNotifyplan)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public List<LabNotifyplan> selectLabNotifyplanList(LabNotifyplan labNotifyplan) {
|
|
|
return labNotifyplanMapper.selectLabNotifyplanList(labNotifyplan);
|
|
return labNotifyplanMapper.selectLabNotifyplanList(labNotifyplan);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -132,23 +127,14 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
try {
|
|
try {
|
|
|
//是否需要解析excel 标识 remark=1
|
|
//是否需要解析excel 标识 remark=1
|
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
|
- ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
|
|
|
|
+ ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<>(LabNotifyplanExcelVO.class);
|
|
|
//url为空时跳出本次循环
|
|
//url为空时跳出本次循环
|
|
|
if(list.get(0).getContentUrl()!=null) {
|
|
if(list.get(0).getContentUrl()!=null) {
|
|
|
- /*String baseUrl=request.getServerName() ;
|
|
|
|
|
- String url="";
|
|
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
|
|
- url=fileConfigUtils.getLocalUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }else{
|
|
|
|
|
- url=fileConfigUtils.getRemoteUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }*/
|
|
|
|
|
//通过配置加载文件域名
|
|
//通过配置加载文件域名
|
|
|
String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
|
|
|
|
|
|
//文件访问路径
|
|
//文件访问路径
|
|
|
- //String url = "http://192.168.1.17:9300//statics/2022/02/18/3d78b3c2-8108-4e78-a419-954e4b71a92a.xls";
|
|
|
|
|
intstream = new URL(url).openStream();
|
|
intstream = new URL(url).openStream();
|
|
|
List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
|
list.get(0).setExcelList(excelList);
|
|
list.get(0).setExcelList(excelList);
|
|
@@ -194,37 +180,12 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
//是否需要解析excel 标识 remark=1
|
|
//是否需要解析excel 标识 remark=1
|
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
|
ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
|
|
//url为空时跳出本次循环
|
|
//url为空时跳出本次循环
|
|
|
if(list.get(0).getContentUrl()!=null) {
|
|
if(list.get(0).getContentUrl()!=null) {
|
|
|
- /*String baseUrl=request.getServerName() ;
|
|
|
|
|
- String url="";
|
|
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
|
|
- url=fileConfigUtils.getLocalUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }else{
|
|
|
|
|
- url=fileConfigUtils.getRemoteUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }*/
|
|
|
|
|
//通过配置加载文件域名
|
|
//通过配置加载文件域名
|
|
|
String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
|
-
|
|
|
|
|
- /*//文件访问路径
|
|
|
|
|
- //String url = "http://192.168.1.17:9300//statics/2022/02/18/3d78b3c2-8108-4e78-a419-954e4b71a92a.xls";
|
|
|
|
|
- InputStream intstream = new URL(list.get(0).getContentUrl()).openStream();
|
|
|
|
|
- List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
|
|
|
- //list.get(0).setContent(excelList.get(0).getContent());
|
|
|
|
|
- //list.get(0).setCompany(excelList.get(0).getCompany());
|
|
|
|
|
- Date date = (Date) sdf.parse(excelList.get(0).getCreateDate());
|
|
|
|
|
- String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date);
|
|
|
|
|
- //String ss = sdf.format(Date.parse(excelList.get(0).getCreateDate()));
|
|
|
|
|
- *//*Date date = (Date) sdf.parse("Sat Jan 01 10:20:00 CST 2022");
|
|
|
|
|
- String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);*//*
|
|
|
|
|
- //list.get(0).setCreateTime(formatStr);
|
|
|
|
|
- excelList.get(0).setCreateDate(formatStr);
|
|
|
|
|
- list.get(0).setExcelList(excelList);
|
|
|
|
|
- intstream.close();*/
|
|
|
|
|
//文件访问路径
|
|
//文件访问路径
|
|
|
- //String url = "http://192.168.1.17:9300//statics/2022/02/18/3d78b3c2-8108-4e78-a419-954e4b71a92a.xls";
|
|
|
|
|
intstream = new URL(url).openStream();
|
|
intstream = new URL(url).openStream();
|
|
|
List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
|
list.get(0).setExcelList(excelList);
|
|
list.get(0).setExcelList(excelList);
|
|
@@ -262,8 +223,7 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int insertLabNotifyplan(LabNotifyplan labNotifyplan, HttpServletRequest request)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int insertLabNotifyplan(LabNotifyplan labNotifyplan, HttpServletRequest request) {
|
|
|
//添加创建人
|
|
//添加创建人
|
|
|
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
labNotifyplan.setUserId(sysUser.getUserId());
|
|
labNotifyplan.setUserId(sysUser.getUserId());
|
|
@@ -276,13 +236,6 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
try {
|
|
try {
|
|
|
//为工作计划时 解析文件是否合格 主要是时间校验
|
|
//为工作计划时 解析文件是否合格 主要是时间校验
|
|
|
if(2==labNotifyplan.getType()){
|
|
if(2==labNotifyplan.getType()){
|
|
|
- /*String baseUrl=request.getServerName() ;
|
|
|
|
|
- String url="";
|
|
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
|
|
- url=fileConfigUtils.getLocalUrl()+ labNotifyplan.getContentUrl();
|
|
|
|
|
- }else{
|
|
|
|
|
- url=fileConfigUtils.getRemoteUrl()+ labNotifyplan.getContentUrl();
|
|
|
|
|
- }*/
|
|
|
|
|
//通过配置加载文件域名
|
|
//通过配置加载文件域名
|
|
|
String url = fileConfigUtils.getFileDomainApp() + labNotifyplan.getContentUrl();
|
|
String url = fileConfigUtils.getFileDomainApp() + labNotifyplan.getContentUrl();
|
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
@@ -321,8 +274,7 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
* @return 结果
|
|
* @return 结果
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public int updateLabNotifyplan(LabNotifyplan labNotifyplan)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ public int updateLabNotifyplan(LabNotifyplan labNotifyplan) {
|
|
|
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
labNotifyplan.setUpdateTime(DateUtils.getNowDate());
|
|
labNotifyplan.setUpdateTime(DateUtils.getNowDate());
|
|
|
labNotifyplan.setUpdateUserid(sysUser.getUserId());
|
|
labNotifyplan.setUpdateUserid(sysUser.getUserId());
|
|
@@ -367,27 +319,17 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
//是否需要解析excel 标识 remark=1
|
|
//是否需要解析excel 标识 remark=1
|
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
if(list.size()>0 && "1".equals(labNotifyplan.getRemark())){
|
|
|
ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
ExcelUtil<LabNotifyplanExcelVO> util = new ExcelUtil<LabNotifyplanExcelVO>(LabNotifyplanExcelVO.class);
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
|
|
-
|
|
|
|
|
- if(list.get(0).getContentUrl()!=null) {
|
|
|
|
|
- /*String baseUrl=request.getServerName() ;
|
|
|
|
|
- String url="";
|
|
|
|
|
- if(baseUrl.contains("192.168")){
|
|
|
|
|
- url=fileConfigUtils.getLocalUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }else{
|
|
|
|
|
- url=fileConfigUtils.getRemoteUrl()+list.get(0).getContentUrl();
|
|
|
|
|
- }*/
|
|
|
|
|
- //通过配置加载文件域名
|
|
|
|
|
- String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
|
|
|
- url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
|
|
|
|
|
+ if(list.get(0).getContentUrl()!=null) {
|
|
|
|
|
+ //通过配置加载文件域名
|
|
|
|
|
+ String url = fileConfigUtils.getFileDomainApp() + list.get(0).getContentUrl();
|
|
|
|
|
+ url= UrlFormatUtils.getHttpsORHttpUrl(url);
|
|
|
|
|
|
|
|
- //文件访问路径
|
|
|
|
|
- //String url = "http://192.168.1.17:9300//statics/2022/02/18/3d78b3c2-8108-4e78-a419-954e4b71a92a.xls";
|
|
|
|
|
- intstream = new URL(url).openStream();
|
|
|
|
|
- List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
|
|
|
- list.get(0).setExcelList(excelList);
|
|
|
|
|
- intstream.close();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //文件访问路径
|
|
|
|
|
+ intstream = new URL(url).openStream();
|
|
|
|
|
+ List<LabNotifyplanExcelVO> excelList = util.importExcel(intstream);
|
|
|
|
|
+ list.get(0).setExcelList(excelList);
|
|
|
|
|
+ intstream.close();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
//e.printStackTrace();
|
|
//e.printStackTrace();
|
|
@@ -411,10 +353,4 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
|
|
|
}
|
|
}
|
|
|
return list;
|
|
return list;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- public static void main(String[] args) throws ParseException {
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
|
|
- Date date = (Date) sdf.parse("Sat Jan 01 10:20:00 CST 2022");
|
|
|
|
|
- String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|