Browse Source

fit:剔除问题

master
pengwei 6 months ago
parent
commit
49f47b6b88
  1. 44
      src/main/java/com/biutag/supervision/service/SupRotaService.java

44
src/main/java/com/biutag/supervision/service/SupRotaService.java

@ -28,42 +28,44 @@ public class SupRotaService extends ServiceImpl<SupRotaMapper, SupRota> {
private final SupDepartService departService;
//展示数据的接口
public JSONObject getSupRotaTable(SupRotaQueryParam queryParam){
public JSONObject getSupRotaTable(SupRotaQueryParam queryParam) {
UserAuth user = UserContextHolder.getCurrentUser();
//判断传入的id是市局、还是分局
JSONObject jsonObject=new JSONObject();
if (StrUtil.isBlank(queryParam.getDeptId()) && (user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()) || user.getRoleCodes().contains(RoleCodeEnum.ADMIN.getCode()))) {
JSONObject jsonObject = new JSONObject();
String dateTime = null;
// 获取当前的本地时间
LocalTime currentTime = LocalTime.now();
SupDepart supDepart = departService.getById(AppConstants.ROOT_DEPART_ID);
// 定义时间格式化为字符串的格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
// 获取当前的本地时间
LocalTime currentTime = LocalTime.now();
// 将本地时间格式化为字符串
String timeString = currentTime.format(formatter);
// 定义时间格式化为字符串的格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
dateTime = queryParam.getDate() + " " + timeString;
if (StrUtil.isBlank(queryParam.getDeptId()) && (user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()) || user.getRoleCodes().contains(RoleCodeEnum.ADMIN.getCode()))) {
SupDepart supDepart = departService.getById(AppConstants.ROOT_DEPART_ID);
// 将本地时间格式化为字符串
String timeString = currentTime.format(formatter);
String dateTime=queryParam.getDate() + " "+timeString;
//市局的数据进行分类
//市局本身
List<SupRota> supRota = baseMapper.selectList(new LambdaQueryWrapper<SupRota>()
.eq(SupRota::getDeptCode,supDepart.getId())
.ge(SupRota::getStartTime,dateTime)
.le(SupRota::getEndTime,dateTime));
jsonObject.fluentPut("cityBureau",supRota);
.eq(SupRota::getDeptCode, supDepart.getId())
.ge(SupRota::getStartTime, dateTime)
.le(SupRota::getEndTime, dateTime));
jsonObject.fluentPut("cityBureau", supRota);
//分局
List<SupRotaVo> suboffice =baseMapper.getSubofficeData(queryParam.getDate(),"3");
jsonObject.fluentPut("suboffice",suboffice);
List<SupRotaVo> suboffice = baseMapper.getSubofficeData(dateTime, "3");
jsonObject.fluentPut("suboffice", suboffice);
//局属单位
List<SupRotaVo> departmental =baseMapper.getSubofficeData(queryParam.getDate(),"4");
jsonObject.fluentPut("departmental",departmental);
List<SupRotaVo> departmental = baseMapper.getSubofficeData(dateTime, "4");
jsonObject.fluentPut("departmental", departmental);
} else {
List<SupRotaVo> supRotaList = baseMapper.getSupRotaList(queryParam.getDate(),queryParam.getDeptId());
jsonObject.fluentPut("supRotaList",supRotaList);
List<SupRotaVo> supRotaList = baseMapper.getSupRotaList(dateTime, queryParam.getDeptId());
jsonObject.fluentPut("supRotaList", supRotaList);
}
return jsonObject;
}

Loading…
Cancel
Save