Commit bafa60de by guojuxing

联合商户列表接口

parent 9d969642
......@@ -30,6 +30,12 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!--参数验证-->
<dependency>
<groupId>org.hibernate</groupId>
......
package com.gic.enterprise.constant.union;
/**
* 联合商户资源授权状态
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 2:03 PM

*/
public enum UnionEnterpriseAuthDetailStatusEnum {
/**
* 未授权
*/
NO_AUTH(1, "未授权"),
/**
* 资源处理中
*/
RESOURCE_DEALING(2, "资源处理中"),
/**
* 已授权
*/
HAS_AUTH(3, "已授权"),
/**
* 授权失败
*/
AUTH_FAIL(4, "授权失败"),
/**
* 部分失败
*/
AUTH_PART_FAIL(5, "部分失败"),
/**
* 等待解除
*/
TO_RELIEVE(6, "等待解除"),
/**
* 资源解除中
*/
RELIEVING(7, "资源解除中"),
/**
* 已解除联合
*/
HAS_RELIEVE(8, "已解除联合");
private Integer code;
private String message;
UnionEnterpriseAuthDetailStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public UnionEnterpriseAuthDetailStatusEnum setCode(Integer code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public UnionEnterpriseAuthDetailStatusEnum setMessage(String message) {
this.message = message;
return this;
}
}
package com.gic.enterprise.constant.union;
/**
* 联合商户资源种类
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 2:03 PM

*/
public enum UnionEnterpriseAuthResTypeEnum {
/**
* 有效
*/
USER_AREA(1, "用户域资源"),
/**
* 门店资源
*/
STORE(2, "门店资源"),
/**
* 商品资源
*/
GOODS(3, "商品资源");
private Integer code;
private String message;
UnionEnterpriseAuthResTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public UnionEnterpriseAuthResTypeEnum setCode(Integer code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public UnionEnterpriseAuthResTypeEnum setMessage(String message) {
this.message = message;
return this;
}
}
package com.gic.enterprise.constant.union;
/**
* 联合商户授权状态
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 2:03 PM

*/
public enum UnionEnterpriseAuthStatusEnum {
/**
* 有效
*/
NORMAL(1, "有效"),
/**
* 解除中
*/
RELIEVING(2, "解除中"),
/**
* 已解除
*/
RELIEVED(3, "已解除");
private Integer code;
private String message;
UnionEnterpriseAuthStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public UnionEnterpriseAuthStatusEnum setCode(Integer code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public UnionEnterpriseAuthStatusEnum setMessage(String message) {
this.message = message;
return this;
}
}
package com.gic.enterprise.dto.union;
import java.io.Serializable;
import java.util.Date;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 1:45 PM

*/
public class UnionEnterpriseAuthDTO implements Serializable{
private static final long serialVersionUID = -4843823461762272567L;
/**
* id
*/
private Integer unionEnterpriseAuthId;
/**
* 自有商户ID
*/
private Integer ownEnterpriseId;
/**
* 联合商户ID
*/
private Integer unionEnterpriseId;
/**
* 1:有效 2:解除中 3: 已解除联合
*/
private Integer statusFlag;
/**
* 最新联合完成时间(最后一项资源授权完毕时间)
*/
private Date lastUnionTime;
/**
* 最新解除时间(最后一项资源收回完毕时间)
*/
private Date lastRelieveTime;
/**
* 解除时间
*/
private Date relieveTime;
/**
* 解除生效时间,保留X个自然日后开始解除资源
*/
private Integer relieveEffectDate;
/**
* 解除原因备注
*/
private String relieveRemark;
/**
* 资源组ID
*/
private Integer resourceGroupId;
/**
* 受审组,多选,英文逗号隔开
*/
private String auditeeGroup;
/**
* 账号分组,多选,英文逗号隔开
*/
private String accountGroup;
/**
* 数据加密字段 1:用户手机号、卡号 2:用户收获地址 。多选,英文逗号隔开
*/
private String dataEncryField;
/**
* 用户修改权限 1:用户归属修改权限 2:用户等级修改权限 3:用户积分修改权限 4:用户手机号修改权限 。多选,英文逗号隔开
*/
private String userEditAuth;
/**
* 白名单用户授权 1:是 0:否
*/
private Integer whiteListAuth;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthDTO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getOwnEnterpriseId() {
return ownEnterpriseId;
}
public UnionEnterpriseAuthDTO setOwnEnterpriseId(Integer ownEnterpriseId) {
this.ownEnterpriseId = ownEnterpriseId;
return this;
}
public Integer getUnionEnterpriseId() {
return unionEnterpriseId;
}
public UnionEnterpriseAuthDTO setUnionEnterpriseId(Integer unionEnterpriseId) {
this.unionEnterpriseId = unionEnterpriseId;
return this;
}
public Integer getStatusFlag() {
return statusFlag;
}
public UnionEnterpriseAuthDTO setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
return this;
}
public Date getLastUnionTime() {
return lastUnionTime;
}
public UnionEnterpriseAuthDTO setLastUnionTime(Date lastUnionTime) {
this.lastUnionTime = lastUnionTime;
return this;
}
public Date getLastRelieveTime() {
return lastRelieveTime;
}
public UnionEnterpriseAuthDTO setLastRelieveTime(Date lastRelieveTime) {
this.lastRelieveTime = lastRelieveTime;
return this;
}
public Date getRelieveTime() {
return relieveTime;
}
public UnionEnterpriseAuthDTO setRelieveTime(Date relieveTime) {
this.relieveTime = relieveTime;
return this;
}
public Integer getRelieveEffectDate() {
return relieveEffectDate;
}
public UnionEnterpriseAuthDTO setRelieveEffectDate(Integer relieveEffectDate) {
this.relieveEffectDate = relieveEffectDate;
return this;
}
public String getRelieveRemark() {
return relieveRemark;
}
public UnionEnterpriseAuthDTO setRelieveRemark(String relieveRemark) {
this.relieveRemark = relieveRemark;
return this;
}
public Integer getResourceGroupId() {
return resourceGroupId;
}
public UnionEnterpriseAuthDTO setResourceGroupId(Integer resourceGroupId) {
this.resourceGroupId = resourceGroupId;
return this;
}
public String getAuditeeGroup() {
return auditeeGroup;
}
public UnionEnterpriseAuthDTO setAuditeeGroup(String auditeeGroup) {
this.auditeeGroup = auditeeGroup;
return this;
}
public String getAccountGroup() {
return accountGroup;
}
public UnionEnterpriseAuthDTO setAccountGroup(String accountGroup) {
this.accountGroup = accountGroup;
return this;
}
public String getDataEncryField() {
return dataEncryField;
}
public UnionEnterpriseAuthDTO setDataEncryField(String dataEncryField) {
this.dataEncryField = dataEncryField;
return this;
}
public String getUserEditAuth() {
return userEditAuth;
}
public UnionEnterpriseAuthDTO setUserEditAuth(String userEditAuth) {
this.userEditAuth = userEditAuth;
return this;
}
public Integer getWhiteListAuth() {
return whiteListAuth;
}
public UnionEnterpriseAuthDTO setWhiteListAuth(Integer whiteListAuth) {
this.whiteListAuth = whiteListAuth;
return this;
}
public Date getCreateTime() {
return createTime;
}
public UnionEnterpriseAuthDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public UnionEnterpriseAuthDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public UnionEnterpriseAuthDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthDTO{" +
"unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", ownEnterpriseId=" + ownEnterpriseId +
", unionEnterpriseId=" + unionEnterpriseId +
", statusFlag=" + statusFlag +
", lastUnionTime=" + lastUnionTime +
", lastRelieveTime=" + lastRelieveTime +
", relieveTime=" + relieveTime +
", relieveEffectDate=" + relieveEffectDate +
", relieveRemark='" + relieveRemark + '\'' +
", resourceGroupId=" + resourceGroupId +
", auditeeGroup='" + auditeeGroup + '\'' +
", accountGroup='" + accountGroup + '\'' +
", dataEncryField='" + dataEncryField + '\'' +
", userEditAuth='" + userEditAuth + '\'' +
", whiteListAuth=" + whiteListAuth +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteFlag=" + deleteFlag +
'}';
}
}
\ No newline at end of file
package com.gic.enterprise.dto.union;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* 联合商户列表
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/4 2:04 PM

*/
public class UnionEnterpriseAuthListDTO implements Serializable{
private static final long serialVersionUID = 6966464635507244406L;
private String userName;
private String phoneNumber;
/**
* 国际区号,如中国 86
*/
private String phoneAreaCode;
private String enterpriseName;
private String companyName;
private String address;
/**
* 联合商户ID
*/
private Integer enterpriseId;
/**
* 联合商户记录主键
*/
private Integer unionEnterpriseAuthId;
/**
* 1:有效 2:解除中 3: 已解除联合
*/
private Integer statusFlag;
/**
* 解除时间
*/
private Date relieveTime;
/**
* 最新解除时间(最后一项资源收回完毕时间)
*/
private Date lastRelieveTime;
/**
* 解除生效时间,保留X个自然日后开始解除资源
*/
private Integer relieveEffectDate;
/**
* 将解除时间时间yyyy-MM-dd
*/
private String startRelieveTime;
/**
* 具体资源授权信息
*/
private List<UnionEnterpriseAuthResDetailDTO> unionEnterpriseResourceList;
public String getUserName() {
return userName;
}
public UnionEnterpriseAuthListDTO setUserName(String userName) {
this.userName = userName;
return this;
}
public String getPhoneNumber() {
return phoneNumber;
}
public UnionEnterpriseAuthListDTO setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
public String getPhoneAreaCode() {
return phoneAreaCode;
}
public UnionEnterpriseAuthListDTO setPhoneAreaCode(String phoneAreaCode) {
this.phoneAreaCode = phoneAreaCode;
return this;
}
public String getEnterpriseName() {
return enterpriseName;
}
public UnionEnterpriseAuthListDTO setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
return this;
}
public String getCompanyName() {
return companyName;
}
public UnionEnterpriseAuthListDTO setCompanyName(String companyName) {
this.companyName = companyName;
return this;
}
public String getAddress() {
return address;
}
public UnionEnterpriseAuthListDTO setAddress(String address) {
this.address = address;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public UnionEnterpriseAuthListDTO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public Integer getStatusFlag() {
return statusFlag;
}
public UnionEnterpriseAuthListDTO setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
return this;
}
public Date getRelieveTime() {
return relieveTime;
}
public UnionEnterpriseAuthListDTO setRelieveTime(Date relieveTime) {
this.relieveTime = relieveTime;
return this;
}
public Date getLastRelieveTime() {
return lastRelieveTime;
}
public UnionEnterpriseAuthListDTO setLastRelieveTime(Date lastRelieveTime) {
this.lastRelieveTime = lastRelieveTime;
return this;
}
public Integer getRelieveEffectDate() {
return relieveEffectDate;
}
public UnionEnterpriseAuthListDTO setRelieveEffectDate(Integer relieveEffectDate) {
this.relieveEffectDate = relieveEffectDate;
return this;
}
public String getStartRelieveTime() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (relieveTime != null && relieveEffectDate != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(relieveTime);
calendar.add(Calendar.DAY_OF_YEAR, relieveEffectDate);
//待解除
setStatusFlag(4);
return sdf.format(calendar.getTime());
}
return startRelieveTime;
}
public UnionEnterpriseAuthListDTO setStartRelieveTime(String startRelieveTime) {
this.startRelieveTime = startRelieveTime;
return this;
}
public List<UnionEnterpriseAuthResDetailDTO> getUnionEnterpriseResourceList() {
return unionEnterpriseResourceList;
}
public UnionEnterpriseAuthListDTO setUnionEnterpriseResourceList(List<UnionEnterpriseAuthResDetailDTO> unionEnterpriseResourceList) {
this.unionEnterpriseResourceList = unionEnterpriseResourceList;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthListDTO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthListDTO{" +
"userName='" + userName + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", phoneAreaCode='" + phoneAreaCode + '\'' +
", enterpriseName='" + enterpriseName + '\'' +
", companyName='" + companyName + '\'' +
", address='" + address + '\'' +
", enterpriseId=" + enterpriseId +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", statusFlag=" + statusFlag +
", relieveTime=" + relieveTime +
", lastRelieveTime=" + lastRelieveTime +
", relieveEffectDate=" + relieveEffectDate +
", startRelieveTime='" + startRelieveTime + '\'' +
", unionEnterpriseResourceList=" + unionEnterpriseResourceList +
'}';
}
}
package com.gic.enterprise.dto.union;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 联合商户授权资源
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 7:51 PM

*/
public class UnionEnterpriseAuthResDTO implements Serializable{
private static final long serialVersionUID = 2861920176711536732L;
/**
* 自有商户ID
*/
@NotNull(message = "自有商户不能为空")
private Integer ownEnterpriseId;
/**
* 联合商户ID
*/
@NotNull(message = "联合商户不能为空")
private Integer unionEnterpriseId;
/**
* 资源组ID
*/
@NotNull(message = "资源组不能为空")
private Integer resourceGroupId;
/**
* 受审组,多选,英文逗号隔开
*/
private String auditeeGroup;
/**
* 账号分组,多选,英文逗号隔开
*/
private String accountGroup;
/**
* 数据加密字段 1:用户手机号、卡号 2:用户收获地址 。多选,英文逗号隔开
*/
private String dataEncryField;
/**
* 用户修改权限 1:用户归属修改权限 2:用户等级修改权限 3:用户积分修改权限 4:用户手机号修改权限 。多选,英文逗号隔开
*/
private String userEditAuth;
/**
* 白名单用户授权 1:是 0:否
*/
private Integer whiteListAuth;
public Integer getOwnEnterpriseId() {
return ownEnterpriseId;
}
public UnionEnterpriseAuthResDTO setOwnEnterpriseId(Integer ownEnterpriseId) {
this.ownEnterpriseId = ownEnterpriseId;
return this;
}
public Integer getUnionEnterpriseId() {
return unionEnterpriseId;
}
public UnionEnterpriseAuthResDTO setUnionEnterpriseId(Integer unionEnterpriseId) {
this.unionEnterpriseId = unionEnterpriseId;
return this;
}
public Integer getResourceGroupId() {
return resourceGroupId;
}
public UnionEnterpriseAuthResDTO setResourceGroupId(Integer resourceGroupId) {
this.resourceGroupId = resourceGroupId;
return this;
}
public String getAuditeeGroup() {
return auditeeGroup;
}
public UnionEnterpriseAuthResDTO setAuditeeGroup(String auditeeGroup) {
this.auditeeGroup = auditeeGroup;
return this;
}
public String getAccountGroup() {
return accountGroup;
}
public UnionEnterpriseAuthResDTO setAccountGroup(String accountGroup) {
this.accountGroup = accountGroup;
return this;
}
public String getDataEncryField() {
return dataEncryField;
}
public UnionEnterpriseAuthResDTO setDataEncryField(String dataEncryField) {
this.dataEncryField = dataEncryField;
return this;
}
public String getUserEditAuth() {
return userEditAuth;
}
public UnionEnterpriseAuthResDTO setUserEditAuth(String userEditAuth) {
this.userEditAuth = userEditAuth;
return this;
}
public Integer getWhiteListAuth() {
return whiteListAuth;
}
public UnionEnterpriseAuthResDTO setWhiteListAuth(Integer whiteListAuth) {
this.whiteListAuth = whiteListAuth;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthResDTO{" +
"ownEnterpriseId=" + ownEnterpriseId +
", unionEnterpriseId=" + unionEnterpriseId +
", resourceGroupId=" + resourceGroupId +
", auditeeGroup='" + auditeeGroup + '\'' +
", accountGroup='" + accountGroup + '\'' +
", dataEncryField='" + dataEncryField + '\'' +
", userEditAuth='" + userEditAuth + '\'' +
", whiteListAuth=" + whiteListAuth +
'}';
}
}
package com.gic.enterprise.dto.union;
import java.io.Serializable;
import java.util.Date;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 8:35 PM

*/
public class UnionEnterpriseAuthResDetailDTO implements Serializable{
private static final long serialVersionUID = -4919487387076228142L;
/**
* id
*/
private Integer unionEnterpriseAuthResDetailId;
/**
* 联合商户授权主键ID,关联字段
*/
private Integer unionEnterpriseAuthId;
/**
* 1:用户域资源 2:门店资源 3:商品资源
*/
private Integer resourceType;
/**
* 授权状态 1:未授权 2:资源处理中 3:已授权 4:授权失败 5:部分失败 6:等待解除 7:资源解除中 8:已解除联合
*/
private Integer authStatus;
/**
* 授权备注
*/
private String remark;
/**
* 资源授权的key值,只保留最新授权的key值.用于重新授权
*/
private String authKey;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthResDetailId() {
return unionEnterpriseAuthResDetailId;
}
public UnionEnterpriseAuthResDetailDTO setUnionEnterpriseAuthResDetailId(Integer unionEnterpriseAuthResDetailId) {
this.unionEnterpriseAuthResDetailId = unionEnterpriseAuthResDetailId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthResDetailDTO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getResourceType() {
return resourceType;
}
public UnionEnterpriseAuthResDetailDTO setResourceType(Integer resourceType) {
this.resourceType = resourceType;
return this;
}
public Integer getAuthStatus() {
return authStatus;
}
public UnionEnterpriseAuthResDetailDTO setAuthStatus(Integer authStatus) {
this.authStatus = authStatus;
return this;
}
public String getRemark() {
return remark;
}
public UnionEnterpriseAuthResDetailDTO setRemark(String remark) {
this.remark = remark;
return this;
}
public String getAuthKey() {
return authKey;
}
public UnionEnterpriseAuthResDetailDTO setAuthKey(String authKey) {
this.authKey = authKey;
return this;
}
public Date getCreateTime() {
return createTime;
}
public UnionEnterpriseAuthResDetailDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public UnionEnterpriseAuthResDetailDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public UnionEnterpriseAuthResDetailDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthResDetailDTO{" +
"unionEnterpriseAuthResDetailId=" + unionEnterpriseAuthResDetailId +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", resourceType=" + resourceType +
", authStatus=" + authStatus +
", remark='" + remark + '\'' +
", authKey='" + authKey + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteFlag=" + deleteFlag +
'}';
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthResDTO;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 1:47 PM

*/
public interface UnionEnterpriseAuthApiService {
/**
* 创建联合商户
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
ServiceResponse<Void> saveUnionEnterprise(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
/**
* 授权资源
* @param dto
* @return
*/
ServiceResponse<Void> authResource(@Valid UnionEnterpriseAuthResDTO dto);
/**
* 查询联合商户记录
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
ServiceResponse<UnionEnterpriseAuthDTO> getUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
/**
* 资源重新授权
* @param ownEnterpriseId
* @param unionEnterpriseId
* @param resourceType UnionEnterpriseAuthResTypeEnum
* @return
*/
ServiceResponse<Void> resetAuthResource(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId, @NotNull Integer resourceType);
/**
* 解除联合
* @param ownEnterpriseId
* @param unionEnterpriseId
* @param relieveReason 解除理由
* @return
*/
ServiceResponse<Void> relieveUnion(Integer ownEnterpriseId, Integer unionEnterpriseId, String relieveReason);
/**
* 联合商户列表
* @param ownEnterpriseId 自有商户ID
* @param enterpriseName 联合商户名称
* @param authStatus UnionEnterpriseAuthDetailStatusEnum
* @return
*/
ServiceResponse<List<UnionEnterpriseAuthListDTO>> listUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId, String enterpriseName, Integer authStatus);
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/4 9:51 AM

*/
public interface UnionEnterpriseAuthResDetailApiService {
/**
* 业务方数据授权回调
* @return
*/
ServiceResponse<Void> authDataCallback();
}
package com.gic.enterprise.config;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.exception.CommonException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
......@@ -9,6 +12,8 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.annotation.Configuration;
import javax.validation.ConstraintViolationException;
/**
* 采集GIC系统操作日志
*
......@@ -40,8 +45,22 @@ public class ParamAop {
return joinPoint.proceed();
} catch (Throwable throwable) {
logger.warn("拦截器错误", throwable);
throw throwable;
return handlerException(throwable);
}
}
private ServiceResponse handlerException(Throwable e) {
ServiceResponse response = new ServiceResponse();
if (e instanceof CommonException) {
response.setCode(((CommonException) e).getErrorCode());
} else if (e instanceof ConstraintViolationException) {
response.setCode(ErrorCode.SYSTEM_ERROR.getCode());
} else {
response.setCode(ErrorCode.SYSTEM_ERROR.getCode());
}
response.setMessage(e.getMessage());
return response;
}
/**
......
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 7:56 PM

*/
public interface TabSysUnionEnterpriseAuthMapper {
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabSysUnionEnterpriseAuth record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabSysUnionEnterpriseAuth record);
/**
* 根据主键查询
*
* @param unionEnterpriseAuthId 主键
* @return 实体对象
*/
TabSysUnionEnterpriseAuth selectByPrimaryKey(Integer unionEnterpriseAuthId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabSysUnionEnterpriseAuth record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysUnionEnterpriseAuth record);
/**
* 查询未解除联合的商户数据
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
TabSysUnionEnterpriseAuth getUnionEnterprise(@Param("ownEnterpriseId") Integer ownEnterpriseId,
@Param("unionEnterpriseId") Integer unionEnterpriseId);
/**
* 联合商户列表接口
* @param ownEnterpriseId
* @param unionEnterpriseIdList
* @param authStatus
* @return
*/
List<UnionEnterpriseAuthListDTO> listUnionEnterpriseAuth(@Param("ownEnterpriseId") Integer ownEnterpriseId,
@Param("list") List<Integer> unionEnterpriseIdList,
@Param("authStatus") Integer authStatus);
}
\ No newline at end of file
package com.gic.enterprise.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 8:51 PM

*/
public interface TabSysUnionEnterpriseAuthResDetailMapper {
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabSysUnionEnterpriseAuthResDetail record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabSysUnionEnterpriseAuthResDetail record);
/**
* 根据主键查询
*
* @param unionEnterpriseAuthResDetailId 主键
* @return 实体对象
*/
TabSysUnionEnterpriseAuthResDetail selectByPrimaryKey(Integer unionEnterpriseAuthResDetailId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabSysUnionEnterpriseAuthResDetail record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysUnionEnterpriseAuthResDetail record);
/**
* 查询某中资源详情
* @param unionEnterpriseAuthId
* @param authStatus
* @return
*/
List<TabSysUnionEnterpriseAuthResDetail> listUnionEnterpriseAuthResDetail(@Param("unionEnterpriseAuthId") Integer unionEnterpriseAuthId,
@Param("authStatus") Integer authStatus);
/**
* 查询列表数据
* @param unionEnterpriseAuthIdList
* @return
*/
List<TabSysUnionEnterpriseAuthResDetail> listByUnionEnterpriseAuthIdList(@Param("list") List<Integer> unionEnterpriseAuthIdList);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 7:48 PM

*/
public class TabSysUnionEnterpriseAuth {
/**
* id
*/
private Integer unionEnterpriseAuthId;
/**
* 自有商户ID
*/
private Integer ownEnterpriseId;
/**
* 联合商户ID
*/
private Integer unionEnterpriseId;
/**
* 1:有效 2:解除中 3: 已解除联合
*/
private Integer statusFlag;
/**
* 最新联合完成时间(最后一项资源授权完毕时间)
*/
private Date lastUnionTime;
/**
* 最新解除时间(最后一项资源收回完毕时间)
*/
private Date lastRelieveTime;
/**
* 解除时间
*/
private Date relieveTime;
/**
* 解除生效时间,保留X个自然日后开始解除资源
*/
private Integer relieveEffectDate;
/**
* 解除原因备注
*/
private String relieveRemark;
/**
* 资源组ID
*/
private Integer resourceGroupId;
/**
* 受审组,多选,英文逗号隔开
*/
private String auditeeGroup;
/**
* 账号分组,多选,英文逗号隔开
*/
private String accountGroup;
/**
* 数据加密字段 1:用户手机号、卡号 2:用户收获地址 。多选,英文逗号隔开
*/
private String dataEncryField;
/**
* 用户修改权限 1:用户归属修改权限 2:用户等级修改权限 3:用户积分修改权限 4:用户手机号修改权限 。多选,英文逗号隔开
*/
private String userEditAuth;
/**
* 白名单用户授权 1:是 0:否
*/
private Integer whiteListAuth;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public TabSysUnionEnterpriseAuth setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getOwnEnterpriseId() {
return ownEnterpriseId;
}
public TabSysUnionEnterpriseAuth setOwnEnterpriseId(Integer ownEnterpriseId) {
this.ownEnterpriseId = ownEnterpriseId;
return this;
}
public Integer getUnionEnterpriseId() {
return unionEnterpriseId;
}
public TabSysUnionEnterpriseAuth setUnionEnterpriseId(Integer unionEnterpriseId) {
this.unionEnterpriseId = unionEnterpriseId;
return this;
}
public Integer getStatusFlag() {
return statusFlag;
}
public TabSysUnionEnterpriseAuth setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
return this;
}
public Date getLastUnionTime() {
return lastUnionTime;
}
public TabSysUnionEnterpriseAuth setLastUnionTime(Date lastUnionTime) {
this.lastUnionTime = lastUnionTime;
return this;
}
public Date getLastRelieveTime() {
return lastRelieveTime;
}
public TabSysUnionEnterpriseAuth setLastRelieveTime(Date lastRelieveTime) {
this.lastRelieveTime = lastRelieveTime;
return this;
}
public Date getRelieveTime() {
return relieveTime;
}
public TabSysUnionEnterpriseAuth setRelieveTime(Date relieveTime) {
this.relieveTime = relieveTime;
return this;
}
public Integer getRelieveEffectDate() {
return relieveEffectDate;
}
public TabSysUnionEnterpriseAuth setRelieveEffectDate(Integer relieveEffectDate) {
this.relieveEffectDate = relieveEffectDate;
return this;
}
public String getRelieveRemark() {
return relieveRemark;
}
public TabSysUnionEnterpriseAuth setRelieveRemark(String relieveRemark) {
this.relieveRemark = relieveRemark;
return this;
}
public Integer getResourceGroupId() {
return resourceGroupId;
}
public TabSysUnionEnterpriseAuth setResourceGroupId(Integer resourceGroupId) {
this.resourceGroupId = resourceGroupId;
return this;
}
public String getAuditeeGroup() {
return auditeeGroup;
}
public TabSysUnionEnterpriseAuth setAuditeeGroup(String auditeeGroup) {
this.auditeeGroup = auditeeGroup;
return this;
}
public String getAccountGroup() {
return accountGroup;
}
public TabSysUnionEnterpriseAuth setAccountGroup(String accountGroup) {
this.accountGroup = accountGroup;
return this;
}
public String getDataEncryField() {
return dataEncryField;
}
public TabSysUnionEnterpriseAuth setDataEncryField(String dataEncryField) {
this.dataEncryField = dataEncryField;
return this;
}
public String getUserEditAuth() {
return userEditAuth;
}
public TabSysUnionEnterpriseAuth setUserEditAuth(String userEditAuth) {
this.userEditAuth = userEditAuth;
return this;
}
public Integer getWhiteListAuth() {
return whiteListAuth;
}
public TabSysUnionEnterpriseAuth setWhiteListAuth(Integer whiteListAuth) {
this.whiteListAuth = whiteListAuth;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabSysUnionEnterpriseAuth setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabSysUnionEnterpriseAuth setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabSysUnionEnterpriseAuth setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 8:35 PM

*/
public class TabSysUnionEnterpriseAuthResDetail {
/**
* id
*/
private Integer unionEnterpriseAuthResDetailId;
/**
* 联合商户授权主键ID,关联字段
*/
private Integer unionEnterpriseAuthId;
/**
* 1:用户域资源 2:门店资源 3:商品资源
*/
private Integer resourceType;
/**
* 授权状态 1:未授权 2:资源处理中 3:已授权 4:授权失败 5:部分失败 6:等待解除 7:资源解除中 8:已解除联合
*/
private Integer authStatus;
/**
* 授权备注
*/
private String remark;
/**
* 资源授权的key值,只保留最新授权的key值.用于重新授权
*/
private String authKey;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthResDetailId() {
return unionEnterpriseAuthResDetailId;
}
public TabSysUnionEnterpriseAuthResDetail setUnionEnterpriseAuthResDetailId(Integer unionEnterpriseAuthResDetailId) {
this.unionEnterpriseAuthResDetailId = unionEnterpriseAuthResDetailId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public TabSysUnionEnterpriseAuthResDetail setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getResourceType() {
return resourceType;
}
public TabSysUnionEnterpriseAuthResDetail setResourceType(Integer resourceType) {
this.resourceType = resourceType;
return this;
}
public Integer getAuthStatus() {
return authStatus;
}
public TabSysUnionEnterpriseAuthResDetail setAuthStatus(Integer authStatus) {
this.authStatus = authStatus;
return this;
}
public String getRemark() {
return remark;
}
public TabSysUnionEnterpriseAuthResDetail setRemark(String remark) {
this.remark = remark;
return this;
}
public String getAuthKey() {
return authKey;
}
public TabSysUnionEnterpriseAuthResDetail setAuthKey(String authKey) {
this.authKey = authKey;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabSysUnionEnterpriseAuthResDetail setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabSysUnionEnterpriseAuthResDetail setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabSysUnionEnterpriseAuthResDetail setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import java.util.List;
import javax.validation.constraints.NotNull;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail;
/**
* 联合商户资源详情
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 8:39 PM

*/
public interface UnionEnterpriseAuthResDetailService {
/**
* 查询资源详情列表
* @param unionEnterpriseAuthId
* @param authStatus 授权状态 UnionEnterpriseAuthDetailStatusEnum
* @return
*/
List<TabSysUnionEnterpriseAuthResDetail> listUnionEnterpriseAuthResDetail(Integer unionEnterpriseAuthId, Integer authStatus);
/**
* 查询某种资源详情
* @param unionEnterpriseAuthId
* @param resourceType 资源类型 UnionEnterpriseAuthResTypeEnum
* @return
*/
TabSysUnionEnterpriseAuthResDetail getUnionEnterpriseAuthResDetail(@NotNull Integer unionEnterpriseAuthId, @NotNull Integer resourceType);
/**
* 资源授权的时候,初始化资源详情数据
* 每一种资源生成一条未授权记录
* @param unionEnterpriseAuthId
*/
void initUnionEnterpriseAuthResDetail(@NotNull Integer unionEnterpriseAuthId);
/**
* 查询资源详情列表数据
* @param unionEnterpriseAuthIdList
* @return
*/
List<TabSysUnionEnterpriseAuthResDetail> listByUnionEnterpriseAuthIdList(List<Integer> unionEnterpriseAuthIdList);
}
package com.gic.enterprise.service;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import java.util.List;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 1:52 PM

*/
public interface UnionEnterpriseAuthService {
/**
* 创建联合商户
* @param ownEnterpriseId 自有商户ID
* @param unionEnterpriseId 联合商户ID
* @return
*/
int saveUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId);
/**
* 获取联合信息
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
TabSysUnionEnterpriseAuth getUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId);
/**
* 更新数据
* @param dto
* @return
*/
int update(UnionEnterpriseAuthDTO dto);
/**
* 联合商户列表接口
* @param ownEnterpriseId
* @param unionEnterpriseIdList 联合商户ID
* @param authStatus 资源授权状态 UnionEnterpriseAuthDetailStatusEnum
* @return
*/
List<UnionEnterpriseAuthListDTO> listUnionEnterpriseAuth(Integer ownEnterpriseId, List<Integer> unionEnterpriseIdList, Integer authStatus);
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthDetailStatusEnum;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthResTypeEnum;
import com.gic.enterprise.dao.mapper.TabSysUnionEnterpriseAuthResDetailMapper;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail;
import com.gic.enterprise.service.UnionEnterpriseAuthResDetailService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@Service("unionEnterpriseAuthResDetailService")
public class UnionEnterpriseAuthResDetailServiceImpl implements UnionEnterpriseAuthResDetailService{
@Autowired
private TabSysUnionEnterpriseAuthResDetailMapper tabSysUnionEnterpriseAuthResDetailMapper;
@Override
public List<TabSysUnionEnterpriseAuthResDetail> listUnionEnterpriseAuthResDetail(Integer unionEnterpriseAuthId, Integer authStatus) {
return Optional.ofNullable(tabSysUnionEnterpriseAuthResDetailMapper
.listUnionEnterpriseAuthResDetail(unionEnterpriseAuthId, authStatus))
.orElse(Collections.emptyList());
}
@Override
public TabSysUnionEnterpriseAuthResDetail getUnionEnterpriseAuthResDetail(@NotNull Integer unionEnterpriseAuthId, @NotNull Integer resourceType) {
List<TabSysUnionEnterpriseAuthResDetail> list = listUnionEnterpriseAuthResDetail(unionEnterpriseAuthId, null);
if (CollectionUtils.isNotEmpty(list)) {
for (TabSysUnionEnterpriseAuthResDetail obj : list) {
if (obj.getResourceType().equals(resourceType)) {
return obj;
}
}
}
return null;
}
@Override
public void initUnionEnterpriseAuthResDetail(@NotNull Integer unionEnterpriseAuthId) {
if (CollectionUtils.isNotEmpty(listUnionEnterpriseAuthResDetail(unionEnterpriseAuthId, null))) {
return;
}
Date now = new Date();
//因为资源种类不多,循环单条创建
for (UnionEnterpriseAuthResTypeEnum typeEnum : UnionEnterpriseAuthResTypeEnum.values()) {
TabSysUnionEnterpriseAuthResDetail record = new TabSysUnionEnterpriseAuthResDetail();
record.setUpdateTime(now)
.setCreateTime(now)
.setDeleteFlag(0)
.setUnionEnterpriseAuthId(unionEnterpriseAuthId)
.setResourceType(typeEnum.getCode())
.setAuthStatus(UnionEnterpriseAuthDetailStatusEnum.NO_AUTH.getCode());
tabSysUnionEnterpriseAuthResDetailMapper.insertSelective(record);
}
}
@Override
public List<TabSysUnionEnterpriseAuthResDetail> listByUnionEnterpriseAuthIdList(List<Integer> unionEnterpriseAuthIdList) {
return tabSysUnionEnterpriseAuthResDetailMapper.listByUnionEnterpriseAuthIdList(unionEnterpriseAuthIdList);
}
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthStatusEnum;
import com.gic.enterprise.dao.mapper.TabSysUnionEnterpriseAuthMapper;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import com.gic.enterprise.service.UnionEnterpriseAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 联合商户
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/3 1:57 PM

*/
@Service("unionEnterpriseAuthService")
public class UnionEnterpriseAuthServiceImpl implements UnionEnterpriseAuthService{
@Autowired
private TabSysUnionEnterpriseAuthMapper tabSysUnionEnterpriseAuthMapper;
@Override
public int saveUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId) {
TabSysUnionEnterpriseAuth record = new TabSysUnionEnterpriseAuth();
Date now = new Date();
record.setCreateTime(now)
.setUpdateTime(now)
.setDeleteFlag(0)
.setOwnEnterpriseId(ownEnterpriseId)
.setUnionEnterpriseId(unionEnterpriseId)
.setStatusFlag(UnionEnterpriseAuthStatusEnum.NORMAL.getCode());
return tabSysUnionEnterpriseAuthMapper.insertSelective(record);
}
@Override
public TabSysUnionEnterpriseAuth getUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId) {
return tabSysUnionEnterpriseAuthMapper.getUnionEnterprise(ownEnterpriseId, unionEnterpriseId);
}
@Override
public int update(UnionEnterpriseAuthDTO dto) {
TabSysUnionEnterpriseAuth record = new TabSysUnionEnterpriseAuth();
record.setUpdateTime(new Date());
return tabSysUnionEnterpriseAuthMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<UnionEnterpriseAuthListDTO> listUnionEnterpriseAuth(Integer ownEnterpriseId, List<Integer> unionEnterpriseIdList, Integer authStatus) {
return tabSysUnionEnterpriseAuthMapper.listUnionEnterpriseAuth(ownEnterpriseId, unionEnterpriseIdList, authStatus);
}
}
package com.gic.enterprise.service.outer.impl.union;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.service.UnionEnterpriseAuthResDetailApiService;
import org.springframework.stereotype.Service;
@Service("unionEnterpriseAuthResDetailApiService")
public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpriseAuthResDetailApiService{
@Override
public ServiceResponse<Void> authDataCallback() {
return null;
}
}
......@@ -131,11 +131,14 @@
<dubbo:service interface="com.gic.enterprise.service.WmStoreSyncLogApiService" ref="wmStoreSyncLogApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.EnterpriseWhiteListApiService" ref="enterpriseWhiteListApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.EnterpriseGoodsResourceApiService" ref="enterpriseGoodsResourceApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.UnionEnterpriseAuthApiService" ref="unionEnterpriseAuthApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.UnionEnterpriseAuthResDetailApiService" ref="unionEnterpriseAuthResDetailApiService" timeout="6000" />
<dubbo:reference interface="com.gic.mall.share.api.service.ShopApiService" id="shopApiService" timeout="6000" />
<dubbo:reference interface="com.gic.auth.service.BusinessFrontResApiService" id="businessFrontResApiService" timeout="6000" />
<dubbo:reference interface="com.gic.auth.service.ResourceGroupApiService" id="resourceGroupApiService" timeout="6000" />
<dubbo:reference interface="com.gic.marketing.process.api.service.tmpl.WxTemplateRouterApiService" id="wxTemplateRouterApiService" timeout="60000" />
<dubbo:reference interface="com.gic.member.api.service.MemberUserApiService" id="memberUserApiService" timeout="60000" />
<dubbo:reference interface="com.gic.store.service.StoreApiService" id="storeApiService" timeout="60000" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.enterprise.dao.mapper.TabSysUnionEnterpriseAuthResDetailMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail">
<id column="union_enterprise_auth_res_detail_id" jdbcType="INTEGER" property="unionEnterpriseAuthResDetailId" />
<result column="union_enterprise_auth_id" jdbcType="INTEGER" property="unionEnterpriseAuthId" />
<result column="resource_type" jdbcType="INTEGER" property="resourceType" />
<result column="auth_status" jdbcType="INTEGER" property="authStatus" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="auth_key" jdbcType="VARCHAR" property="authKey" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="delete_flag" jdbcType="INTEGER" property="deleteFlag" />
</resultMap>
<sql id="Base_Column_List">
union_enterprise_auth_res_detail_id, union_enterprise_auth_id, resource_type,
auth_status, remark, auth_key, create_time, update_time, delete_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_union_enterprise_auth_res_detail
where union_enterprise_auth_res_detail_id = #{unionEnterpriseAuthResDetailId,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail">
insert into tab_sys_union_enterprise_auth_res_detail (union_enterprise_auth_res_detail_id, union_enterprise_auth_id,
resource_type, auth_status, remark,
auth_key, create_time, update_time,
delete_flag)
values (#{unionEnterpriseAuthResDetailId,jdbcType=INTEGER}, #{unionEnterpriseAuthId,jdbcType=INTEGER},
#{resourceType,jdbcType=INTEGER}, #{authStatus,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{authKey,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{deleteFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail">
insert into tab_sys_union_enterprise_auth_res_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="unionEnterpriseAuthResDetailId != null">
union_enterprise_auth_res_detail_id,
</if>
<if test="unionEnterpriseAuthId != null">
union_enterprise_auth_id,
</if>
<if test="resourceType != null">
resource_type,
</if>
<if test="authStatus != null">
auth_status,
</if>
<if test="remark != null">
remark,
</if>
<if test="authKey != null">
auth_key,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="unionEnterpriseAuthResDetailId != null">
#{unionEnterpriseAuthResDetailId,jdbcType=INTEGER},
</if>
<if test="unionEnterpriseAuthId != null">
#{unionEnterpriseAuthId,jdbcType=INTEGER},
</if>
<if test="resourceType != null">
#{resourceType,jdbcType=INTEGER},
</if>
<if test="authStatus != null">
#{authStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="authKey != null">
#{authKey,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail">
update tab_sys_union_enterprise_auth_res_detail
<set>
<if test="unionEnterpriseAuthId != null">
union_enterprise_auth_id = #{unionEnterpriseAuthId,jdbcType=INTEGER},
</if>
<if test="resourceType != null">
resource_type = #{resourceType,jdbcType=INTEGER},
</if>
<if test="authStatus != null">
auth_status = #{authStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="authKey != null">
auth_key = #{authKey,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
</set>
where union_enterprise_auth_res_detail_id = #{unionEnterpriseAuthResDetailId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail">
update tab_sys_union_enterprise_auth_res_detail
set union_enterprise_auth_id = #{unionEnterpriseAuthId,jdbcType=INTEGER},
resource_type = #{resourceType,jdbcType=INTEGER},
auth_status = #{authStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
auth_key = #{authKey,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where union_enterprise_auth_res_detail_id = #{unionEnterpriseAuthResDetailId,jdbcType=INTEGER}
</update>
<select id="listUnionEnterpriseAuthResDetail" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth_res_detail
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
<if test="authStatus != null">
and auth_status = #{authStatus}
</if>
</select>
<select id="listByUnionEnterpriseAuthIdList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth_res_detail
where delete_flag = 0
and union_enterprise_auth_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,11 @@ package com.gic.enterprise.web.controller.union;
import com.gic.api.base.commons.Page;
import com.gic.auth.dto.*;
import com.gic.auth.service.*;
import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthResDTO;
import com.gic.enterprise.exception.CommonException;
import com.gic.enterprise.service.UnionEnterpriseAuthApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.web.vo.union.*;
import com.gic.open.api.dto.ApplicationDTO;
......@@ -53,6 +58,8 @@ public class UnionEnterpriseAuthController {
private AccountGroupApiService accountGroupApiService;
@Autowired
private ApplicationApiService applicationApiService;
@Autowired
private UnionEnterpriseAuthApiService unionEnterpriseAuthApiService;
private static final String UNION_ENTERPRISE_AUTH_SMS_CODE = "GICSHHT001";
......@@ -110,6 +117,13 @@ public class UnionEnterpriseAuthController {
return EnterpriseRestResponse.failure(result);
}
/**
* 发送验证码校验联合商户,如果已存在则进入资源授权页面;如果不存在,则新建联合商户
* @param authCode
* @param authCodeId
* @param enterpriseName
* @return
*/
@RequestMapping("create-union-enterprise")
public RestResponse resetPasswordByAuthCode(String authCode, Integer authCodeId, String enterpriseName) {
ServiceResponse authCodeResult = authCodeApiService.validateAuthCode(authCodeId, authCode);
......@@ -120,8 +134,20 @@ public class UnionEnterpriseAuthController {
if (unionEnterprise == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在或者是自有商户");
}
//todo starrynight 创建联合商户
return RestResponse.success(1);
Integer ownEnterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
Integer unionEnterpriseId = unionEnterprise.getEnterpriseId();
//查询是否已存在联合商户
UnionEnterpriseAuthDTO unionEnterpriseAuthDTO = getUnionEnterpriseAuth(ownEnterpriseId, unionEnterpriseId);
if (unionEnterpriseAuthDTO != null) {
//已存在,则不需要记录操作日志
return RestResponse.success();
} else {
return OperationResultUtils.operationResult(
unionEnterpriseAuthApiService.saveUnionEnterprise(ownEnterpriseId, unionEnterpriseId),
OperationResultUtils.LOG_NEW + "联合商户",
unionEnterprise.getEnterpriseName());
}
}
/**
......@@ -155,11 +181,21 @@ public class UnionEnterpriseAuthController {
return ResultControllerUtils.commonResult(response, UnionAccountGroupVO.class);
}
/**
* 资源授权
* @param unionEnterpriseAuthResQO
* @return
*/
@RequestMapping("auth-resource")
public RestResponse authResource(@RequestBody UnionEnterpriseAuthResQO unionEnterpriseAuthResQO) {
//todo starrynight 资源授权
return RestResponse.success();
//资源授权
UnionEnterpriseAuthResDTO dto = EntityUtil.changeEntityNew(UnionEnterpriseAuthResDTO.class, unionEnterpriseAuthResQO);
dto.setOwnEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return OperationResultUtils.operationResult(
unionEnterpriseAuthApiService.authResource(dto),
"资源授权联合",
getEnterpriseById(dto.getUnionEnterpriseId()).getEnterpriseName());
}
@RequestMapping("get-resource-detail")
......@@ -176,8 +212,11 @@ public class UnionEnterpriseAuthController {
*/
@RequestMapping("relieve-resource")
public RestResponse relieveResource(Integer enterpriseId, String relieveRemark) {
//todo starrynight 解除资源
return RestResponse.success();
//解除资源
return OperationResultUtils.operationResult(
unionEnterpriseAuthApiService.relieveUnion(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseId, relieveRemark),
"解除联合",
getEnterpriseById(enterpriseId).getEnterpriseName());
}
/**
......@@ -188,15 +227,16 @@ public class UnionEnterpriseAuthController {
*/
@RequestMapping("list-union-enterprise")
public RestResponse listUnionEnterprise(String enterpriseName, Integer authStatus) {
List<UnionEnterpriseListVO> list = new ArrayList<>();
//todo starrynight
return RestResponse.success(list);
return ResultControllerUtils.commonResult(unionEnterpriseAuthApiService
.listUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseName, authStatus),
UnionEnterpriseListVO.class);
}
@RequestMapping("resource-reset-auth")
public RestResponse resourceResetAuth(Integer enterpriseId, Integer resourceType) {
//todo starrynight
return RestResponse.success();
//重新授权
return ResultControllerUtils.commonResult(unionEnterpriseAuthApiService
.resetAuthResource(UserDetailUtils.getUserDetail().getEnterpriseId(), enterpriseId, resourceType));
}
@RequestMapping("list-app")
......@@ -292,4 +332,28 @@ public class UnionEnterpriseAuthController {
return null;
}
/**
* 查询联合商户
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
private UnionEnterpriseAuthDTO getUnionEnterpriseAuth(Integer ownEnterpriseId, Integer unionEnterpriseId) {
ServiceResponse<UnionEnterpriseAuthDTO> unionResponse = unionEnterpriseAuthApiService
.getUnionEnterpriseAuth(ownEnterpriseId, unionEnterpriseId);
if (unionResponse.isSuccess()) {
return unionResponse.getResult();
}
return null;
}
private EnterpriseDTO getEnterpriseById(Integer enterpriseId) {
//查询联合商户信息
ServiceResponse<EnterpriseDTO> enterpriseResponse = enterpriseApiService.getEnterpriseById(enterpriseId);
if (!enterpriseResponse.isSuccess()) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在");
}
return enterpriseResponse.getResult();
}
}
......@@ -37,9 +37,9 @@ public class UnionEnterpriseAuthResQO implements Serializable{
private String userEditAuth;
/**
* 联合商户名称
* 白名单用户授权 1:是 0:否
*/
private String enterpriseName;
private Integer whiteListAuth;
/**
*
......@@ -91,12 +91,12 @@ public class UnionEnterpriseAuthResQO implements Serializable{
return this;
}
public String getEnterpriseName() {
return enterpriseName;
public Integer getWhiteListAuth() {
return whiteListAuth;
}
public UnionEnterpriseAuthResQO setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
public UnionEnterpriseAuthResQO setWhiteListAuth(Integer whiteListAuth) {
this.whiteListAuth = whiteListAuth;
return this;
}
......@@ -117,7 +117,7 @@ public class UnionEnterpriseAuthResQO implements Serializable{
", accountGroup='" + accountGroup + '\'' +
", dataEncryField='" + dataEncryField + '\'' +
", userEditAuth='" + userEditAuth + '\'' +
", enterpriseName='" + enterpriseName + '\'' +
", whiteListAuth='" + whiteListAuth + '\'' +
", enterpriseId=" + enterpriseId +
'}';
}
......
......@@ -32,7 +32,7 @@ public class UnionEnterpriseListVO implements Serializable{
private String enterpriseId;
/**
* 1:有效 2:解除中 3: 已解除联合
* 1:有效 2:解除中 3: 已解除联合 4:待解除
*/
private Integer statusFlag;
......@@ -52,6 +52,11 @@ public class UnionEnterpriseListVO implements Serializable{
private Integer relieveEffectDate;
/**
* 将解除时间时间yyyy-MM-dd
*/
private String startRelieveTime;
/**
* 资源对象
*/
private List<UnionEnterpriseResourceVO> unionEnterpriseResourceList;
......@@ -164,6 +169,15 @@ public class UnionEnterpriseListVO implements Serializable{
return this;
}
public String getStartRelieveTime() {
return startRelieveTime;
}
public UnionEnterpriseListVO setStartRelieveTime(String startRelieveTime) {
this.startRelieveTime = startRelieveTime;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseListVO{" +
......@@ -178,6 +192,7 @@ public class UnionEnterpriseListVO implements Serializable{
", relieveTime=" + relieveTime +
", lastRelieveTime=" + lastRelieveTime +
", relieveEffectDate=" + relieveEffectDate +
", startRelieveTime='" + startRelieveTime + '\'' +
", unionEnterpriseResourceList=" + unionEnterpriseResourceList +
'}';
}
......
......@@ -103,6 +103,9 @@
<!--退款查询-->
<dubbo:reference interface="com.gic.enterprise.service.BillingRefundApiService" id="billingRefundApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.UnionEnterpriseAuthApiService" id="unionEnterpriseAuthApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.UnionEnterpriseAuthResDetailApiService" id="unionEnterpriseAuthResDetailApiService" timeout="6000" />
<dubbo:reference interface="com.gic.auth.service.MenuApiService" id="menuApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.enterprise.service.AppletDecorationConfigApiService" id="appletDecorationConfigApiService" timeout="6000"/>
<dubbo:reference interface="com.gic.member.config.api.service.AppletsConfigApiService" id="appletsConfigApiService" timeout="6000"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment