实体修改
This commit is contained in:
@@ -1,41 +1,32 @@
|
||||
package org.nl.modules.common.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019年10月24日20:48:53
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
public class BaseDTO implements Serializable {
|
||||
|
||||
private String createBy;
|
||||
private String create_name;
|
||||
|
||||
private String updatedBy;
|
||||
private Long create_id;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
private String update_optname;
|
||||
|
||||
private Long update_optid;
|
||||
|
||||
|
||||
private Date create_time;
|
||||
|
||||
|
||||
private Date update_time;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
Field[] fields = this.getClass().getDeclaredFields();
|
||||
try {
|
||||
for (Field f : fields) {
|
||||
f.setAccessible(true);
|
||||
builder.append(f.getName(), f.get(this)).append("\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
builder.append("toString builder encounter an error");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.nl.modules.common.base;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
@@ -28,7 +26,7 @@ import javax.persistence.Column;
|
||||
import javax.persistence.EntityListeners;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 通用字段, is_del 根据需求自行添加
|
||||
@@ -55,15 +53,13 @@ public class BaseEntity implements Serializable {
|
||||
|
||||
private Long update_optid;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time", updatable = false)
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
private Timestamp create_time;
|
||||
private Date create_time;
|
||||
|
||||
@UpdateTimestamp
|
||||
@Column(name = "update_time")
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
private Timestamp update_time;
|
||||
private Date update_time;
|
||||
|
||||
/* 分组校验 */
|
||||
public @interface Create {}
|
||||
|
||||
@@ -29,11 +29,11 @@ class ApiError {
|
||||
|
||||
private Integer status = 400;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime timestamp;
|
||||
private LocalDateTime Date;
|
||||
private String message;
|
||||
|
||||
private ApiError() {
|
||||
timestamp = LocalDateTime.now();
|
||||
Date = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public static ApiError error(String message){
|
||||
|
||||
@@ -36,18 +36,18 @@ public class DateUtil {
|
||||
* @param localDateTime /
|
||||
* @return /
|
||||
*/
|
||||
public static Long getTimeStamp(LocalDateTime localDateTime) {
|
||||
public static Long getDate(LocalDateTime localDateTime) {
|
||||
return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond();
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳转LocalDateTime
|
||||
*
|
||||
* @param timeStamp /
|
||||
* @param Date /
|
||||
* @return /
|
||||
*/
|
||||
public static LocalDateTime fromTimeStamp(Long timeStamp) {
|
||||
return LocalDateTime.ofEpochSecond(timeStamp, 0, OffsetDateTime.now().getOffset());
|
||||
public static LocalDateTime fromDate(Long Date) {
|
||||
return LocalDateTime.ofEpochSecond(Date, 0, OffsetDateTime.now().getOffset());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ import static org.nl.modules.common.utils.FileUtil.SYS_TEM_DIR;
|
||||
@SuppressWarnings({"unchecked", "all"})
|
||||
public class GenUtil {
|
||||
|
||||
private static final String TIMESTAMP = "Timestamp";
|
||||
private static final String Date = "Date";
|
||||
|
||||
private static final String BIGDECIMAL = "BigDecimal";
|
||||
|
||||
@@ -218,10 +218,10 @@ public class GenUtil {
|
||||
genMap.put("className", className);
|
||||
// 保存小写开头的类名
|
||||
genMap.put("changeClassName", changeClassName);
|
||||
// 存在 Timestamp 字段
|
||||
genMap.put("hasTimestamp", false);
|
||||
// 查询类中存在 Timestamp 字段
|
||||
genMap.put("queryHasTimestamp", false);
|
||||
// 存在 Date 字段
|
||||
genMap.put("hasDate", false);
|
||||
// 查询类中存在 Date 字段
|
||||
genMap.put("queryHasDate", false);
|
||||
// 存在 BigDecimal 字段
|
||||
genMap.put("hasBigDecimal", false);
|
||||
// 查询类中存在 BigDecimal 字段
|
||||
@@ -266,9 +266,9 @@ public class GenUtil {
|
||||
// 存储大写开头的字段名
|
||||
genMap.put("pkCapitalColName", capitalColumnName);
|
||||
}
|
||||
// 是否存在 Timestamp 类型的字段
|
||||
if (TIMESTAMP.equals(colType)) {
|
||||
genMap.put("hasTimestamp", true);
|
||||
// 是否存在 Date 类型的字段
|
||||
if (Date.equals(colType)) {
|
||||
genMap.put("hasDate", true);
|
||||
}
|
||||
// 是否存在 BigDecimal 类型的字段
|
||||
if (BIGDECIMAL.equals(colType)) {
|
||||
@@ -317,9 +317,9 @@ public class GenUtil {
|
||||
listMap.put("queryType", column.getQueryType());
|
||||
// 是否存在查询
|
||||
genMap.put("hasQuery", true);
|
||||
if (TIMESTAMP.equals(colType)) {
|
||||
// 查询中存储 Timestamp 类型
|
||||
genMap.put("queryHasTimestamp", true);
|
||||
if (Date.equals(colType)) {
|
||||
// 查询中存储 Date 类型
|
||||
genMap.put("queryHasDate", true);
|
||||
}
|
||||
if (BIGDECIMAL.equals(colType)) {
|
||||
// 查询中存储 BigDecimal 类型
|
||||
|
||||
@@ -18,11 +18,10 @@ package org.nl.modules.logging.domain;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -71,8 +70,7 @@ public class Log implements Serializable {
|
||||
private byte[] exceptionDetail;
|
||||
|
||||
/** 创建日期 */
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
private Date createTime;
|
||||
|
||||
public Log(String logType, Long time) {
|
||||
this.logType = logType;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -43,5 +43,5 @@ public class LogErrorDTO implements Serializable {
|
||||
|
||||
private String address;
|
||||
|
||||
private Timestamp createTime;
|
||||
}
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,5 +36,5 @@ public class LogQueryCriteria {
|
||||
private String logType;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
private List<Date> createTime;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -37,5 +37,5 @@ public class LogSmallDTO implements Serializable {
|
||||
|
||||
private String browser;
|
||||
|
||||
private Timestamp createTime;
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,10 @@ package org.nl.modules.quartz.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -62,7 +61,7 @@ public class QuartzLog implements Serializable {
|
||||
@ApiModelProperty(value = "执行耗时", hidden = true)
|
||||
private Long time;
|
||||
|
||||
@CreationTimestamp
|
||||
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
private Timestamp createTime;
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.quartz.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -35,5 +35,5 @@ public class JobQueryCriteria {
|
||||
private Boolean isSuccess;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
private List<Date> createTime;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Dept extends BaseEntity implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer deptSort;
|
||||
private Integer dept_sort;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
@@ -48,12 +48,12 @@ public class Dept extends BaseEntity implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled;
|
||||
private Boolean is_used;
|
||||
|
||||
@ApiModelProperty(value = "上级部门")
|
||||
private Long pid;
|
||||
|
||||
@ApiModelProperty(value = "子节点数目", hidden = true)
|
||||
private Integer subCount = 0;
|
||||
private Integer sub_count = 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -28,6 +29,7 @@ import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.service.DeptService;
|
||||
import org.nl.modules.system.service.dto.DeptDto;
|
||||
import org.nl.modules.system.service.dto.DeptQueryCriteria;
|
||||
import org.nl.modules.system.service.dto.DeptTree;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -52,7 +54,7 @@ public class DeptController {
|
||||
@GetMapping
|
||||
@SaCheckPermission(value = {"user:list", "dept:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> query(DeptQueryCriteria criteria) throws Exception {
|
||||
List<DeptDto> deptDtos = deptService.queryAll(criteria, true);
|
||||
List<Dept> deptDtos = deptService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -60,11 +62,11 @@ public class DeptController {
|
||||
@PostMapping("/superior")
|
||||
@SaCheckPermission(value = {"user:list", "dept:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody List<Long> ids) {
|
||||
Set<DeptDto> deptDtos = new LinkedHashSet<>();
|
||||
Set<DeptTree> deptDtos = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
DeptDto deptDto = deptService.findById(id);
|
||||
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
|
||||
deptDtos.addAll(depts);
|
||||
DeptTree deptTree = deptService.findById(id, DeptTree.class);
|
||||
List<DeptTree> superior = deptService.getSuperior(deptTree, new ArrayList<>());
|
||||
deptDtos.addAll(superior);
|
||||
}
|
||||
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptDtos)),HttpStatus.OK);
|
||||
}
|
||||
@@ -95,7 +97,7 @@ public class DeptController {
|
||||
@DeleteMapping
|
||||
@SaCheckPermission("dept:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
Set<DeptDto> deptDtos = new HashSet<>();
|
||||
Set<Dept> deptDtos = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
List<Dept> deptList = deptService.findByPid(id);
|
||||
deptDtos.add(deptService.findById(id));
|
||||
|
||||
@@ -112,10 +112,11 @@ public class UserController {
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody User resources){
|
||||
checkLevel(resources);
|
||||
// 默认密码 123456
|
||||
if (ObjectUtil.isEmpty(resources.getPassword()))
|
||||
if (ObjectUtil.isEmpty(resources.getPassword())) {
|
||||
resources.setPassword(SaSecureUtil.md5BySalt("123456", "salt"));
|
||||
else
|
||||
} else {
|
||||
resources.setPassword(SaSecureUtil.md5BySalt(resources.getPassword(), "salt"));
|
||||
}
|
||||
userService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package org.nl.modules.system.service;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.service.dto.DeptDto;
|
||||
import org.nl.modules.system.service.dto.DeptQueryCriteria;
|
||||
import org.nl.modules.system.service.dto.DeptTree;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -36,7 +38,7 @@ public interface DeptService {
|
||||
* @return /
|
||||
* @throws Exception /
|
||||
*/
|
||||
List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception;
|
||||
List<Dept> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取
|
||||
@@ -52,7 +54,9 @@ public interface DeptService {
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
DeptDto findById(Long id);
|
||||
Dept findById(Long id);
|
||||
|
||||
List<Dept> findByPid(Long pid);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
@@ -73,33 +77,24 @@ public interface DeptService {
|
||||
*
|
||||
* @param deptDtos /
|
||||
*/
|
||||
void delete(Set<DeptDto> deptDtos);
|
||||
void delete(Set<Dept> deptDtos);
|
||||
|
||||
/**
|
||||
* 根据PID查询
|
||||
*
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
List<Dept> findByPid(long pid);
|
||||
<T> T findById(Long id, Class<T> tagert);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询
|
||||
*
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
Set<Dept> findByRoleId(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 获取待删除的部门
|
||||
*
|
||||
* @param deptList /
|
||||
* @param deptDtos /
|
||||
* @return /
|
||||
*/
|
||||
Set<DeptDto> getDeleteDepts(List<Dept> deptList, Set<DeptDto> deptDtos);
|
||||
Set<Dept> getDeleteDepts(List<Dept> deptList, Set<Dept> depts);
|
||||
|
||||
/**
|
||||
* 根据ID获取同级与上级数据
|
||||
@@ -108,7 +103,7 @@ public interface DeptService {
|
||||
* @param depts /
|
||||
* @return /
|
||||
*/
|
||||
List<DeptDto> getSuperior(DeptDto deptDto, List<Dept> depts);
|
||||
List<DeptTree> getSuperior(DeptTree deptDto, List<DeptTree> depts);
|
||||
|
||||
/**
|
||||
* 构建树形数据
|
||||
@@ -116,7 +111,7 @@ public interface DeptService {
|
||||
* @param deptDtos /
|
||||
* @return /
|
||||
*/
|
||||
Object buildTree(List<DeptDto> deptDtos);
|
||||
Object buildTree(List<DeptTree> deptDtos);
|
||||
|
||||
|
||||
/**
|
||||
@@ -124,7 +119,7 @@ public interface DeptService {
|
||||
*
|
||||
* @param deptDtos /
|
||||
*/
|
||||
void verification(Set<DeptDto> deptDtos);
|
||||
void verification(Set<Dept> deptDtos);
|
||||
|
||||
/**
|
||||
* 获取当前节点的所有子类节点集合数据
|
||||
|
||||
@@ -19,8 +19,7 @@ import lombok.Data;
|
||||
import org.nl.modules.common.annotation.DataPermission;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -37,7 +36,7 @@ public class DeptQueryCriteria{
|
||||
private String code;
|
||||
|
||||
@Query
|
||||
private Boolean enabled;
|
||||
private Boolean is_used;
|
||||
|
||||
@Query
|
||||
private Long pid;
|
||||
@@ -46,5 +45,7 @@ public class DeptQueryCriteria{
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
private Date startTime;
|
||||
|
||||
private Date endTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.system.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.nl.modules.common.base.BaseDTO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class DeptTree extends BaseDTO implements Serializable {
|
||||
|
||||
private Long Dept_id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Boolean is_used;
|
||||
|
||||
private Integer dept_sort;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptTree> children;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private Integer sub_count;
|
||||
|
||||
private String versionId;
|
||||
|
||||
public Boolean getHasChildren() {
|
||||
return sub_count > 0;
|
||||
}
|
||||
|
||||
public Boolean getLeaf() {
|
||||
return sub_count <= 0;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.system.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public class MenuQueryCriteria {
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
private List<Date> createTime;
|
||||
|
||||
@Query(type = Query.Type.IS_NULL, propName = "pid")
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.system.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,5 +32,5 @@ public class RoleQueryCriteria {
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
private List<Date> createTime;
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@ import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,15 +82,17 @@ public class DataServiceImpl implements DataService {
|
||||
* @param role 角色
|
||||
* @return 数据权限ID
|
||||
*/
|
||||
@Deprecated
|
||||
public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){
|
||||
Set<Dept> depts = deptService.findByRoleId(role.getId());
|
||||
for (Dept dept : depts) {
|
||||
deptIds.add(dept.getDept_id());
|
||||
List<Dept> deptChildren = deptService.findByPid(dept.getPid());
|
||||
if (deptChildren != null && deptChildren.size() != 0) {
|
||||
deptIds.addAll(deptService.getDeptChildren(deptChildren));
|
||||
}
|
||||
}
|
||||
return deptIds;
|
||||
//角色跟部门不挂钩
|
||||
// Set<Dept> depts = deptService.findByRoleId(role.getId());
|
||||
// for (Dept dept : depts) {
|
||||
// deptIds.add(dept.getDept_id());
|
||||
// List<Dept> deptChildren = deptService.findByPid(dept.getPid());
|
||||
// if (deptChildren != null && deptChildren.size() != 0) {
|
||||
// deptIds.addAll(deptService.getDeptChildren(deptChildren));
|
||||
// }
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,26 +16,25 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.Db;
|
||||
import cn.hutool.db.Entity;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.CacheKey;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.domain.User;
|
||||
import org.nl.modules.system.repository.DeptRepository;
|
||||
import org.nl.modules.system.repository.RoleRepository;
|
||||
import org.nl.modules.system.repository.UserRepository;
|
||||
import org.nl.modules.system.service.DeptService;
|
||||
import org.nl.modules.system.service.dto.DeptDto;
|
||||
import org.nl.modules.system.service.dto.DeptQueryCriteria;
|
||||
import org.nl.modules.system.service.mapstruct.DeptMapper;
|
||||
import org.nl.modules.system.service.dto.DeptTree;
|
||||
import org.nl.modules.tools.MapOf;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
@@ -43,11 +42,13 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -59,70 +60,51 @@ import java.util.stream.Collectors;
|
||||
@CacheConfig(cacheNames = "dept")
|
||||
public class DeptServiceImpl implements DeptService {
|
||||
|
||||
private final DeptRepository deptRepository;
|
||||
private final DeptMapper deptMapper;
|
||||
private final UserRepository userRepository;
|
||||
private final RedisUtils redisUtils;
|
||||
private final RoleRepository roleRepository;
|
||||
|
||||
@Override
|
||||
public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
|
||||
Sort sort = Sort.by(Sort.Direction.ASC, "deptSort");
|
||||
// String dataScopeType = SecurityUtils.getDataScopeType();
|
||||
if (isQuery) {
|
||||
// if (dataScopeType.equals(DataScopeEnum.ALL.getValue())) {
|
||||
criteria.setPidIsNull(true);
|
||||
// }
|
||||
List<Field> fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>());
|
||||
List<String> fieldNames = new ArrayList<String>() {{
|
||||
add("pidIsNull");
|
||||
add("enabled");
|
||||
}};
|
||||
for (Field field : fields) {
|
||||
//设置对象的访问权限,保证对private的属性的访问
|
||||
field.setAccessible(true);
|
||||
Object val = field.get(criteria);
|
||||
if (fieldNames.contains(field.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(val)) {
|
||||
criteria.setPidIsNull(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public List<Dept> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
|
||||
JSONObject o = (JSONObject) JSON.toJSON(criteria);
|
||||
HashMap map = MapOf.of("name", MapUtil.getStr(o, "name")
|
||||
, "code", MapUtil.getStr(o, "code")
|
||||
, "is_used", MapUtil.getStr(o, "is_used")
|
||||
, "startTime", MapUtil.getStr(o, "startTime")
|
||||
, "endTime", MapUtil.getStr(o, "endTime")
|
||||
, "pid", MapUtil.getStr(o, "pid")
|
||||
, "pidIsNull", MapUtil.getStr(o, "pidIsNull")
|
||||
);
|
||||
JSONArray array = WQL.getWO("SYS_DEPT").addParamMap(map).process().getResultJSONArray(0);
|
||||
return array.toJavaList(Dept.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T findById(Long id,Class<T> tagert) {
|
||||
if (id==null){
|
||||
return null;
|
||||
}
|
||||
List<DeptDto> list = deptMapper.toDto(deptRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), sort));
|
||||
// 如果为空,就代表为自定义权限或者本级权限,就需要去重,不理解可以注释掉,看查询结果
|
||||
// if (StrUtil.isEmpty(dataScopeType)) {
|
||||
// return deduplication(list);
|
||||
// }
|
||||
return list;
|
||||
JSONObject result = WQLObject.getWQLObject("sys_dept").query("dept_id ='" + id + "'").uniqueResult(0);
|
||||
return result.toJavaObject(tagert);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'id:' + #p0")
|
||||
public DeptDto findById(Long id) {
|
||||
Dept dept = deptRepository.findById(id).orElseGet(Dept::new);
|
||||
ValidationUtil.isNull(dept.getDept_id(), "Dept", "id", id);
|
||||
return deptMapper.toDto(dept);
|
||||
public Dept findById(Long id) {
|
||||
JSONObject result = WQLObject.getWQLObject("sys_dept").query("dept_id ='" + id + "'").uniqueResult(0);
|
||||
return result.toJavaObject(Dept.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> findByPid(long pid) {
|
||||
return deptRepository.findByPid(pid);
|
||||
public List<Dept> findByPid(Long pid) {
|
||||
JSONArray result = WQLObject.getWQLObject("sys_dept").query("pid ='" + pid + "'").getResultJSONArray(0);
|
||||
return result.toJavaList(Dept.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Dept> findByRoleId(Long id) {
|
||||
return deptRepository.findByRoleId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Dept resources) {
|
||||
deptRepository.save(resources);
|
||||
WQLObject.getWQLObject("sys_user").insert((JSONObject)JSON.toJSON(resources));
|
||||
// 计算子节点数目
|
||||
resources.setSubCount(0);
|
||||
resources.setSub_count(0);
|
||||
// 清理缓存
|
||||
updateSubCnt(resources.getPid());
|
||||
}
|
||||
@@ -136,10 +118,9 @@ public class DeptServiceImpl implements DeptService {
|
||||
if (resources.getPid() != null && resources.getDept_id().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
Dept dept = deptRepository.findById(resources.getDept_id()).orElseGet(Dept::new);
|
||||
ValidationUtil.isNull(dept.getDept_id(), "Dept", "id", resources.getDept_id());
|
||||
Dept dept = findById(resources.getDept_id());
|
||||
resources.setDept_id(dept.getDept_id());
|
||||
deptRepository.save(resources);
|
||||
WQLObject.getWQLObject("sys_user").update((JSONObject)JSON.toJSON(resources),"dept_id = '"+resources.getDept_id()+"'");
|
||||
// 更新父节点中子节点数目
|
||||
updateSubCnt(oldPid);
|
||||
updateSubCnt(newPid);
|
||||
@@ -149,20 +130,23 @@ public class DeptServiceImpl implements DeptService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<DeptDto> deptDtos) {
|
||||
for (DeptDto deptDto : deptDtos) {
|
||||
// 清理缓存
|
||||
delCaches(deptDto.getId());
|
||||
deptRepository.deleteById(deptDto.getId());
|
||||
updateSubCnt(deptDto.getPid());
|
||||
public void delete(Set<Dept> deptDtos) {
|
||||
if (!CollectionUtils.isEmpty(deptDtos)){
|
||||
String collectSql = deptDtos.stream().map(a -> String.valueOf(a.getDept_id())).collect(Collectors.joining("','"));
|
||||
WQLObject.getWQLObject("sys_user").delete("dept_id in ('" + collectSql + "')");
|
||||
for (Dept deptDto : deptDtos) {
|
||||
// 清理缓存
|
||||
delCaches(deptDto.getDept_id());
|
||||
updateSubCnt(deptDto.getPid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<DeptDto> getDeleteDepts(List<Dept> menuList, Set<DeptDto> deptDtos) {
|
||||
public Set<Dept> getDeleteDepts(List<Dept> menuList, Set<Dept> deptDtos) {
|
||||
for (Dept dept : menuList) {
|
||||
deptDtos.add(deptMapper.toDto(dept));
|
||||
List<Dept> depts = deptRepository.findByPid(dept.getDept_id());
|
||||
deptDtos.add(dept);
|
||||
List<Dept> depts = findByPid(dept.getDept_id());
|
||||
if (depts != null && depts.size() != 0) {
|
||||
getDeleteDepts(depts, deptDtos);
|
||||
}
|
||||
@@ -171,28 +155,27 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDto> getSuperior(DeptDto deptDto, List<Dept> depts) {
|
||||
public List<DeptTree> getSuperior(DeptTree deptDto, List<DeptTree> depts) {
|
||||
depts.add(deptDto);
|
||||
if (deptDto.getPid() == null) {
|
||||
depts.addAll(deptRepository.findByPidIsNull());
|
||||
return deptMapper.toDto(depts);
|
||||
return depts;
|
||||
}
|
||||
depts.addAll(deptRepository.findByPid(deptDto.getPid()));
|
||||
return getSuperior(findById(deptDto.getPid()), depts);
|
||||
return getSuperior(findById(deptDto.getPid(),DeptTree.class), depts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildTree(List<DeptDto> deptDtos) {
|
||||
Set<DeptDto> trees = new LinkedHashSet<>();
|
||||
Set<DeptDto> depts = new LinkedHashSet<>();
|
||||
List<String> deptNames = deptDtos.stream().map(DeptDto::getName).collect(Collectors.toList());
|
||||
public Object buildTree(List<DeptTree> deptDtos) {
|
||||
Set<DeptTree> trees = new LinkedHashSet<>();
|
||||
Set<DeptTree> depts = new LinkedHashSet<>();
|
||||
List<String> deptNames = deptDtos.stream().map(DeptTree::getName).collect(Collectors.toList());
|
||||
boolean isChild;
|
||||
for (DeptDto deptDTO : deptDtos) {
|
||||
for (DeptTree deptDTO : deptDtos) {
|
||||
isChild = false;
|
||||
if (deptDTO.getPid() == null) {
|
||||
trees.add(deptDTO);
|
||||
}
|
||||
for (DeptDto it : deptDtos) {
|
||||
if (it.getPid() != null && deptDTO.getId().equals(it.getPid())) {
|
||||
for (DeptTree it : deptDtos) {
|
||||
if (it.getPid() != null && deptDTO.getDept_id().equals(it.getPid())) {
|
||||
isChild = true;
|
||||
if (deptDTO.getChildren() == null) {
|
||||
deptDTO.setChildren(new ArrayList<>());
|
||||
@@ -217,21 +200,21 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verification(Set<DeptDto> deptDtos) {
|
||||
Set<Long> deptIds = deptDtos.stream().map(DeptDto::getId).collect(Collectors.toSet());
|
||||
if (userRepository.countByDepts(deptIds) > 0) {
|
||||
throw new BadRequestException("所选部门存在用户关联,请解除后再试!");
|
||||
}
|
||||
if (roleRepository.countByDepts(deptIds) > 0) {
|
||||
throw new BadRequestException("所选部门存在角色关联,请解除后再试!");
|
||||
public void verification(Set<Dept> deptDtos) {
|
||||
if (!CollectionUtils.isEmpty(deptDtos)){
|
||||
String collectSql = deptDtos.stream().map(a -> String.valueOf(a.getDept_id())).collect(Collectors.joining("','"));
|
||||
ResultBean result = WQLObject.getWQLObject("sys_user_dept").query("dept_id in ('" + collectSql + "')");
|
||||
if (result.getResultCount()>0){
|
||||
throw new BadRequestException("部门存在绑定的人员,请先解绑人员对应部门");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateSubCnt(Long deptId) {
|
||||
if (deptId != null) {
|
||||
int count = deptRepository.countByPid(deptId);
|
||||
deptRepository.updateSubCntById(count, deptId);
|
||||
List<Dept> byPid = findByPid(deptId);
|
||||
WQLObject.getWQLObject("sys_user").update(MapOf.of("sub_count",byPid.size()),"dept_id = '"+deptId+"'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,9 +241,10 @@ public class DeptServiceImpl implements DeptService {
|
||||
* @param id /
|
||||
*/
|
||||
public void delCaches(Long id) {
|
||||
List<User> users = userRepository.findByRoleDeptId(id);
|
||||
JSONArray array = WQLObject.getWQLObject("sys_user_dept").query("dept_id ='" + id + "'").getResultJSONArray(0);
|
||||
Set<Long> users = array.stream().map(a -> ((JSONObject) a).getLong("user_id")).collect(Collectors.toSet());
|
||||
// 删除数据权限
|
||||
redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getUser_id).collect(Collectors.toSet()));
|
||||
redisUtils.delByKeys(CacheKey.DATA_USER, users);
|
||||
redisUtils.del(CacheKey.DEPT_ID + id);
|
||||
}
|
||||
|
||||
@@ -268,8 +252,8 @@ public class DeptServiceImpl implements DeptService {
|
||||
public List<Long> getDeptChildren(List<Dept> deptList) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
deptList.forEach(dept -> {
|
||||
if (dept != null && dept.getEnabled()) {
|
||||
List<Dept> depts = deptRepository.findByPid(dept.getDept_id());
|
||||
if (dept != null && dept.getIs_used()) {
|
||||
List<Dept> depts = findByPid(dept.getDept_id());
|
||||
if (deptList.size() != 0) {
|
||||
list.addAll(getDeptChildren(depts));
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -28,16 +27,13 @@ import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.repository.DictRepository;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||
import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||
import org.nl.modules.system.service.mapstruct.DictMapper;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -80,17 +76,17 @@ public class DictServiceImpl implements DictService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DictDto dto) {
|
||||
public void create(Dict dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
Date date = new Date();
|
||||
dto.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setUpdate_time(date);
|
||||
dto.setCreate_time(date);
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
@@ -108,7 +104,7 @@ public class DictServiceImpl implements DictService {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
// resources.setUpdate_time(DateUtil.now());
|
||||
resources.setUpdate_time(new Date());
|
||||
resources.setUpdate_optid(currentUserId);
|
||||
resources.setUpdate_optname(nickName);
|
||||
WQLObject dictTab = WQLObject.getWQLObject("sys_dict");
|
||||
@@ -138,7 +134,7 @@ public class DictServiceImpl implements DictService {
|
||||
// map.put("字典描述", dictDTO.getDescription());
|
||||
// map.put("字典标签", dictDetail.getLabel());
|
||||
// map.put("字典值", dictDetail.getValue());
|
||||
// map.put("创建日期", dictDetail.getCreateTime());
|
||||
// map.put("创建日期", dictDetail.getCreate_time());
|
||||
// list.add(map);
|
||||
// }
|
||||
// } else {
|
||||
@@ -147,7 +143,7 @@ public class DictServiceImpl implements DictService {
|
||||
// map.put("字典描述", dictDTO.getDescription());
|
||||
// map.put("字典标签", null);
|
||||
// map.put("字典值", null);
|
||||
// map.put("创建日期", dictDTO.getCreateTime());
|
||||
// map.put("创建日期", dictDTO.getCreate_time());
|
||||
// list.add(map);
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.nl.modules.system.service.RoleService;
|
||||
import org.nl.modules.system.service.dto.RoleDto;
|
||||
import org.nl.modules.system.service.dto.RoleQueryCriteria;
|
||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.nl.modules.system.service.mapstruct.RoleMapper;
|
||||
import org.nl.modules.system.service.mapstruct.RoleSmallMapper;
|
||||
import org.nl.modules.wql.WQL;
|
||||
@@ -41,7 +40,6 @@ import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.util.IdUtil;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -199,7 +197,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
map.put("角色名称", role.getName());
|
||||
map.put("角色级别", role.getLevel());
|
||||
map.put("描述", role.getDescription());
|
||||
map.put("创建日期", role.getCreateTime());
|
||||
map.put("创建日期", role.getCreate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
||||
@@ -32,18 +32,14 @@ import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.common.utils.dto.CurrentUser;
|
||||
import org.nl.modules.security.service.OnlineUserService;
|
||||
import org.nl.modules.system.domain.User;
|
||||
import org.nl.modules.system.repository.UserRepository;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
|
||||
import org.nl.modules.system.service.dto.UserQueryCriteria;
|
||||
import org.nl.modules.system.service.mapstruct.UserMapper;
|
||||
import org.nl.modules.tools.MapOf;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -66,7 +62,6 @@ import java.util.stream.Collectors;
|
||||
@CacheConfig(cacheNames = "user")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private final UserMapper userMapper;
|
||||
private final FileProperties properties;
|
||||
private final RedisUtils redisUtils;
|
||||
private final OnlineUserService onlineUserService;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.system.service.mapstruct;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.nl.modules.common.base.BaseMapper;
|
||||
import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.service.dto.DeptDto;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptMapper extends BaseMapper<DeptDto, Dept> {
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.system.service.mapstruct;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.nl.modules.common.base.BaseMapper;
|
||||
import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.service.dto.DeptSmallDto;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptSmallMapper extends BaseMapper<DeptSmallDto, Dept> {
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import org.nl.modules.system.service.dto.RoleDto;
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = {MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
@Mapper(componentModel = "spring", uses = {MenuMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleMapper extends BaseMapper<RoleDto, Role> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.system.service.mapstruct;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.nl.modules.common.base.BaseMapper;
|
||||
import org.nl.modules.system.domain.User;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserMapper extends BaseMapper<UserDto, User> {
|
||||
}
|
||||
@@ -18,7 +18,7 @@ package org.nl.modules.tools.service.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.annotation.Query;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ public class LocalStorageQueryCriteria{
|
||||
private String blurry;
|
||||
|
||||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Timestamp> createTime;
|
||||
}
|
||||
private List<Date> createTime;
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||
map.put("备注名", localStorageDTO.getName());
|
||||
map.put("文件类型", localStorageDTO.getType());
|
||||
map.put("文件大小", localStorageDTO.getSize());
|
||||
map.put("创建者", localStorageDTO.getCreateBy());
|
||||
map.put("创建日期", localStorageDTO.getCreateTime());
|
||||
map.put("创建者", localStorageDTO.getCreate_name());
|
||||
map.put("创建日期", localStorageDTO.getCreate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
|
||||
@@ -29,4 +29,4 @@ import org.nl.modules.tools.service.dto.LocalStorageDto;
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LocalStorageMapper extends BaseMapper<LocalStorageDto, LocalStorage> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* 创 建 者 :yumeng
|
||||
* 创建时间:2014-07-01 14:25:35
|
||||
* 文件版本:v1.0
|
||||
* 文件版本:v1.0
|
||||
*
|
||||
*******************************************************/
|
||||
package org.nl.modules.wql.core.bean;
|
||||
@@ -110,7 +110,7 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
// */
|
||||
// public WQLData getWQLData(WQLObject wo,int value){
|
||||
// if (value < rslist.size()) {
|
||||
//
|
||||
//
|
||||
// ArrayList list = getResultSet(value);
|
||||
// try{
|
||||
// WQLData wd = null;
|
||||
@@ -127,7 +127,7 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 返回普通dataset
|
||||
// * @param value
|
||||
@@ -287,10 +287,10 @@ public class ResultBean implements Serializable, Cloneable {
|
||||
Object value = row.get(key);
|
||||
String strValue = WqlUtil.getSQLFieldValue(value).trim();
|
||||
|
||||
if (value instanceof Timestamp)
|
||||
if (value instanceof Date)
|
||||
//时间处理
|
||||
if (ObjectUtil.isEmpty(strValue) && ObjectUtil.isNotEmpty(value)) {
|
||||
if (value instanceof Timestamp) {
|
||||
if (value instanceof Date) {
|
||||
strValue = value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -648,16 +648,16 @@ public class MethodFactory {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (prop.getPropertyType().getName().indexOf("Timestamp") >= 0) {
|
||||
// if (prop.getPropertyType().getName().indexOf("Date") >= 0) {
|
||||
//
|
||||
// Method method = prop.getReadMethod();
|
||||
// if (method != null) {
|
||||
//
|
||||
// Timestamp date = (Timestamp) (method.invoke(dto,
|
||||
// Date date = (Date) (method.invoke(dto,
|
||||
// null));
|
||||
//
|
||||
// if ((date != null)
|
||||
// && (date.before(Timestamp
|
||||
// && (date.before(Date
|
||||
// .valueOf("1900-01-02 00:00:00.0")))) {
|
||||
//
|
||||
// method = prop.getWriteMethod();
|
||||
@@ -969,7 +969,7 @@ public class MethodFactory {
|
||||
prop.append("double");
|
||||
propValue = "0.0";
|
||||
} else if (props[i].getPropertyType().getName().indexOf(
|
||||
"Timestamp") >= 0) {
|
||||
"Date") >= 0) {
|
||||
prop.append("String");
|
||||
propValue = "\"\"";
|
||||
} else {
|
||||
@@ -1022,7 +1022,7 @@ public class MethodFactory {
|
||||
PropertyDescriptor[] props = java.beans.Introspector.getBeanInfo(
|
||||
inClass).getPropertyDescriptors();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
if (props[i].getPropertyType().getName().indexOf("Timestamp") >= 0) {
|
||||
if (props[i].getPropertyType().getName().indexOf("Date") >= 0) {
|
||||
StringBuffer prop = new StringBuffer();
|
||||
//formreceivedate = MethodFactory.formatDBDate(formreceivedate);
|
||||
prop.append("form" + props[i].getName());
|
||||
@@ -1368,8 +1368,6 @@ public class MethodFactory {
|
||||
// depot.setustcStatus(new Integer(8));
|
||||
// depot.setostcInputerid(new Integer(Constants.NULL_INT));
|
||||
// aForm.setForminputdate(formatDBDate(null));
|
||||
System.out.println(Timestamp.valueOf("2003-01-01 00:00:00.0")
|
||||
.compareTo(Timestamp.valueOf("1990-01-02 00:00:00.0")));
|
||||
//System.out.println(formatDBDate(null));
|
||||
// copyProperties(depot, aForm, false);
|
||||
//generateVariable("com.crea.curmedi.biz.struct.stcbBizkeep");
|
||||
@@ -1385,4 +1383,4 @@ public class MethodFactory {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user