提交 6a615c7b 作者: 17607474349

fix:

1、加入feign-okhttp
2、相关检索、分配标签
上级 1f0cb788
...@@ -73,4 +73,7 @@ dependencies { ...@@ -73,4 +73,7 @@ dependencies {
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign
implementation "org.springframework.cloud:spring-cloud-starter-openfeign:${openfeignVersion}" implementation "org.springframework.cloud:spring-cloud-starter-openfeign:${openfeignVersion}"
// feign-okhttp
implementation "io.github.openfeign:feign-okhttp:${feignOkhttpVersion}"
} }
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.config;
import feign.Feign;
import java.util.concurrent.TimeUnit;
import okhttp3.ConnectionPool;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* feignOkhttp
*
* @author LJ-2204
* @date 2022/4/27
*/
@Configuration
@ConditionalOnClass(Feign.class)
@AutoConfigureBefore(FeignAutoConfiguration.class)
public class FeignOkHttpConfig {
@Bean
public okhttp3.OkHttpClient okHttpClient() {
return new okhttp3.OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS)
.connectionPool(new ConnectionPool())
.build();
}
}
...@@ -99,6 +99,10 @@ public class LocationTag extends BasicEntity implements Serializable { ...@@ -99,6 +99,10 @@ public class LocationTag extends BasicEntity implements Serializable {
@Comment("电量单位") @Comment("电量单位")
String voltUnit; String voltUnit;
@FieldMapping
@Comment("类型(1:内部/2:访客/3:承包商)")
Integer category;
@FieldMapping(value = "raiseTimestamp", desc = "更新时间戳", type = Long.class) @FieldMapping(value = "raiseTimestamp", desc = "更新时间戳", type = Long.class)
@Comment("更新时间") @Comment("更新时间")
LocalDateTime updateTime; LocalDateTime updateTime;
......
...@@ -43,13 +43,13 @@ public class DepartmentAddParam implements Serializable { ...@@ -43,13 +43,13 @@ public class DepartmentAddParam implements Serializable {
@ApiModelProperty(value = "部门状态", example = "1") @ApiModelProperty(value = "部门状态", example = "1")
Boolean enable; Boolean enable;
public Department transform() { public static Department transform(DepartmentAddParam departmentAddParam) {
return Department return Department
.builder() .builder()
.pid(this.id) .pid(departmentAddParam.getId())
.name(this.name) .name(departmentAddParam.getName())
.leader(User.builder().id(this.leaderId).build()) .leader(User.builder().id(departmentAddParam.getLeaderId()).build())
.enable(this.enable) .enable(departmentAddParam.getEnable())
.createTime(LocalDateTime.now()) .createTime(LocalDateTime.now())
.updateTime(LocalDateTime.now()) .updateTime(LocalDateTime.now())
.build(); .build();
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.dept;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 部门导入
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("DepartmentExportParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class DepartmentExportParam implements Serializable {
@Serial
private static final long serialVersionUID = 6314061369190511168L;
@ApiModelProperty(value = "部门状态", example = "启用/禁用")
Boolean enable;
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location; package com.yiring.app.param.location.tag;
import com.yiring.app.domain.location.LocationTag; import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -39,12 +39,12 @@ public class LocationTagAddParam implements Serializable { ...@@ -39,12 +39,12 @@ public class LocationTagAddParam implements Serializable {
@ApiModelProperty(value = "imei 设备编码标识", example = "88888888") @ApiModelProperty(value = "imei 设备编码标识", example = "88888888")
String imei; String imei;
public LocationTag transform() { public static LocationTag transform(LocationTagAddParam locationTagAddParam) {
return LocationTag return LocationTag
.builder() .builder()
.code(this.code) .code(locationTagAddParam.getCode())
.type(this.type) .type(locationTagAddParam.getType())
.imei(this.imei) .imei(locationTagAddParam.getImei())
.used(false) .used(false)
.silent(false) .silent(false)
.volt(0) .volt(0)
......
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location; package com.yiring.app.param.location.tag;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location.tag;
import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("LocationTagExportParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class LocationTagExportParam implements Serializable {
@Serial
private static final long serialVersionUID = -344458727454884014L;
@ApiModelProperty(value = "编号", example = "BTT88888888")
String code;
@ApiModelProperty(value = "标签类型", example = "蓝牙人员定位卡")
LocationTag.Type type;
@ApiModelProperty(value = "状态", example = "true")
Boolean silent;
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location; package com.yiring.app.param.location.tag;
import com.yiring.app.domain.location.LocationTag; import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location; package com.yiring.app.param.location.tag;
import com.yiring.app.domain.location.LocationTag; import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.location.tag;
import io.swagger.annotations.ApiModel;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 标签分配
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("LocationTagTypeFindParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class LocationTagTypeFindParam implements Serializable {
@Serial
private static final long serialVersionUID = -647961131755069990L;
String code;
Integer category;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.post;
import com.yiring.auth.domain.post.Post;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 职位新增
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("PostAddParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class PostAddParam implements Serializable {
@Serial
private static final long serialVersionUID = -7451952048517810923L;
@ApiModelProperty(value = "名称", example = "Java", required = true)
@NotNull(message = "名称不能为空")
String name;
@ApiModelProperty(value = "描述", example = "描述")
String describe;
@ApiModelProperty(value = "是否启用", example = "true")
Boolean enable;
public static Post transform(PostAddParam param) {
return Post.builder().name(param.getName()).describe(param.getDescribe()).enable(param.getEnable()).build();
}
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.post;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 职位导入入参
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("PostExportParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class PostExportParam implements Serializable {
@Serial
private static final long serialVersionUID = 86398868302287802L;
@ApiModelProperty(value = "名称", example = "Java")
String name;
@ApiModelProperty(value = "是否启用", example = "true")
Boolean enable;
}
...@@ -9,7 +9,7 @@ import lombok.*; ...@@ -9,7 +9,7 @@ import lombok.*;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
/** /**
* 职位分页入参 * 职位条件入参
* @author LJ-2204 * @author LJ-2204
* @date 2022/4/13 * @date 2022/4/13
*/ */
......
...@@ -30,11 +30,11 @@ public class PostModifyParam implements Serializable { ...@@ -30,11 +30,11 @@ public class PostModifyParam implements Serializable {
private static final long serialVersionUID = 9182648236336186660L; private static final long serialVersionUID = 9182648236336186660L;
@ApiModelProperty(value = "主键", example = "1", required = true) @ApiModelProperty(value = "主键", example = "1", required = true)
@NotNull @NotNull(message = "编号不能为空")
Long id; Long id;
@ApiModelProperty(value = "名称", example = "Java", required = true) @ApiModelProperty(value = "名称", example = "Java", required = true)
@NotNull @NotNull(message = "名称不能为空")
String name; String name;
@ApiModelProperty(value = "描述", example = "描述") @ApiModelProperty(value = "描述", example = "描述")
......
...@@ -29,7 +29,7 @@ public class PostParam implements Serializable { ...@@ -29,7 +29,7 @@ public class PostParam implements Serializable {
private static final long serialVersionUID = 5247408856592333466L; private static final long serialVersionUID = 5247408856592333466L;
@ApiModelProperty(value = "名称", example = "Java", required = true) @ApiModelProperty(value = "名称", example = "Java", required = true)
@NotNull @NotNull(message = "名称不能为空")
String name; String name;
@ApiModelProperty(value = "描述", example = "描述") @ApiModelProperty(value = "描述", example = "描述")
......
...@@ -57,18 +57,18 @@ public class UserAddParam implements Serializable { ...@@ -57,18 +57,18 @@ public class UserAddParam implements Serializable {
@ApiModelProperty(value = "是否特殊人员", example = "0/1", required = true) @ApiModelProperty(value = "是否特殊人员", example = "0/1", required = true)
Boolean isSpecial; Boolean isSpecial;
public User transform() { public static User transform(UserAddParam userAddParam) {
return User return User
.builder() .builder()
.avatar(this.avatar) .avatar(userAddParam.getAvatar())
.realName(this.realName) .realName(userAddParam.getRealName())
.mobile(this.mobile) .mobile(userAddParam.getMobile())
.type(this.type) .type(userAddParam.getType())
.gender(this.gender) .gender(userAddParam.getGender())
.department(Department.builder().id(Convert.toLong(this.deptId)).build()) .department(Department.builder().id(Convert.toLong(userAddParam.getDeptId())).build())
.uuid(this.uuid) .uuid(userAddParam.getUuid())
.post(Post.builder().id(Convert.toLong(this.postId)).build()) .post(Post.builder().id(Convert.toLong(userAddParam.getPostId())).build())
.isSpecial(this.isSpecial) .isSpecial(userAddParam.getIsSpecial())
.build(); .build();
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
package com.yiring.app.service.dept; package com.yiring.app.service.dept;
import com.yiring.app.param.dept.DepartmentAddParam; import com.yiring.app.param.dept.DepartmentAddParam;
import com.yiring.app.param.dept.DepartmentExportParam;
import com.yiring.app.param.dept.DepartmentFindParam; import com.yiring.app.param.dept.DepartmentFindParam;
import com.yiring.app.param.dept.DepartmentModifyParam; import com.yiring.app.param.dept.DepartmentModifyParam;
import com.yiring.app.vo.dept.DepartmentInfoVo; import com.yiring.app.vo.dept.DepartmentInfoVo;
...@@ -23,17 +24,17 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -23,17 +24,17 @@ import org.springframework.web.multipart.MultipartFile;
public interface DepartmentService { public interface DepartmentService {
/** /**
* 新增部门 * 新增部门
* @param param DepartmentAddParam * @param departmentAddParam DepartmentAddParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> addDepartment(DepartmentAddParam param); Result<String> addDepartment(DepartmentAddParam departmentAddParam);
/** /**
* 查询树状图 * 查询树状图
* @param param DepartmentFindParam * @param departmentFindParam DepartmentFindParam
* @return Result<PageVo<DepartmentVo>> * @return Result<PageVo<DepartmentVo>>
*/ */
Result<PageVo<DepartmentVo>> findDepartmentTree(DepartmentFindParam param); Result<PageVo<DepartmentVo>> findDepartmentTree(DepartmentFindParam departmentFindParam);
/** /**
* 根据id查询详细信息 * 根据id查询详细信息
...@@ -44,10 +45,10 @@ public interface DepartmentService { ...@@ -44,10 +45,10 @@ public interface DepartmentService {
/** /**
* 导出部门 * 导出部门
* @param param DepartmentFindParam * @param departmentExportParam DepartmentFindParam
* @param response HttpServletResponse * @param response HttpServletResponse
*/ */
void exportDepartment(DepartmentFindParam param, HttpServletResponse response); void exportDepartment(DepartmentExportParam departmentExportParam, HttpServletResponse response);
/** /**
* 逻辑删除部门 * 逻辑删除部门
...@@ -73,10 +74,10 @@ public interface DepartmentService { ...@@ -73,10 +74,10 @@ public interface DepartmentService {
/** /**
* 部门修改 * 部门修改
* @param param DepartmentModifyParam * @param departmentModifyParam DepartmentModifyParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> modifyDept(DepartmentModifyParam param); Result<String> modifyDept(DepartmentModifyParam departmentModifyParam);
/** /**
* 导入部门 * 导入部门
......
...@@ -10,10 +10,10 @@ import com.github.liaochong.myexcel.core.SaxExcelReader; ...@@ -10,10 +10,10 @@ import com.github.liaochong.myexcel.core.SaxExcelReader;
import com.yiring.app.excel.dept.DepartmentExportExcel; import com.yiring.app.excel.dept.DepartmentExportExcel;
import com.yiring.app.excel.dept.DepartmentImportExcel; import com.yiring.app.excel.dept.DepartmentImportExcel;
import com.yiring.app.param.dept.DepartmentAddParam; import com.yiring.app.param.dept.DepartmentAddParam;
import com.yiring.app.param.dept.DepartmentExportParam;
import com.yiring.app.param.dept.DepartmentFindParam; import com.yiring.app.param.dept.DepartmentFindParam;
import com.yiring.app.param.dept.DepartmentModifyParam; import com.yiring.app.param.dept.DepartmentModifyParam;
import com.yiring.app.service.dept.DepartmentService; import com.yiring.app.service.dept.DepartmentService;
import com.yiring.app.service.zy.ZyHttpService;
import com.yiring.app.vo.dept.DepartmentInfoVo; import com.yiring.app.vo.dept.DepartmentInfoVo;
import com.yiring.app.vo.dept.DepartmentVo; import com.yiring.app.vo.dept.DepartmentVo;
import com.yiring.auth.domain.dept.Department; import com.yiring.auth.domain.dept.Department;
...@@ -55,30 +55,28 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -55,30 +55,28 @@ public class DepartmentServiceImpl implements DepartmentService {
@Resource @Resource
DepartmentRepository departmentRepository; DepartmentRepository departmentRepository;
@Resource
ZyHttpService zyHttpService;
// todo
@Override @Override
public Result<String> addDepartment(DepartmentAddParam param) { public Result<String> addDepartment(DepartmentAddParam departmentAddParam) {
long pidExist = departmentRepository.count(Example.of(Department.builder().id(param.getId()).build())); long pidExist = departmentRepository.count(
Example.of(Department.builder().id(departmentAddParam.getId()).build())
);
if (pidExist == 0) return Result.no(Status.BAD_REQUEST, "上级部门不存在"); if (pidExist == 0) return Result.no(Status.BAD_REQUEST, "上级部门不存在");
long exist = departmentRepository.count( long exist = departmentRepository.count(
Example.of(Department.builder().name(param.getName()).pid(param.getId()).build()) Example.of(Department.builder().name(departmentAddParam.getName()).pid(departmentAddParam.getId()).build())
); );
if (exist > 0) return Result.no(Status.BAD_REQUEST, "同级目录下,已存在该部门"); if (exist > 0) return Result.no(Status.BAD_REQUEST, "同级目录下,已存在该部门");
Department department = param.transform(); Department department = DepartmentAddParam.transform(departmentAddParam);
departmentRepository.save(department); departmentRepository.save(department);
return Result.ok(); return Result.ok();
} }
@Override @Override
public Result<PageVo<DepartmentVo>> findDepartmentTree(DepartmentFindParam param) { public Result<PageVo<DepartmentVo>> findDepartmentTree(DepartmentFindParam departmentFindParam) {
List<Department> departments = departmentRepository.findAll( List<Department> departments = departmentRepository.findAll(
Example.of(Department.builder().enable(param.getEnable()).build()) Example.of(Department.builder().enable(departmentFindParam.getEnable()).build())
); );
List<DepartmentVo> departmentVos = departments List<DepartmentVo> departmentVos = departments
.stream() .stream()
...@@ -112,9 +110,9 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -112,9 +110,9 @@ public class DepartmentServiceImpl implements DepartmentService {
} }
@Override @Override
public void exportDepartment(DepartmentFindParam param, HttpServletResponse response) { public void exportDepartment(DepartmentExportParam departmentExportParam, HttpServletResponse response) {
List<Department> departments = departmentRepository.findAll( List<Department> departments = departmentRepository.findAll(
Example.of(Department.builder().enable(param.getEnable()).build()) Example.of(Department.builder().enable(departmentExportParam.getEnable()).build())
); );
List<DepartmentExportExcel> departmentExportExcels = departments List<DepartmentExportExcel> departmentExportExcels = departments
.stream() .stream()
...@@ -197,24 +195,32 @@ public class DepartmentServiceImpl implements DepartmentService { ...@@ -197,24 +195,32 @@ public class DepartmentServiceImpl implements DepartmentService {
} }
@Override @Override
public Result<String> modifyDept(DepartmentModifyParam param) { public Result<String> modifyDept(DepartmentModifyParam departmentModifyParam) {
Optional<Department> departmentOptional = departmentRepository.findOne( Optional<Department> departmentOptional = departmentRepository.findOne(
Example.of(Department.builder().id(param.getId()).build()) Example.of(Department.builder().id(departmentModifyParam.getId()).build())
); );
if (departmentOptional.isEmpty()) return Result.no(Status.BAD_REQUEST); if (departmentOptional.isEmpty()) return Result.no(Status.BAD_REQUEST);
long pidExist = departmentRepository.count(Example.of(Department.builder().id(param.getPid()).build())); long pidExist = departmentRepository.count(
Example.of(Department.builder().id(departmentModifyParam.getPid()).build())
);
if (pidExist == 0) return Result.no(Status.BAD_REQUEST, "上级部门不存在"); if (pidExist == 0) return Result.no(Status.BAD_REQUEST, "上级部门不存在");
Department department = departmentOptional.get(); Department department = departmentOptional.get();
if (!StrUtil.equals(department.getName(), param.getName())) { if (!StrUtil.equals(department.getName(), departmentModifyParam.getName())) {
long exist = departmentRepository.count( long exist = departmentRepository.count(
Example.of(Department.builder().name(param.getName()).pid(param.getId()).build()) Example.of(
Department
.builder()
.name(departmentModifyParam.getName())
.pid(departmentModifyParam.getId())
.build()
)
); );
if (exist > 0) return Result.no(Status.BAD_REQUEST, "同级目录下,已存在该部门"); if (exist > 0) return Result.no(Status.BAD_REQUEST, "同级目录下,已存在该部门");
} }
Department newDepartment = param.transform(); Department newDepartment = departmentModifyParam.transform();
departmentRepository.save(newDepartment); departmentRepository.save(newDepartment);
return Result.ok(); return Result.ok();
......
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.location; package com.yiring.app.service.location.tag;
import com.yiring.app.param.location.LocationTagAddParam; import com.yiring.app.param.location.tag.*;
import com.yiring.app.param.location.LocationTagDeleteParam; import com.yiring.app.vo.location.tag.LocationTagIndexVo;
import com.yiring.app.param.location.LocationTagFindParam; import com.yiring.app.vo.location.tag.LocationTagVo;
import com.yiring.app.param.location.LocationTagModifyParam;
import com.yiring.app.vo.location.LocationTagVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -20,31 +19,31 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -20,31 +19,31 @@ import org.springframework.web.multipart.MultipartFile;
public interface LocationTagService { public interface LocationTagService {
/** /**
* 新增定位标签 * 新增定位标签
* @param param 入参 * @param locationTagAddParam LocationTagAddParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> addLocationTag(LocationTagAddParam param); Result<String> addLocationTag(LocationTagAddParam locationTagAddParam);
/** /**
* 分页查询 * 分页查询
* @param param 入参 * @param locationTagFindParam LocationTagFindParam
* @return Result<PageVo<LocationTagVo>> * @return Result<PageVo<LocationTagVo>>
*/ */
Result<PageVo<LocationTagVo>> findLocationTagPage(LocationTagFindParam param, PageParam pageParam); Result<PageVo<LocationTagVo>> findLocationTagPage(LocationTagFindParam locationTagFindParam, PageParam pageParam);
/** /**
* 销毁定位标签 * 销毁定位标签
* @param param 入参 * @param locationTagDeleteParam 入参
* @return Result<String> * @return Result<String>
*/ */
Result<String> deleteLocationTag(LocationTagDeleteParam param); Result<String> deleteLocationTag(LocationTagDeleteParam locationTagDeleteParam);
/** /**
* 导出定位标签 * 导出定位标签
* @param param 入参 * @param locationTagExportParam 入参
* @param response 响应信息 * @param response 响应信息
*/ */
void exportLocationTagInfo(LocationTagFindParam param, HttpServletResponse response); void exportLocationTagInfo(LocationTagExportParam locationTagExportParam, HttpServletResponse response);
/** /**
* 导入定位标签 * 导入定位标签
...@@ -55,8 +54,15 @@ public interface LocationTagService { ...@@ -55,8 +54,15 @@ public interface LocationTagService {
/** /**
* 修改定位标签 * 修改定位标签
* @param param 入参 * @param locationTagModifyParam 入参
* @return Result<String> * @return Result<String>
*/ */
Result<String> modifyLocationTag(LocationTagModifyParam param); Result<String> modifyLocationTag(LocationTagModifyParam locationTagModifyParam);
/**
* 检索标签
* @param indexParam IndexParam
* @return Result<PageVo<LocationTagIndexVo>>
*/
Result<PageVo<LocationTagIndexVo>> indexLocationTag(IndexParam indexParam);
} }
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.location.tag;
import com.yiring.app.param.location.tag.LocationTagTypeFindParam;
import com.yiring.app.vo.location.tag.LocationTagTypeVo;
import com.yiring.common.core.Result;
import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo;
/**
* 标签分配
*
* @author LJ-2204
* @date 2022/4/27
*/
public interface LocationTagTypeService {
/**
* 分页查询
* @param locationTagTypeFindParam LocationTagTypeFindParam
* @param pageParam PageParam
* @return Result<PageVo<LocationTagTypeVo>>
*/
Result<PageVo<LocationTagTypeVo>> findLocationTagType(
LocationTagTypeFindParam locationTagTypeFindParam,
PageParam pageParam
);
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.location.impl; package com.yiring.app.service.location.tag.impl;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
...@@ -11,16 +11,15 @@ import com.yiring.app.domain.location.LocationTag; ...@@ -11,16 +11,15 @@ import com.yiring.app.domain.location.LocationTag;
import com.yiring.app.domain.location.LocationTagRepository; import com.yiring.app.domain.location.LocationTagRepository;
import com.yiring.app.excel.location.LocationTagExportExcel; import com.yiring.app.excel.location.LocationTagExportExcel;
import com.yiring.app.excel.location.LocationTagImportExcel; import com.yiring.app.excel.location.LocationTagImportExcel;
import com.yiring.app.param.location.LocationTagAddParam; import com.yiring.app.param.location.tag.*;
import com.yiring.app.param.location.LocationTagDeleteParam;
import com.yiring.app.param.location.LocationTagFindParam;
import com.yiring.app.param.location.LocationTagModifyParam;
import com.yiring.app.param.location.zy.ZyLocationTagAddParam; import com.yiring.app.param.location.zy.ZyLocationTagAddParam;
import com.yiring.app.service.location.LocationTagService; import com.yiring.app.service.location.tag.LocationTagService;
import com.yiring.app.service.zy.ZyHttpService; import com.yiring.app.service.zy.ZyHttpService;
import com.yiring.app.vo.location.LocationTagVo; import com.yiring.app.vo.location.tag.LocationTagIndexVo;
import com.yiring.app.vo.location.tag.LocationTagVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.core.Status; import com.yiring.common.core.Status;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import java.io.IOException; import java.io.IOException;
...@@ -37,7 +36,6 @@ import javax.persistence.criteria.Predicate; ...@@ -37,7 +36,6 @@ import javax.persistence.criteria.Predicate;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.domain.*; import org.springframework.data.domain.*;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -64,9 +62,10 @@ public class LocationTagServiceImpl implements LocationTagService { ...@@ -64,9 +62,10 @@ public class LocationTagServiceImpl implements LocationTagService {
LocationTagRepository locationTagRepository; LocationTagRepository locationTagRepository;
@Override @Override
public Result<String> addLocationTag(LocationTagAddParam param) { public Result<String> addLocationTag(LocationTagAddParam locationTagAddParam) {
if (hasLocationTagInfoByCode(param.getCode())) return Result.no(Status.BAD_REQUEST, "编号已存在"); if (hasLocationTagInfoByCode(locationTagAddParam.getCode())) return Result.no(Status.BAD_REQUEST, "编号已存在");
LocationTag locationTag = param.transform();
LocationTag locationTag = LocationTagAddParam.transform(locationTagAddParam);
ZyLocationTagAddParam zyLocationTagAddParam = ZyLocationTagAddParam.transform(locationTag, FACTORY_ID); ZyLocationTagAddParam zyLocationTagAddParam = ZyLocationTagAddParam.transform(locationTag, FACTORY_ID);
List<ZyLocationTagAddParam> of = ListUtil.of(zyLocationTagAddParam); List<ZyLocationTagAddParam> of = ListUtil.of(zyLocationTagAddParam);
zyHttpService.post("/positionApi/api/tag/saveTag", of, 3000); zyHttpService.post("/positionApi/api/tag/saveTag", of, 3000);
...@@ -76,8 +75,30 @@ public class LocationTagServiceImpl implements LocationTagService { ...@@ -76,8 +75,30 @@ public class LocationTagServiceImpl implements LocationTagService {
} }
@Override @Override
public Result<PageVo<LocationTagVo>> findLocationTagPage(LocationTagFindParam param, PageParam pageParam) { public Result<PageVo<LocationTagVo>> findLocationTagPage(
Specification<LocationTag> specification = getLocationTagPageSpecification(param); LocationTagFindParam locationTagFindParam,
PageParam pageParam
) {
Specification<LocationTag> specification = (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(locationTagFindParam.getCode())) {
predicates.add(cb.like(root.get(LocationTag.Fields.code), "%" + locationTagFindParam.getCode() + "%"));
}
if (ObjectUtil.isNotEmpty(locationTagFindParam.getType())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.type), locationTagFindParam.getType()));
}
if (ObjectUtil.isNotEmpty(locationTagFindParam.getSilent())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.silent), locationTagFindParam.getSilent()));
}
Order order = cb.desc(root.get(LocationTag.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
};
// 分页 // 分页
Pageable pageable = PageRequest.of(pageParam.getPageNo() - 1, pageParam.getPageSize()); Pageable pageable = PageRequest.of(pageParam.getPageNo() - 1, pageParam.getPageSize());
...@@ -91,18 +112,39 @@ public class LocationTagServiceImpl implements LocationTagService { ...@@ -91,18 +112,39 @@ public class LocationTagServiceImpl implements LocationTagService {
} }
@Override @Override
public Result<String> deleteLocationTag(LocationTagDeleteParam param) { public Result<String> deleteLocationTag(LocationTagDeleteParam locationTagDeleteParam) {
Map<Object, Object> map = MapUtil.createMap(HashMap.class); Map<Object, Object> map = MapUtil.createMap(HashMap.class);
map.put("tagIds", param.getCodes()); map.put("tagIds", locationTagDeleteParam.getCodes());
map.put("orgId", FACTORY_ID); map.put("orgId", FACTORY_ID);
zyHttpService.delete("/positionApi/api/tag/delete", map, 3000); zyHttpService.delete("/positionApi/api/tag/delete", map, 3000);
locationTagRepository.deleteAllById(ListUtil.toList(param.getIds())); locationTagRepository.deleteAllById(ListUtil.toList(locationTagDeleteParam.getIds()));
return Result.ok(); return Result.ok();
} }
@Override @Override
public void exportLocationTagInfo(LocationTagFindParam param, HttpServletResponse response) { public void exportLocationTagInfo(LocationTagExportParam locationTagExportParam, HttpServletResponse response) {
Specification<LocationTag> specification = getLocationTagPageSpecification(param); Specification<LocationTag> specification = (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(locationTagExportParam.getCode())) {
predicates.add(
cb.like(root.get(LocationTag.Fields.code), "%" + locationTagExportParam.getCode() + "%")
);
}
if (ObjectUtil.isNotEmpty(locationTagExportParam.getType())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.type), locationTagExportParam.getType()));
}
if (ObjectUtil.isNotEmpty(locationTagExportParam.getSilent())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.silent), locationTagExportParam.getSilent()));
}
Order order = cb.desc(root.get(LocationTag.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
};
List<LocationTag> locationTags = locationTagRepository.findAll(specification); List<LocationTag> locationTags = locationTagRepository.findAll(specification);
List<LocationTagExportExcel> locationTagExportExcels = locationTags List<LocationTagExportExcel> locationTagExportExcels = locationTags
.stream() .stream()
...@@ -173,47 +215,47 @@ public class LocationTagServiceImpl implements LocationTagService { ...@@ -173,47 +215,47 @@ public class LocationTagServiceImpl implements LocationTagService {
} }
@Override @Override
public Result<String> modifyLocationTag(LocationTagModifyParam param) { public Result<String> modifyLocationTag(LocationTagModifyParam locationTagModifyParam) {
long count = locationTagRepository.count( long count = locationTagRepository.count(
Example.of(LocationTag.builder().id(param.getId()).code(param.getCode()).build()) Example.of(
LocationTag.builder().id(locationTagModifyParam.getId()).code(locationTagModifyParam.getCode()).build()
)
); );
// code相同 // code相同
if (count == 0 && hasLocationTagInfoByCode(param.getCode())) { if (count == 0 && hasLocationTagInfoByCode(locationTagModifyParam.getCode())) {
return Result.no(Status.BAD_REQUEST, "编号重复"); return Result.no(Status.BAD_REQUEST, "编号重复");
} }
LocationTag locationTag = LocationTagModifyParam.transform(param); LocationTag locationTag = LocationTagModifyParam.transform(locationTagModifyParam);
locationTagRepository.save(locationTag); locationTagRepository.save(locationTag);
return Result.ok(); return Result.ok();
} }
private boolean hasLocationTagInfoByCode(String code) { @Override
LocationTag locationTag = LocationTag.builder().code(code).build(); public Result<PageVo<LocationTagIndexVo>> indexLocationTag(IndexParam indexParam) {
return locationTagRepository.count(Example.of(locationTag)) > 0; Specification<LocationTag> specification = (root, cq, cb) -> {
}
@NotNull
private Specification<LocationTag> getLocationTagPageSpecification(LocationTagFindParam param) {
return (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList(); List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(indexParam.getStr())) {
if (StrUtil.isNotEmpty(param.getCode())) { predicates.add(cb.like(root.get(LocationTag.Fields.code), "%" + indexParam.getStr() + "%"));
predicates.add(cb.like(root.get(LocationTag.Fields.code), "%" + param.getCode() + "%"));
}
if (ObjectUtil.isNotEmpty(param.getType())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.type), param.getType()));
}
if (ObjectUtil.isNotEmpty(param.getSilent())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.silent), param.getSilent()));
} }
Order order = cb.desc(root.get(LocationTag.Fields.createTime)); Order order = cb.desc(root.get(LocationTag.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction(); return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
}; };
List<LocationTag> locationTags = locationTagRepository.findAll(specification);
List<LocationTagIndexVo> locationTagIndexVos = locationTags
.stream()
.map(LocationTagIndexVo::transform)
.collect(Collectors.toList());
PageVo<LocationTagIndexVo> pageVo = PageVo.build(locationTagIndexVos, locationTagIndexVos.size());
return Result.ok(pageVo);
}
private boolean hasLocationTagInfoByCode(String code) {
LocationTag locationTag = LocationTag.builder().code(code).build();
return locationTagRepository.count(Example.of(locationTag)) > 0;
} }
} }
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.location.tag.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.yiring.app.domain.location.LocationTag;
import com.yiring.app.domain.location.LocationTagRepository;
import com.yiring.app.param.location.tag.LocationTagTypeFindParam;
import com.yiring.app.service.location.tag.LocationTagTypeService;
import com.yiring.app.vo.location.tag.LocationTagTypeVo;
import com.yiring.common.core.Result;
import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.persistence.criteria.Order;
import javax.persistence.criteria.Predicate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/4/27
*/
@Transactional(rollbackFor = RuntimeException.class)
@Service
@Slf4j
public class LocationTagTypeServiceImpl implements LocationTagTypeService {
@Resource
LocationTagRepository locationTagRepository;
@Override
public Result<PageVo<LocationTagTypeVo>> findLocationTagType(
LocationTagTypeFindParam locationTagTypeFindParam,
PageParam pageParam
) {
Specification<LocationTag> specification = (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(locationTagTypeFindParam.getCode())) {
predicates.add(
cb.like(root.get(LocationTag.Fields.code), "%" + locationTagTypeFindParam.getCode() + "%")
);
}
if (ObjectUtil.isNotEmpty(locationTagTypeFindParam.getCategory())) {
predicates.add(cb.equal(root.get(LocationTag.Fields.category), locationTagTypeFindParam.getCategory()));
}
Order order = cb.desc(root.get(LocationTag.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
};
List<LocationTag> locationTags = locationTagRepository.findAll(specification);
List<LocationTagTypeVo> locationTagTypeVos = locationTags
.stream()
.map(LocationTagTypeVo::transform)
.collect(Collectors.toList());
PageVo<LocationTagTypeVo> pageVo = PageVo.build(locationTagTypeVos, locationTagTypeVos.size());
return Result.ok(pageVo);
}
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.post; package com.yiring.app.service.post;
import com.yiring.app.param.post.PostFindParam; import com.yiring.app.param.post.*;
import com.yiring.app.param.post.PostModifyParam; import com.yiring.app.vo.post.PostIndexVo;
import com.yiring.app.param.post.PostParam; import com.yiring.app.vo.post.PostInfoVo;
import com.yiring.app.vo.post.PostVo; import com.yiring.app.vo.post.PostVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -19,56 +20,58 @@ import javax.servlet.http.HttpServletResponse; ...@@ -19,56 +20,58 @@ import javax.servlet.http.HttpServletResponse;
public interface PostService { public interface PostService {
/** /**
* 新增职位信息 * 新增职位信息
* @param postParam 入参 * @param postAddParam PostAddParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> addPost(PostParam postParam); Result<String> addPost(PostAddParam postAddParam);
/** /**
* 修改职位信息 * 修改职位信息
* @param postParam 入参 * @param postModifyParam PostModifyParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> modifyPost(PostModifyParam postParam); Result<String> modifyPost(PostModifyParam postModifyParam);
/** /**
* 销毁职位信息 * 销毁职位信息
* @param idParam id * @param idParam IdParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> deletePost(IdParam idParam); Result<String> deletePost(IdParam idParam);
/** /**
* 职位信息分页 * 职位信息分页
* @param param 入参 * @param postFindParam PostFindParam
* @param pageParam PageParam
* @return Result<PageVo<PostVo>> * @return Result<PageVo<PostVo>>
*/ */
Result<PageVo<PostVo>> findPostPage(PostFindParam param, PageParam pageParam); Result<PageVo<PostVo>> findPostPage(PostFindParam postFindParam, PageParam pageParam);
/** /**
* 详细信息查询 * 详细信息查询
* @param idParam id * @param idParam IdParam
* @return Result<PostVo> * @return Result<PostInfoVo>
*/ */
Result<PostVo> findPostById(IdParam idParam); Result<PostInfoVo> findPostById(IdParam idParam);
/** /**
* 根据名称判断是否存在职业信息 * 根据名称判断是否存在职业信息
* @param name 职业名称 * @param name String
* @return T/F * @return boolean
*/ */
boolean hasPostInfo(String name); boolean hasPostInfo(String name);
/** /**
* 导出职位信息 * 导出职位信息
* @param param 入参 * @param postExportParam PostExportParam
* @param response 响应信息 * @param response HttpServletResponse
*/ */
void exportPostInfo(PostFindParam param, HttpServletResponse response); void exportPostInfo(PostExportParam postExportParam, HttpServletResponse response);
/** /**
* 下拉菜单 * 职位检索
* @return Result<PageVo<PostVo>> * @param indexParam IndexParam
* @return Result<PageVo<PostIndexVo>>
*/ */
Result<PageVo<PostVo>> selectPost(); Result<PageVo<PostIndexVo>> indexPost(IndexParam indexParam);
} }
...@@ -5,10 +5,10 @@ import cn.hutool.core.collection.ListUtil; ...@@ -5,10 +5,10 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder; import com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder;
import com.yiring.app.param.post.PostFindParam; import com.yiring.app.param.post.*;
import com.yiring.app.param.post.PostModifyParam;
import com.yiring.app.param.post.PostParam;
import com.yiring.app.service.post.PostService; import com.yiring.app.service.post.PostService;
import com.yiring.app.vo.post.PostIndexVo;
import com.yiring.app.vo.post.PostInfoVo;
import com.yiring.app.vo.post.PostVo; import com.yiring.app.vo.post.PostVo;
import com.yiring.auth.domain.post.Post; import com.yiring.auth.domain.post.Post;
import com.yiring.auth.domain.post.PostRepository; import com.yiring.auth.domain.post.PostRepository;
...@@ -16,6 +16,7 @@ import com.yiring.auth.excel.post.PostExcel; ...@@ -16,6 +16,7 @@ import com.yiring.auth.excel.post.PostExcel;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.core.Status; import com.yiring.common.core.Status;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import java.io.OutputStream; import java.io.OutputStream;
...@@ -49,26 +50,28 @@ public class PostServiceImpl implements PostService { ...@@ -49,26 +50,28 @@ public class PostServiceImpl implements PostService {
PostRepository postRepository; PostRepository postRepository;
@Override @Override
public Result<String> addPost(PostParam postParam) { public Result<String> addPost(PostAddParam postAddParam) {
// 判断职位是否存在 // 判断职位是否存在
if (hasPostInfo(postParam.getName())) return Result.no(Status.BAD_REQUEST, "职位已存在"); if (hasPostInfo(postAddParam.getName())) return Result.no(Status.BAD_REQUEST, "职位已存在");
Post post = PostParam.transform(postParam);
Post post = PostAddParam.transform(postAddParam);
postRepository.save(post); postRepository.save(post);
return Result.ok(); return Result.ok();
} }
@Override @Override
public Result<String> modifyPost(PostModifyParam postParam) { public Result<String> modifyPost(PostModifyParam postModifyParam) {
// 是否变更 职位名称 // 是否变更 职位名称
long count = postRepository.count( long count = postRepository.count(
Example.of(Post.builder().id(postParam.getId()).name(postParam.getName()).build()) Example.of(Post.builder().id(postModifyParam.getId()).name(postModifyParam.getName()).build())
); );
// 变更处理 // 变更处理
if (count == 0 && hasPostInfo(postParam.getName())) { if (count == 0 && hasPostInfo(postModifyParam.getName())) {
return Result.no(Status.BAD_REQUEST, "职位名称重复"); return Result.no(Status.BAD_REQUEST, "职位名称重复");
} }
Post post = postParam.transform(postParam);
Post post = postModifyParam.transform(postModifyParam);
postRepository.save(post); postRepository.save(post);
return Result.ok(); return Result.ok();
} }
...@@ -81,11 +84,25 @@ public class PostServiceImpl implements PostService { ...@@ -81,11 +84,25 @@ public class PostServiceImpl implements PostService {
} }
@Override @Override
public Result<PageVo<PostVo>> findPostPage(PostFindParam param, PageParam pageParam) { public Result<PageVo<PostVo>> findPostPage(PostFindParam postFindParam, PageParam pageParam) {
Specification<Post> specification = getPostPageSpecification(param); Specification<Post> specification = (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(postFindParam.getName())) {
predicates.add(cb.like(root.get(Post.Fields.name), "%" + postFindParam.getName() + "%"));
}
if (ObjectUtil.isNotEmpty(postFindParam.getEnable())) {
predicates.add(cb.equal(root.get(Post.Fields.enable), postFindParam.getEnable()));
}
Order order = cb.desc(root.get(Post.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
};
// 分页 // 分页
Pageable pageable = PageRequest.of(pageParam.getPageNo() - 1, pageParam.getPageSize()); Pageable pageable = PageRequest.of(pageParam.getPageNo() - 1, pageParam.getPageSize());
Page<Post> page = postRepository.findAll(specification, pageable); Page<Post> page = postRepository.findAll(specification, pageable);
List<PostVo> postVos = page.getContent().stream().map(PostVo::transform).collect(Collectors.toList()); List<PostVo> postVos = page.getContent().stream().map(PostVo::transform).collect(Collectors.toList());
PageVo<PostVo> pageVo = PageVo.build(postVos, postVos.size()); PageVo<PostVo> pageVo = PageVo.build(postVos, postVos.size());
...@@ -93,10 +110,10 @@ public class PostServiceImpl implements PostService { ...@@ -93,10 +110,10 @@ public class PostServiceImpl implements PostService {
} }
@Override @Override
public Result<PostVo> findPostById(IdParam idParam) { public Result<PostInfoVo> findPostById(IdParam idParam) {
Post post = postRepository.getById(idParam.getId()); Post post = postRepository.getById(idParam.getId());
PostVo postVo = PostVo.transform(post); PostInfoVo postInfoVo = PostInfoVo.transform(post);
return Result.ok(postVo); return Result.ok(postInfoVo);
} }
@Override @Override
...@@ -106,8 +123,23 @@ public class PostServiceImpl implements PostService { ...@@ -106,8 +123,23 @@ public class PostServiceImpl implements PostService {
} }
@Override @Override
public void exportPostInfo(PostFindParam param, HttpServletResponse response) { public void exportPostInfo(PostExportParam postExportParam, HttpServletResponse response) {
Specification<Post> specification = getPostPageSpecification(param); Specification<Post> specification = (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(postExportParam.getName())) {
predicates.add(cb.like(root.get(Post.Fields.name), "%" + postExportParam.getName() + "%"));
}
if (ObjectUtil.isNotEmpty(postExportParam.getEnable())) {
predicates.add(cb.equal(root.get(Post.Fields.enable), postExportParam.getEnable()));
}
Order order = cb.desc(root.get(Post.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
};
List<Post> postList = postRepository.findAll(specification); List<Post> postList = postRepository.findAll(specification);
List<PostExcel> postExcels = postList.stream().map(PostExcel::transform).collect(Collectors.toList()); List<PostExcel> postExcels = postList.stream().map(PostExcel::transform).collect(Collectors.toList());
try ( try (
...@@ -125,9 +157,11 @@ public class PostServiceImpl implements PostService { ...@@ -125,9 +157,11 @@ public class PostServiceImpl implements PostService {
streamExcelBuilder.append(postExcels); streamExcelBuilder.append(postExcels);
String fileName = URLEncoder.encode("职位信息.xlsx", StandardCharsets.UTF_8); String fileName = URLEncoder.encode("职位信息.xlsx", StandardCharsets.UTF_8);
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
OutputStream out = response.getOutputStream(); OutputStream out = response.getOutputStream();
Workbook workbook = streamExcelBuilder.fixedTitles().build(); Workbook workbook = streamExcelBuilder.fixedTitles().build();
...@@ -142,28 +176,21 @@ public class PostServiceImpl implements PostService { ...@@ -142,28 +176,21 @@ public class PostServiceImpl implements PostService {
} }
@Override @Override
public Result<PageVo<PostVo>> selectPost() { public Result<PageVo<PostIndexVo>> indexPost(IndexParam indexParam) {
List<Post> posts = postRepository.findAll(); List<Post> posts = postRepository.findAll((root, cq, cb) -> {
List<PostVo> postVos = posts.stream().map(PostVo::transform).collect(Collectors.toList());
PageVo<PostVo> pageVo = PageVo.build(postVos, postVos.size());
return Result.ok(pageVo);
}
private Specification<Post> getPostPageSpecification(PostFindParam param) {
return (root, cq, cb) -> {
List<Predicate> predicates = ListUtil.toList(); List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(param.getName())) { if (StrUtil.isNotEmpty(indexParam.getStr())) {
predicates.add(cb.like(root.get(Post.Fields.name), "%" + param.getName() + "%")); predicates.add(cb.like(root.get(Post.Fields.name), "%" + indexParam.getStr() + "%"));
}
if (ObjectUtil.isNotEmpty(param.getEnable())) {
predicates.add(cb.equal(root.get(Post.Fields.enable), param.getEnable()));
} }
Order order = cb.desc(root.get(Post.Fields.createTime)); Order order = cb.desc(root.get(Post.Fields.createTime));
return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction(); return cq.orderBy(order).where(predicates.toArray(new Predicate[0])).getRestriction();
}; });
List<PostIndexVo> postIndexVos = posts.stream().map(PostIndexVo::transform).collect(Collectors.toList());
PageVo<PostIndexVo> pageVo = PageVo.build(postIndexVos, postIndexVos.size());
return Result.ok(pageVo);
} }
} }
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
package com.yiring.app.service.user; package com.yiring.app.service.user;
import com.yiring.app.param.user.*; import com.yiring.app.param.user.*;
import com.yiring.app.vo.user.UserInfoVo;
import com.yiring.app.vo.user.UserVo; import com.yiring.app.vo.user.UserVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -18,25 +20,25 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -18,25 +20,25 @@ import org.springframework.web.multipart.MultipartFile;
public interface UserService { public interface UserService {
/** /**
* 表格查询 * 表格查询
* @param param UserByNameParam * @param userFindParam UserByNameParam
* @param pageParam PageParam * @param pageParam PageParam
* @return Result<PageVo<UserAutoVo>> * @return Result<PageVo<UserAutoVo>>
*/ */
Result<PageVo<UserVo>> findUserPage(UserFindParam param, PageParam pageParam); Result<PageVo<UserVo>> findUserPage(UserFindParam userFindParam, PageParam pageParam);
/** /**
* 用户详细信息 * 用户详细信息
* @param idParam IdParam * @param idParam IdParam
* @return Result<UserVo> * @return Result<UserVo>
*/ */
Result<UserVo> findUserById(IdParam idParam); Result<UserInfoVo> findUserById(IdParam idParam);
/** /**
* 用户绑定标签 * 用户绑定标签
* @param param UserBingTagParam * @param userBingTagParam UserBingTagParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> userBingTag(UserBingTagParam param); Result<String> userBingTag(UserBingTagParam userBingTagParam);
/** /**
* 收卡 * 收卡
...@@ -53,17 +55,11 @@ public interface UserService { ...@@ -53,17 +55,11 @@ public interface UserService {
Result<String> deleteUser(IdParam idParam); Result<String> deleteUser(IdParam idParam);
/** /**
* 下拉菜单
* @return Result<PageVo<UserVo>>
*/
Result<PageVo<UserVo>> selectUser();
/**
* 导出用户 * 导出用户
* @param param UserFindParam * @param userFindParam UserFindParam
* @param response HttpServletResponse * @param response HttpServletResponse
*/ */
void exportUser(UserFindParam param, HttpServletResponse response); void exportUser(UserFindParam userFindParam, HttpServletResponse response);
/** /**
* 启用/停用 * 启用/停用
...@@ -74,17 +70,17 @@ public interface UserService { ...@@ -74,17 +70,17 @@ public interface UserService {
/** /**
* 修改用户 * 修改用户
* @param param UserModifyParam * @param userModifyParam UserModifyParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> modifyUser(UserModifyParam param); Result<String> modifyUser(UserModifyParam userModifyParam);
/** /**
* 新增用户 * 新增用户
* @param param UserAddParam * @param userAddParam UserAddParam
* @return Result<String> * @return Result<String>
*/ */
Result<String> addUser(UserAddParam param); Result<String> addUser(UserAddParam userAddParam);
/** /**
* 导入 * 导入
...@@ -95,8 +91,8 @@ public interface UserService { ...@@ -95,8 +91,8 @@ public interface UserService {
/** /**
* 用户索引 * 用户索引
* @param param UserIndexParam * @param indexParam IndexParam
* @return Result<PageVo<UserVo>> * @return Result<PageVo<UserVo>>
*/ */
Result<PageVo<UserVo>> indexUser(UserIndexParam param); Result<PageVo<UserVo>> indexUser(IndexParam indexParam);
} }
...@@ -13,6 +13,7 @@ import com.yiring.app.excel.user.UserImportExcel; ...@@ -13,6 +13,7 @@ import com.yiring.app.excel.user.UserImportExcel;
import com.yiring.app.param.user.*; import com.yiring.app.param.user.*;
import com.yiring.app.service.dept.DepartmentService; import com.yiring.app.service.dept.DepartmentService;
import com.yiring.app.service.user.UserService; import com.yiring.app.service.user.UserService;
import com.yiring.app.vo.user.UserInfoVo;
import com.yiring.app.vo.user.UserVo; import com.yiring.app.vo.user.UserVo;
import com.yiring.auth.domain.dept.Department; import com.yiring.auth.domain.dept.Department;
import com.yiring.auth.domain.dept.DepartmentRepository; import com.yiring.auth.domain.dept.DepartmentRepository;
...@@ -24,6 +25,7 @@ import com.yiring.common.core.Result; ...@@ -24,6 +25,7 @@ import com.yiring.common.core.Result;
import com.yiring.common.core.Status; import com.yiring.common.core.Status;
import com.yiring.common.domain.BasicEntity; import com.yiring.common.domain.BasicEntity;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import java.io.IOException; import java.io.IOException;
...@@ -76,8 +78,8 @@ public class UserServiceImpl implements UserService { ...@@ -76,8 +78,8 @@ public class UserServiceImpl implements UserService {
PostRepository postRepository; PostRepository postRepository;
@Override @Override
public Result<PageVo<UserVo>> findUserPage(UserFindParam param, PageParam pageParam) { public Result<PageVo<UserVo>> findUserPage(UserFindParam userFindParam, PageParam pageParam) {
CriteriaQuery<UserVo> cq = getUserVoCriteriaQuery(param); CriteriaQuery<UserVo> cq = getUserVoCriteriaQuery(userFindParam);
List<UserVo> userVos = em List<UserVo> userVos = em
.createQuery(cq) .createQuery(cq)
...@@ -89,19 +91,19 @@ public class UserServiceImpl implements UserService { ...@@ -89,19 +91,19 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Result<UserVo> findUserById(IdParam idParam) { public Result<UserInfoVo> findUserById(IdParam idParam) {
Optional<User> userOptional = userRepository.findOne(Example.of(User.builder().id(idParam.getId()).build())); Optional<User> userOptional = userRepository.findOne(Example.of(User.builder().id(idParam.getId()).build()));
if (userOptional.isPresent()) { if (userOptional.isPresent()) {
UserVo userVo = UserVo.transformUserInfo(userOptional.get()); UserInfoVo userInfoVo = UserInfoVo.transform(userOptional.get());
return Result.ok(userVo); return Result.ok(userInfoVo);
} }
return Result.no(Status.BAD_REQUEST); return Result.no(Status.BAD_REQUEST);
} }
@Override @Override
public Result<String> userBingTag(UserBingTagParam param) { public Result<String> userBingTag(UserBingTagParam userBingTagParam) {
Optional<LocationTag> locationTagOptional = locationTagRepository.findOne( Optional<LocationTag> locationTagOptional = locationTagRepository.findOne(
Example.of(LocationTag.builder().code(param.getCode()).build()) Example.of(LocationTag.builder().code(userBingTagParam.getCode()).build())
); );
if (locationTagOptional.isEmpty()) throw new RuntimeException("标签卡不存在"); if (locationTagOptional.isEmpty()) throw new RuntimeException("标签卡不存在");
...@@ -110,7 +112,7 @@ public class UserServiceImpl implements UserService { ...@@ -110,7 +112,7 @@ public class UserServiceImpl implements UserService {
throw new RuntimeException("已绑定其他用户 : " + locationTag.getUser().getRealName()); throw new RuntimeException("已绑定其他用户 : " + locationTag.getUser().getRealName());
} }
locationTag.setUser(User.builder().id(param.getId()).build()); locationTag.setUser(User.builder().id(userBingTagParam.getId()).build());
locationTag.setUsed(true); locationTag.setUsed(true);
locationTagRepository.save(locationTag); locationTagRepository.save(locationTag);
...@@ -147,16 +149,8 @@ public class UserServiceImpl implements UserService { ...@@ -147,16 +149,8 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Result<PageVo<UserVo>> selectUser() { public void exportUser(UserFindParam userFindParam, HttpServletResponse response) {
List<User> users = userRepository.findAll(); CriteriaQuery<UserVo> cq = getUserVoCriteriaQuery(userFindParam);
List<UserVo> userVos = UserVo.transforms(users);
PageVo<UserVo> pageVo = PageVo.build(userVos, userVos.size());
return Result.ok(pageVo);
}
@Override
public void exportUser(UserFindParam param, HttpServletResponse response) {
CriteriaQuery<UserVo> cq = getUserVoCriteriaQuery(param);
List<UserVo> userVos = em.createQuery(cq).getResultList(); List<UserVo> userVos = em.createQuery(cq).getResultList();
List<UserExportExcel> userExportExcels = userVos List<UserExportExcel> userExportExcels = userVos
.stream() .stream()
...@@ -215,20 +209,22 @@ public class UserServiceImpl implements UserService { ...@@ -215,20 +209,22 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Result<String> modifyUser(UserModifyParam param) { public Result<String> modifyUser(UserModifyParam userModifyParam) {
Optional<User> userOptional = userRepository.findOne(Example.of(User.builder().id(param.getId()).build())); Optional<User> userOptional = userRepository.findOne(
Example.of(User.builder().id(userModifyParam.getId()).build())
);
if (userOptional.isEmpty()) return Result.no(Status.BAD_REQUEST, "用户不存在"); if (userOptional.isEmpty()) return Result.no(Status.BAD_REQUEST, "用户不存在");
User user = userOptional.get(); User user = userOptional.get();
if (!StrUtil.equals(user.getUuid(), param.getUuid())) { if (!StrUtil.equals(user.getUuid(), userModifyParam.getUuid())) {
long count = userRepository.count(Example.of(User.builder().uuid(param.getUuid()).build())); long count = userRepository.count(Example.of(User.builder().uuid(userModifyParam.getUuid()).build()));
if (count > 0) return Result.no(Status.BAD_REQUEST, "工号相同"); if (count > 0) return Result.no(Status.BAD_REQUEST, "工号相同");
} }
User newUser = param.transform(); User newUser = userModifyParam.transform();
userRepository.save(newUser); userRepository.save(newUser);
...@@ -236,12 +232,12 @@ public class UserServiceImpl implements UserService { ...@@ -236,12 +232,12 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Result<String> addUser(UserAddParam param) { public Result<String> addUser(UserAddParam userAddParam) {
long count = userRepository.count(Example.of(User.builder().uuid(param.getUuid()).build())); long count = userRepository.count(Example.of(User.builder().uuid(userAddParam.getUuid()).build()));
if (count > 0) return Result.no(Status.BAD_REQUEST, "工号相同"); if (count > 0) return Result.no(Status.BAD_REQUEST, "工号相同");
User user = param.transform(); User user = UserAddParam.transform(userAddParam);
userRepository.save(user); userRepository.save(user);
return Result.ok(); return Result.ok();
...@@ -302,10 +298,11 @@ public class UserServiceImpl implements UserService { ...@@ -302,10 +298,11 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
public Result<PageVo<UserVo>> indexUser(UserIndexParam param) { public Result<PageVo<UserVo>> indexUser(IndexParam indexParam) {
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<UserVo> cq = cb.createQuery(UserVo.class); CriteriaQuery<UserVo> cq = cb.createQuery(UserVo.class);
Root<User> root = cq.from(User.class); Root<User> root = cq.from(User.class);
Expression<Long> id = root.get(BasicEntity.Fields.id);
Expression<String> realName = root.get(User.Fields.realName); Expression<String> realName = root.get(User.Fields.realName);
Expression<String> uuid = root.get(User.Fields.uuid); Expression<String> uuid = root.get(User.Fields.uuid);
Expression<User.Type> type = root.get(User.Fields.type); Expression<User.Type> type = root.get(User.Fields.type);
...@@ -320,14 +317,14 @@ public class UserServiceImpl implements UserService { ...@@ -320,14 +317,14 @@ public class UserServiceImpl implements UserService {
query.select(tagRoot.get(LocationTag.Fields.code)); query.select(tagRoot.get(LocationTag.Fields.code));
query.where(cb.equal(tagRoot.get(LocationTag.Fields.user), root)); query.where(cb.equal(tagRoot.get(LocationTag.Fields.user), root));
cq.multiselect(realName, uuid, type, department, mobile, post, query, gender, isSpecial); cq.multiselect(id, realName, uuid, type, department, mobile, post, query, gender, isSpecial);
List<Predicate> predicates = ListUtil.toList(); List<Predicate> predicates = ListUtil.toList();
if (StrUtil.isNotEmpty(param.getStr())) { if (StrUtil.isNotEmpty(indexParam.getStr())) {
if (StrUtil.isNumeric(param.getStr())) { if (StrUtil.isNumeric(indexParam.getStr())) {
predicates.add(cb.like(root.get(User.Fields.mobile), param.getStr() + "%")); predicates.add(cb.like(root.get(User.Fields.mobile), indexParam.getStr() + "%"));
} else { } else {
predicates.add(cb.like(root.get(User.Fields.realName), param.getStr() + "%")); predicates.add(cb.like(root.get(User.Fields.realName), indexParam.getStr() + "%"));
} }
} }
...@@ -346,6 +343,7 @@ public class UserServiceImpl implements UserService { ...@@ -346,6 +343,7 @@ public class UserServiceImpl implements UserService {
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<UserVo> cq = cb.createQuery(UserVo.class); CriteriaQuery<UserVo> cq = cb.createQuery(UserVo.class);
Root<User> root = cq.from(User.class); Root<User> root = cq.from(User.class);
Expression<Long> id = root.get(BasicEntity.Fields.id);
Expression<String> realName = root.get(User.Fields.realName); Expression<String> realName = root.get(User.Fields.realName);
Expression<String> uuid = root.get(User.Fields.uuid); Expression<String> uuid = root.get(User.Fields.uuid);
Expression<User.Type> type = root.get(User.Fields.type); Expression<User.Type> type = root.get(User.Fields.type);
...@@ -360,7 +358,7 @@ public class UserServiceImpl implements UserService { ...@@ -360,7 +358,7 @@ public class UserServiceImpl implements UserService {
query.select(tagRoot.get(LocationTag.Fields.code)); query.select(tagRoot.get(LocationTag.Fields.code));
query.where(cb.equal(tagRoot.get(LocationTag.Fields.user), root)); query.where(cb.equal(tagRoot.get(LocationTag.Fields.user), root));
cq.multiselect(realName, uuid, type, department, mobile, post, query, gender, isSpecial); cq.multiselect(id, realName, uuid, type, department, mobile, post, query, gender, isSpecial);
List<Predicate> predicates = ListUtil.toList(); List<Predicate> predicates = ListUtil.toList();
......
...@@ -64,7 +64,7 @@ public class DepartmentInfoVo implements Serializable { ...@@ -64,7 +64,7 @@ public class DepartmentInfoVo implements Serializable {
return DepartmentInfoVo return DepartmentInfoVo
.builder() .builder()
.name(department.getName()) .name(department.getName())
.userVo(UserVo.transform(department.getLeader())) .userVo(UserVo.transformDept(department.getLeader()))
.enable(department.getEnable()) .enable(department.getEnable())
.posts(department.getPosts()) .posts(department.getPosts())
.pid(department.getPid()) .pid(department.getPid())
......
...@@ -37,6 +37,10 @@ public class DepartmentVo implements Serializable { ...@@ -37,6 +37,10 @@ public class DepartmentVo implements Serializable {
@ApiModelProperty(value = "主键", example = "111") @ApiModelProperty(value = "主键", example = "111")
Long id; Long id;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "上级部门", example = "0根目录")
Long pid;
@ApiModelProperty(value = "部门名称", example = "研发部") @ApiModelProperty(value = "部门名称", example = "研发部")
String name; String name;
...@@ -46,10 +50,6 @@ public class DepartmentVo implements Serializable { ...@@ -46,10 +50,6 @@ public class DepartmentVo implements Serializable {
@ApiModelProperty(value = "是否启用", example = "T/F") @ApiModelProperty(value = "是否启用", example = "T/F")
Boolean enable; Boolean enable;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "上级部门", example = "0根目录")
Long pid;
@ApiModelProperty(value = "上级部门名称", example = "前端") @ApiModelProperty(value = "上级部门名称", example = "前端")
String pName; String pName;
...@@ -73,7 +73,7 @@ public class DepartmentVo implements Serializable { ...@@ -73,7 +73,7 @@ public class DepartmentVo implements Serializable {
.createTime(department.getCreateTime()) .createTime(department.getCreateTime())
.build(); .build();
if (ObjectUtil.isNotEmpty(department.getLeader())) { if (ObjectUtil.isNotEmpty(department.getLeader())) {
departmentVo.setLeader(UserVo.transform(department.getLeader())); departmentVo.setLeader(UserVo.transformDept(department.getLeader()));
} }
return departmentVo; return departmentVo;
} }
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.location.tag;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 定位索引
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("LocationTagIndexVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class LocationTagIndexVo implements Serializable {
@Serial
private static final long serialVersionUID = -1459205162627200071L;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键", example = "188354391834")
Long id;
@ApiModelProperty(value = "编号", example = "BTT88888888")
String code;
@ApiModelProperty(value = "标签型号", example = "BTT01")
LocationTag.Type type;
@ApiModelProperty(value = "是否启用", example = "0/1")
Boolean used;
public static LocationTagIndexVo transform(LocationTag locationTag) {
return LocationTagIndexVo
.builder()
.id(locationTag.getId())
.code(locationTag.getCode())
.type(locationTag.getType())
.used(locationTag.getUsed())
.build();
}
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.location.tag;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yiring.app.domain.location.LocationTag;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 标签分配
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("LocationTagTypeVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class LocationTagTypeVo implements Serializable {
@Serial
private static final long serialVersionUID = -5223102796143763942L;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键", example = "188354391834")
Long id;
@ApiModelProperty(value = "编号", example = "BTT88888888")
String code;
@ApiModelProperty(value = "标签型号", example = "BTT01")
LocationTag.Type type;
@ApiModelProperty(value = "标签类型", example = "人员")
String tagType;
@ApiModelProperty(value = "类型", example = "类型(1:内部/2:访客/3:承包商)")
Integer category;
public static LocationTagTypeVo transform(LocationTag locationTag) {
String entityType = StrUtil.equals(locationTag.getType().name(), "BTT02") ? "car" : "staff";
return LocationTagTypeVo
.builder()
.id(locationTag.getId())
.code(locationTag.getCode())
.type(locationTag.getType())
.tagType(entityType)
.category(locationTag.getCategory())
.build();
}
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.location; package com.yiring.app.vo.location.tag;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
...@@ -42,12 +42,12 @@ public class LocationTagVo implements Serializable { ...@@ -42,12 +42,12 @@ public class LocationTagVo implements Serializable {
@ApiModelProperty(value = "状态", example = "静止") @ApiModelProperty(value = "状态", example = "静止")
Boolean silent; Boolean silent;
@ApiModelProperty(value = "电量", example = "1")
Integer volt;
@ApiModelProperty(value = "imei 设备编码", example = "88888888") @ApiModelProperty(value = "imei 设备编码", example = "88888888")
String imei; String imei;
@ApiModelProperty(value = "电量", example = "1")
Integer volt;
@ApiModelProperty(value = "最近更新时间", example = "2022-01-01 00:00:00") @ApiModelProperty(value = "最近更新时间", example = "2022-01-01 00:00:00")
LocalDateTime updateTime; LocalDateTime updateTime;
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.post;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yiring.auth.domain.post.Post;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 职位索引视图
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("PostIndexVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class PostIndexVo implements Serializable {
@Serial
private static final long serialVersionUID = 6787422359697016766L;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键", example = "1")
Long id;
@ApiModelProperty(value = "名称", example = "Java")
String name;
public static PostIndexVo transform(Post post) {
return PostIndexVo.builder().id(post.getId()).name(post.getName()).build();
}
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.post;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yiring.auth.domain.post.Post;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 职位详细视图
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("PostInfoVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class PostInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = -8256863200798776816L;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键", example = "1")
Long id;
@ApiModelProperty(value = "名称", example = "Java")
String name;
@ApiModelProperty(value = "描述", example = "描述")
String describe;
@ApiModelProperty(value = "创建时间", example = "创建时间")
LocalDateTime createTime;
@ApiModelProperty(value = "更新时间", example = "更新时间")
LocalDateTime updateTime;
@ApiModelProperty(value = "职位状态", example = "true")
Boolean enable;
public static PostInfoVo transform(Post post) {
return PostInfoVo
.builder()
.id(post.getId())
.name(post.getName())
.describe(post.getDescribe())
.enable(post.getEnable())
.createTime(post.getCreateTime())
.updateTime(post.getUpdateTime())
.build();
}
}
...@@ -36,16 +36,10 @@ public class PostVo implements Serializable { ...@@ -36,16 +36,10 @@ public class PostVo implements Serializable {
@ApiModelProperty(value = "名称", example = "Java") @ApiModelProperty(value = "名称", example = "Java")
String name; String name;
@ApiModelProperty(value = "描述", example = "描述")
String describe;
@ApiModelProperty(value = "创建时间", example = "创建时间") @ApiModelProperty(value = "创建时间", example = "创建时间")
LocalDateTime createTime; LocalDateTime createTime;
@ApiModelProperty(value = "更新时间", example = "更新时间") @ApiModelProperty(value = "职位状态", example = "true")
LocalDateTime updateTime;
@ApiModelProperty(value = "是否启用", example = "true")
Boolean enable; Boolean enable;
public static PostVo transform(Post post) { public static PostVo transform(Post post) {
...@@ -53,10 +47,8 @@ public class PostVo implements Serializable { ...@@ -53,10 +47,8 @@ public class PostVo implements Serializable {
.builder() .builder()
.id(post.getId()) .id(post.getId())
.name(post.getName()) .name(post.getName())
.describe(post.getDescribe())
.enable(post.getEnable()) .enable(post.getEnable())
.createTime(post.getCreateTime()) .createTime(post.getCreateTime())
.updateTime(post.getUpdateTime())
.build(); .build();
} }
} }
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.user;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yiring.auth.domain.user.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* 用户详细信息模型
*
* @author LJ-2204
* @date 2022/4/27
*/
@ApiModel("UserInfoVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class UserInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = -1040199557851348068L;
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键", example = "1")
Long id;
@ApiModelProperty(value = "真实姓名", example = "超级用户")
String realName;
@ApiModelProperty(value = "工号", example = "8888888")
String uuid;
@ApiModelProperty(value = "类型", example = "员工")
User.Type type;
@ApiModelProperty(value = "部门", example = "系统管理员")
String department;
@ApiModelProperty(value = "手机号", example = "13012345678")
String mobile;
@ApiModelProperty(value = "职位", example = "系统管理员")
String post;
@ApiModelProperty(value = "邮箱", example = "developer@yiring.com")
String email;
@ApiModelProperty(value = "头像", example = "https://s1.ax1x.com/2022/03/30/qggJH0.jpg")
String avatar;
@ApiModelProperty(value = "是否启用", example = "true")
Boolean enabled;
@ApiModelProperty(value = "是否删除", example = "false")
Boolean deleted;
@ApiModelProperty(value = "是否特殊", example = "false")
Boolean isSpecial;
@ApiModelProperty(value = "性别", example = "false")
Boolean gender;
@ApiModelProperty(value = "创建时间", example = "2022-01-01 00:00:00")
LocalDateTime createTime;
@ApiModelProperty(value = "更新时间", example = "2022-01-01 00:00:00")
LocalDateTime updateTime;
public static UserInfoVo transform(User user) {
return UserInfoVo
.builder()
.id(user.getId())
.realName(user.getRealName())
.uuid(user.getUuid())
.type(user.getType())
.department(user.getDepartment().getName())
.mobile(user.getMobile())
.post(user.getPost().getName())
.email(user.getEmail())
.avatar(user.getAvatar())
.enabled(user.getEnabled())
.deleted(user.getDeleted())
.isSpecial(user.getIsSpecial())
.gender(user.getGender())
.createTime(user.getCreateTime())
.updateTime(user.getUpdateTime())
.build();
}
}
...@@ -8,9 +8,6 @@ import io.swagger.annotations.ApiModel; ...@@ -8,9 +8,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import lombok.*; import lombok.*;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
...@@ -56,75 +53,17 @@ public class UserVo implements Serializable { ...@@ -56,75 +53,17 @@ public class UserVo implements Serializable {
@ApiModelProperty(value = "标签编号", example = "BTT88888888") @ApiModelProperty(value = "标签编号", example = "BTT88888888")
String code; String code;
@ApiModelProperty(value = "用户名", example = "admin")
String username;
@ApiModelProperty(value = "邮箱", example = "developer@yiring.com")
String email;
@ApiModelProperty(value = "头像", example = "https://s1.ax1x.com/2022/03/30/qggJH0.jpg")
String avatar;
@ApiModelProperty(value = "是否启用", example = "true")
Boolean enabled;
@ApiModelProperty(value = "是否删除", example = "false")
Boolean deleted;
@ApiModelProperty(value = "是否特殊", example = "false") @ApiModelProperty(value = "是否特殊", example = "false")
Boolean isSpecial; Boolean isSpecial;
@ApiModelProperty(value = "性别", example = "false") @ApiModelProperty(value = "性别", example = "false")
Boolean gender; Boolean gender;
@ApiModelProperty(value = "最后登录IP地址", example = "127.0.0.1") @ApiModelProperty(value = "邮箱", example = "developer@yiring.com")
String lastLoginIp; String email;
@ApiModelProperty(value = "最后登录时间", example = "2022-10-24 10:24:00")
LocalDateTime lastLoginTime;
@ApiModelProperty(value = "创建时间", example = "2022-01-01 00:00:00")
LocalDateTime createTime;
public static UserVo transform(User user) {
return UserVo
.builder()
.id(user.getId())
.realName(user.getRealName())
.username(user.getUsername())
.mobile(user.getMobile())
.email(user.getEmail())
.enabled(user.getEnabled())
.deleted(user.getDeleted())
.lastLoginIp(user.getLastLoginIp())
.lastLoginTime(user.getLastLoginTime())
.createTime(user.getCreateTime())
.build();
}
public static List<UserVo> transforms(List<User> users) {
return users
.stream()
.map(user ->
UserVo
.builder()
.id(user.getId())
.realName(user.getRealName())
.username(user.getUsername())
.mobile(user.getMobile())
.email(user.getEmail())
.avatar(user.getAvatar())
.enabled(user.getEnabled())
.deleted(user.getDeleted())
.lastLoginIp(user.getLastLoginIp())
.lastLoginTime(user.getLastLoginTime())
.createTime(user.getCreateTime())
.build()
)
.collect(Collectors.toList());
}
public UserVo( public UserVo(
Long id,
String realName, String realName,
String uuid, String uuid,
User.Type type, User.Type type,
...@@ -135,6 +74,7 @@ public class UserVo implements Serializable { ...@@ -135,6 +74,7 @@ public class UserVo implements Serializable {
Boolean gender, Boolean gender,
Boolean isSpecial Boolean isSpecial
) { ) {
this.id = id;
this.realName = realName; this.realName = realName;
this.uuid = uuid; this.uuid = uuid;
this.type = type; this.type = type;
...@@ -146,20 +86,13 @@ public class UserVo implements Serializable { ...@@ -146,20 +86,13 @@ public class UserVo implements Serializable {
this.isSpecial = isSpecial; this.isSpecial = isSpecial;
} }
public static UserVo transformUserInfo(User user) { public static UserVo transformDept(User user) {
return UserVo return UserVo
.builder() .builder()
.id(user.getId()) .id(user.getId())
.realName(user.getRealName()) .realName(user.getRealName())
.username(user.getUsername())
.mobile(user.getMobile()) .mobile(user.getMobile())
.email(user.getEmail()) .email(user.getEmail())
.avatar(user.getAvatar())
.enabled(user.getEnabled())
.deleted(user.getDeleted())
.lastLoginIp(user.getLastLoginIp())
.lastLoginTime(user.getLastLoginTime())
.createTime(user.getCreateTime())
.build(); .build();
} }
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
package com.yiring.app.web.dept; package com.yiring.app.web.dept;
import com.yiring.app.param.dept.DepartmentAddParam; import com.yiring.app.param.dept.DepartmentAddParam;
import com.yiring.app.param.dept.DepartmentExportParam;
import com.yiring.app.param.dept.DepartmentFindParam; import com.yiring.app.param.dept.DepartmentFindParam;
import com.yiring.app.param.dept.DepartmentModifyParam; import com.yiring.app.param.dept.DepartmentModifyParam;
import com.yiring.app.service.dept.DepartmentService; import com.yiring.app.service.dept.DepartmentService;
...@@ -39,14 +40,14 @@ public class DepartmentController { ...@@ -39,14 +40,14 @@ public class DepartmentController {
@ApiOperation("新增部门") @ApiOperation("新增部门")
@PostMapping("addDepartment") @PostMapping("addDepartment")
public Result<String> addDepartment(@Valid DepartmentAddParam param) { public Result<String> addDepartment(@Valid DepartmentAddParam departmentAddParam) {
return departmentService.addDepartment(param); return departmentService.addDepartment(departmentAddParam);
} }
@ApiOperation("树形表格") @ApiOperation("树形表格")
@GetMapping("findDepartmentTree") @GetMapping("findDepartmentTree")
public Result<PageVo<DepartmentVo>> findDepartmentTree(@Valid DepartmentFindParam param) { public Result<PageVo<DepartmentVo>> findDepartmentTree(@Valid DepartmentFindParam departmentFindParam) {
return departmentService.findDepartmentTree(param); return departmentService.findDepartmentTree(departmentFindParam);
} }
@ApiOperation("部门详细信息") @ApiOperation("部门详细信息")
...@@ -57,8 +58,8 @@ public class DepartmentController { ...@@ -57,8 +58,8 @@ public class DepartmentController {
@ApiOperation("部门导出") @ApiOperation("部门导出")
@GetMapping("exportDepartment") @GetMapping("exportDepartment")
public void exportDepartment(@Valid DepartmentFindParam param, HttpServletResponse response) { public void exportDepartment(@Valid DepartmentExportParam departmentExportParam, HttpServletResponse response) {
departmentService.exportDepartment(param, response); departmentService.exportDepartment(departmentExportParam, response);
} }
@ApiOperation("逻辑删除部门") @ApiOperation("逻辑删除部门")
...@@ -81,8 +82,8 @@ public class DepartmentController { ...@@ -81,8 +82,8 @@ public class DepartmentController {
@ApiOperation("部门编辑") @ApiOperation("部门编辑")
@PutMapping("modifyDepartment") @PutMapping("modifyDepartment")
public Result<String> modifyDepartment(@Valid DepartmentModifyParam param) { public Result<String> modifyDepartment(@Valid DepartmentModifyParam departmentModifyParam) {
return departmentService.modifyDept(param); return departmentService.modifyDept(departmentModifyParam);
} }
@ApiOperation("部门导入") @ApiOperation("部门导入")
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.location.beacon;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 定位信标
*
* @author LJ-2204
* @date 2022/4/27
*/
@Slf4j
@Validated
@Api(tags = "定位信标")
@RestController
@RequestMapping("/location/beacon/")
public class LocationBeaconController {}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.location.tag; package com.yiring.app.web.location.tag;
import com.yiring.app.param.location.LocationTagAddParam; import com.yiring.app.param.location.tag.*;
import com.yiring.app.param.location.LocationTagDeleteParam; import com.yiring.app.service.location.tag.LocationTagService;
import com.yiring.app.param.location.LocationTagFindParam; import com.yiring.app.vo.location.tag.LocationTagIndexVo;
import com.yiring.app.param.location.LocationTagModifyParam; import com.yiring.app.vo.location.tag.LocationTagVo;
import com.yiring.app.service.location.LocationTagService;
import com.yiring.app.vo.location.LocationTagVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -38,26 +37,32 @@ public class LocationTagController { ...@@ -38,26 +37,32 @@ public class LocationTagController {
@ApiOperation("新增定位标签") @ApiOperation("新增定位标签")
@PostMapping("addLocationTag") @PostMapping("addLocationTag")
public Result<String> addLocationTag(@Valid LocationTagAddParam param) { public Result<String> addLocationTag(@Valid LocationTagAddParam locationTagAddParam) {
return locationTagService.addLocationTag(param); return locationTagService.addLocationTag(locationTagAddParam);
} }
@ApiOperation("分页查询") @ApiOperation("分页查询")
@GetMapping("findLocationTagPage") @GetMapping("findLocationTagPage")
public Result<PageVo<LocationTagVo>> findLocationTagPage(@Valid LocationTagFindParam param, PageParam pageParam) { public Result<PageVo<LocationTagVo>> findLocationTagPage(
return locationTagService.findLocationTagPage(param, pageParam); @Valid LocationTagFindParam locationTagFindParam,
@Valid PageParam pageParam
) {
return locationTagService.findLocationTagPage(locationTagFindParam, pageParam);
} }
@ApiOperation("销毁定位标签") @ApiOperation("销毁定位标签")
@DeleteMapping("deleteLocationTag") @DeleteMapping("deleteLocationTag")
public Result<String> deleteLocationTag(@Valid LocationTagDeleteParam param) { public Result<String> deleteLocationTag(@Valid LocationTagDeleteParam locationTagDeleteParam) {
return locationTagService.deleteLocationTag(param); return locationTagService.deleteLocationTag(locationTagDeleteParam);
} }
@ApiOperation("导出定位标签") @ApiOperation("导出定位标签")
@GetMapping("exportLocationTagInfo") @GetMapping("exportLocationTagInfo")
public void exportLocationTagInfo(@Valid LocationTagFindParam param, HttpServletResponse response) { public void exportLocationTagInfo(
locationTagService.exportLocationTagInfo(param, response); @Valid LocationTagExportParam locationTagExportParam,
HttpServletResponse response
) {
locationTagService.exportLocationTagInfo(locationTagExportParam, response);
} }
@ApiOperation("导入定位标签") @ApiOperation("导入定位标签")
...@@ -68,7 +73,13 @@ public class LocationTagController { ...@@ -68,7 +73,13 @@ public class LocationTagController {
@ApiOperation("修改定位标签") @ApiOperation("修改定位标签")
@PutMapping("modifyLocationTag") @PutMapping("modifyLocationTag")
public Result<String> modifyLocationTag(@Valid LocationTagModifyParam param) { public Result<String> modifyLocationTag(@Valid LocationTagModifyParam locationTagModifyParam) {
return locationTagService.modifyLocationTag(param); return locationTagService.modifyLocationTag(locationTagModifyParam);
}
@ApiOperation("标签检索")
@GetMapping("indexLocationTag")
public Result<PageVo<LocationTagIndexVo>> indexLocationTag(@Valid IndexParam indexParam) {
return locationTagService.indexLocationTag(indexParam);
} }
} }
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.location.tag;
import com.yiring.app.param.location.tag.LocationTagTypeFindParam;
import com.yiring.app.service.location.tag.LocationTagTypeService;
import com.yiring.app.vo.location.tag.LocationTagTypeVo;
import com.yiring.common.core.Result;
import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 标签分配
*
* @author LJ-2204
* @date 2022/4/27
*/
@Slf4j
@Validated
@Api(tags = "标签分配")
@RestController
@RequestMapping("/location/tag/type")
public class LocationTagTypeController {
@Resource
LocationTagTypeService locationTagTypeService;
@ApiOperation("分页查询")
@GetMapping("findLocationTagType")
public Result<PageVo<LocationTagTypeVo>> findLocationTagType(
@Valid LocationTagTypeFindParam locationTagTypeFindParam,
@Valid PageParam pageParam
) {
return locationTagTypeService.findLocationTagType(locationTagTypeFindParam, pageParam);
}
}
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.post; package com.yiring.app.web.post;
import com.yiring.app.param.post.PostAddParam;
import com.yiring.app.param.post.PostExportParam;
import com.yiring.app.param.post.PostFindParam; import com.yiring.app.param.post.PostFindParam;
import com.yiring.app.param.post.PostModifyParam; import com.yiring.app.param.post.PostModifyParam;
import com.yiring.app.param.post.PostParam;
import com.yiring.app.service.post.PostService; import com.yiring.app.service.post.PostService;
import com.yiring.app.vo.post.PostIndexVo;
import com.yiring.app.vo.post.PostInfoVo;
import com.yiring.app.vo.post.PostVo; import com.yiring.app.vo.post.PostVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -37,14 +41,14 @@ public class PostController { ...@@ -37,14 +41,14 @@ public class PostController {
@ApiOperation(value = "新增职位") @ApiOperation(value = "新增职位")
@PostMapping("addPost") @PostMapping("addPost")
public Result<String> addPost(@Valid PostParam postParam) { public Result<String> addPost(@Valid PostAddParam postAddParam) {
return postService.addPost(postParam); return postService.addPost(postAddParam);
} }
@ApiOperation(value = "修改职位") @ApiOperation(value = "修改职位")
@PutMapping("modifyPost") @PutMapping("modifyPost")
public Result<String> modifyPost(@Valid PostModifyParam postParam) { public Result<String> modifyPost(@Valid PostModifyParam postModifyParam) {
return postService.modifyPost(postParam); return postService.modifyPost(postModifyParam);
} }
@ApiOperation(value = "销毁职位") @ApiOperation(value = "销毁职位")
...@@ -55,25 +59,25 @@ public class PostController { ...@@ -55,25 +59,25 @@ public class PostController {
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
@GetMapping("findPostPage") @GetMapping("findPostPage")
public Result<PageVo<PostVo>> findPostPage(@Valid PostFindParam param, @Valid PageParam pageParam) { public Result<PageVo<PostVo>> findPostPage(@Valid PostFindParam postFindParam, @Valid PageParam pageParam) {
return postService.findPostPage(param, pageParam); return postService.findPostPage(postFindParam, pageParam);
} }
@ApiOperation(value = "详细信息查询") @ApiOperation(value = "详细信息查询")
@GetMapping("findPostById") @GetMapping("findPostById")
public Result<PostVo> findPostById(@Valid IdParam idParam) { public Result<PostInfoVo> findPostById(@Valid IdParam idParam) {
return postService.findPostById(idParam); return postService.findPostById(idParam);
} }
@ApiOperation(value = "导出职位信息") @ApiOperation(value = "导出职位信息")
@GetMapping("exportPostInfo") @GetMapping("exportPostInfo")
public void exportPostInfo(@Valid PostFindParam param, HttpServletResponse response) { public void exportPostInfo(@Valid PostExportParam postExportParam, HttpServletResponse response) {
postService.exportPostInfo(param, response); postService.exportPostInfo(postExportParam, response);
} }
@ApiOperation(value = "下拉菜单") @ApiOperation(value = "职位检索")
@GetMapping("selectPost") @GetMapping("indexPost")
public Result<PageVo<PostVo>> selectPost() { public Result<PageVo<PostIndexVo>> indexPost(@Valid IndexParam indexParam) {
return postService.selectPost(); return postService.indexPost(indexParam);
} }
} }
...@@ -3,9 +3,11 @@ package com.yiring.app.web.user; ...@@ -3,9 +3,11 @@ package com.yiring.app.web.user;
import com.yiring.app.param.user.*; import com.yiring.app.param.user.*;
import com.yiring.app.service.user.UserService; import com.yiring.app.service.user.UserService;
import com.yiring.app.vo.user.UserInfoVo;
import com.yiring.app.vo.user.UserVo; import com.yiring.app.vo.user.UserVo;
import com.yiring.common.core.Result; import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam; import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.param.PageParam; import com.yiring.common.param.PageParam;
import com.yiring.common.vo.PageVo; import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -38,20 +40,20 @@ public class UserAppController { ...@@ -38,20 +40,20 @@ public class UserAppController {
@ApiOperation("表格查询") @ApiOperation("表格查询")
@GetMapping("findUserPage") @GetMapping("findUserPage")
public Result<PageVo<UserVo>> findUserPage(@Valid UserFindParam param, @Valid PageParam pageParam) { public Result<PageVo<UserVo>> findUserPage(@Valid UserFindParam userFindParam, @Valid PageParam pageParam) {
return userService.findUserPage(param, pageParam); return userService.findUserPage(userFindParam, pageParam);
} }
@ApiOperation("用户详细信息查询") @ApiOperation("用户详细信息查询")
@GetMapping("findUserById") @GetMapping("findUserById")
public Result<UserVo> findUserById(@Valid IdParam idParam) { public Result<UserInfoVo> findUserById(@Valid IdParam idParam) {
return userService.findUserById(idParam); return userService.findUserById(idParam);
} }
@ApiOperation("给用户分配标签卡") @ApiOperation("给用户分配标签卡")
@PutMapping("userBingTag") @PutMapping("userBingTag")
public Result<String> userBingTag(@Valid UserBingTagParam param) { public Result<String> userBingTag(@Valid UserBingTagParam userBingTagParam) {
return userService.userBingTag(param); return userService.userBingTag(userBingTagParam);
} }
@ApiOperation("收卡") @ApiOperation("收卡")
...@@ -66,16 +68,10 @@ public class UserAppController { ...@@ -66,16 +68,10 @@ public class UserAppController {
return userService.deleteUser(idParam); return userService.deleteUser(idParam);
} }
@ApiOperation("下拉菜单")
@GetMapping("selectUser")
public Result<PageVo<UserVo>> selectUser() {
return userService.selectUser();
}
@ApiOperation("用户导出") @ApiOperation("用户导出")
@GetMapping("exportUser") @GetMapping("exportUser")
public void exportUser(@Valid UserFindParam param, HttpServletResponse response) { public void exportUser(@Valid UserFindParam userFindParam, HttpServletResponse response) {
userService.exportUser(param, response); userService.exportUser(userFindParam, response);
} }
@ApiOperation("启用/停用") @ApiOperation("启用/停用")
...@@ -86,14 +82,14 @@ public class UserAppController { ...@@ -86,14 +82,14 @@ public class UserAppController {
@ApiOperation("编辑用户") @ApiOperation("编辑用户")
@PutMapping("modifyUser") @PutMapping("modifyUser")
public Result<String> modifyUser(@Valid UserModifyParam param) { public Result<String> modifyUser(@Valid UserModifyParam userModifyParam) {
return userService.modifyUser(param); return userService.modifyUser(userModifyParam);
} }
@ApiOperation("新增用户") @ApiOperation("新增用户")
@PostMapping("addUser") @PostMapping("addUser")
public Result<String> addUser(@Valid UserAddParam param) { public Result<String> addUser(@Valid UserAddParam userAddParam) {
return userService.addUser(param); return userService.addUser(userAddParam);
} }
@ApiOperation("导入") @ApiOperation("导入")
...@@ -104,7 +100,7 @@ public class UserAppController { ...@@ -104,7 +100,7 @@ public class UserAppController {
@ApiOperation("用户信息检索") @ApiOperation("用户信息检索")
@GetMapping("indexUser") @GetMapping("indexUser")
public Result<PageVo<UserVo>> indexUser(@Valid UserIndexParam param) { public Result<PageVo<UserVo>> indexUser(@Valid IndexParam indexParam) {
return userService.indexUser(param); return userService.indexUser(indexParam);
} }
} }
...@@ -37,6 +37,11 @@ spring: ...@@ -37,6 +37,11 @@ spring:
simple: simple:
# 手动确认消息 # 手动确认消息
acknowledge-mode: manual acknowledge-mode: manual
servlet:
multipart:
enabled: true
max-file-size: 50MB
max-request-size: 100MB
# knife4j # knife4j
knife4j: knife4j:
...@@ -92,3 +97,10 @@ zy-config: ...@@ -92,3 +97,10 @@ zy-config:
manage: manage:
username: test123 username: test123
password: test123 password: test123
feign:
httpclient:
enabled: false
okhttp:
enabled: true
/* (C) 2022 YiRing, Inc. */ /* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.user; package com.yiring.common.param;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import javax.validation.Valid;
import lombok.*; import lombok.*;
import lombok.experimental.FieldDefaults; import lombok.experimental.FieldDefaults;
/** /**
* 用户检索 * 公共下拉str查询入参
* *
* @author LJ-2204 * @author LJ-2204
* @date 2022/4/26 * @date 2022/4/26
*/ */
@ApiModel("UserIndexParam") @ApiModel("IndexParam")
@Valid
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE) @FieldDefaults(level = AccessLevel.PRIVATE)
public class UserIndexParam implements Serializable { public class IndexParam implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -5843843146263025946L; private static final long serialVersionUID = 1175269732754454737L;
@ApiModelProperty(value = "真实姓名or手机号码") @ApiModelProperty(value = "下拉查询")
String str; String str;
} }
...@@ -31,6 +31,8 @@ buildscript { ...@@ -31,6 +31,8 @@ buildscript {
myexcelVersion = '4.1.1' myexcelVersion = '4.1.1'
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign
openfeignVersion = '3.1.1' openfeignVersion = '3.1.1'
// https://mvnrepository.com/artifact/io.github.openfeign/feign-okhttp
feignOkhttpVersion= '11.8'
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论