|
@@ -17,6 +17,7 @@ import com.simuwang.base.pojo.dto.MailboxInfoDTO;
|
|
|
import com.simuwang.manage.service.DeletionService;
|
|
|
import com.simuwang.shiro.utils.UserUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.FilterOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -53,7 +56,6 @@ public class SendDeletionEmailTask {
|
|
|
public void sendDeletionEmail(){
|
|
|
EmailTaskInfoDO emailTaskInfoDO = startEmailTask(null, 1);
|
|
|
try{
|
|
|
- String preDay = DateUtils.getAroundToday(-1) ;
|
|
|
//获取有设置净值频率的基金ID
|
|
|
List<FundDeletionBaseInfoDO> fundDeletionBaseInfoDOList = fundInfoMapper.getHasFrequencyFundInfo();
|
|
|
Map<FundDeletionBaseInfoDO,List<EmailDeletionInfoDO>> fundDeletionBaseInfoDOListMap = new HashMap<>();
|
|
@@ -66,7 +68,7 @@ public class SendDeletionEmailTask {
|
|
|
}else{
|
|
|
fundDeletionBaseInfoDO.setIsDeletion(YesOrNoType.YES.getInfo());
|
|
|
}
|
|
|
- List<EmailDeletionInfoDO> fundDeletionDetailDOList = deletionService.selectDeletionInfoByFundId(fundId,preDay);
|
|
|
+ List<EmailDeletionInfoDO> fundDeletionDetailDOList = deletionService.selectDeletionInfoByFundId(fundId);
|
|
|
if(fundDeletionDetailDOList.isEmpty()){
|
|
|
continue;
|
|
|
}
|
|
@@ -141,8 +143,8 @@ public class SendDeletionEmailTask {
|
|
|
}
|
|
|
}
|
|
|
values.put(sheetName,dataList);
|
|
|
- HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName,head,values,null);
|
|
|
- File file = new File(path+"/"+DateUtils.format(new Date(),DateUtils.YYYYMMDDHHMMSS)+"缺失明细.xls");
|
|
|
+ XSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName,head,values,null);
|
|
|
+ File file = new File(path+"/"+DateUtils.format(new Date(),DateUtils.YYYYMMDDHHMMSS)+"缺失明细.xlsx");
|
|
|
if(!file.exists()){
|
|
|
try {
|
|
|
file.createNewFile();
|
|
@@ -151,8 +153,10 @@ public class SendDeletionEmailTask {
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
|
- wb.write(file);
|
|
|
+ FileOutputStream fos = new FileOutputStream(file);
|
|
|
+ wb.write(fos);
|
|
|
wb.close();
|
|
|
+ fos.close();
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
@@ -230,8 +234,8 @@ public class SendDeletionEmailTask {
|
|
|
dataList.add(data);
|
|
|
}
|
|
|
values.put(sheetName,dataList);
|
|
|
- HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName,head,values,null);
|
|
|
- File file = new File(path+"/"+DateUtils.format(new Date(),DateUtils.YYYYMMDDHHMMSS)+"缺失产品清单.xls");
|
|
|
+ XSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName,head,values,null);
|
|
|
+ File file = new File(path+"/"+DateUtils.format(new Date(),DateUtils.YYYYMMDDHHMMSS)+"缺失产品清单.xlsx");
|
|
|
if(!file.exists()){
|
|
|
try {
|
|
|
file.createNewFile();
|
|
@@ -240,7 +244,7 @@ public class SendDeletionEmailTask {
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
|
- wb.write(file);
|
|
|
+ wb.write(new FileOutputStream(file));
|
|
|
wb.close();
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|