Browse Source

值班管理编辑

master
laishajiang 2 years ago
parent
commit
86e3726edd
  1. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java
  2. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/DutyController.java
  3. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java
  4. 96
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java
  5. 6
      mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyUpdateValidate.java

2
mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java

@ -38,7 +38,7 @@ public class DictDataController {
List<DictDataVo> list = iDictDataService.all(params); List<DictDataVo> list = iDictDataService.all(params);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@NotPower
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value="字典数据列表") @ApiOperation(value="字典数据列表")
public AjaxResult<PageResult<DictDataVo>> list(@Validated PageValidate pageValidate, public AjaxResult<PageResult<DictDataVo>> list(@Validated PageValidate pageValidate,

2
mailbox-lan/src/main/java/com/biutag/lan/controller/system/DutyController.java

@ -1,5 +1,6 @@
package com.biutag.lan.controller.system; package com.biutag.lan.controller.system;
import com.biutag.aop.NotPower;
import com.biutag.lan.aop.Log; import com.biutag.lan.aop.Log;
import com.biutag.lan.service.IDutyService; import com.biutag.lan.service.IDutyService;
import com.biutag.lan.validate.commons.IdValidate; import com.biutag.lan.validate.commons.IdValidate;
@ -34,6 +35,7 @@ public class DutyController {
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@NotPower
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperation(value="值班详情") @ApiOperation(value="值班详情")
public AjaxResult<DutyDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) { public AjaxResult<DutyDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {

2
mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java

@ -50,7 +50,7 @@ public class PoliceUserController {
List<PoliceUser> list = iPoliceUserService.all( searchValidate); List<PoliceUser> list = iPoliceUserService.all( searchValidate);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@NotPower
@GetMapping("/search") @GetMapping("/search")
@ApiOperation(value="搜索管理员列表") @ApiOperation(value="搜索管理员列表")
public AjaxResult<List<PoliceUser>> searchPoliceUserList(@RequestParam("searchName") String searchName) { public AjaxResult<List<PoliceUser>> searchPoliceUserList(@RequestParam("searchName") String searchName) {

96
mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java

@ -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());

6
mailbox-lan/src/main/java/com/biutag/lan/validate/system/DutyUpdateValidate.java

@ -19,9 +19,9 @@ public class DutyUpdateValidate implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@IDMust(message = "id参数必传且需大于0") @NotNull(message = "id参数缺失")
@ApiModelProperty(value = "") @ApiModelProperty(value = "id")
private Long id; Integer id;
// @NotNull(message = "开始时间参数缺失") // @NotNull(message = "开始时间参数缺失")

Loading…
Cancel
Save