|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.biutag.lan.service.impl; |
|
|
|
package com.biutag.lan.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -7,6 +8,9 @@ import com.biutag.constants.AppConstants; |
|
|
|
import com.biutag.entity.setting.DictData; |
|
|
|
import com.biutag.entity.setting.DictData; |
|
|
|
import com.biutag.entity.system.Dept; |
|
|
|
import com.biutag.entity.system.Dept; |
|
|
|
import com.biutag.entity.system.PoliceUser; |
|
|
|
import com.biutag.entity.system.PoliceUser; |
|
|
|
|
|
|
|
import com.biutag.lan.config.AdminThreadLocal; |
|
|
|
|
|
|
|
import com.biutag.lan.domain.Work; |
|
|
|
|
|
|
|
import com.biutag.lan.domain.bo.MailQuery; |
|
|
|
import com.biutag.lan.validate.commons.PageValidate; |
|
|
|
import com.biutag.lan.validate.commons.PageValidate; |
|
|
|
import com.biutag.lan.service.IDutyService; |
|
|
|
import com.biutag.lan.service.IDutyService; |
|
|
|
import com.biutag.lan.validate.system.DutyCreateValidate; |
|
|
|
import com.biutag.lan.validate.system.DutyCreateValidate; |
|
|
|
@ -69,7 +73,7 @@ public class DutyServiceImpl implements IDutyService { |
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotNull(searchValidate.getSearchTime())&& !"null".equals(searchValidate.getSearchTime())) { |
|
|
|
if(StringUtils.isNotNull(searchValidate.getSearchTime())&& !"null".equals(searchValidate.getSearchTime())) { |
|
|
|
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{ |
|
|
|
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{ |
|
|
|
"like:departName@depart_name:str", |
|
|
|
"=:departName@depart_id:str", |
|
|
|
"like:policeName@police_name:str", |
|
|
|
"like:policeName@police_name:str", |
|
|
|
"like:mobile:str", |
|
|
|
"like:mobile:str", |
|
|
|
"like:empNo@emp_no:str", |
|
|
|
"like:empNo@emp_no:str", |
|
|
|
@ -79,25 +83,93 @@ public class DutyServiceImpl implements IDutyService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{ |
|
|
|
dutyMapper.setSearch(queryWrapper, searchValidate, new String[]{ |
|
|
|
"like:departName@depart_name:str", |
|
|
|
"=:departName@depart_id:str", |
|
|
|
"like:policeName@police_name:str", |
|
|
|
"like:policeName@police_name:str", |
|
|
|
"like:mobile:str", |
|
|
|
"like:mobile:str", |
|
|
|
"like:empNo@emp_no:str", |
|
|
|
"like:empNo@emp_no:str", |
|
|
|
"=:deptType@dept_type:str", |
|
|
|
"=:deptType@dept_type:str", |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Integer roleId = AdminThreadLocal.getRoleId(); |
|
|
|
|
|
|
|
Integer deptId = AdminThreadLocal.getDeptId(); |
|
|
|
|
|
|
|
String empNo = AdminThreadLocal.getEmpNo(); |
|
|
|
|
|
|
|
QueryWrapper<PoliceUser> queryWrapper_policeuser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper_policeuser.eq("emp_no",empNo); |
|
|
|
|
|
|
|
PoliceUser policeUser = policeUserMapper.selectOne(queryWrapper_policeuser); |
|
|
|
|
|
|
|
String data_dept_id = policeUser.getDataDeptId().toString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPage<Duty> iPage = dutyMapper.selectPage(new Page<>(page, limit), queryWrapper); |
|
|
|
IPage<Duty> iPage = dutyMapper.selectPage(new Page<>(page, limit), queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
List<DutyListedVo> list = new LinkedList<>(); |
|
|
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), deptDutySearch(data_dept_id,searchValidate.getDepartName(),queryWrapper,iPage)); |
|
|
|
for(Duty item : iPage.getRecords()) { |
|
|
|
} |
|
|
|
DutyListedVo vo = new DutyListedVo(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(item, vo); |
|
|
|
private List<DutyListedVo> deptDutySearch(String searchValidate,String deptId, QueryWrapper<Duty> queryWrapper,IPage<Duty> iPage) { |
|
|
|
list.add(vo); |
|
|
|
List<DutyListedVo> list = new LinkedList<>(); |
|
|
|
} |
|
|
|
Dept dept = deptMapper.selectById(searchValidate); |
|
|
|
|
|
|
|
QueryWrapper<Dept> DeptQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
// if(deptId == null ||"".equals(deptId)){
|
|
|
|
|
|
|
|
// DeptQueryWrapper.eq("id",searchValidate).or().eq("pid",searchValidate);
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// System.out.println("deptId"+deptId);
|
|
|
|
|
|
|
|
// DeptQueryWrapper.eq("id",deptId).or().eq("pid",deptId);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
DeptQueryWrapper.eq("id",searchValidate).or().eq("pid",searchValidate); |
|
|
|
|
|
|
|
|
|
|
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); |
|
|
|
List<Dept> depts = deptMapper.selectList(DeptQueryWrapper); |
|
|
|
|
|
|
|
System.out.println(depts); |
|
|
|
|
|
|
|
switch (dept.getLevel()) { |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
// if (deptId == null ||"".equals(deptId)){
|
|
|
|
|
|
|
|
for (Duty item : iPage.getRecords()){ |
|
|
|
|
|
|
|
DutyListedVo vo = new DutyListedVo(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(item, vo); |
|
|
|
|
|
|
|
list.add(vo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
|
|
|
// for (Duty item : iPage.getRecords()){
|
|
|
|
|
|
|
|
// for (Dept dept_item: depts){
|
|
|
|
|
|
|
|
// if (item.getDepartId().equals(dept_item.getId().toString())){
|
|
|
|
|
|
|
|
// DutyListedVo vo = new DutyListedVo();
|
|
|
|
|
|
|
|
// BeanUtils.copyProperties(item, vo);
|
|
|
|
|
|
|
|
// list.add(vo);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
for (Duty item : iPage.getRecords()){ |
|
|
|
|
|
|
|
for (Dept dept_item: depts){ |
|
|
|
|
|
|
|
if (item.getDepartId().equals(dept_item.getId().toString())){ |
|
|
|
|
|
|
|
DutyListedVo vo = new DutyListedVo(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(item, vo); |
|
|
|
|
|
|
|
list.add(vo); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
for (Duty item : iPage.getRecords()){ |
|
|
|
|
|
|
|
if (item.getDepartId().equals(dept.getId().toString())){ |
|
|
|
|
|
|
|
System.out.println("dept.getId().toString()"+dept.getId().toString()); |
|
|
|
|
|
|
|
DutyListedVo vo = new DutyListedVo(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(item, vo); |
|
|
|
|
|
|
|
list.add(vo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 值班详情 |
|
|
|
* 值班详情 |
|
|
|
* |
|
|
|
* |
|
|
|
@ -154,7 +226,7 @@ public class DutyServiceImpl implements IDutyService { |
|
|
|
model.setTypeName(dictData.getName()); |
|
|
|
model.setTypeName(dictData.getName()); |
|
|
|
model.setDeptType(dictData.getValue()); |
|
|
|
model.setDeptType(dictData.getValue()); |
|
|
|
Assert.notNull(dept, "机构不存在"); |
|
|
|
Assert.notNull(dept, "机构不存在"); |
|
|
|
model.setDepartName(dept.getName()); |
|
|
|
model.setDepartName(dept.getFullName()); |
|
|
|
model.setDepartId(createValidate.getDepartId()); |
|
|
|
model.setDepartId(createValidate.getDepartId()); |
|
|
|
|
|
|
|
|
|
|
|
model.setCreateTime(System.currentTimeMillis() / 1000); |
|
|
|
model.setCreateTime(System.currentTimeMillis() / 1000); |
|
|
|
@ -171,13 +243,15 @@ public class DutyServiceImpl implements IDutyService { |
|
|
|
public void edit(DutyUpdateValidate updateValidate) { |
|
|
|
public void edit(DutyUpdateValidate updateValidate) { |
|
|
|
Duty model = dutyMapper.selectOne( |
|
|
|
Duty model = dutyMapper.selectOne( |
|
|
|
new QueryWrapper<Duty>() |
|
|
|
new QueryWrapper<Duty>() |
|
|
|
.eq("emp_no", updateValidate.getEmpNo()) |
|
|
|
.eq("id", updateValidate.getId()) |
|
|
|
.last("limit 1")); |
|
|
|
.last("limit 1")); |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(model, "数据不存在!"); |
|
|
|
Assert.notNull(model, "数据不存在!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setDepartId(updateValidate.getDepartId()); |
|
|
|
model.setDepartId(updateValidate.getDepartId()); |
|
|
|
|
|
|
|
Dept dept = deptMapper.selectById(updateValidate.getDepartId()); |
|
|
|
|
|
|
|
model.setDepartName(dept.getFullName()); |
|
|
|
// model.setDepartName(updateValidate.getDepartName());
|
|
|
|
// model.setDepartName(updateValidate.getDepartName());
|
|
|
|
model.setPoliceName(updateValidate.getPoliceName()); |
|
|
|
model.setPoliceName(updateValidate.getPoliceName()); |
|
|
|
model.setMobile(updateValidate.getMobile()); |
|
|
|
model.setMobile(updateValidate.getMobile()); |
|
|
|
|