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

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

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