|
@@ -46,8 +46,7 @@ import java.lang.reflect.InvocationTargetException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
-import static com.boman.common.core.utils.obj.ObjectUtils.isEmpty;
|
|
|
-import static com.boman.common.core.utils.obj.ObjectUtils.map;
|
|
|
+import static com.boman.common.core.utils.obj.ObjectUtils.*;
|
|
|
|
|
|
/**
|
|
|
* 本地文件存储
|
|
@@ -242,9 +241,9 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
} else {
|
|
|
LOGGER.info("开始查询, 线程名称: {}", Thread.currentThread().getName());
|
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
|
- list = getData1(dto, tableName, columns, deptIdList);
|
|
|
+ list = getData1(dto, tableName, columns, token);
|
|
|
if (isEmpty(list)) {
|
|
|
- size =0;
|
|
|
+ size = 0;
|
|
|
emptyIn = true;
|
|
|
} else {
|
|
|
size = list.size();
|
|
@@ -255,18 +254,18 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
|
|
|
try {
|
|
|
util.asyncExportExcelCommon(new FileOutputStream(file), list, "sheet1", columns, emptyIn, false);
|
|
|
- long timeout = 2L;
|
|
|
- if (size > 100000 && size < 500000) {
|
|
|
- timeout = 5L;
|
|
|
- } else if(size > 500000){
|
|
|
- timeout = 10L;
|
|
|
- }
|
|
|
+// long timeout = 2L;
|
|
|
+// if (size > 100000 && size < 500000) {
|
|
|
+// timeout = 5L;
|
|
|
+// } else if(size > 500000){
|
|
|
+// timeout = 10L;
|
|
|
+// }
|
|
|
|
|
|
String key = RedisKey.ASYNC_DOWNLOAD_YMJZ + username;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("fileStaticPath", fileStaticPath);
|
|
|
jsonObject.put("fileAbsPath", fileAbsPath);
|
|
|
- redisService.setCacheObject(key, jsonObject, timeout, TimeUnit.MINUTES);
|
|
|
+ redisService.setCacheObject(key, jsonObject);
|
|
|
} catch (IOException e) {
|
|
|
LOGGER.error("导出失败", e);
|
|
|
e.printStackTrace();
|
|
@@ -348,12 +347,71 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- private List<Map<String, Object>> getData1(ExportExcelDto dto, String tableName, List<GenTableColumn> columns, List<Long> deptIdList) {
|
|
|
+ private List<Map<String, Object>> getData1(ExportExcelDto dto, String tableName, List<GenTableColumn> columns, String token) {
|
|
|
List<Map<String, Object>> list = null;
|
|
|
+ Map<String, Object> formData = dto.getCondition();
|
|
|
+ String idCard = (String) formData.get("idCard");
|
|
|
+ String phoneNum = (String) formData.get("phoneNum");
|
|
|
+ String jici = (String) formData.get("jici");
|
|
|
+ String keyIndustries = (String) formData.get("keyIndustries");
|
|
|
+ String vaccineName = (String) formData.get("vaccineName");
|
|
|
+ String vaccinationPlace = (String) formData.get("vaccinationPlace");
|
|
|
+ String isVaccination = (String) formData.get("isVaccination");
|
|
|
+ String shouldBe = (String) formData.get("shouldBe");
|
|
|
+ String shouldSlow = (String) formData.get("shouldslow");
|
|
|
+ long deptId = ((Number) formData.get("deptId")).longValue();
|
|
|
+ if (deptId == 0) {
|
|
|
+ LoginUser loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
|
|
+ deptId = loginUser.getSysUser().getDeptId();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysDept> sysDepts = remoteDeptService.listChildrenDepts(deptId);
|
|
|
+ List<Long> deptIdList = new ArrayList<>();
|
|
|
+ if (sysDepts != null && sysDepts.size() > 0) {
|
|
|
+ for (SysDept sysDept : sysDepts) {
|
|
|
+ Long id = sysDept.getId();
|
|
|
+ deptIdList.add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
FormDataDto condition = new FormDataDto();
|
|
|
condition.setTable(tableName);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("dept_id", deptIdList);
|
|
|
+ if (isNotEmpty(idCard)) {
|
|
|
+ jsonObject.put("id_card", idCard);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(phoneNum)) {
|
|
|
+ jsonObject.put("phone_num", phoneNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(jici)) {
|
|
|
+ jsonObject.put("jici", jici);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(keyIndustries)) {
|
|
|
+ jsonObject.put("key_industries", keyIndustries);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(vaccineName)) {
|
|
|
+ jsonObject.put("vaccine_name", vaccineName);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(vaccinationPlace)) {
|
|
|
+ jsonObject.put("vaccination_place", vaccinationPlace);
|
|
|
+ }
|
|
|
+ if (isNotEmpty(isVaccination)) {
|
|
|
+ jsonObject.put("is_vaccination", isVaccination);
|
|
|
+ }
|
|
|
+ if (isNotEmpty(shouldBe)) {
|
|
|
+ jsonObject.put("should_be", shouldBe);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNotEmpty(shouldSlow)) {
|
|
|
+ jsonObject.put("should_slow", shouldSlow);
|
|
|
+ }
|
|
|
+
|
|
|
condition.setFixedData(jsonObject);
|
|
|
condition.setPageSize(Integer.MAX_VALUE);
|
|
|
condition.setPageNo(1);
|