Commit e376254a authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 30ce3869 9c9e5646
......@@ -9,6 +9,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.ServletUtils;
......@@ -29,6 +30,7 @@ import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity;
import com.mortals.xhx.module.perform.model.vo.AppealInfo;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.formula.functions.T;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
......@@ -44,6 +46,7 @@ import com.mortals.xhx.module.attendance.service.AttendanceRecordService;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.*;
......@@ -103,11 +106,7 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
@Override
public void doExportBefore(Context context, AttendanceRecordEntity query, List<String> properties) throws AppException {
String bool = cacheService.get(RedisCacheKeys.getRecordExportLockKey());
if (!ObjectUtils.isEmpty(bool)) {
throw new AppException("每日数据正在导出中,请稍后再试!");
}
cacheService.set(RedisCacheKeys.getRecordExportLockKey(), "111", 120L);
if (query.getGroupId() != null) {
query.setAttendanceGroupId(query.getGroupId());
}
......@@ -116,7 +115,13 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
query.setAttendanceDateStart(DateUtil.today());
query.setAttendanceDateEnd(DateUtil.today());
}
try {
if (DateUtils.getBetween(query.getAttendanceDateStart(), query.getAttendanceDateEnd(), DateUtils.P_yyyy_MM_dd, 2) != 0) {
throw new AppException("选择的日期跨度不能超过一天");
}
}catch (Exception e){
throw new AppException(e.getMessage());
}
if (ObjectUtils.isEmpty(query.getOrderColList())) {
query.setOrderColList(Arrays.asList(new OrderCol("attendanceDate", OrderCol.DESCENDING), new OrderCol("staffName", OrderCol.DESCENDING)));
} else {
......@@ -139,6 +144,11 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
properties.addAll(query.getProperties());
}
String bool = cacheService.get(RedisCacheKeys.getRecordExportLockKey());
if (!ObjectUtils.isEmpty(bool)) {
throw new AppException("每日数据正在导出中,请稍后再试!");
}
cacheService.set(RedisCacheKeys.getRecordExportLockKey(), "111", 120L);
}
@Override
......@@ -250,6 +260,15 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
this.responseStream(response, data, fileName);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
JSONObject ret = new JSONObject();
ret.put("code", -1);
ret.put("msg", e.getMessage());
try {
IOUtils.write(ret.toJSONString(), response.getOutputStream());
}catch (IOException e1){
}
this.doException(request, "导出异常", new HashMap<>(), e);
}
}
......@@ -458,5 +477,4 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
}
return jsonObject.toJSONString();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment