|
@@ -6,10 +6,7 @@ import com.ywt.gapi.base.file.ReadFileResponse;
|
|
|
import com.ywt.mg.configs.Constants;
|
|
|
import com.ywt.mg.core.PagedList;
|
|
|
import com.ywt.mg.core.SqlHelper;
|
|
|
-import com.ywt.mg.core.utils.Checker;
|
|
|
-import com.ywt.mg.core.utils.CollectionUtil;
|
|
|
-import com.ywt.mg.core.utils.FormatUtil;
|
|
|
-import com.ywt.mg.core.utils.StringHelper;
|
|
|
+import com.ywt.mg.core.utils.*;
|
|
|
import com.ywt.mg.core.utils.serializers.JsonSerializer;
|
|
|
import com.ywt.mg.domain.entities.*;
|
|
|
import com.ywt.mg.domain.models.ConstantDef;
|
|
@@ -158,9 +155,13 @@ public class DownloadRecordService {
|
|
|
item.put("id", p.getId());
|
|
|
item.put("name", p.getName());
|
|
|
item.put("createTime", FormatUtil.createTimeFormatDetail(p.getCreateTime()));
|
|
|
- item.put("updateTime", FormatUtil.createTimeFormatDetail(p.getUpdateTime()));
|
|
|
item.put("status", p.getStatus());
|
|
|
item.put("statusStr", DownloadRecordStatusEnum.getDisplayName(p.getStatus()));
|
|
|
+ if(p.getStatus() == DownloadRecordStatusEnum.Default.getValue()){
|
|
|
+ item.put("updateTime", "下载中");
|
|
|
+ } else {
|
|
|
+ item.put("updateTime", FormatUtil.createTimeFormatDetail(p.getUpdateTime()));
|
|
|
+ }
|
|
|
return item;
|
|
|
});
|
|
|
pageDataResponse.setData(datas);
|
|
@@ -188,6 +189,42 @@ public class DownloadRecordService {
|
|
|
whereSql += " and ( admin_id = ?)";
|
|
|
paramList.add(hospitalId);
|
|
|
}
|
|
|
+ int status = Checker.getIntegerValue(request.getStatus());
|
|
|
+ if(status == 1){
|
|
|
+ whereSql += " and ( status = ?)";
|
|
|
+ paramList.add(status);
|
|
|
+ } else {
|
|
|
+ whereSql += " and ( status = 0 or status = 1)";
|
|
|
+ }
|
|
|
+ String formatDate = "yyyy-MM-dd";
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat(formatDate);
|
|
|
+ String endTime = getCurrentDate();
|
|
|
+ if (!Checker.isNull(endTime)) {
|
|
|
+ whereSql += " and ( create_time < ?)";
|
|
|
+ Date date = format.parse(endTime);
|
|
|
+
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(date);
|
|
|
+ calendar.add(calendar.DATE, 1);
|
|
|
+ date = calendar.getTime();
|
|
|
+
|
|
|
+ paramList.add(date);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String startTime = DateUtil.getPastDate(70);
|
|
|
+ if (!Checker.isNull(startTime)) {
|
|
|
+ whereSql += " and ( create_time >= ?)";
|
|
|
+ Date date = format.parse(startTime);
|
|
|
+ paramList.add(date);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
int pageIndex = request.getPageIndex();
|
|
|
int pageSize = request.getPageSize();
|
|
|
return sqlHelper.getPagedList(pageIndex, pageSize, "*", whereSql, "create_time desc", DownloadRecord.class, paramList.toArray());
|
|
@@ -245,12 +282,12 @@ public class DownloadRecordService {
|
|
|
|
|
|
|
|
|
ExcelStyleMap excelStyleMap = new ExcelStyleMap(new String[]{});
|
|
|
- excelDownloadSrv.generateAndReturnExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
|
|
|
+ OutputStream ba = excelDownloadSrv.generateAndReturnExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
|
|
|
|
|
|
|
|
|
String ossPath = String.format(ConstantDef.BIG_DATA_EXCEL_FILE_PATH, FormatUtil.formatDate(new Date(), "yyyy-MM"));
|
|
|
String ossFileName = fileName + suffixFormat;
|
|
|
- DataResponse dataResponse = fileSrv.localFileUploadToOss(localPath, ossFileName, ossPath);
|
|
|
+ DataResponse dataResponse = fileSrv.localFileUploadToOss(localPath, ossFileName, ossPath, ba);
|
|
|
if (dataResponse.getCode() == BaseResponse.SUCCEED) {
|
|
|
|
|
|
saveUrlAndStatus(downloadRecordId, dataResponse.getData().toString(), DownloadRecordStatusEnum.SUCCESS.getValue());
|
|
@@ -282,12 +319,12 @@ public class DownloadRecordService {
|
|
|
|
|
|
|
|
|
ExcelStyleMap excelStyleMap = new ExcelStyleMap(new String[]{});
|
|
|
- excelDownloadSrv.generateAndReturnMealExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
|
|
|
+ OutputStream ba = excelDownloadSrv.generateAndReturnMealExcelFileWithNoStyleAndCollectLocal(fileName, localPath, map, excelStyleMap, itemList);
|
|
|
|
|
|
|
|
|
String ossPath = String.format(ConstantDef.BIG_DATA_EXCEL_FILE_PATH, FormatUtil.formatDate(new Date(), "yyyy-MM"));
|
|
|
String ossFileName = fileName + suffixFormat;
|
|
|
- DataResponse dataResponse = fileSrv.localFileUploadToOss(localPath, ossFileName, ossPath);
|
|
|
+ DataResponse dataResponse = fileSrv.localFileUploadToOss(localPath, ossFileName, ossPath, ba);
|
|
|
if (dataResponse.getCode() == BaseResponse.SUCCEED) {
|
|
|
|
|
|
saveUrlAndStatus(downloadRecordId, dataResponse.getData().toString(), DownloadRecordStatusEnum.SUCCESS.getValue());
|
|
@@ -298,4 +335,15 @@ public class DownloadRecordService {
|
|
|
|
|
|
fileSrv.deleteFile(localPath);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private String getCurrentDate() {
|
|
|
+ try {
|
|
|
+ String value = DateUtil.formatDate(new Date(), DateUtil.DADE_FROMAT_YMD);
|
|
|
+ return value;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|