Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 11a6372d
authored
Dec 21, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
删除多余的代码
1 parent
ee287ddb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
0 additions
and
899 deletions
pom.xml
src/main/java/cn/com/glsx/stdinterface/common/enums/FileExtensionEnum.java
src/main/java/cn/com/glsx/stdinterface/config/FdfsPropertyConfig.java
src/main/java/cn/com/glsx/stdinterface/modules/component/EmailCompont.java
src/main/java/cn/com/glsx/stdinterface/modules/controller/ZhongliWindReportController.java
src/main/java/cn/com/glsx/stdinterface/modules/model/MailInfo.java
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteGpsBsService.java
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteReportFeignService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/ZhongliWindReportService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/ZhongliWindReportSetData.java
src/main/java/cn/com/glsx/stdinterface/modules/util/EmailUtil.java
src/main/java/cn/com/glsx/stdinterface/modules/util/FdfsUtils.java
pom.xml
View file @
11a6372
...
@@ -82,13 +82,6 @@
...
@@ -82,13 +82,6 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<!-- 发送邮件 -->
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
mail
</artifactId>
<version>
1.4.7
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/cn/com/glsx/stdinterface/common/enums/FileExtensionEnum.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
common
.
enums
;
/**
* 项目名:ne-shield-insurancenter
* 包名: cn.com.glsx.insurance.common.enums
* 作者: Yanglinlong
* 日期: 2021/7/6 17:24
*/
public
enum
FileExtensionEnum
{
/**
* 文件扩展名枚举
*/
PDF
(
"pdf"
),
XLS
(
"xls"
),
XLSX
(
"xlsx"
);
private
String
fileExtension
;
FileExtensionEnum
(
String
fileExtension
)
{
this
.
fileExtension
=
fileExtension
;
}
public
String
getFileExtension
()
{
return
this
.
fileExtension
;
}
}
src/main/java/cn/com/glsx/stdinterface/config/FdfsPropertyConfig.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
/**
* FastDFS 配置类
*
* @author yll
*/
@Configuration
@ConfigurationProperties
(
prefix
=
"fdfs"
)
public
class
FdfsPropertyConfig
{
/**
* 图片服务器的地址
*/
private
String
trackerNginxDomain
;
public
String
getTrackerNginxDomain
()
{
return
trackerNginxDomain
;
}
public
void
setTrackerNginxDomain
(
String
trackerNginxDomain
)
{
this
.
trackerNginxDomain
=
trackerNginxDomain
;
}
}
src/main/java/cn/com/glsx/stdinterface/modules/component/EmailCompont.java
deleted
100644 → 0
View file @
ee287dd
//package cn.com.glsx.stdinterface.modules.component;
//
//import cn.com.glsx.stdinterface.modules.model.MailInfo;
//import cn.com.glsx.stdinterface.modules.util.EmailUtil;
//import com.glsx.plat.context.utils.PropertiesUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//import org.springframework.util.CollectionUtils;
//
//import javax.mail.*;
//import javax.mail.internet.InternetAddress;
//import javax.mail.internet.MimeMessage;
//import java.io.UnsupportedEncodingException;
//import java.util.List;
//import java.util.Properties;
//
///**
// * 发送邮件组件
// *
// * @author yll
// */
//@Slf4j
//@Component
//public class EmailCompont {
// private static final String USER_NAME = PropertiesUtils.getProperty("mail.username");
// private static final String PASSWORD = PropertiesUtils.getProperty("mail.pwd");
// private static Session session;
//
// static {
// Properties properties = new Properties();
// properties.setProperty("mail.smtp.host", PropertiesUtils.getProperty("mail.host"));
// properties.setProperty("mail.transport.protocol", "smtp");
// properties.setProperty("mail.smtp.auth", "true");
// properties.setProperty("mail.smtp.port", "465");
// properties.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
// properties.setProperty("mail.smtp.socketFactory.fallback", "false");
//
// // Get the Session object.(Session session = Session.getDefaultInstance(properties);)
// session = Session.getInstance(properties,
// new javax.mail.Authenticator() {
// @Override
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(USER_NAME, PASSWORD);
// }
// });
// session.setDebug(false);
// }
//
// public boolean sendEmail(MailInfo mailInfo) {
// // 1. 创建内容
// MimeMessage mimeMessage = null;
// try {
// mimeMessage = initMimeMessage(mailInfo);
// } catch (Exception e) {
// log.error("send email instance messageinfo exception:{}", e.getMessage(), e);
// return false;
// }
//
// // 2. 初始化发送
// Transport transport = null;
// try {
// transport = session.getTransport();
// } catch (NoSuchProviderException e) {
// log.error("send email get transeport exception:{}", e.getMessage(), e);
// return false;
// }
//
// try {
// // 3. 使用 邮箱账号 和 密码 连接邮件服务器
// transport.connect(USER_NAME, PASSWORD);
// // 4. 发送邮件, 发到所有的收件地址, message.getAllRecipients() 获取到的是在创建邮件对象时添加的所有收件人, 抄送人, 密送人
// transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
// } catch (MessagingException e) {
// log.error("send email connect server exception:{}", e.getMessage(), e);
// return false;
// } finally {
// try {
// transport.close();
// } catch (MessagingException e) {
// log.error("send email transeport close exception:{}", e.getMessage(), e);
// return false;
// }
// }
// return true;
// }
//
// private MimeMessage initMimeMessage(MailInfo mailInfo) throws MessagingException, UnsupportedEncodingException {
// // 1. 创建消息
// MimeMessage mimeMessage = new MimeMessage(session);
// // 2. 设置发送人(可自定义personal)
// mimeMessage.setFrom(new InternetAddress(mailInfo.getFromUser(), "广联运营企业邮箱", mailInfo.getCharset()));
// // 3. 设置接收人
// // mimeMessage.addRecipients(Message.RecipientType.TO, mailInfo.getToUser());
// InternetAddress[] internetAddressCC = InternetAddress.parse(mailInfo.getToUser());
// mimeMessage.addRecipients(Message.RecipientType.TO, internetAddressCC);
// // 4. 设置抄送人
// addCCUser(mailInfo.getCcUsers(), mimeMessage);
// // 5. 设置主题
// mimeMessage.setSubject(mailInfo.getSubject(), mailInfo.getCharset());
// // 6. 设置邮件内容(包含邮件体和附件;设置整封邮件的MIME消息体为混合的组合关系)
// mimeMessage.setContent(EmailUtil.buildEmailContent(mailInfo));
// mimeMessage.saveChanges();
// return mimeMessage;
// }
//
// private void addCCUser(List<String> ccUsers, MimeMessage mimeMessage) throws MessagingException {
// if (CollectionUtils.isEmpty(ccUsers)) {
// return;
// }
//
// for (String user :
// ccUsers) {
// mimeMessage.addRecipients(Message.RecipientType.CC, user);
// }
// }
//}
src/main/java/cn/com/glsx/stdinterface/modules/controller/ZhongliWindReportController.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
controller
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.enums.OperateType
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 仲利风控报表 controller
*
* @author yll
*/
@Slf4j
@RestController
@RequestMapping
(
value
=
"/statisticsinstore"
)
@Api
(
value
=
"定时任务仲利风控报表数据"
,
tags
=
{
"定时任务仲利风控报表数据"
})
public
class
ZhongliWindReportController
{
private
final
static
String
MODULE
=
"仲利风控报表"
;
// @Autowired
// private ZhongliWindReportService zhongliWindReportService;
@GetMapping
(
value
=
"/statisticsandsendemail"
)
@SysLog
(
module
=
MODULE
,
value
=
"统计并发送仲利风控报表邮件"
,
action
=
OperateType
.
QUERY
)
@ApiOperation
(
value
=
"统计并发送仲利风控报表邮件"
)
public
R
<
Integer
>
statisticsAndSendEmail
()
{
// log.info("开始构建仲利风控数据===start");
// StopWatch sw = new StopWatch();
// sw.start("statisticsAndSendEmail");
// // 1.查找、构建数据
// List<ZhongliWindReport> zhongliWindReportList = zhongliWindReportService.makeWindData();
// log.info("本次统计仲利风控的报表条数===" + zhongliWindReportList.size());
//
// // 2.插入仲利风控数据
// zhongliWindReportService.saveZhongliWindDataList(zhongliWindReportList);
//
// // 3.构建报表信息
// File excelFile = zhongliWindReportService.exportToExcel(zhongliWindReportList);
//
// // 4.发送邮件
// zhongliWindReportService.sendEmail(excelFile);
//
// sw.stop();
// log.info("{} 耗时:{} s", sw.getLastTaskName(), sw.getLastTaskTimeMillis());
// log.info("构建仲利风控数据结束===end");
// return R.ok().data(zhongliWindReportList.size());
return
R
.
ok
();
}
}
src/main/java/cn/com/glsx/stdinterface/modules/model/MailInfo.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
model
;
import
java.io.File
;
import
java.util.List
;
/**
* 邮件实体类
*
* @author yll
*/
public
class
MailInfo
{
/**
* 发送人
*/
private
String
fromUser
;
/**
* 接收人
*/
private
String
toUser
;
/**
* 主题
*/
private
String
subject
;
/**
* 抄送人
*/
private
List
<
String
>
ccUsers
;
/**
* 附件
*/
private
List
<
File
>
attachList
;
/**
* 邮件内容
*/
private
String
content
;
/**
* 编码格式
*/
private
String
charset
=
"utf-8"
;
public
String
getFromUser
()
{
return
fromUser
;
}
public
MailInfo
setFromUser
(
String
fromUser
)
{
this
.
fromUser
=
fromUser
;
return
this
;
}
public
String
getToUser
()
{
return
toUser
;
}
public
MailInfo
setToUser
(
String
toUser
)
{
this
.
toUser
=
toUser
;
return
this
;
}
public
String
getSubject
()
{
return
subject
;
}
public
MailInfo
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
return
this
;
}
public
List
<
String
>
getCcUsers
()
{
return
ccUsers
;
}
public
MailInfo
setCcUsers
(
List
<
String
>
ccUsers
)
{
this
.
ccUsers
=
ccUsers
;
return
this
;
}
public
List
<
File
>
getAttachList
()
{
return
attachList
;
}
public
MailInfo
setAttachList
(
List
<
File
>
attachList
)
{
this
.
attachList
=
attachList
;
return
this
;
}
public
String
getContent
()
{
return
content
;
}
public
MailInfo
setContent
(
String
content
)
{
this
.
content
=
content
;
return
this
;
}
public
String
getCharset
()
{
return
charset
;
}
public
MailInfo
setCharset
(
String
charset
)
{
this
.
charset
=
charset
;
return
this
;
}
@Override
public
String
toString
()
{
return
"MailInfo{"
+
", fromUser='"
+
fromUser
+
'\''
+
", toUser='"
+
toUser
+
'\''
+
", subject='"
+
subject
+
'\''
+
", ccUsers="
+
ccUsers
+
", attachList="
+
attachList
+
", content='"
+
content
+
'\''
+
", charset='"
+
charset
+
'\''
+
'}'
;
}
}
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteGpsBsService.java
deleted
100644 → 0
View file @
ee287dd
//package cn.com.glsx.stdinterface.modules.remote;
//
////import cn.com.glsx.devicemonitor.api.feign.GpsBsService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * GpsBsService 服务的处理层
// *
// * @author yll
// */
//@Slf4j
//@Service
//public class RemoteGpsBsService {
//
//// @Autowired
//// private GpsBsService gpsBsService;
//}
src/main/java/cn/com/glsx/stdinterface/modules/remote/RemoteReportFeignService.java
deleted
100644 → 0
View file @
ee287dd
//package cn.com.glsx.stdinterface.modules.remote;
//
//import cn.com.glsx.alarm.api.AlarmFeignClient;
//import cn.com.glsx.alarm.api.DeviceLoginFeignClient;
//import cn.com.glsx.alarm.api.DevicePowerFeignClient;
//import cn.com.glsx.alarm.api.StuJudgeAlarmFeignClient;
//import cn.com.glsx.alarm.services.export.*;
//import cn.com.glsx.devicemonitor.api.dto.export.DeviceRelateFactorDto;
//import cn.com.glsx.devicemonitor.api.dto.export.HomeWorkAddrDto;
//import cn.com.glsx.devicemonitor.api.dto.export.MileageModelDto;
//import cn.com.glsx.devicemonitor.api.feign.MileFeignService;
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.util.ObjectUtil;
//import com.glsx.plat.common.utils.StringUtils;
//import com.glsx.plat.core.web.R;
//import com.google.common.collect.Lists;
//import com.google.gson.reflect.TypeToken;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.collections.CollectionUtils;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
///**
// * 里程家庭地址基础服务
// *
// * @author yll
// */
//@Slf4j
//@Service
//public class RemoteReportFeignService {
//
// @Autowired
// private MileFeignService mileFeignService;
//
// @Autowired
// private DeviceLoginFeignClient deviceLoginFeignClient;
//
// @Autowired
// private AlarmFeignClient alarmFeignClient;
//
// @Autowired
// private DevicePowerFeignClient devicePowerFeignClient;
//
// @Autowired
// private StuJudgeAlarmFeignClient stuJudgeAlarmFeignClient;
//
// public HomeWorkAddrDto getHomeWorkAddr(String sn, String homeAddr, String workAddr) {
// R<HomeWorkAddrDto> homeWorkAddrR = mileFeignService.getHomeWorkAddr(sn, homeAddr, workAddr);
// HomeWorkAddrDto homeWorkAddr = homeWorkAddrR.getData(HomeWorkAddrDto.class);
// if (ObjectUtil.isNull(homeWorkAddr)) {
// homeWorkAddr = new HomeWorkAddrDto();
// }
// return homeWorkAddr;
// }
//
// public MileageModelDto getToatlandAverageMilage(String sn) {
// R<MileageModelDto> toatlandAverageMilageR = mileFeignService.getToatlandAverageMilage(sn);
// MileageModelDto toatlandAverageMilage = toatlandAverageMilageR.getData(MileageModelDto.class);
// if (ObjectUtil.isNull(toatlandAverageMilage)) {
// toatlandAverageMilage = new MileageModelDto();
// }
// return toatlandAverageMilage;
// }
//
// public DeviceRelateFactorDto getDeviceRelateFactor(String sn, Integer source) {
// R<DeviceRelateFactorDto> deviceRelateFactorR = mileFeignService.getDeviceRelateFactor(sn, source);
// DeviceRelateFactorDto deviceRelateFactor = deviceRelateFactorR.getData(DeviceRelateFactorDto.class);
// if (ObjectUtil.isNull(deviceRelateFactor)) {
// deviceRelateFactor = new DeviceRelateFactorDto();
// }
// return deviceRelateFactor;
// }
//
// public DeviceRelateFactorDto getNoSourceDeviceRelateFactor(String sn, Integer source) {
// R<DeviceRelateFactorDto> deviceRelateFactorR = mileFeignService.getDeviceRelateFactor(sn, source);
// DeviceRelateFactorDto deviceRelateFactor = deviceRelateFactorR.getData(DeviceRelateFactorDto.class);
// if (ObjectUtil.isNull(deviceRelateFactor)) {
// deviceRelateFactor = new DeviceRelateFactorDto();
// }
// return deviceRelateFactor;
// }
//
// public List<DeviceOfflineDto> getDeviceOfflineDesc(List<String> sns) {
// long offlineTime = 3 * 24 * 3600L;
// R<List<DeviceOfflineDto>> deviceOfflineListR = deviceLoginFeignClient.getDeviceOfflineDesc(sns, offlineTime);
// List<DeviceOfflineDto> deviceOfflineList = deviceOfflineListR.getDataList(new TypeToken<List<DeviceOfflineDto>>() {
// }.getType());
// if (CollectionUtil.isEmpty(deviceOfflineList)) {
// deviceOfflineList = Lists.newArrayList();
// }
// return deviceOfflineList;
// }
//
// public AlarmLightDto getAlarmLight(List<String> sns, int alarmType) {
// R<List<AlarmLightDto>> alarmLightListR = alarmFeignClient.getAlarmLight(sns, alarmType);
// List<AlarmLightDto> alarmLightList = alarmLightListR.getDataList(new TypeToken<List<DeviceOfflineDto>>() {
// }.getType());
// if (CollectionUtils.isEmpty(alarmLightList)) {
// return null;
// }
// AlarmLightDto retAlarmLight = new AlarmLightDto();
// for (AlarmLightDto alarmLight : alarmLightList) {
// String alarmTime = alarmLight.getAlarmTime();
// if (StringUtils.isEmpty(alarmTime)) {
// continue;
// }
// String lng = alarmLight.getLng();
// String lat = alarmLight.getLat();
//// String address = iceInstance.parserGpsAddress(lng, lat);
// retAlarmLight.setRuleName(alarmLight.getRuleName());
// retAlarmLight.setAlarmTime(alarmTime);
//// retAlarmLight.setAlarmAddress(address);
// retAlarmLight.setRuleType("平台默认触发");
// retAlarmLight.setRuleName("设备报警");
// retAlarmLight.setAlarmTimes(alarmLightList.size());
// //查询最新的第一条返回
// break;
// }
// return retAlarmLight;
// }
//
// public SecondPressurePOIDto getSecondPressurePoi(List<String> sns) {
// R<List<BaseAlarmDataModelDto>> secondPressurePoiListR = stuJudgeAlarmFeignClient.getSecondPressurePoi(sns);
// List<BaseAlarmDataModelDto> secondPressurePoiList = secondPressurePoiListR.getDataList(new TypeToken<List<BaseAlarmDataModelDto>>() {
// }.getType());
// if (CollectionUtils.isEmpty(secondPressurePoiList)) {
// return null;
// }
// SecondPressurePOIDto retSecondPressure = new SecondPressurePOIDto();
// for (BaseAlarmDataModelDto secPress : secondPressurePoiList) {
// String alarmTime = secPress.getAlarmTime();
// if (StringUtils.isEmpty(alarmTime)) {
// continue;
// }
// BeanUtils.copyProperties(secPress, retSecondPressure);
// retSecondPressure.setAlarmTime(alarmTime);
// retSecondPressure.setRuleType("平台默认触发");
// retSecondPressure.setAlarnTimes(secondPressurePoiList.size());
// //设置地址
//// retSecondPressure.setAlarmAddress(handleAlarmAddress(ice, secPress));
// break;
// }
// return retSecondPressure;
// }
//
// public AlarmHighRiskDto getAlarmHighRisk(List<String> sns) {
// R<List<BaseAlarmDataModelDto>> alarmHighRiskR = alarmFeignClient.getAlarmHighRisk(sns);
// List<BaseAlarmDataModelDto> alarmHighRiskList = alarmHighRiskR.getDataList(new TypeToken<List<BaseAlarmDataModelDto>>() {
// }.getType());
// if (CollectionUtils.isEmpty(alarmHighRiskList)) {
// return null;
// }
// AlarmHighRiskDto alarmHighRisk = new AlarmHighRiskDto();
// for (BaseAlarmDataModelDto secPress : alarmHighRiskList) {
// String alarmTime = secPress.getAlarmTime();
// if (StringUtils.isEmpty(alarmTime)) {
// continue;
// }
// BeanUtils.copyProperties(secPress, alarmHighRisk);
// alarmHighRisk.setAlarmTime(alarmTime);
// alarmHighRisk.setRuleType("平台默认触发");
// alarmHighRisk.setAlarmTimes(alarmHighRiskList.size());
// //设置地址
//// alarmHighRisk.setAlarmAddress(handleAlarmAddress(ice, secPress));
// break;
// }
// return alarmHighRisk;
// }
//
// public AlarmStayOverTimeDto getAlarmOverTime(List<String> sns) {
// R<List<BaseAlarmDataModelDto>> alarmOverTimeListR = alarmFeignClient.getAlarmOverTime(sns);
// List<BaseAlarmDataModelDto> alarmOverTimeList = alarmOverTimeListR.getDataList(new TypeToken<List<BaseAlarmDataModelDto>>() {
// }.getType());
// if (CollectionUtils.isEmpty(alarmOverTimeList)) {
// return null;
// }
// AlarmStayOverTimeDto stayOverTime = new AlarmStayOverTimeDto();
// for (BaseAlarmDataModelDto data : alarmOverTimeList) {
// String alarmTime = data.getAlarmTime();
// if (StringUtils.isEmpty(alarmTime)) {
// continue;
// }
// BeanUtils.copyProperties(data, stayOverTime);
// stayOverTime.setRuleType("平台默认触发");
// stayOverTime.setAlarmTimes(alarmOverTimeList.size());
// //设置地址
//// stayOverTime.setAlarmAddress(handleAlarmAddress(ice, data));
// //查询最新的第一条返回
// break;
// }
// return stayOverTime;
// }
//
// public RiskLevelModelDto getRiskLevel(String sn) {
// R<RiskLevelModelDto> riskLevelR = alarmFeignClient.getRiskLevel(sn);
// RiskLevelModelDto riskLevel = riskLevelR.getData(RiskLevelModelDto.class);
// if (ObjectUtil.isNull(riskLevel)) {
// riskLevel = new RiskLevelModelDto();
// }
// return riskLevel;
// }
//
// public AggregationDataModelDto getAggregationDataModel(String sn) {
// R<AggregationDataModelDto> aggregationDataModelR = stuJudgeAlarmFeignClient.getAggregationDataModel(sn);
// AggregationDataModelDto aggregationDataModel = aggregationDataModelR.getData(AggregationDataModelDto.class);
// if (ObjectUtil.isNull(aggregationDataModel)) {
// aggregationDataModel = new AggregationDataModelDto();
// }
// return aggregationDataModel;
// }
//}
src/main/java/cn/com/glsx/stdinterface/modules/service/ZhongliWindReportService.java
deleted
100644 → 0
View file @
ee287dd
//package cn.com.glsx.stdinterface.modules.service;
//
////import cn.com.glsx.stdinterface.modules.component.EmailCompont;
//import cn.com.glsx.stdinterface.modules.mapper.VehicleMapper;
//import cn.com.glsx.stdinterface.modules.model.MailInfo;
//import cn.com.glsx.stdinterface.modules.model.export.ZhongliWindReport;
//import cn.hutool.core.date.DateUtil;
//import com.glsx.plat.common.utils.StringUtils;
//import com.glsx.plat.context.utils.PropertiesUtils;
//import com.glsx.plat.office.excel.EasyExcelUtils;
//import com.google.common.collect.Lists;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.collections.CollectionUtils;
//import org.apache.commons.io.IOUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.io.BufferedOutputStream;
//import java.io.File;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//
///**
// * 仲利风控 service
// *
// * @author yll
// */
//@Slf4j
//@Service
//public class ZhongliWindReportService {
//
// @Autowired
// private ZhongliWindReportSetData zhongliWindReportSetData;
//
//// @Autowired
//// private EmailCompont emailCompont;
//
// @Autowired
// private VehicleMapper vehicleMapper;
//
// private static final String EXPORT_DIR = "/tmp/";
//
// public List<ZhongliWindReport> makeWindData() {
// //1.查询基础数据
// List<ZhongliWindReport> zhongliWindReportList = zhongliWindReportSetData.findVehicleInfo();
// log.info("this time ZhongliWindReport statistics base data is:" + zhongliWindReportList.size());
// zhongliWindReportList.forEach(zhongliWindReport -> {
// // 1.GPS相关信息(ICE)
// zhongliWindReportSetData.setGpsInfo(zhongliWindReport);
//
// // 2.家庭及工作地址匹配(ICE)
// zhongliWindReportSetData.setHomeWorkAddr(zhongliWindReport);
//
// // 3.里程类统计(ICE)
// zhongliWindReportSetData.setMileageModel(zhongliWindReport);
//
// //4.有线设备相关因子(ICE)
// zhongliWindReportSetData.setDeviceRelateFactor(zhongliWindReport);
//
// //5.无线设备相关因子(ICE)
// zhongliWindReportSetData.setNoSourceDeviceRelateFactor(zhongliWindReport);
//
// //6.双设备离线 有d_device_login 表
// zhongliWindReportSetData.setDeviceOfflineDesc(zhongliWindReport);
//
// //7.光感报警 d_track_alarm_rec
// zhongliWindReportSetData.setAlarmLight(zhongliWindReport);
//
// //8.掉电报警【=断电报警】 d_track_alarm_rec
// zhongliWindReportSetData.setAlarmPowerOff(zhongliWindReport);
//
// //9.二押区域POI信息 d_alarm_second_data
// zhongliWindReportSetData.setSecondPressurePoi(zhongliWindReport);
//
// //10.高危区域POI信息 d_alarm_high_risk_data
// zhongliWindReportSetData.setAlarmHighRisk(zhongliWindReport);
//
// //11.超时停留 eshield_device_alarm eshield_device_alarm_rule
// zhongliWindReportSetData.setAlarmOverTime(zhongliWindReport);
//
// //12.风险等级评估 d_device_risk_level
// zhongliWindReportSetData.setRiskLevel(zhongliWindReport);
//
// //16.异常聚集报警 by yangll t_track_stujudge_alarm
// zhongliWindReportSetData.setAggregationDataModel(zhongliWindReport);
// });
// return zhongliWindReportList;
// }
//
// public void saveZhongliWindDataList(List<ZhongliWindReport> zhongliWindReportList) {
// Integer num = vehicleMapper.saveZhongliWindDataList(zhongliWindReportList);
// log.info("仲利报表数据插入数据的行数===" + num);
// }
//
// public File exportToExcel(List<ZhongliWindReport> zhongliWindReportList) {
// if (CollectionUtils.isEmpty(zhongliWindReportList)) {
// return null;
// }
// //写入数据到 excel
// String fileName = "仲利风控报表" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx";
// try {
// FileOutputStream outputStream = new FileOutputStream(new File(EXPORT_DIR, fileName));
// BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
// EasyExcelUtils.writeExcel(bufferedOutputStream, zhongliWindReportList, fileName, ZhongliWindReport.class);
// IOUtils.closeQuietly(bufferedOutputStream);
// IOUtils.closeQuietly(outputStream);
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// }
//
// return new File(EXPORT_DIR, fileName);
// }
//
// public void sendEmail(File file) {
// if (file == null) {
// return;
// }
// String filePath = file.getAbsolutePath();
// if (StringUtils.isEmpty(filePath)) {
// return;
// }
// List<File> fileList = Lists.newArrayList(file);
// String receviceEmail = PropertiesUtils.getProperty("gq.wind.report.recevice.email");
// //抄送
// String receviceEmailSub = PropertiesUtils.getProperty("gq.wind.report.sub.recevice.email");
// if (StringUtils.isEmpty(receviceEmail) || StringUtils.isEmpty(receviceEmailSub)) {
// log.info("发送失败,未填写邮件收件人!");
// return;
// }
// String[] receviceEmailSubs = {};
// if (StringUtils.isNotEmpty(receviceEmailSub)) {
// receviceEmailSubs = receviceEmailSub.split(",");
// }
// String sendMail = PropertiesUtils.getProperty("mail.sendemail");
// String content = "仲利警情聚合宽表,具体信息请查看附件!";
//
// MailInfo mailInfo = new MailInfo();
// mailInfo.setFromUser(sendMail)
// .setToUser(receviceEmail)
// .setCcUsers(Arrays.asList(receviceEmailSubs))
// .setSubject("仲利警情聚合宽表-" + DateUtil.format(new Date(), "yyyy-MM-dd"))
// .setContent(content).
// setAttachList(fileList);
//// boolean succ = emailCompont.sendEmail(mailInfo);
//// if (succ) {
//// log.info("send ZhongliWindReport mail success!");
//// } else {
//// log.info("send ZhongliWindReport mail failed!");
//// }
// }
//}
src/main/java/cn/com/glsx/stdinterface/modules/service/ZhongliWindReportSetData.java
deleted
100644 → 0
View file @
ee287dd
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/glsx/stdinterface/modules/util/EmailUtil.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
util
;
import
cn.com.glsx.stdinterface.modules.model.MailInfo
;
import
org.springframework.util.CollectionUtils
;
import
javax.activation.DataHandler
;
import
javax.activation.FileDataSource
;
import
javax.mail.BodyPart
;
import
javax.mail.MessagingException
;
import
javax.mail.Multipart
;
import
javax.mail.internet.MimeBodyPart
;
import
javax.mail.internet.MimeMultipart
;
import
javax.mail.internet.MimeUtility
;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
/**
* 发送邮件工具类
*
* @author yll
*/
public
class
EmailUtil
{
/**
* 邮件内容模式:默认mixed
*/
private
static
final
String
mailSubType
=
"mixed"
;
public
static
Multipart
buildEmailContent
(
MailInfo
mailInfo
)
throws
MessagingException
,
UnsupportedEncodingException
{
// 1. 创建邮件内容
MimeMultipart
mixed
=
new
MimeMultipart
(
mailSubType
);
// 2. 构建邮件正文
mixed
.
addBodyPart
(
getBodyContent
(
mailInfo
));
// 3. 构建附件内容
buildAttackList
(
mailInfo
,
mixed
);
return
mixed
;
}
private
static
MimeBodyPart
getBodyContent
(
MailInfo
mailInfo
)
throws
MessagingException
{
//创建邮件正文
MimeBodyPart
content
=
new
MimeBodyPart
();
MimeMultipart
bodyMimeMultipart
=
new
MimeMultipart
(
"related"
);
//正文的HTML部分(支持html标签)
MimeBodyPart
bodyPart
=
new
MimeBodyPart
();
bodyPart
.
setContent
(
mailInfo
.
getContent
(),
"text/html;charset=utf-8"
);
// 设置正文内容
bodyMimeMultipart
.
addBodyPart
(
bodyPart
);
content
.
setContent
(
bodyMimeMultipart
);
return
content
;
}
private
static
void
buildAttackList
(
MailInfo
mailInfo
,
MimeMultipart
mixed
)
throws
MessagingException
,
UnsupportedEncodingException
{
if
(
CollectionUtils
.
isEmpty
(
mailInfo
.
getAttachList
()))
{
return
;
}
for
(
File
attackFile
:
mailInfo
.
getAttachList
())
{
mixed
.
addBodyPart
(
getFileAttack
(
attackFile
));
}
}
private
static
BodyPart
getFileAttack
(
File
attackFile
)
throws
MessagingException
,
UnsupportedEncodingException
{
MimeBodyPart
attackPart
=
new
MimeBodyPart
();
FileDataSource
fileDataSource
=
new
FileDataSource
(
attackFile
);
DataHandler
dataHandler
=
new
DataHandler
(
fileDataSource
);
attackPart
.
setDataHandler
(
dataHandler
);
attackPart
.
setFileName
(
MimeUtility
.
encodeText
(
attackFile
.
getName
()));
return
attackPart
;
}
}
src/main/java/cn/com/glsx/stdinterface/modules/util/FdfsUtils.java
deleted
100644 → 0
View file @
ee287dd
package
cn
.
com
.
glsx
.
stdinterface
.
modules
.
util
;
import
cn.com.glsx.stdinterface.config.FdfsPropertyConfig
;
import
cn.hutool.core.date.DateUtil
;
import
com.github.tobato.fastdfs.domain.fdfs.StorePath
;
import
com.github.tobato.fastdfs.service.FastFileStorageClient
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Date
;
/**
* FastDFS 文件操作工具类
*
* @author yll
*/
@Component
public
class
FdfsUtils
{
private
static
final
String
FDFS_DOMAIN_PROP
=
"tracker-nginx-domain"
;
private
static
final
String
DOMAIN_SEPARATOR
=
"/"
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FdfsUtils
.
class
);
private
static
FdfsPropertyConfig
fdfsPropertyConfig
;
private
static
FastFileStorageClient
storageClient
;
public
static
String
uploadFile
(
MultipartFile
multipartFile
)
throws
IOException
{
String
fileUrl
;
InputStream
inputStream
=
multipartFile
.
getInputStream
();
long
fileSize
=
multipartFile
.
getSize
();
String
fileExtension
=
FilenameUtils
.
getExtension
(
multipartFile
.
getOriginalFilename
());
StorePath
storePath
=
storageClient
.
uploadFile
(
inputStream
,
fileSize
,
fileExtension
,
null
);
fileUrl
=
getFileUrl
(
storePath
);
return
fileUrl
;
}
public
static
String
uploadFile
(
byte
[]
bytes
,
String
fileExtension
)
{
ByteArrayInputStream
inputStream
=
new
ByteArrayInputStream
(
bytes
);
StorePath
storePath
=
storageClient
.
uploadFile
(
inputStream
,
bytes
.
length
,
fileExtension
,
null
);
return
getFileUrl
(
storePath
);
}
public
static
String
uploadFile
(
InputStream
inputStream
,
String
fileExtension
)
throws
IOException
{
StorePath
storePath
=
storageClient
.
uploadFile
(
inputStream
,
inputStream
.
available
(),
fileExtension
,
null
);
return
getFileUrl
(
storePath
);
}
public
static
void
deleteFile
(
String
fileUrl
)
{
if
(
StringUtils
.
isNoneBlank
(
fileUrl
))
{
StorePath
storePath
=
StorePath
.
parseFromUrl
(
fileUrl
);
storageClient
.
deleteFile
(
storePath
.
getGroup
(),
storePath
.
getPath
());
}
}
private
static
String
getFileUrl
(
StorePath
storePath
)
{
String
domain
=
fdfsPropertyConfig
.
getTrackerNginxDomain
();
logger
.
info
(
"domain == "
+
domain
);
return
domain
+
DOMAIN_SEPARATOR
+
storePath
.
getFullPath
();
}
@Autowired
public
void
setFdfsProperty
(
FdfsPropertyConfig
fdfsPropertyConfig
)
{
FdfsUtils
.
fdfsPropertyConfig
=
fdfsPropertyConfig
;
}
@Autowired
public
void
setStorageClient
(
FastFileStorageClient
storageClient
)
{
FdfsUtils
.
storageClient
=
storageClient
;
}
public
static
String
getFileName
(
String
desName
)
{
return
desName
+
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
);
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment