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

ibiz4j 发布系统代码 [ ibiz-pay,支付]

上级 d9b31e0d
......@@ -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 = "IBZOPENACCESS", resultMap = "PayOpenAccessResultMap")
@ApiModel("支付平台")
public class PayOpenAccess extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -50,6 +53,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableId(value = "accessid", type = IdType.ASSIGN_UUID)
@JSONField(name = "id")
@JsonProperty("id")
@ApiModelProperty("开放平台接入标识")
private String id;
/**
* 开放平台
......@@ -58,6 +62,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "accessname")
@JSONField(name = "name")
@JsonProperty("name")
@ApiModelProperty("开放平台")
private String name;
/**
* 开放平台类型
......@@ -66,6 +71,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "open_type")
@JSONField(name = "open_type")
@JsonProperty("open_type")
@ApiModelProperty("开放平台类型")
private String openType;
/**
* AccessKey(AppId)
......@@ -74,6 +80,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "access_key")
@JSONField(name = "access_key")
@JsonProperty("access_key")
@ApiModelProperty("AccessKey(AppId)")
private String accessKey;
/**
* SecretKey(AppSecret)
......@@ -82,6 +89,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "secret_key")
@JSONField(name = "secret_key")
@JsonProperty("secret_key")
@ApiModelProperty("SecretKey(AppSecret)")
private String secretKey;
/**
* RegionId
......@@ -90,6 +98,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "region_id")
@JSONField(name = "region_id")
@JsonProperty("region_id")
@ApiModelProperty("RegionId")
private String regionId;
/**
* 管理账号token
......@@ -98,6 +107,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "access_token")
@JSONField(name = "access_token")
@JsonProperty("access_token")
@ApiModelProperty("管理账号token")
private String accessToken;
/**
* 管理账号token过期时间
......@@ -107,6 +117,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
@JSONField(name = "expires_time", format = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("expires_time")
@ApiModelProperty("管理账号token过期时间")
private Timestamp expiresTime;
/**
* 是否禁用
......@@ -115,6 +126,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "disabled")
@JSONField(name = "disabled")
@JsonProperty("disabled")
@ApiModelProperty("是否禁用")
private Integer disabled;
/**
* RedirectURI
......@@ -123,6 +135,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "redirect_uri")
@JSONField(name = "redirect_uri")
@JsonProperty("redirect_uri")
@ApiModelProperty("RedirectURI")
private String redirectUri;
/**
* NotifyUrl
......@@ -131,6 +144,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "notify_url")
@JSONField(name = "notify_url")
@JsonProperty("notify_url")
@ApiModelProperty("NotifyUrl")
private String notifyUrl;
/**
* AGENT_ID
......@@ -139,6 +153,7 @@ public class PayOpenAccess extends EntityMP implements Serializable {
@TableField(value = "agent_id")
@JSONField(name = "agent_id")
@JsonProperty("agent_id")
@ApiModelProperty("AGENT_ID")
private Long agentId;
......
......@@ -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 = "IBZPAYTRADE", resultMap = "PayTradeResultMap")
@ApiModel("支付交易")
public class PayTrade extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -49,6 +52,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "subject")
@JSONField(name = "subject")
@JsonProperty("subject")
@ApiModelProperty("订单标题")
private String subject;
/**
* 订单金额
......@@ -56,6 +60,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "totalamount")
@JSONField(name = "total_amount")
@JsonProperty("total_amount")
@ApiModelProperty("订单金额")
private String totalAmount;
/**
* 交易名称
......@@ -63,6 +68,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "tradename")
@JSONField(name = "trade_name")
@JsonProperty("trade_name")
@ApiModelProperty("交易名称")
private String tradeName;
/**
* 支付类型
......@@ -70,6 +76,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "tradetype")
@JSONField(name = "trade_type")
@JsonProperty("trade_type")
@ApiModelProperty("支付类型")
private String tradeType;
/**
* 支付状态
......@@ -77,6 +84,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "tradestatus")
@JSONField(name = "trade_status")
@JsonProperty("trade_status")
@ApiModelProperty("支付状态")
private String tradeStatus;
/**
* 订单号
......@@ -84,6 +92,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "outtradeno")
@JSONField(name = "out_trade_no")
@JsonProperty("out_trade_no")
@ApiModelProperty("订单号")
private String outTradeNo;
/**
* 交易标识
......@@ -92,6 +101,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableId(value = "tradeid", type = IdType.ASSIGN_UUID)
@JSONField(name = "trade_id")
@JsonProperty("trade_id")
@ApiModelProperty("交易标识")
private String tradeId;
/**
* AccessKey(AppId)
......@@ -99,6 +109,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "appid")
@JSONField(name = "app_id")
@JsonProperty("app_id")
@ApiModelProperty("AccessKey(AppId)")
private String appId;
/**
* 支付平台
......@@ -106,6 +117,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "accessname")
@JSONField(name = "access_name")
@JsonProperty("access_name")
@ApiModelProperty("支付平台")
private String accessName;
/**
* 支付平台接入标识
......@@ -113,6 +125,7 @@ public class PayTrade extends EntityMP implements Serializable {
@TableField(value = "accessid")
@JSONField(name = "access_id")
@JsonProperty("access_id")
@ApiModelProperty("支付平台接入标识")
private String accessId;
/**
......
......@@ -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对象[PayOpenAccessDTO]
*/
@Data
@ApiModel("支付平台")
public class PayOpenAccessDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -36,6 +39,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "id")
@JsonProperty("id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("开放平台接入标识")
private String id;
/**
......@@ -45,6 +49,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "name")
@JsonProperty("name")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("开放平台")
private String name;
/**
......@@ -54,6 +59,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "open_type")
@JsonProperty("open_type")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("开放平台类型")
private String openType;
/**
......@@ -63,6 +69,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "access_key")
@JsonProperty("access_key")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("AccessKey(AppId)")
private String accessKey;
/**
......@@ -72,6 +79,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "secret_key")
@JsonProperty("secret_key")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("SecretKey(AppSecret)")
private String secretKey;
/**
......@@ -81,6 +89,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "region_id")
@JsonProperty("region_id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("RegionId")
private String regionId;
/**
......@@ -90,6 +99,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "access_token")
@JsonProperty("access_token")
@Size(min = 0, max = 1000, message = "内容长度必须小于等于[1000]")
@ApiModelProperty("管理账号token")
private String accessToken;
/**
......@@ -99,6 +109,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "expires_time" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("expires_time")
@ApiModelProperty("管理账号token过期时间")
private Timestamp expiresTime;
/**
......@@ -107,6 +118,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "disabled")
@JsonProperty("disabled")
@ApiModelProperty("是否禁用")
private Integer disabled;
/**
......@@ -116,6 +128,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "redirect_uri")
@JsonProperty("redirect_uri")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
@ApiModelProperty("RedirectURI")
private String redirectUri;
/**
......@@ -125,6 +138,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "notify_url")
@JsonProperty("notify_url")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
@ApiModelProperty("NotifyUrl")
private String notifyUrl;
/**
......@@ -134,6 +148,7 @@ public class PayOpenAccessDTO extends DTOBase implements Serializable {
@JSONField(name = "agent_id")
@JsonProperty("agent_id")
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("AGENT_ID")
private Long agentId;
......
......@@ -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对象[PayTradeDTO]
*/
@Data
@ApiModel("支付交易")
public class PayTradeDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -36,6 +39,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "subject")
@JsonProperty("subject")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("订单标题")
private String subject;
/**
......@@ -45,6 +49,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "total_amount")
@JsonProperty("total_amount")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("订单金额")
private String totalAmount;
/**
......@@ -54,6 +59,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "trade_name")
@JsonProperty("trade_name")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("交易名称")
private String tradeName;
/**
......@@ -63,6 +69,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "trade_type")
@JsonProperty("trade_type")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("支付类型")
private String tradeType;
/**
......@@ -72,6 +79,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "trade_status")
@JsonProperty("trade_status")
@Size(min = 0, max = 60, message = "内容长度必须小于等于[60]")
@ApiModelProperty("支付状态")
private String tradeStatus;
/**
......@@ -81,6 +89,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "out_trade_no")
@JsonProperty("out_trade_no")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("订单号")
private String outTradeNo;
/**
......@@ -90,6 +99,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "trade_id")
@JsonProperty("trade_id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("交易标识")
private String tradeId;
/**
......@@ -99,6 +109,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "app_id")
@JsonProperty("app_id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("AccessKey(AppId)")
private String appId;
/**
......@@ -108,6 +119,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "access_name")
@JsonProperty("access_name")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("支付平台")
private String accessName;
/**
......@@ -117,6 +129,7 @@ public class PayTradeDTO extends DTOBase implements Serializable {
@JSONField(name = "access_id")
@JsonProperty("access_id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
@ApiModelProperty("支付平台接入标识")
private String accessId;
......
......@@ -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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册