Commit ebdab5ea authored by 李腾威's avatar 李腾威

日常管理-警情填报优化

parent 5506c269
...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlarmStatisticsDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlarmStatisticsDto;
...@@ -45,14 +44,11 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -45,14 +44,11 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Stream;
/** /**
* 警情接警填报记录 * 警情接警填报记录
...@@ -257,64 +253,22 @@ public class AlertCalledController extends BaseController { ...@@ -257,64 +253,22 @@ public class AlertCalledController extends BaseController {
} }
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper); page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page); IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page);
calledVoIPage.getRecords().stream().forEach(e->{
//e.setAlertAddress(e.getAddress());
});
return ResponseHelper.buildResponse(calledVoIPage); return ResponseHelper.buildResponse(calledVoIPage);
} }
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){ private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
Class<? extends AlertCalled> aClass = alertCalled.getClass();
queryWrapper.eq("is_delete", 0); queryWrapper.eq("is_delete", 0);
if(sort!=null) {
// String[] date= sort.split(",");
// if(date[1].equals("ascend")) {
// queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
// }else {
// queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
// }
}else {
queryWrapper.orderByDesc("call_time"); queryWrapper.orderByDesc("call_time");
}
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) { if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(), alertCalled.getCallTimeEnd()); queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
} }
if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警 if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警
queryWrapper.isNull("father_alert"); queryWrapper.isNull("father_alert");
} }
Stream<Field> fieldStream = Arrays.stream(aClass.getDeclaredFields()).filter(field -> {
String name = NameUtils.camel2Underline(field.getName());
return !("IS_FATHER_ALERT".equals(name));
});
fieldStream.forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(alertCalled);
if (o != null && !"serialVersionUID".equals(field.getName())) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
} else if (type.equals(Boolean.class)) {
Boolean fileValue = (Boolean) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}else if (type.equals(Long.class) || "long".equals(type.toString())) {
Long fileValue = (Long) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
});
return queryWrapper; return queryWrapper;
} }
......
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