提交 c0f52cd2 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ibz-dict,字典]

上级 36f625b1
......@@ -24,6 +24,8 @@ import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
......@@ -39,6 +41,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZDICTOPTION", resultMap = "DictOptionResultMap")
@ApiModel("字典项")
public class DictOption extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -50,6 +53,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableId(value = "vkey", type = IdType.ASSIGN_UUID)
@JSONField(name = "value_key")
@JsonProperty("value_key")
@ApiModelProperty("标识")
private String valueKey;
/**
* 目录代码
......@@ -58,6 +62,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "cid")
@JSONField(name = "catalog_id")
@JsonProperty("catalog_id")
@ApiModelProperty("目录代码")
private String catalogId;
/**
* 目录
......@@ -66,6 +71,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "cname")
@JSONField(name = "catalog_name")
@JsonProperty("catalog_name")
@ApiModelProperty("目录")
private String catalogName;
/**
* 代码值
......@@ -74,6 +80,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "val")
@JSONField(name = "value")
@JsonProperty("value")
@ApiModelProperty("代码值")
private String value;
/**
* 名称
......@@ -81,6 +88,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "label")
@JSONField(name = "label")
@JsonProperty("label")
@ApiModelProperty("名称")
private String label;
/**
* 父代码值
......@@ -89,6 +97,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "pval")
@JSONField(name = "parent")
@JsonProperty("parent")
@ApiModelProperty("父代码值")
private String parent;
/**
* 过滤项
......@@ -97,6 +106,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "vfilter")
@JSONField(name = "filter")
@JsonProperty("filter")
@ApiModelProperty("过滤项")
private String filter;
/**
* 栏目样式
......@@ -105,6 +115,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "cls")
@JSONField(name = "cls")
@JsonProperty("cls")
@ApiModelProperty("栏目样式")
private String cls;
/**
* 图标
......@@ -113,6 +124,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "iconcls")
@JSONField(name = "icon_class")
@JsonProperty("icon_class")
@ApiModelProperty("图标")
private String iconClass;
/**
* 是否禁用
......@@ -121,6 +133,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "disabled")
@JSONField(name = "disabled")
@JsonProperty("disabled")
@ApiModelProperty("是否禁用")
private Integer disabled;
/**
* 过期/失效
......@@ -129,6 +142,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "expired")
@JSONField(name = "expired")
@JsonProperty("expired")
@ApiModelProperty("过期/失效")
private Integer expired;
/**
* 排序
......@@ -136,6 +150,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "showorder")
@JSONField(name = "showorder")
@JsonProperty("showorder")
@ApiModelProperty("排序")
private Integer showorder;
/**
* 扩展
......@@ -143,6 +158,7 @@ public class DictOption extends EntityMP implements Serializable {
@TableField(value = "extension")
@JSONField(name = "extension")
@JsonProperty("extension")
@ApiModelProperty("扩展")
private String extension;
/**
* 最后修改时间
......@@ -152,6 +168,7 @@ public class DictOption extends EntityMP implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
@JSONField(name = "updatedate", format = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
@ApiModelProperty("最后修改时间")
private Timestamp updatedate;
/**
* 创建时间
......@@ -161,6 +178,7 @@ public class DictOption extends EntityMP implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
@JSONField(name = "createdate", format = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
@ApiModelProperty("创建时间")
private Timestamp createdate;
/**
......
......@@ -20,11 +20,14 @@ import javax.validation.constraints.Size;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 服务DTO对象[DictCatalogDTO]
*/
@Data
@ApiModel("字典")
public class DictCatalogDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -36,6 +39,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JSONField(name = "id")
@JsonProperty("id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("标识")
private String id;
/**
......@@ -46,6 +50,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JsonProperty("code")
@NotBlank(message = "[代码]不允许为空!")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("代码")
private String code;
/**
......@@ -56,6 +61,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JsonProperty("name")
@NotBlank(message = "[名称]不允许为空!")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("名称")
private String name;
/**
......@@ -65,6 +71,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JSONField(name = "group")
@JsonProperty("group")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("分组")
private String group;
/**
......@@ -74,6 +81,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JSONField(name = "memo")
@JsonProperty("memo")
@Size(min = 0, max = 255, message = "内容长度必须小于等于[255]")
@ApiModelProperty("备注")
private String memo;
/**
......@@ -82,6 +90,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "enable")
@JsonProperty("enable")
@ApiModelProperty("是否有效")
private Integer enable;
/**
......@@ -91,6 +100,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
@ApiModelProperty("最后修改时间")
private Timestamp updatedate;
/**
......@@ -100,6 +110,7 @@ public class DictCatalogDTO extends DTOBase implements Serializable {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
@ApiModelProperty("创建时间")
private Timestamp createdate;
......
......@@ -20,11 +20,14 @@ import javax.validation.constraints.Size;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 服务DTO对象[DictOptionDTO]
*/
@Data
@ApiModel("字典项")
public class DictOptionDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -36,6 +39,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "value_key")
@JsonProperty("value_key")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("标识")
private String valueKey;
/**
......@@ -46,6 +50,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonProperty("catalog_id")
@NotBlank(message = "[目录代码]不允许为空!")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("目录代码")
private String catalogId;
/**
......@@ -56,6 +61,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonProperty("catalog_name")
@NotBlank(message = "[目录]不允许为空!")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("目录")
private String catalogName;
/**
......@@ -66,6 +72,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonProperty("value")
@NotBlank(message = "[代码值]不允许为空!")
@Size(min = 0, max = 40, message = "内容长度必须小于等于[40]")
@ApiModelProperty("代码值")
private String value;
/**
......@@ -76,6 +83,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonProperty("label")
@NotBlank(message = "[名称]不允许为空!")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("名称")
private String label;
/**
......@@ -85,6 +93,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "parent")
@JsonProperty("parent")
@Size(min = 0, max = 40, message = "内容长度必须小于等于[40]")
@ApiModelProperty("父代码值")
private String parent;
/**
......@@ -94,6 +103,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "filter")
@JsonProperty("filter")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
@ApiModelProperty("过滤项")
private String filter;
/**
......@@ -103,6 +113,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "cls")
@JsonProperty("cls")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
@ApiModelProperty("栏目样式")
private String cls;
/**
......@@ -112,6 +123,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "icon_class")
@JsonProperty("icon_class")
@Size(min = 0, max = 255, message = "内容长度必须小于等于[255]")
@ApiModelProperty("图标")
private String iconClass;
/**
......@@ -120,6 +132,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "disabled")
@JsonProperty("disabled")
@ApiModelProperty("是否禁用")
private Integer disabled;
/**
......@@ -128,6 +141,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "expired")
@JsonProperty("expired")
@ApiModelProperty("过期/失效")
private Integer expired;
/**
......@@ -136,6 +150,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "showorder")
@JsonProperty("showorder")
@ApiModelProperty("排序")
private Integer showorder;
/**
......@@ -145,6 +160,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JSONField(name = "extension")
@JsonProperty("extension")
@Size(min = 0, max = 1000, message = "内容长度必须小于等于[1000]")
@ApiModelProperty("扩展")
private String extension;
/**
......@@ -154,6 +170,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
@ApiModelProperty("最后修改时间")
private Timestamp updatedate;
/**
......@@ -163,6 +180,7 @@ public class DictOptionDTO extends DTOBase implements Serializable {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
@ApiModelProperty("创建时间")
private Timestamp createdate;
......
......@@ -27,6 +27,16 @@ import java.util.Map;
@Component
public class DEFieldDefaultValueAspect
{
/**
* 操作用户标识
*/
final static String TAG_PERSONID = "SRF_PERSONID";
/**
* 操作用户名称
*/
final static String TAG_PERSONNAME = "SRF_PERSONNAME";
/**
* 新建数据切入点
* @param point
......@@ -221,16 +231,16 @@ public class DEFieldDefaultValueAspect
switch(preFieldType) {
case CREATEMAN:
et.set(fieldname, curUser.getUserid());
et.set(fieldname, StringUtils.isEmpty(curUser.getUserid()) ? et.get(TAG_PERSONID) : curUser.getUserid());
break;
case CREATEMANNAME:
et.set(fieldname, curUser.getPersonname());
et.set(fieldname, StringUtils.isEmpty(curUser.getPersonname()) ? et.get(TAG_PERSONNAME) : curUser.getPersonname());
break;
case UPDATEMAN:
et.set(fieldname, curUser.getUserid());
et.set(fieldname, StringUtils.isEmpty(curUser.getUserid()) ? et.get(TAG_PERSONID) : curUser.getUserid());
break;
case UPDATEMANNAME:
et.set(fieldname, curUser.getPersonname());
et.set(fieldname, StringUtils.isEmpty(curUser.getPersonname()) ? et.get(TAG_PERSONNAME) : curUser.getPersonname());
break;
case CREATEDATE:
et.set(fieldname, new Timestamp(new Date().getTime()));
......
......@@ -2,6 +2,7 @@ package cn.ibizlab.util.client;
import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.util.MultiValueMap;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
......
......@@ -5,6 +5,7 @@ import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.util.MultiValueMap;
import com.alibaba.fastjson.JSONObject;
@FeignClient(value = "${ibiz.ref.service.uaa:ibzuaa-api}",contextId = "uaa",fallback = IBZUAAFallback.class)
......
......@@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.ObjectUtils;
import java.sql.Timestamp;
......@@ -231,6 +232,15 @@ public class AuthenticationUser implements UserDetails
return authuserdetail;
}
public static AuthenticationUser setAuthenticationUser(String userId , String userName) {
AuthenticationUser user = new AuthenticationUser();
user.setUserid(userId);
user.setPersonname(userName);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
return user;
}
public Map <String,Object> getSessionParams()
{
if(this.sessionParams==null)
......
......@@ -4,11 +4,17 @@ import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.LinkedHashMap;
/**
* feign请求拦截器
......@@ -19,23 +25,23 @@ public class FeignRequestInterceptor implements RequestInterceptor {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void apply(RequestTemplate requestTemplate) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
if (requestAttributes != null) {
HttpServletRequest request = requestAttributes.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
if(name.equalsIgnoreCase("transfer-encoding")){
if (name.equalsIgnoreCase("transfer-encoding")) {
continue;
}
String values = request.getHeader(name);
requestTemplate.header(name, values);
}
logger.info("feign interceptor header:{}",requestTemplate);
logger.info("feign interceptor header:{}", requestTemplate);
}
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册