Commit 9f9e7465 by guojuxing

应用策略接口

parent b1bf05d3
package com.gic.enterprise.dto.union;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 应用策略
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/5 10:01 AM

*/
public class UnionEnterpriseAuthAppDTO implements Serializable{
private static final long serialVersionUID = 5065082149450392146L;
/**
* id
*/
private Integer unionEnterpriseAuthAppId;
/**
* 联合商户授权主键ID,关联字段
*/
@NotNull(message = "联合商户主键不能为空")
private Integer unionEnterpriseAuthId;
/**
* 策略名称
*/
@NotBlank(message = "策略名称不能为空")
private String strategyName;
/**
* 应用ID,多选,英文逗号隔开
*/
@NotBlank(message = "应用不能为空")
private String appId;
/**
* 0:不授予 1:授予
*/
@NotNull(message = "授予标志不能为空")
private Integer appAuthStatus;
/**
* 所选资源组中的用户域中的域资源(mcu,fcu,acu,scu),json数组格式
*/
private String authData;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
}
public UnionEnterpriseAuthAppDTO setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public UnionEnterpriseAuthAppDTO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public String getStrategyName() {
return strategyName;
}
public UnionEnterpriseAuthAppDTO setStrategyName(String strategyName) {
this.strategyName = strategyName;
return this;
}
public String getAppId() {
return appId;
}
public UnionEnterpriseAuthAppDTO setAppId(String appId) {
this.appId = appId;
return this;
}
public Integer getAppAuthStatus() {
return appAuthStatus;
}
public UnionEnterpriseAuthAppDTO setAppAuthStatus(Integer appAuthStatus) {
this.appAuthStatus = appAuthStatus;
return this;
}
public String getAuthData() {
return authData;
}
public UnionEnterpriseAuthAppDTO setAuthData(String authData) {
this.authData = authData;
return this;
}
public Date getCreateTime() {
return createTime;
}
public UnionEnterpriseAuthAppDTO setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public UnionEnterpriseAuthAppDTO setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public UnionEnterpriseAuthAppDTO setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAuthAppDTO{" +
"unionEnterpriseAuthAppId=" + unionEnterpriseAuthAppId +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", strategyName='" + strategyName + '\'' +
", appId='" + appId + '\'' +
", appAuthStatus=" + appAuthStatus +
", authData='" + authData + '\'' +
", 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.UnionEnterpriseAuthAppDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthResDTO;
......@@ -67,4 +68,28 @@ public interface UnionEnterpriseAuthApiService {
* @return
*/
ServiceResponse<List<UnionEnterpriseAuthListDTO>> listUnionEnterpriseAuth(@NotNull Integer ownEnterpriseId, String enterpriseName, Integer authStatus);
/**************应用策略************************/
/**
* 新增/更新策略
* @param dto
* @return
*/
ServiceResponse<Void> saveOrUpdateUnionEnterpriseAuthApp(@Valid UnionEnterpriseAuthAppDTO dto);
/**
* 策略详情
* @param unionEnterpriseAuthAppId
* @return
*/
ServiceResponse<UnionEnterpriseAuthAppDTO> getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
/**
* 策略列表
* @param ownEnterpriseId
* @param unionEnterpriseId
* @return
*/
ServiceResponse<List<UnionEnterpriseAuthAppDTO>> listUnionEnterpriseAuthApp(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 应用策略
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/5 10:15 AM

*/
public interface TabSysUnionEnterpriseAuthAppMapper {
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabSysUnionEnterpriseAuthApp record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabSysUnionEnterpriseAuthApp record);
/**
* 根据主键查询
*
* @param unionEnterpriseAuthAppId 主键
* @return 实体对象
*/
TabSysUnionEnterpriseAuthApp selectByPrimaryKey(Integer unionEnterpriseAuthAppId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabSysUnionEnterpriseAuthApp record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabSysUnionEnterpriseAuthApp record);
/**
* 查询联合商户下面的应用策略列表
* @param unionEnterpriseAuthId
* @return
*/
List<TabSysUnionEnterpriseAuthApp> listUnionEnterpriseAuthApp(@Param("unionEnterpriseAuthId") Integer unionEnterpriseAuthId);
/**
* 策略名称
* @param unionEnterpriseAuthAppId
* @param unionEnterpriseAuthId
* @param strategyName
* @return
*/
int countRepeatStrategyName(@Param("unionEnterpriseAuthAppId") Integer unionEnterpriseAuthAppId,
@Param("unionEnterpriseAuthId") Integer unionEnterpriseAuthId,
@Param("strategyName") String strategyName);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* 应用策略
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/5 10:01 AM

*/
public class TabSysUnionEnterpriseAuthApp {
/**
* id
*/
private Integer unionEnterpriseAuthAppId;
/**
* 联合商户授权主键ID,关联字段
*/
private Integer unionEnterpriseAuthId;
/**
* 策略名称
*/
private String strategyName;
/**
* 应用ID,多选,英文逗号隔开
*/
private String appId;
/**
* 0:不授予 1:授予
*/
private Integer appAuthStatus;
/**
* 所选资源组中的用户域中的域资源(mcu,fcu,acu,scu),json数组格式
*/
private String authData;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 状态(0:正常;1:删除)
*/
private Integer deleteFlag;
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
}
public TabSysUnionEnterpriseAuthApp setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
}
public TabSysUnionEnterpriseAuthApp setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
return this;
}
public String getStrategyName() {
return strategyName;
}
public TabSysUnionEnterpriseAuthApp setStrategyName(String strategyName) {
this.strategyName = strategyName;
return this;
}
public String getAppId() {
return appId;
}
public TabSysUnionEnterpriseAuthApp setAppId(String appId) {
this.appId = appId;
return this;
}
public Integer getAppAuthStatus() {
return appAuthStatus;
}
public TabSysUnionEnterpriseAuthApp setAppAuthStatus(Integer appAuthStatus) {
this.appAuthStatus = appAuthStatus;
return this;
}
public String getAuthData() {
return authData;
}
public TabSysUnionEnterpriseAuthApp setAuthData(String authData) {
this.authData = authData;
return this;
}
public Date getCreateTime() {
return createTime;
}
public TabSysUnionEnterpriseAuthApp setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public TabSysUnionEnterpriseAuthApp setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public TabSysUnionEnterpriseAuthApp setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
return this;
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthAppDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 应用策略
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/5 10:06 AM

*/
public interface UnionEnterpriseAuthAppService {
/**
* 新增应用策略
* @param dto
* @return
*/
int saveUnionEnterpriseAuthApp(UnionEnterpriseAuthAppDTO dto);
/**
* 编辑应用策略
* @param dto
* @return
*/
int editUnionEnterpriseAuthApp(UnionEnterpriseAuthAppDTO dto);
/**
* 查询联合商户下面的应用策略列表
* @param unionEnterpriseAuthId
* @return
*/
List<TabSysUnionEnterpriseAuthApp> listUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthId);
/**
* 策略名称重复
* @param unionEnterpriseAuthAppId
* @param unionEnterpriseAuthId
* @param strategyName
* @return
*/
boolean isRepeatStrategyName(Integer unionEnterpriseAuthAppId, Integer unionEnterpriseAuthId, String strategyName);
/**
* 查询详情
* @param unionEnterpriseAuthAppId
* @return
*/
TabSysUnionEnterpriseAuthApp getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId);
}
package com.gic.enterprise.service.impl;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dao.mapper.TabSysUnionEnterpriseAuthAppMapper;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthAppDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp;
import com.gic.enterprise.service.UnionEnterpriseAuthAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* 应用策略
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/5 10:08 AM

