|
|
|
|
@ -3,6 +3,8 @@ package com.biutag.lan.service.impl;
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Assert; |
|
|
|
|
import com.biutag.constants.AppConstants; |
|
|
|
|
import com.biutag.entity.setting.DictData; |
|
|
|
|
import com.biutag.lan.service.IDeptService; |
|
|
|
|
import com.biutag.lan.validate.system.DeptCreateValidate; |
|
|
|
|
import com.biutag.lan.validate.system.DeptSearchValidate; |
|
|
|
|
@ -10,9 +12,11 @@ import com.biutag.lan.validate.system.DeptUpdateValidate;
|
|
|
|
|
import com.biutag.lan.vo.system.DeptVo; |
|
|
|
|
import com.biutag.entity.system.PoliceUser; |
|
|
|
|
import com.biutag.entity.system.Dept; |
|
|
|
|
import com.biutag.mapper.setting.DictDataMapper; |
|
|
|
|
import com.biutag.mapper.system.PoliceUserMapper; |
|
|
|
|
import com.biutag.mapper.system.DeptMapper; |
|
|
|
|
import com.biutag.util.ListUtils; |
|
|
|
|
import com.biutag.util.StringUtils; |
|
|
|
|
import com.biutag.util.TimeUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -32,6 +36,11 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
@Resource |
|
|
|
|
PoliceUserMapper policeUserMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
DictDataMapper dictDataMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 岗位所有 |
|
|
|
|
* |
|
|
|
|
@ -46,12 +55,12 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
.orderByDesc((Arrays.asList("sort", "id")))); |
|
|
|
|
|
|
|
|
|
List<DeptVo> list = new ArrayList<>(); |
|
|
|
|
for (Dept Dept : DeptList) { |
|
|
|
|
for (Dept dept : DeptList) { |
|
|
|
|
DeptVo vo = new DeptVo(); |
|
|
|
|
BeanUtils.copyProperties(Dept, vo); |
|
|
|
|
BeanUtils.copyProperties(dept, vo); |
|
|
|
|
|
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); |
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); |
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(dept.getUpdateTime())); |
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(dept.getCreateTime())); |
|
|
|
|
list.add(vo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -80,14 +89,21 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
List<Dept> DeptList = deptMapper.selectList(queryWrapper); |
|
|
|
|
List<DictData> dictDataList = dictDataMapper.selectList(new QueryWrapper<DictData>() |
|
|
|
|
.select("id,type_id,name,value,remark,sort,status,create_time,update_time") |
|
|
|
|
.eq("type_id", AppConstants.DEPT_TYPE_CATEGORY)//机构类型
|
|
|
|
|
.eq("is_delete", 0).orderByDesc("sort")); |
|
|
|
|
|
|
|
|
|
List<DeptVo> list = new LinkedList<>(); |
|
|
|
|
for (Dept Dept : DeptList) { |
|
|
|
|
for (Dept dept : DeptList) { |
|
|
|
|
DeptVo vo = new DeptVo(); |
|
|
|
|
BeanUtils.copyProperties(Dept, vo); |
|
|
|
|
|
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); |
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); |
|
|
|
|
BeanUtils.copyProperties(dept, vo); |
|
|
|
|
if(StringUtils.isNotEmpty(dept.getCategory()) ){ |
|
|
|
|
vo.setCategoryName(dictDataList.stream().filter(entity -> |
|
|
|
|
entity.getValue().equals(dept.getCategory())).findFirst().get().getName()); ; |
|
|
|
|
} |
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(dept.getCreateTime())); |
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(dept.getUpdateTime())); |
|
|
|
|
list.add(vo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -104,7 +120,7 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public DeptVo detail(Integer id) { |
|
|
|
|
Dept Dept = deptMapper.selectOne( |
|
|
|
|
Dept dept = deptMapper.selectOne( |
|
|
|
|
new QueryWrapper<Dept>() |
|
|
|
|
.select(Dept.class, info -> |
|
|
|
|
!info.getColumn().equals("is_delete") && |
|
|
|
|
@ -113,12 +129,12 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
.eq("is_delete", 0) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
|
|
|
|
|
Assert.notNull(Dept, "部门已不存在!"); |
|
|
|
|
Assert.notNull(dept, "部门已不存在!"); |
|
|
|
|
|
|
|
|
|
DeptVo vo = new DeptVo(); |
|
|
|
|
BeanUtils.copyProperties(Dept, vo); |
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); |
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); |
|
|
|
|
BeanUtils.copyProperties(dept, vo); |
|
|
|
|
vo.setCreateTime(TimeUtils.timestampToDate(dept.getCreateTime())); |
|
|
|
|
vo.setUpdateTime(TimeUtils.timestampToDate(dept.getUpdateTime())); |
|
|
|
|
|
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
@ -145,8 +161,9 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
Dept model = new Dept(); |
|
|
|
|
model.setPid(createValidate.getPid()); |
|
|
|
|
model.setName(createValidate.getName()); |
|
|
|
|
model.setDuty(createValidate.getDuty()); |
|
|
|
|
//model.setDuty(createValidate.getDuty());
|
|
|
|
|
model.setMobile(createValidate.getMobile()); |
|
|
|
|
model.setCategory(createValidate.getCategory()); |
|
|
|
|
model.setSort(createValidate.getSort()); |
|
|
|
|
model.setIsStop(createValidate.getIsStop()); |
|
|
|
|
model.setCreateTime(System.currentTimeMillis() / 1000); |
|
|
|
|
@ -177,7 +194,7 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
|
|
|
|
|
model.setPid(updateValidate.getPid()); |
|
|
|
|
model.setName(updateValidate.getName()); |
|
|
|
|
model.setDuty(updateValidate.getDuty()); |
|
|
|
|
model.setCategory(updateValidate.getCategory()); |
|
|
|
|
model.setMobile(updateValidate.getMobile()); |
|
|
|
|
model.setSort(updateValidate.getSort()); |
|
|
|
|
model.setIsStop(updateValidate.getIsStop()); |
|
|
|
|
|