Commit 2ceb460a by guojuxing

联合商户资源操作日志

parent 15c759e5
package com.gic.enterprise.constant.union;
/**
* 联合商户授权资源操作类型
* @ClassName:
* @Description: 

* @author guojuxing

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

*/
public enum UnionEnterpriseAuthResOperateEnum {
/**
* 发起联合
*/
UNION(1, "发起联合"),
/**
* 重新授权
*/
RE_AUTH(2, "重新授权"),
/**
* 解除联合
*/
RELIEVED(3, "解除联合"),
/**
* 编辑资源范围
*/
EDIT_RESOURCE_AREA(4, "编辑资源范围"),
/**
* 发起解除联合
*/
START_RELIEVE(5, "发起解除联合");
private Integer code;
private String message;
UnionEnterpriseAuthResOperateEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public UnionEnterpriseAuthResOperateEnum setCode(Integer code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public UnionEnterpriseAuthResOperateEnum setMessage(String message) {
this.message = message;
return this;
}
}
......@@ -28,6 +28,15 @@ public enum UnionEnterpriseAuthResTypeEnum {
this.message = message;
}
public static String getMessage(Integer code) {
for (UnionEnterpriseAuthResTypeEnum type : values()) {
if (type.getCode().equals(code)) {
return type.getMessage();
}
}
return "--";
}
public Integer getCode() {
return code;
}
......
......@@ -2,6 +2,7 @@ package com.gic.enterprise.dto.union;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 自有商户列表
......@@ -55,6 +56,11 @@ public class OwnEnterpriseAuthListDTO implements Serializable{
*/
private Date lastUnionTime;
/**
* 具体资源授权信息
*/
private List<UnionEnterpriseAuthResDetailDTO> unionEnterpriseResourceList;
public String getUserName() {
return userName;
}
......@@ -163,6 +169,15 @@ public class OwnEnterpriseAuthListDTO implements Serializable{
return this;
}
public List<UnionEnterpriseAuthResDetailDTO> getUnionEnterpriseResourceList() {
return unionEnterpriseResourceList;
}
public OwnEnterpriseAuthListDTO setUnionEnterpriseResourceList(List<UnionEnterpriseAuthResDetailDTO> unionEnterpriseResourceList) {
this.unionEnterpriseResourceList = unionEnterpriseResourceList;
return this;
}
@Override
public String toString() {
return "OwnEnterpriseAuthListDTO{" +
......@@ -178,6 +193,7 @@ public class OwnEnterpriseAuthListDTO implements Serializable{
", statusFlag=" + statusFlag +
", lastRelieveTime=" + lastRelieveTime +
", lastUnionTime=" + lastUnionTime +
", unionEnterpriseResourceList=" + unionEnterpriseResourceList +
'}';
}
}
package com.gic.enterprise.dto.union;
import java.io.Serializable;
import java.util.Date;
/**
* 资源操作日志
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 7:20 PM

*/
public class UnionEnterpriseAuthResLogDTO implements Serializable{
private static final long serialVersionUID = -2863505864141167299L;
/**
* id
*/
private Integer unionEnterpriseAuthResLogId;
/**
* 联合商户授权主键ID,关联字段
*/
private Integer unionEnterpriseAuthId;
/**
* 1:用户域资源 2:门店资源 3:商品资源
*/
private Integer resourceType;
/**
* 日志内容
*/
private String logContent;
/**
* 处理开始时间
*/
private Date dealStartTime;
/**
* 处理完成时间
*/
private Date dealEndTime;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthResLogId() {
return unionEnterpriseAuthResLogId;
}
public UnionEnterpriseAuthResLogDTO setUnionEnterpriseAuthResLogId(Integer unionEnterpriseAuthResLogId) {
this.unionEnterpriseAuthResLogId = unionEnterpriseAuthResLogId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthResLogDTO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getResourceType() {
return resourceType;
}
public UnionEnterpriseAuthResLogDTO setResourceType(Integer resourceType) {
this.resourceType = resourceType;
return this;
}
public String getLogContent() {
return logContent;
}
public UnionEnterpriseAuthResLogDTO setLogContent(String logContent) {
this.logContent = logContent;
return this;
}
public Date getDealStartTime() {
return dealStartTime;
}
public UnionEnterpriseAuthResLogDTO setDealStartTime(Date dealStartTime) {
this.dealStartTime = dealStartTime;
return this;
}
public Date getDealEndTime() {
return dealEndTime;
}
public UnionEnterpriseAuthResLogDTO setDealEndTime(Date dealEndTime) {
this.dealEndTime = dealEndTime;
return this;
}
public Date getCreateTime() {
return createTime;
}
public UnionEnterpriseAuthResLogDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public UnionEnterpriseAuthResLogDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public UnionEnterpriseAuthResLogDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthResLogDTO{" +
"unionEnterpriseAuthResLogId=" + unionEnterpriseAuthResLogId +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", resourceType=" + resourceType +
", logContent='" + logContent + '\'' +
", dealStartTime=" + dealStartTime +
", dealEndTime=" + dealEndTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
", deleteFlag=" + deleteFlag +
'}';
}
}
\ No newline at end of file
package com.gic.enterprise.qo.union;
import java.io.Serializable;
/**
* 资源操作日志
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/8 10:40 AM

*/
public class UnionEnterpriseAuthResLogQO implements Serializable{
private static final long serialVersionUID = 6287422364343763319L;
/**
* 内容
*/
private String content;
private Integer unionEnterpriseAuthId;
private String startTime;
private String endTime;
private Integer pageNum;
private Integer pageSize;
public String getContent() {
return content;
}
public UnionEnterpriseAuthResLogQO setContent(String content) {
this.content = content;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthResLogQO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public String getStartTime() {
return startTime;
}
public UnionEnterpriseAuthResLogQO setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public String getEndTime() {
return endTime;
}
public UnionEnterpriseAuthResLogQO setEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public Integer getPageNum() {
if (pageNum == null) {
return 1;
}
return pageNum;
}
public UnionEnterpriseAuthResLogQO setPageNum(Integer pageNum) {
this.pageNum = pageNum;
return this;
}
public Integer getPageSize() {
if (pageSize == null) {
return 20;
}
return pageSize;
}
public UnionEnterpriseAuthResLogQO setPageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthResLogQO{" +
"content='" + content + '\'' +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", startTime='" + startTime + '\'' +
", endTime='" + endTime + '\'' +
", pageNum=" + pageNum +
", pageSize=" + pageSize +
'}';
}
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.union.*;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
......@@ -90,6 +92,13 @@ public interface UnionEnterpriseAuthApiService {
*/
ServiceResponse<List<UnionEnterpriseAuthAppDTO>> listUnionEnterpriseAuthApp(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
/**
* 删除应用策略
* @param unionEnterpriseAuthAppId
* @return
*/
ServiceResponse<String> deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
/********联合商户视角接口***********/
/**
......@@ -100,4 +109,11 @@ public interface UnionEnterpriseAuthApiService {
* @return
*/
ServiceResponse<List<OwnEnterpriseAuthListDTO>> listOwnEnterpriseAuth(@NotNull Integer unionEnterpriseId, String startTime, String endTime);
/**
* 操作日志
* @param param
* @return
*/
ServiceResponse<Page<UnionEnterpriseAuthResLogDTO>> listUnionEnterpriseAuthResLog(UnionEnterpriseAuthResLogQO param);
}
......@@ -2,6 +2,8 @@ package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import javax.validation.constraints.NotNull;
/**
* 联合商户资源详情
* @ClassName:
......@@ -17,4 +19,13 @@ public interface UnionEnterpriseAuthResDetailApiService {
*/
ServiceResponse<Void> authDataCallback();
/**
* 门店资源联合进程
* @param authStatus 资源联合状态 UnionEnterpriseAuthDetailStatusEnum
* @param ownEnterpriseId 自有商户ID
* @param unionEnterpriseId 联合商户ID
* @return
*/
ServiceResponse<Void> unionForStore(@NotNull Integer authStatus, @NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import java.util.List;
/**
* 资源操作日志
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/8 9:33 AM

*/
public interface TabSysUnionEnterpriseAuthResLogMapper {
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabSysUnionEnterpriseAuthResLog record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabSysUnionEnterpriseAuthResLog record);
/**
* 根据主键查询
*
* @param unionEnterpriseAuthResLogId 主键
* @return 实体对象
*/
TabSysUnionEnterpriseAuthResLog selectByPrimaryKey(Integer unionEnterpriseAuthResLogId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabSysUnionEnterpriseAuthResLog record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysUnionEnterpriseAuthResLog record);
/**
* 日志列表
* @param param
* @return
*/
List<TabSysUnionEnterpriseAuthResLog> listUnionEnterpriseAuthResLog(UnionEnterpriseAuthResLogQO param);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* 资源操作日志
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 7:20 PM

*/
public class TabSysUnionEnterpriseAuthResLog {
/**
* id
*/
private Integer unionEnterpriseAuthResLogId;
/**
* 联合商户授权主键ID,关联字段
*/
private Integer unionEnterpriseAuthId;
/**
* 1:用户域资源 2:门店资源 3:商品资源
*/
private Integer resourceType;
/**
* 日志内容
*/
private String logContent;
/**
* 处理开始时间
*/
private Date dealStartTime;
/**
* 处理完成时间
*/
private Date dealEndTime;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthResLogId() {
return unionEnterpriseAuthResLogId;
}
public TabSysUnionEnterpriseAuthResLog setUnionEnterpriseAuthResLogId(Integer unionEnterpriseAuthResLogId) {
this.unionEnterpriseAuthResLogId = unionEnterpriseAuthResLogId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public TabSysUnionEnterpriseAuthResLog setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public Integer getResourceType() {
return resourceType;
}
public TabSysUnionEnterpriseAuthResLog setResourceType(Integer resourceType) {
this.resourceType = resourceType;
return this;
}
public String getLogContent() {
return logContent;
}
public TabSysUnionEnterpriseAuthResLog setLogContent(String logContent) {
this.logContent = logContent;
return this;
}
public Date getDealStartTime() {
return dealStartTime;
}
public TabSysUnionEnterpriseAuthResLog setDealStartTime(Date dealStartTime) {
this.dealStartTime = dealStartTime;
return this;
}
public Date getDealEndTime() {
return dealEndTime;
}
public TabSysUnionEnterpriseAuthResLog setDealEndTime(Date dealEndTime) {
this.dealEndTime = dealEndTime;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabSysUnionEnterpriseAuthResLog setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabSysUnionEnterpriseAuthResLog setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabSysUnionEnterpriseAuthResLog setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
......@@ -51,4 +51,11 @@ public interface UnionEnterpriseAuthAppService {
* @return
*/
TabSysUnionEnterpriseAuthApp getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
/**
* 删除策略
* @param unionEnterpriseAuthAppId
* @return
*/
int deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
}
......@@ -32,12 +32,19 @@ public interface UnionEnterpriseAuthResDetailService {
/**
* 资源授权的时候,初始化资源详情数据
* 每一种资源生成一条未授权记录
* 每一种资源生成一条未授权记录.
* 如果已存在,则是编辑逻辑
* @param unionEnterpriseAuthId
*/
void initUnionEnterpriseAuthResDetail(@NotNull Integer unionEnterpriseAuthId);
/**
* 发起解除联合(并未真正开始解除,因为有保留时间)
* @param unionEnterpriseAuthId
*/
void relieveUnion(@NotNull Integer unionEnterpriseAuthId);
/**
* 查询资源详情列表数据
* @param unionEnterpriseAuthIdList
* @return
......
package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import com.github.pagehelper.Page;
/**
* 资源授权操作日志
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 7:27 PM

*/
public interface UnionEnterpriseAuthResLogService {
/**
* 新增操作日志
* @param unionEnterpriseAuthId
* @param resourceType UnionEnterpriseAuthResTypeEnum
* @param logContent 日志内容
* @return
*/
int saveUnionEnterpriseAuthResLog(Integer unionEnterpriseAuthId, Integer resourceType, String logContent);
/**
* 操作日志查询
* @param param
* @return
*/
Page<TabSysUnionEnterpriseAuthResLog> listUnionEnterpriseAuthResLog(UnionEnterpriseAuthResLogQO param);
}
......@@ -59,4 +59,12 @@ public class UnionEnterpriseAuthAppServiceImpl implements UnionEnterpriseAuthApp
public TabSysUnionEnterpriseAuthApp getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
return tabSysUnionEnterpriseAuthAppMapper.selectByPrimaryKey(unionEnterpriseAuthAppId);
}
@Override
public int deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
return tabSysUnionEnterpriseAuthAppMapper.updateByPrimaryKeySelective(new TabSysUnionEnterpriseAuthApp()
.setUpdateTime(new Date())
.setDeleteFlag(1)
.setUnionEnterpriseAuthAppId(unionEnterpriseAuthAppId));
}
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthDetailStatusEnum;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthResOperateEnum;
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 com.gic.enterprise.service.UnionEnterpriseAuthResLogService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,6 +21,8 @@ import java.util.Optional;
public class UnionEnterpriseAuthResDetailServiceImpl implements UnionEnterpriseAuthResDetailService{
@Autowired
private TabSysUnionEnterpriseAuthResDetailMapper tabSysUnionEnterpriseAuthResDetailMapper;
@Autowired
private UnionEnterpriseAuthResLogService unionEnterpriseAuthResLogService;
@Override
public List<TabSysUnionEnterpriseAuthResDetail> listUnionEnterpriseAuthResDetail(Integer unionEnterpriseAuthId, Integer authStatus) {
......@@ -51,6 +55,9 @@ public class UnionEnterpriseAuthResDetailServiceImpl implements UnionEnterpriseA
.setRemark("")
.setAuthKey("");
tabSysUnionEnterpriseAuthResDetailMapper.updateByPrimaryKeySelective(old);
//日志
unionEnterpriseAuthResLogService.saveUnionEnterpriseAuthResLog(unionEnterpriseAuthId,
old.getResourceType(), UnionEnterpriseAuthResOperateEnum.EDIT_RESOURCE_AREA.getMessage());
}
return;
}
......@@ -65,6 +72,25 @@ public class UnionEnterpriseAuthResDetailServiceImpl implements UnionEnterpriseA
.setResourceType(typeEnum.getCode())
.setAuthStatus(UnionEnterpriseAuthDetailStatusEnum.NO_AUTH.getCode());
tabSysUnionEnterpriseAuthResDetailMapper.insertSelective(record);
//日志
unionEnterpriseAuthResLogService.saveUnionEnterpriseAuthResLog(unionEnterpriseAuthId,
typeEnum.getCode(), UnionEnterpriseAuthResOperateEnum.UNION.getMessage());
}
}
@Override
public void relieveUnion(@NotNull Integer unionEnterpriseAuthId) {
List<TabSysUnionEnterpriseAuthResDetail> list = listUnionEnterpriseAuthResDetail(unionEnterpriseAuthId, null);
if (CollectionUtils.isNotEmpty(list)) {
for (TabSysUnionEnterpriseAuthResDetail temp : list) {
temp.setUpdateTime(new Date())
.setAuthStatus(UnionEnterpriseAuthDetailStatusEnum.TO_RELIEVE.getCode());
tabSysUnionEnterpriseAuthResDetailMapper.updateByPrimaryKeySelective(temp);
//日志
unionEnterpriseAuthResLogService.saveUnionEnterpriseAuthResLog(unionEnterpriseAuthId,
temp.getResourceType(), UnionEnterpriseAuthResOperateEnum.START_RELIEVE.getMessage());
}
}
}
......
package com.gic.enterprise.service.impl;
import com.gic.enterprise.dao.mapper.TabSysUnionEnterpriseAuthResLogMapper;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import com.gic.enterprise.service.UnionEnterpriseAuthResLogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
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/8 9:34 AM

*/
@Service("unionEnterpriseAuthResLogService")
public class UnionEnterpriseAuthResLogServiceImpl implements UnionEnterpriseAuthResLogService{
@Autowired
private TabSysUnionEnterpriseAuthResLogMapper tabSysUnionEnterpriseAuthResLogMapper;
@Override
public int saveUnionEnterpriseAuthResLog(Integer unionEnterpriseAuthId, Integer resourceType, String logContent) {
TabSysUnionEnterpriseAuthResLog record = new TabSysUnionEnterpriseAuthResLog();
Date now = new Date();
record.setUpdateTime(now)
.setCreateTime(now)
.setDeleteFlag(0)
.setUnionEnterpriseAuthId(unionEnterpriseAuthId)
.setResourceType(resourceType)
.setLogContent(logContent);
return tabSysUnionEnterpriseAuthResLogMapper.insertSelective(record);
}
@Override
public Page<TabSysUnionEnterpriseAuthResLog> listUnionEnterpriseAuthResLog(UnionEnterpriseAuthResLogQO param) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
List<TabSysUnionEnterpriseAuthResLog> list = tabSysUnionEnterpriseAuthResLogMapper.listUnionEnterpriseAuthResLog(param);
return (Page<TabSysUnionEnterpriseAuthResLog>) list;
}
}
package com.gic.enterprise.service.outer.impl.union;
import com.gic.api.base.commons.Page;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.ResourceGroupApiService;
import com.gic.auth.service.UserApiService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthResOperateEnum;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.union.*;
import com.gic.enterprise.entity.TabEnterprise;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResDetail;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import com.gic.enterprise.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -51,6 +55,8 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
private UserApiService userApiService;
@Autowired
private UnionEnterpriseAuthAppService unionEnterpriseAuthAppService;
@Autowired
private UnionEnterpriseAuthResLogService unionEnterpriseAuthResLogService;
@Override
public ServiceResponse<Void> saveUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId) {
......@@ -119,21 +125,27 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
//todo 重新授权
//门店资源
String authKey = detail.getAuthKey();
//日志
unionEnterpriseAuthResLogService.saveUnionEnterpriseAuthResLog(old.getUnionEnterpriseAuthId(),
resourceType, UnionEnterpriseAuthResOperateEnum.RE_AUTH.getMessage());
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> relieveUnion(Integer ownEnterpriseId, Integer unionEnterpriseId, String relieveReason) {
TabSysUnionEnterpriseAuth old = checkExistUnionEnterprise(ownEnterpriseId, unionEnterpriseId);
//todo 通知业务方
UnionEnterpriseAuthDTO dto = new UnionEnterpriseAuthDTO();
dto.setRelieveTime(new Date());
//除生效时间,保留X个自然日后开始解除资源
//除生效时间,保留X个自然日后开始解除资源
dto.setRelieveEffectDate(7);
dto.setRelieveRemark(relieveReason);
dto.setUnionEnterpriseAuthId(old.getUnionEnterpriseAuthId());
unionEnterpriseAuthService.update(dto);
//资源状态
unionEnterpriseAuthResDetailService.relieveUnion(old.getUnionEnterpriseAuthId());
return ServiceResponse.success();
}
......@@ -236,10 +248,7 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
@Override
public ServiceResponse<UnionEnterpriseAuthAppDTO> getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
TabSysUnionEnterpriseAuthApp old = unionEnterpriseAuthAppService.getUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
if (old == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "策略不存在");
}
TabSysUnionEnterpriseAuthApp old = checkUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
return ServiceResponse.success(EntityUtil.changeEntityNew(UnionEnterpriseAuthAppDTO.class, old));
}
......@@ -254,6 +263,13 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
@Override
public ServiceResponse<String> deleteUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
TabSysUnionEnterpriseAuthApp old = checkUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
unionEnterpriseAuthAppService.deleteUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
return ServiceResponse.success(old.getStrategyName());
}
@Override
public ServiceResponse<List<OwnEnterpriseAuthListDTO>> listOwnEnterpriseAuth(@NotNull Integer unionEnterpriseId, String startTime, String endTime) {
List<OwnEnterpriseAuthListDTO> list = unionEnterpriseAuthService.listOwnEnterpriseAuth(unionEnterpriseId, startTime, endTime);
if (CollectionUtils.isNotEmpty(list)) {
......@@ -284,6 +300,12 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
return ServiceResponse.success(Collections.emptyList());
}
@Override
public ServiceResponse<Page<UnionEnterpriseAuthResLogDTO>> listUnionEnterpriseAuthResLog(UnionEnterpriseAuthResLogQO param) {
com.github.pagehelper.Page page = unionEnterpriseAuthResLogService.listUnionEnterpriseAuthResLog(param);
return ServiceResponse.success(PageHelperUtils.changePageHelperToCurrentPage(page, UnionEnterpriseAuthResLogDTO.class));
}
private Map<Integer, TabEnterprise> getEnterprise(List<Integer> enterpriseIdList) {
List<TabEnterprise> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIdList);
if (CollectionUtils.isNotEmpty(enterpriseList)) {
......@@ -311,4 +333,12 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
return old;
}
private TabSysUnionEnterpriseAuthApp checkUnionEnterpriseAuthApp(Integer unionEnterpriseAuthAppId) {
TabSysUnionEnterpriseAuthApp old = unionEnterpriseAuthAppService.getUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
if (old == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "策略不存在");
}
return old;
}
}
package com.gic.enterprise.service.outer.impl.union;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.exception.CommonException;
import com.gic.enterprise.service.UnionEnterpriseAuthResDetailApiService;
import com.gic.enterprise.service.UnionEnterpriseAuthResDetailService;
import com.gic.enterprise.service.UnionEnterpriseAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
/**
* 联合资源回调接口
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/8 10:27 AM

*/
@Service("unionEnterpriseAuthResDetailApiService")
public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpriseAuthResDetailApiService{
@Autowired
private UnionEnterpriseAuthResDetailService unionEnterpriseAuthResDetailService;
@Autowired
private UnionEnterpriseAuthService unionEnterpriseAuthService;
@Override
public ServiceResponse<Void> authDataCallback() {
return null;
}
@Override
public ServiceResponse<Void> unionForStore(@NotNull Integer authStatus, @NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId) {
TabSysUnionEnterpriseAuth old = unionEnterpriseAuthService.getUnionEnterprise(ownEnterpriseId, unionEnterpriseId);
if (old == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在");
}
//todo starrynight
return ServiceResponse.success();
}
}
<?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.TabSysUnionEnterpriseAuthResLogMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog">
<id column="union_enterprise_auth_res_log_id" jdbcType="INTEGER" property="unionEnterpriseAuthResLogId" />
<result column="union_enterprise_auth_id" jdbcType="INTEGER" property="unionEnterpriseAuthId" />
<result column="resource_type" jdbcType="INTEGER" property="resourceType" />
<result column="log_content" jdbcType="VARCHAR" property="logContent" />
<result column="deal_start_time" jdbcType="TIMESTAMP" property="dealStartTime" />
<result column="deal_end_time" jdbcType="TIMESTAMP" property="dealEndTime" />
<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_log_id, union_enterprise_auth_id, resource_type, log_content,
deal_start_time, deal_end_time, 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_log
where union_enterprise_auth_res_log_id = #{unionEnterpriseAuthResLogId,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog">
insert into tab_sys_union_enterprise_auth_res_log (union_enterprise_auth_res_log_id, union_enterprise_auth_id,
resource_type, log_content, deal_start_time,
deal_end_time, create_time, update_time,
delete_flag)
values (#{unionEnterpriseAuthResLogId,jdbcType=INTEGER}, #{unionEnterpriseAuthId,jdbcType=INTEGER},
#{resourceType,jdbcType=INTEGER}, #{logContent,jdbcType=VARCHAR}, #{dealStartTime,jdbcType=TIMESTAMP},
#{dealEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{deleteFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog">
insert into tab_sys_union_enterprise_auth_res_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="unionEnterpriseAuthResLogId != null">
union_enterprise_auth_res_log_id,
</if>
<if test="unionEnterpriseAuthId != null">
union_enterprise_auth_id,
</if>
<if test="resourceType != null">
resource_type,
</if>
<if test="logContent != null">
log_content,
</if>
<if test="dealStartTime != null">
deal_start_time,
</if>
<if test="dealEndTime != null">
deal_end_time,
</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="unionEnterpriseAuthResLogId != null">
#{unionEnterpriseAuthResLogId,jdbcType=INTEGER},
</if>
<if test="unionEnterpriseAuthId != null">
#{unionEnterpriseAuthId,jdbcType=INTEGER},
</if>
<if test="resourceType != null">
#{resourceType,jdbcType=INTEGER},
</if>
<if test="logContent != null">
#{logContent,jdbcType=VARCHAR},
</if>
<if test="dealStartTime != null">
#{dealStartTime,jdbcType=TIMESTAMP},
</if>
<if test="dealEndTime != null">
#{dealEndTime,jdbcType=TIMESTAMP},
</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.TabSysUnionEnterpriseAuthResLog">
update tab_sys_union_enterprise_auth_res_log
<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="logContent != null">
log_content = #{logContent,jdbcType=VARCHAR},
</if>
<if test="dealStartTime != null">
deal_start_time = #{dealStartTime,jdbcType=TIMESTAMP},
</if>
<if test="dealEndTime != null">
deal_end_time = #{dealEndTime,jdbcType=TIMESTAMP},
</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_log_id = #{unionEnterpriseAuthResLogId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthResLog">
update tab_sys_union_enterprise_auth_res_log
set union_enterprise_auth_id = #{unionEnterpriseAuthId,jdbcType=INTEGER},
resource_type = #{resourceType,jdbcType=INTEGER},
log_content = #{logContent,jdbcType=VARCHAR},
deal_start_time = #{dealStartTime,jdbcType=TIMESTAMP},
deal_end_time = #{dealEndTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where union_enterprise_auth_res_log_id = #{unionEnterpriseAuthResLogId,jdbcType=INTEGER}
</update>
<select id="listUnionEnterpriseAuthResLog" resultMap="BaseResultMap" resultType="com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth_res_log
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
<if test="content != null">
and log_content like concat('%', #{content}, '%')
</if>
<if test="startTime">
and (deal_start_time >= #{startTime} or deal_end_time >= #{startTime})
</if>
<if test="endTime">
and (deal_start_time &lt;= #{endTime} or deal_end_time &lt;= #{endTime})
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.gic.enterprise.web.controller.union;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.enterprise.dto.union.OwnEnterpriseAuthListDTO;
import com.gic.enterprise.qo.union.UnionEnterpriseAuthResLogQO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -337,7 +339,7 @@ public class UnionEnterpriseAuthController {
}
@RequestMapping("auth-app-resource")
public RestResponse authAppResource(@RequestBody UnionEnterpriseAuthAppQO unionEnterpriseAuthAppQO) {
public RestResponse authAppResource(UnionEnterpriseAuthAppQO unionEnterpriseAuthAppQO) {
//app资源授权
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), unionEnterpriseAuthAppQO.getEnterpriseId());
if (old == null) {
......@@ -351,6 +353,14 @@ public class UnionEnterpriseAuthController {
unionEnterpriseAuthAppQO.getStrategyName());
}
@RequestMapping("delete-app-resource")
public RestResponse deleteAppResource(Integer unionEnterpriseAuthAppId) {
return OperationResultUtils.operationResult(
unionEnterpriseAuthApiService.deleteUnionEnterpriseAuthApp(unionEnterpriseAuthAppId),
"删除应用资源策略");
}
@RequestMapping("get-app-resource-detail")
public RestResponse getAppResourceDetail(Integer unionEnterpriseAuthAppId) {
return ResultControllerUtils.commonResultOne(unionEnterpriseAuthApiService
......@@ -475,16 +485,29 @@ public class UnionEnterpriseAuthController {
}
@RequestMapping("list-operation-log")
public RestResponse listOperationLog(Integer ownEnterpriseId, String logContent, String resourceTypeName, String startTime, String endTime) {
//todo starrynight
List<OwnEnterpriseOperationLogVO> list = new ArrayList<>();
return RestResponse.success(list);
public RestResponse listOperationLog(Integer ownEnterpriseId, UnionEnterpriseAuthResLogQO param) {
UnionEnterpriseAuthDTO old = getUnionEnterpriseAuth(ownEnterpriseId, UserDetailUtils.getUserDetail().getEnterpriseId());
if (old == null) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "联合商户不存在");
}
param.setUnionEnterpriseAuthId(old.getUnionEnterpriseAuthId());
return ResultControllerUtils.commonPageResult(unionEnterpriseAuthApiService.listUnionEnterpriseAuthResLog(param), OwnEnterpriseOperationLogVO.class);
}
@RequestMapping("get-last-union-info")
public RestResponse getLastUnionInfo() {
//todo starrynight
return RestResponse.success(new OwnEnterpriseUnionInfoVO());
ServiceResponse<List<OwnEnterpriseAuthListDTO>> response = unionEnterpriseAuthApiService
.listOwnEnterpriseAuth(UserDetailUtils.getUserDetail().getEnterpriseId(), null, null);
if (response.isSuccess()) {
List<UnionEnterpriseIndexVO> voList = response.getResult().stream()
.filter(e -> e != null)
.filter(e -> e.getLastUnionTime() != null)
.map(e -> EntityUtil.changeEntityNew(UnionEnterpriseIndexVO.class, e))
.collect(Collectors.toList());
voList.sort(Comparator.comparing(UnionEnterpriseIndexVO::getLastUnionTime).reversed());
return RestResponse.success(voList);
}
return RestResponse.failure(response.getCode(), response.getMessage());
}
......
package com.gic.enterprise.web.vo.union;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthResTypeEnum;
import java.io.Serializable;
import java.util.Date;
......@@ -24,7 +26,7 @@ public class OwnEnterpriseOperationLogVO implements Serializable{
private Date dealEndTime;
public String getResourceTypeName() {
return resourceTypeName;
return UnionEnterpriseAuthResTypeEnum.getMessage(resourceType);
}
public OwnEnterpriseOperationLogVO setResourceTypeName(String resourceTypeName) {
......
package com.gic.enterprise.web.vo.union;
import com.gic.enterprise.constant.union.UnionEnterpriseAuthResTypeEnum;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 联合商户首页显示自有商户列表
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/8 11:30 AM

*/
public class UnionEnterpriseIndexVO implements Serializable{
private static final long serialVersionUID = -7531909863237188767L;
private String userName;
private String phoneNumber;
/**
* 国际区号,如中国 86
*/
private String phoneAreaCode;
private String enterpriseName;
private String companyName;
private String address;
private String enterpriseId;
private String logo;
/**
* 最新联合完成时间(最后一项资源授权完毕时间
*/
private Date lastUnionTime;
private List<String> resourceName;
public String getUserName() {
return userName;
}
public UnionEnterpriseIndexVO setUserName(String userName) {
this.userName = userName;
return this;
}
public String getPhoneNumber() {
return phoneNumber;
}
public UnionEnterpriseIndexVO setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
public String getPhoneAreaCode() {
return phoneAreaCode;
}
public UnionEnterpriseIndexVO setPhoneAreaCode(String phoneAreaCode) {
this.phoneAreaCode = phoneAreaCode;
return this;
}
public String getEnterpriseName() {
return enterpriseName;
}
public UnionEnterpriseIndexVO setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
return this;
}
public String getCompanyName() {
return companyName;
}
public UnionEnterpriseIndexVO setCompanyName(String companyName) {
this.companyName = companyName;
return this;
}
public String getAddress() {
return address;
}
public UnionEnterpriseIndexVO setAddress(String address) {
this.address = address;
return this;
}
public String getEnterpriseId() {
return enterpriseId;
}
public UnionEnterpriseIndexVO setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public String getLogo() {
return logo;
}
public UnionEnterpriseIndexVO setLogo(String logo) {
this.logo = logo;
return this;
}
public Date getLastUnionTime() {
return lastUnionTime;
}
public UnionEnterpriseIndexVO setLastUnionTime(Date lastUnionTime) {
this.lastUnionTime = lastUnionTime;
return this;
}
public List<String> getResourceName() {
List<String> result = new ArrayList<>();
for (UnionEnterpriseAuthResTypeEnum type : UnionEnterpriseAuthResTypeEnum.values()) {
result.add(type.getMessage());
}
return result;
}
public UnionEnterpriseIndexVO setResourceName(List<String> resourceName) {
this.resourceName = resourceName;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseIndexVO{" +
"userName='" + userName + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", phoneAreaCode='" + phoneAreaCode + '\'' +
", enterpriseName='" + enterpriseName + '\'' +
", companyName='" + companyName + '\'' +
", address='" + address + '\'' +
", enterpriseId='" + enterpriseId + '\'' +
", logo='" + logo + '\'' +
", lastUnionTime=" + lastUnionTime +
", resourceName=" + resourceName +
'}';
}
}
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