*/
@Service("unionEnterpriseAuthAppService")
public class UnionEnterpriseAuthAppServiceImpl implements UnionEnterpriseAuthAppService{
@Autowired
private TabSysUnionEnterpriseAuthAppMapper tabSysUnionEnterpriseAuthAppMapper;
@Override
public int saveUnionEnterpriseAuthApp(UnionEnterpriseAuthAppDTO dto) {
Date now = new Date();
TabSysUnionEnterpriseAuthApp record = EntityUtil.changeEntityNew(TabSysUnionEnterpriseAuthApp.class, dto);
record.setCreateTime(now)
.setUpdateTime(now)
.setDeleteFlag(0);
return tabSysUnionEnterpriseAuthAppMapper.insert(record);
}
@Override
public int editUnionEnterpriseAuthApp(UnionEnterpriseAuthAppDTO dto) {
TabSysUnionEnterpriseAuthApp record = EntityUtil.changeEntityNew(TabSysUnionEnterpriseAuthApp.class, dto);
record.setUpdateTime(new Date());
return tabSysUnionEnterpriseAuthAppMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<TabSysUnionEnterpriseAuthApp> listUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthId) {
return tabSysUnionEnterpriseAuthAppMapper.listUnionEnterpriseAuthApp(unionEnterpriseAuthId);
}
@Override
public boolean isRepeatStrategyName(Integer unionEnterpriseAuthAppId, Integer unionEnterpriseAuthId, String strategyName) {
int count = tabSysUnionEnterpriseAuthAppMapper.countRepeatStrategyName(unionEnterpriseAuthAppId, unionEnterpriseAuthId, strategyName);
if (count > 9) {
return true;
}
return false;
}
@Override
public TabSysUnionEnterpriseAuthApp getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
return tabSysUnionEnterpriseAuthAppMapper.selectByPrimaryKey(unionEnterpriseAuthAppId);
}
}
......@@ -6,13 +6,11 @@ import com.gic.auth.service.ResourceGroupApiService;
import com.gic.auth.service.UserApiService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthListDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthResDetailDTO;
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.service.EnterpriseService;
import com.gic.enterprise.service.UnionEnterpriseAuthResDetailService;
import com.gic.enterprise.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,13 +20,11 @@ import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthResDTO;
import com.gic.enterprise.entity.TabSysUnionEnterpriseAuth;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.exception.CommonException;
import com.gic.enterprise.service.UnionEnterpriseAuthApiService;
import com.gic.enterprise.service.UnionEnterpriseAuthService;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.stream.Collectors;
......@@ -53,6 +49,8 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
private EnterpriseService enterpriseService;
@Autowired
private UserApiService userApiService;
@Autowired
private UnionEnterpriseAuthAppService unionEnterpriseAuthAppService;
@Override
public ServiceResponse<Void> saveUnionEnterprise(Integer ownEnterpriseId, Integer unionEnterpriseId) {
......@@ -194,6 +192,67 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
return ServiceResponse.success(Collections.emptyList());
}
@Override
public ServiceResponse<Void> saveOrUpdateUnionEnterpriseAuthApp(@Valid UnionEnterpriseAuthAppDTO dto) {
List<TabSysUnionEnterpriseAuthApp> appList = unionEnterpriseAuthAppService.listUnionEnterpriseAuthApp(dto.getUnionEnterpriseAuthId());
Set<String> appIdSet = new HashSet<>();
if (CollectionUtils.isNotEmpty(appIdSet)) {
appList.forEach(e -> {
String[] appIdArr = e.getAppId().split(",");
for (String appId : appIdArr) {
if (StringUtils.isBlank(appId)) {
continue;
}
appIdSet.add(appId);
}
});
}
String appIdParam = dto.getAppId();
String[] appIdParamArr = appIdParam.split(",");
for (String temp : appIdParamArr) {
if (StringUtils.isBlank(temp)) {
continue;
}
if (appIdSet.contains(temp)) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "应用已经配置策略");
}
}
Integer unionEnterpriseAuthAppId = dto.getUnionEnterpriseAuthAppId();
if (unionEnterpriseAuthAppService.isRepeatStrategyName(unionEnterpriseAuthAppId, dto.getUnionEnterpriseAuthId(), dto.getStrategyName())) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "策略名称重复");
}
if (unionEnterpriseAuthAppId == null) {
unionEnterpriseAuthAppService.saveUnionEnterpriseAuthApp(dto);
} else {
unionEnterpriseAuthAppService.editUnionEnterpriseAuthApp(dto);
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<UnionEnterpriseAuthAppDTO> getUnionEnterpriseAuthApp(@NotNull Integer unionEnterpriseAuthAppId) {
TabSysUnionEnterpriseAuthApp old = unionEnterpriseAuthAppService.getUnionEnterpriseAuthApp(unionEnterpriseAuthAppId);
if (old == null) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "策略不存在");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(UnionEnterpriseAuthAppDTO.class, old));
}
@Override
public ServiceResponse<List<UnionEnterpriseAuthAppDTO>> listUnionEnterpriseAuthApp(@NotNull Integer ownEnterpriseId, @NotNull Integer unionEnterpriseId) {
TabSysUnionEnterpriseAuth old = checkExistUnionEnterprise(ownEnterpriseId, unionEnterpriseId);
List<TabSysUnionEnterpriseAuthApp> list = unionEnterpriseAuthAppService.listUnionEnterpriseAuthApp(old.getUnionEnterpriseAuthId());
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(EntityUtil.changeEntityListNew(UnionEnterpriseAuthAppDTO.class, list));
}
return ServiceResponse.success(Collections.emptyList());
}
private Map<Integer, TabEnterprise> getEnterprise(List<Integer> enterpriseIdList) {
List<TabEnterprise> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIdList);
if (CollectionUtils.isNotEmpty(enterpriseList)) {
......
<?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.TabSysUnionEnterpriseAuthAppMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp">
<id column="union_enterprise_auth_app_id" jdbcType="INTEGER" property="unionEnterpriseAuthAppId" />
<result column="union_enterprise_auth_id" jdbcType="INTEGER" property="unionEnterpriseAuthId" />
<result column="strategy_name" jdbcType="VARCHAR" property="strategyName" />
<result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="app_auth_status" jdbcType="INTEGER" property="appAuthStatus" />
<result column="auth_data" jdbcType="VARCHAR" property="authData" />
<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_app_id, union_enterprise_auth_id, strategy_name, app_id, app_auth_status,
auth_data, 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_app
where union_enterprise_auth_app_id = #{unionEnterpriseAuthAppId,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp">
insert into tab_sys_union_enterprise_auth_app (union_enterprise_auth_app_id, union_enterprise_auth_id,
strategy_name, app_id, app_auth_status,
auth_data, create_time, update_time,
delete_flag)
values (#{unionEnterpriseAuthAppId,jdbcType=INTEGER}, #{unionEnterpriseAuthId,jdbcType=INTEGER},
#{strategyName,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{appAuthStatus,jdbcType=INTEGER},
#{authData,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{deleteFlag,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp">
insert into tab_sys_union_enterprise_auth_app
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="unionEnterpriseAuthAppId != null">
union_enterprise_auth_app_id,
</if>
<if test="unionEnterpriseAuthId != null">
union_enterprise_auth_id,
</if>
<if test="strategyName != null">
strategy_name,
</if>
<if test="appId != null">
app_id,
</if>
<if test="appAuthStatus != null">
app_auth_status,
</if>
<if test="authData != null">
auth_data,
</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="unionEnterpriseAuthAppId != null">
#{unionEnterpriseAuthAppId,jdbcType=INTEGER},
</if>
<if test="unionEnterpriseAuthId != null">
#{unionEnterpriseAuthId,jdbcType=INTEGER},
</if>
<if test="strategyName != null">
#{strategyName,jdbcType=VARCHAR},
</if>
<if test="appId != null">
#{appId,jdbcType=VARCHAR},
</if>
<if test="appAuthStatus != null">
#{appAuthStatus,jdbcType=INTEGER},
</if>
<if test="authData != null">
#{authData,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.TabSysUnionEnterpriseAuthApp">
update tab_sys_union_enterprise_auth_app
<set>
<if test="unionEnterpriseAuthId != null">
union_enterprise_auth_id = #{unionEnterpriseAuthId,jdbcType=INTEGER},
</if>
<if test="strategyName != null">
strategy_name = #{strategyName,jdbcType=VARCHAR},
</if>
<if test="appId != null">
app_id = #{appId,jdbcType=VARCHAR},
</if>
<if test="appAuthStatus != null">
app_auth_status = #{appAuthStatus,jdbcType=INTEGER},
</if>
<if test="authData != null">
auth_data = #{authData,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_app_id = #{unionEnterpriseAuthAppId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabSysUnionEnterpriseAuthApp">
update tab_sys_union_enterprise_auth_app
set union_enterprise_auth_id = #{unionEnterpriseAuthId,jdbcType=INTEGER},
strategy_name = #{strategyName,jdbcType=VARCHAR},
app_id = #{appId,jdbcType=VARCHAR},
app_auth_status = #{appAuthStatus,jdbcType=INTEGER},
auth_data = #{authData,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
delete_flag = #{deleteFlag,jdbcType=INTEGER}
where union_enterprise_auth_app_id = #{unionEnterpriseAuthAppId,jdbcType=INTEGER}
</update>
<select id="listUnionEnterpriseAuthApp" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_sys_union_enterprise_auth_app
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
</select>
<select id="countRepeatStrategyName" resultType="int">
select count(1) from tab_sys_union_enterprise_auth_app
where delete_flag = 0
and union_enterprise_auth_id = #{unionEnterpriseAuthId}
<if test="unionEnterpriseAuthAppId != null">
and union_enterprise_auth_app_id &lt;&gt; #{unionEnterpriseAuthAppId}
</if>
and strategy_name = #{strategyName}
</select>
</mapper>
\ No newline at end of file
......@@ -219,6 +219,12 @@
<artifactId>gic-spark-run-api</artifactId>
<version>${gic-spark-run-api}</version>
</dependency>
<!-- 配置gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
</dependencies>
<build>
......
package com.gic.enterprise.web.utils.union;
import com.gic.enterprise.web.vo.union.AppletsConfigSimpleOutputVO;
import com.gic.platform.member.constant.enums.CuTypeEnum;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 小程序域数据
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 1:42 PM

*/
public class AppletAreaData implements IUserAreaData<AppletsConfigSimpleOutputVO>{
@Override
public List<AppletsConfigSimpleOutputVO> getUserArea(Map<Integer, Object> areaMap, Map<String, Long[]> authDataArr) {
//小程序域
List<AppletsConfigSimpleOutputVO> appletAreaVoList = new ArrayList<>();
List<AppletsConfigSimpleOutputVO> appletArea = (List<AppletsConfigSimpleOutputVO>) areaMap.get(CuTypeEnum.ACU.getType());
Long[] appletAreaArr = authDataArr.get(CuTypeEnum.ACU.getType());
if (appletAreaArr != null) {
Map<Long, AppletsConfigSimpleOutputVO> appletAreaMap = appletArea.stream().collect(Collectors.toMap(AppletsConfigSimpleOutputVO::getAppletConfigId, e -> e));
if (appletArea != null) {
for (Long cu : appletAreaArr) {
if (appletAreaMap.containsKey(cu)) {
appletAreaVoList.add(appletAreaMap.get(cu));
}
}
}
}
return appletAreaVoList;
}
}
package com.gic.enterprise.web.utils.union;
import java.util.List;
import java.util.Map;
/**
* 资源组里面用户域的数据
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 11:39 AM

*/
public interface IUserAreaData<T> {
/**
* 用户域数据
* @param areaMap 联合商户资源组下面的用户域数据
* @param authDataArr 联合商户应用策略数据
* @return
*/
public List<T> getUserArea(Map<Integer, Object> areaMap, Map<String, Long[]> authDataArr);
}
package com.gic.enterprise.web.utils.union;
import com.gic.enterprise.web.vo.union.OwnerMemberCardVO;
import com.gic.platform.member.constant.enums.CuTypeEnum;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 会员卡域
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 1:38 PM

*/
public class MemberAreaData implements IUserAreaData<OwnerMemberCardVO>{
@Override
public List<OwnerMemberCardVO> getUserArea(Map<Integer, Object> areaMap, Map<String, Long[]> authDataArr) {
//会员卡域
List<OwnerMemberCardVO> memberAreaVoList = new ArrayList<>();
List<OwnerMemberCardVO> memberArea = (List<OwnerMemberCardVO>) areaMap.get(CuTypeEnum.MCU.getType());
Long[] memberCardIdArr = authDataArr.get(CuTypeEnum.MCU.getType());
if (memberCardIdArr != null) {
Map<Long, OwnerMemberCardVO> memberCardMap = memberArea.stream().collect(Collectors.toMap(OwnerMemberCardVO::getCardConfigId, e -> e));
if (memberArea != null) {
for (Long cu : memberCardIdArr) {
if (memberCardMap.containsKey(cu)) {
memberAreaVoList.add(memberCardMap.get(cu));
}
}
}
}
return memberAreaVoList;
}
}
package com.gic.enterprise.web.utils.union;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.gic.enterprise.web.vo.union.ServiceConfigSimpleOutputVO;
import com.gic.platform.member.constant.enums.CuTypeEnum;
/**
* 服务号
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/7 1:44 PM

*/
public class ServiceAreaData implements IUserAreaData<ServiceConfigSimpleOutputVO>{
@Override
public List<ServiceConfigSimpleOutputVO> getUserArea(Map<Integer, Object> areaMap, Map<String, Long[]> authDataArr) {
List<ServiceConfigSimpleOutputVO> areaVoList = new ArrayList<>();
List<ServiceConfigSimpleOutputVO> area = (List<ServiceConfigSimpleOutputVO>) areaMap.get(CuTypeEnum.SCU.getType());
Long[] areaArr = authDataArr.get(CuTypeEnum.SCU.getType());
if (areaArr != null) {
Map<Long, ServiceConfigSimpleOutputVO> serviceMap = area.stream().collect(Collectors.toMap(ServiceConfigSimpleOutputVO::getServiceConfigId, e -> e));
if (area != null) {
for (Long cu : areaArr) {
if (serviceMap.containsKey(cu)) {
areaVoList.add(serviceMap.get(cu));
}
}
}
}
return areaVoList;
}
}
package com.gic.enterprise.web.utils.union;
import com.gic.platform.member.constant.enums.CuTypeEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户域
* @ClassName:
* @Description: 

* @author guojuxing

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

*/
public class UserAeaUtils {
private static Map<Integer, IUserAreaData> map = new HashMap<>();
static {
map.put(CuTypeEnum.ACU.getType(), new AppletAreaData());
map.put(CuTypeEnum.MCU.getType(), new MemberAreaData());
map.put(CuTypeEnum.SCU.getType(), new ServiceAreaData());
}
/**
* 用户域数据
* @param userAreaType
* @param areaMap
* @param authDataArr
* @return
*/
public static List getUserArea(Integer userAreaType, Map<Integer, Object> areaMap, Map<String, Long[]> authDataArr) {
return map.get(userAreaType).getUserArea(areaMap, authDataArr);
}
}
package com.gic.enterprise.web.vo.union;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
/**
* 小程序
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/4 8:15 PM

*/
public class AppletsConfigSimpleOutputVO implements Serializable{
private static final long serialVersionUID = 7948742687277012473L;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long appletConfigId;
private String appletConfigName;
private String img;
private String appId;
private Integer enterpriseId;
private Integer statusFlag;
private String appletUserName;
public Long getAppletConfigId() {
return appletConfigId;
}
public AppletsConfigSimpleOutputVO setAppletConfigId(Long appletConfigId) {
this.appletConfigId = appletConfigId;
return this;
}
public String getAppletConfigName() {
return appletConfigName;
}
public AppletsConfigSimpleOutputVO setAppletConfigName(String appletConfigName) {
this.appletConfigName = appletConfigName;
return this;
}
public String getImg() {
return img;
}
public AppletsConfigSimpleOutputVO setImg(String img) {
this.img = img;
return this;
}
public String getAppId() {
return appId;
}
public AppletsConfigSimpleOutputVO setAppId(String appId) {
this.appId = appId;
return this;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public AppletsConfigSimpleOutputVO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public Integer getStatusFlag() {
return statusFlag;
}
public AppletsConfigSimpleOutputVO setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
return this;
}
public String getAppletUserName() {
return appletUserName;
}
public AppletsConfigSimpleOutputVO setAppletUserName(String appletUserName) {
this.appletUserName = appletUserName;
return this;
}
@Override
public String toString() {
return "AppletsConfigSimpleOutputVO{" +
"appletConfigId=" + appletConfigId +
", appletConfigName='" + appletConfigName + '\'' +
", img='" + img + '\'' +
", appId='" + appId + '\'' +
", enterpriseId=" + enterpriseId +
", statusFlag=" + statusFlag +
", appletUserName='" + appletUserName + '\'' +
'}';
}
}
package com.gic.enterprise.web.vo.union;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
/**
* 会员卡
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/4 8:12 PM

*/
public class OwnerMemberCardVO implements Serializable{
private static final long serialVersionUID = 4076098840726182684L;
/**
* 会员卡基本信息表主键
*/
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long cardConfigId;
private Integer ownerId;
private String cardCode;
private String cardName;
/**
* 1-自有,2-共享
*/
private Byte type;
public Long getCardConfigId() {
return cardConfigId;
}
public OwnerMemberCardVO setCardConfigId(Long cardConfigId) {
this.cardConfigId = cardConfigId;
return this;
}
public Integer getOwnerId() {
return ownerId;
}
public OwnerMemberCardVO setOwnerId(Integer ownerId) {
this.ownerId = ownerId;
return this;
}
public String getCardCode() {
return cardCode;
}
public OwnerMemberCardVO setCardCode(String cardCode) {
this.cardCode = cardCode;
return this;
}
public String getCardName() {
return cardName;
}
public OwnerMemberCardVO setCardName(String cardName) {
this.cardName = cardName;
return this;
}
public Byte getType() {
return type;
}
public OwnerMemberCardVO setType(Byte type) {
this.type = type;
return this;
}
@Override
public String toString() {
return "OwnerMemberCardVO{" +
"cardConfigId=" + cardConfigId +
", ownerId=" + ownerId +
", cardCode='" + cardCode + '\'' +
", cardName='" + cardName + '\'' +
", type=" + type +
'}';
}
}
package com.gic.enterprise.web.vo.union;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
/**
* 服务号
* @ClassName:
* @Description: 

* @author guojuxing

* @date 2021/2/4 8:17 PM

*/
public class ServiceConfigSimpleOutputVO implements Serializable{
private static final long serialVersionUID = 2615466789837414117L;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long serviceConfigId;
private String serviceConfigName;
private String appId;
/**
* 状态(1-初始化中,2-开放平台绑定中,3-正常,4-删除中,5-异常)
*/
private Integer statusFlag;
public Long getServiceConfigId() {
return serviceConfigId;
}
public ServiceConfigSimpleOutputVO setServiceConfigId(Long serviceConfigId) {
this.serviceConfigId = serviceConfigId;
return this;
}
public String getServiceConfigName() {
return serviceConfigName;
}
public ServiceConfigSimpleOutputVO setServiceConfigName(String serviceConfigName) {
this.serviceConfigName = serviceConfigName;
return this;
}
public String getAppId() {
return appId;
}
public ServiceConfigSimpleOutputVO setAppId(String appId) {
this.appId = appId;
return this;
}
public Integer getStatusFlag() {
return statusFlag;
}
public ServiceConfigSimpleOutputVO setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
return this;
}
@Override
public String toString() {
return "ServiceConfigSimpleOutputVO{" +
"serviceConfigId=" + serviceConfigId +
", serviceConfigName='" + serviceConfigName + '\'' +
", appId='" + appId + '\'' +
", statusFlag=" + statusFlag +
'}';
}
}
package com.gic.enterprise.web.vo.union;
import java.io.Serializable;
import java.util.List;
/**
* 应用资源
* @ClassName:
......@@ -16,15 +18,17 @@ public class UnionAppResourceListVO implements Serializable{
*/
private String strategyName;
private String appDesc;
private String authData;
private String appDetail;
private Integer unionEnterpriseAuthAppId;
private String resourceAreaDesc;
private List<OwnerMemberCardVO> memberArea;
private String authData;
private List<AppletsConfigSimpleOutputVO> appletArea;
private Integer unionEnterpriseAuthAppId;
private List<ServiceConfigSimpleOutputVO> serviceArea;
private List<UnionAppVO> appList;
public String getStrategyName() {
return strategyName;
......@@ -35,48 +39,57 @@ public class UnionAppResourceListVO implements Serializable{
return this;
}
public String getAppDesc() {
return appDesc;
public String getAuthData() {
return authData;
}
public UnionAppResourceListVO setAppDesc(String appDesc) {
this.appDesc = appDesc;
public UnionAppResourceListVO setAuthData(String authData) {
this.authData = authData;
return this;
}
public String getResourceAreaDesc() {
return resourceAreaDesc;
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
}
public UnionAppResourceListVO setResourceAreaDesc(String resourceAreaDesc) {
this.resourceAreaDesc = resourceAreaDesc;
public UnionAppResourceListVO setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
return this;
}
public String getAuthData() {
return authData;
public List<OwnerMemberCardVO> getMemberArea() {
return memberArea;
}
public UnionAppResourceListVO setAuthData(String authData) {
this.authData = authData;
public UnionAppResourceListVO setMemberArea(List<OwnerMemberCardVO> memberArea) {
this.memberArea = memberArea;
return this;
}
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
public List<AppletsConfigSimpleOutputVO> getAppletArea() {
return appletArea;
}
public UnionAppResourceListVO setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
public UnionAppResourceListVO setAppletArea(List<AppletsConfigSimpleOutputVO> appletArea) {
this.appletArea = appletArea;
return this;
}
public List<ServiceConfigSimpleOutputVO> getServiceArea() {
return serviceArea;
}
public UnionAppResourceListVO setServiceArea(List<ServiceConfigSimpleOutputVO> serviceArea) {
this.serviceArea = serviceArea;
return this;
}
public String getAppDetail() {
return appDetail;
public List<UnionAppVO> getAppList() {
return appList;
}
public UnionAppResourceListVO setAppDetail(String appDetail) {
this.appDetail = appDetail;
public UnionAppResourceListVO setAppList(List<UnionAppVO> appList) {
this.appList = appList;
return this;
}
......@@ -84,11 +97,12 @@ public class UnionAppResourceListVO implements Serializable{
public String toString() {
return "UnionAppResourceListVO{" +
"strategyName='" + strategyName + '\'' +
", appDesc='" + appDesc + '\'' +
", appDetail='" + appDetail + '\'' +
", resourceAreaDesc='" + resourceAreaDesc + '\'' +
", authData='" + authData + '\'' +
", unionEnterpriseAuthAppId=" + unionEnterpriseAuthAppId +
", memberArea=" + memberArea +
", appletArea=" + appletArea +
", serviceArea=" + serviceArea +
", appList=" + appList +
'}';
}
}
......@@ -24,6 +24,11 @@ public class UnionAppVO implements Serializable{
*/
private String name;
/**
* 应用图标链接
*/
private String iconUrl;
public Long getApplicationId() {
return applicationId;
}
......@@ -42,11 +47,21 @@ public class UnionAppVO implements Serializable{
return this;
}
public String getIconUrl() {
return iconUrl;
}
public UnionAppVO setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
return this;
}
@Override
public String toString() {
return "UnionAppVO{" +
"applicationId=" + applicationId +
", name='" + name + '\'' +
", iconUrl='" + iconUrl + '\'' +
'}';
}
}
......@@ -41,6 +41,11 @@ public class UnionEnterpriseAppResourceDetailVO implements Serializable{
*/
private Integer unionEnterpriseAuthId;
/**
* id
*/
private Integer unionEnterpriseAuthAppId;
public String getStrategyName() {
return strategyName;
}
......@@ -95,6 +100,15 @@ public class UnionEnterpriseAppResourceDetailVO implements Serializable{
return this;
}
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
}
public UnionEnterpriseAppResourceDetailVO setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAppResourceDetailVO{" +
......@@ -104,6 +118,7 @@ public class UnionEnterpriseAppResourceDetailVO implements Serializable{
", authData='" + authData + '\'' +
", enterpriseName='" + enterpriseName + '\'' +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", unionEnterpriseAuthAppId=" + unionEnterpriseAuthAppId +
'}';
}
}
......@@ -39,7 +39,11 @@ public class UnionEnterpriseAuthAppQO implements Serializable{
/**
* 联合商户主键
*/
private Integer unionEnterpriseAuthId;
private Integer enterpriseId;
/**
* id
*/
private Integer unionEnterpriseAuthAppId;
public String getStrategyName() {
return strategyName;
......@@ -86,12 +90,21 @@ public class UnionEnterpriseAuthAppQO implements Serializable{
return this;
}
public Integer getUnionEnterpriseAuthId() {
return unionEnterpriseAuthId;
public Integer getEnterpriseId() {
return enterpriseId;
}
public UnionEnterpriseAuthAppQO setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public Integer getUnionEnterpriseAuthAppId() {
return unionEnterpriseAuthAppId;
}
public UnionEnterpriseAuthAppQO setUnionEnterpriseAuthId(Integer unionEnterpriseAuthId) {
this.unionEnterpriseAuthId = unionEnterpriseAuthId;
public UnionEnterpriseAuthAppQO setUnionEnterpriseAuthAppId(Integer unionEnterpriseAuthAppId) {
this.unionEnterpriseAuthAppId = unionEnterpriseAuthAppId;
return this;
}
......@@ -103,7 +116,8 @@ public class UnionEnterpriseAuthAppQO implements Serializable{
", appAuthStatus=" + appAuthStatus +
", authData='" + authData + '\'' +
", enterpriseName='" + enterpriseName + '\'' +
", unionEnterpriseAuthId=" + unionEnterpriseAuthId +
", enterpriseId=" + enterpriseId +
", unionEnterpriseAuthAppId=" + unionEnterpriseAuthAppId +
'}';
}
}
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