Browse Source

提交

dev-zsy
OUMYYE\Administrator 2 years ago
parent
commit
d5c862883a
  1. 54
      mailbox-common/src/main/java/com/biutag/constants/AppConstants.java
  2. 49
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java
  3. 4
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/DutyServiceImpl.java
  4. 5
      mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java
  5. 5
      mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java
  6. 2
      mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java
  7. 3
      mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java

54
mailbox-common/src/main/java/com/biutag/constants/AppConstants.java

@ -0,0 +1,54 @@
package com.biutag.constants;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by oumyye on 2019/1/18.
*/
public class AppConstants {
public static final String DEPT_TYPE_CATEGORY="6"; //是机构类型 数据字段 类型为6
static class Entity {
private String name;
private String age;
public Entity(String name, String age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public String getAge() {
return age;
}
}
public static void main(String[] args) {
List<Entity> entityList = new ArrayList<>();
entityList.add(new Entity("Alice", "20"));
entityList.add(new Entity("Bob", "25"));
entityList.add(new Entity("Charlie", "30"));
String targetAge = "25";
String matchedNames = entityList.stream()
.filter(entity -> entity.getAge() .equals(targetAge))
.map(Entity::getName).findFirst().get();
System.out.println("Found matching names:"+matchedNames);
}
}

49
mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java

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

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

@ -3,6 +3,7 @@ package com.biutag.lan.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.constants.AppConstants;
import com.biutag.entity.setting.DictData;
import com.biutag.entity.system.Dept;
import com.biutag.entity.system.PoliceUser;
@ -131,8 +132,9 @@ public class DutyServiceImpl implements IDutyService {
model.setEmpNo(createValidate.getEmpNo());
DictData dictData = dictDataMapper.selectOne(new QueryWrapper<DictData>()
.select("id,type_id,name,value,remark,sort,status,create_time,update_time")
.eq("type_id", "6")//机构类型
.eq("type_id", AppConstants.DEPT_TYPE_CATEGORY)//机构类型
.eq("is_delete", 0)
.eq("value",createValidate.getDeptType())
.last("limit 1"));
Assert.notNull(dictData, "机构类型不存在");

5
mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java

@ -28,8 +28,9 @@ public class DeptCreateValidate implements Serializable {
@ApiModelProperty(value = "部门名称", required = true)
private String name;
@Length(min = 1, max = 30, message = "负责人名称必须在1~30个字符内")
private String duty = "";
@NotNull(message = "请选择状态")
@ApiModelProperty(value = "类别", required = true)
private String category;
@Length(min = 11, max = 11, message = "手机号只能为11位")
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")

5
mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java

@ -33,8 +33,9 @@ public class DeptUpdateValidate implements Serializable {
@ApiModelProperty(value = "部门名称")
private String name;
@Length(min = 1, max = 30, message = "负责人名称必须在1~30个字符内")
private String duty = "";
@NotNull(message = "请选择状态")
@ApiModelProperty(value = "类别", required = true)
private String category;
@Length(min = 11, max = 11, message = "手机号只能为11位")
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")

2
mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@ -32,6 +33,7 @@ public class PoliceUserCreateValidate implements Serializable {
@NotEmpty(message = "手机号不能为空")
@Length(min = 2, max = 30, message = "手机号必须在2~30个字符内")
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
@ApiModelProperty(value = "手机号", required = true)
private String mobile;

3
mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java

@ -35,6 +35,9 @@ public class DeptVo implements Serializable {
@ApiModelProperty("类别")
private String category;
@ApiModelProperty("类别名称")
private String categoryName;
@ApiModelProperty("层级")
private String level;

Loading…
Cancel
Save