Commit 6b6f7f28 by guojuxing

商户规则接口

parent 0f357dde
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 分类列表
* @ClassName: RuleClassifyListDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:02 PM

*/
@Accessors(chain = true)
@Data
public class RuleClassifyListDTO implements Serializable{
private static final long serialVersionUID = 6964223664642288932L;
/**
* 分类ID
*/
private Integer ruleId;
/**
* 分类名称
*/
private String ruleName;
/**
* 分类/场景描述
*/
private String ruleDesc;
/**
* 分类/场景备注
*/
private String remark;
/****************下面数据给商户规则配置使用**************/
/**
* 是否选中有效
*/
private Boolean select;
/**
* 分类下的场景列表
*/
private List<RuleClassifySceneListDTO> ruleClassifySceneList;
}
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 场景列表
* @ClassName: RuleClassifySceneListDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:06 PM

*/
@Accessors(chain = true)
@Data
public class RuleClassifySceneListDTO implements Serializable{
private static final long serialVersionUID = 4173483099328063614L;
/**
* 场景ID
*/
private Integer ruleId;
/**
* 场景名称(场景名称是冗余数据)
*/
private String ruleName;
/**
* 分类/场景描述
*/
private String ruleDesc;
/**
* 分类/场景备注
*/
private String remark;
/**
* 营销场景ID/code
*/
private String marketScene;
/**
* 营销对象 1:会员卡域 2:服务号域 3:小程序域
*/
private Integer marketObject;
/****************下面数据给商户规则配置使用**************/
/**
* 是否选中有效
*/
private Boolean select;
}
package com.gic.enterprise.dto.rule;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 商户规则
* @ClassName: RuleEnterpriseDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:20 PM

*/
@Accessors(chain = true)
@Data
public class RuleEnterpriseDTO implements Serializable{
private static final long serialVersionUID = -3847931338484539450L;
/**
*
*/
private Integer enterpriseRuleId;
/**
* 规则名称
*/
private String ruleName;
/**
* 1:部分商户 2:全部商户
*/
private Integer enterpriseType;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 选择部分商户的时候,英文逗号隔开
*/
private String enterpriseIds;
/**
* 平台规则树的,规则/分类/场景ID,英文逗号隔开
*/
private String ruleIds;
/***************************下面是前端展示字段*****************************/
/**
* 规则下商户个数
*/
private Integer countEnterpriseId;
/**
* 企业主键
*/
private Integer enterpriseId;
/**
* 商户名称
*/
private String enterpriseName;
/**
* 公司名称
*/
private String companyName;
/**
*
*/
private String logo;
}
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 商户规则和商户ID关联
* @ClassName: RuleEnterpriseRelDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:21 PM

*/
@Accessors(chain = true)
@Data
public class RuleEnterpriseRelDTO implements Serializable{
private static final long serialVersionUID = 2963511222727402738L;
/**
*
*/
private Integer enterpriseRelId;
/**
* 商户规则ID
*/
private Integer enterpriseRuleId;
/**
* 商户ID
*/
private Integer enterpriseId;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 应用(规则)列表
* @ClassName: RuleListDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:01 PM

*/
@Accessors(chain = true)
@Data
public class RuleListDTO implements Serializable{
private static final long serialVersionUID = -7830092576417787452L;
/**
* 规则ID
*/
private Integer ruleId;
/**
* 规则名称
*/
private String ruleName;
/**
* 规则类型:应用名称
*/
private String appName;
/**
* 规则类型:应用code
*/
private String appCode;
/**
* 是否选中有效
*/
private Boolean select;
/**
* 规则下面的分类列表
*/
private List<RuleClassifyListDTO> ruleClassifyList;
}
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 商户规则和平台规则树关联
* @ClassName: RuleRelDTO

* @Description: 

* @author guojuxing

* @date 2020/3/4 3:22 PM

*/
@Accessors(chain = true)
@Data
public class RuleRelDTO implements Serializable{
private static final long serialVersionUID = 6516187788186040350L;
/**
*
*/
private Integer ruleRelId;
/**
* 商户规则ID
*/
private Integer enterpriseRuleId;
/**
* 平台规则/分类/场景ID
*/
private Integer ruleId;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
......@@ -2,10 +2,7 @@ package com.gic.enterprise.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.rule.ConfigRuleDTO;
import com.gic.enterprise.dto.rule.RuleClassifyDTO;
import com.gic.enterprise.dto.rule.RuleClassifySceneDTO;
import com.gic.enterprise.dto.rule.RuleDTO;
import com.gic.enterprise.dto.rule.*;
import java.util.List;
......@@ -107,4 +104,36 @@ public interface ConfigRuleApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Integer> copyRule(Integer ruleId);
/**
* 规则树
* @Title: getRuleTree

* @Description:

* @author guojuxing
* @param search
应用名称/规则名称/分类名称/场景名称
* @param enterpriseRuleId 商户规则ID 如果有值,查询的是有勾选的规则树数据
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.rule.RuleListDTO>>


*/
ServiceResponse<List<RuleListDTO>> getRuleTree(String search, Integer enterpriseRuleId);
/***************对接其他组*******************/
/**
* 应用code查询下面分类列表
* @Title: listRuleClassifyByAppCode

* @Description:

* @author guojuxing
* @param appCode
应用code
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.rule.RuleClassifyListDTO>>


*/
ServiceResponse<List<RuleClassifyListDTO>> listRuleClassifyByAppCode(String appCode);
/**
* 根据分类ID查询场景列表
* @Title: listRuleSceneByRuleClassifyId

* @Description:

* @author guojuxing
* @param ruleClassifyId
分类ID
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.rule.RuleClassifyListDTO>>


*/
ServiceResponse<List<RuleClassifySceneListDTO>> listRuleSceneByRuleClassifyId(Integer ruleClassifyId);
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.rule.RuleEnterpriseDTO;
public interface ConfigRuleEnterpriseApiService {
/**
* 新增商户规则
* @Title: save

* @Description:

* @author guojuxing
* @param dto

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>


*/
ServiceResponse<Integer> save(RuleEnterpriseDTO dto);
ServiceResponse<Integer> edit(RuleEnterpriseDTO dto);
/**
* 删除商户规则
* @Title: deleteEnterpriseRule

* @Description:

* @author guojuxing
* @param enterpriseRuleId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


*/
ServiceResponse<String> deleteEnterpriseRule(Integer enterpriseRuleId);
/**
* 规则中移除商户
* @Title: removeEnterprise

* @Description:

* @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<java.lang.String>


*/
ServiceResponse<String> removeEnterprise(Integer enterpriseId);
/**
* 规则列表
* @Title: listRule

* @Description:

* @author guojuxing 

* @param search 规则名称/商户名称/公司名称
* @param pageNum
* @param pageSize
* @return java.util.List<com.gic.enterprise.dto.rule.RuleEnterpriseDTO>


*/
ServiceResponse<Page<RuleEnterpriseDTO>> listRule(String search, Integer pageNum, Integer pageSize);
/**
* 商户列表
* @Title: listEnterpriseRule

* @Description:

* @author guojuxing 

* @param search 商户名称/公司名称
* @param enterpriseRuleId 商户规则ID
* @param pageNum
* @param pageSize
* @return java.util.List<com.gic.enterprise.dto.rule.RuleEnterpriseDTO>


*/
ServiceResponse<Page<RuleEnterpriseDTO>> listEnterpriseRule(String search, Integer enterpriseRuleId,
Integer pageNum, Integer pageSize);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.dto.rule.RuleEnterpriseDTO;
import com.gic.enterprise.entity.TabConfigRuleEnterprise;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabConfigRuleEnterpriseMapper {
/**
* 根据主键删除
*
* @param enterpriseRuleId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer enterpriseRuleId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabConfigRuleEnterprise record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabConfigRuleEnterprise record);
/**
* 根据主键查询
*
* @param enterpriseRuleId 主键
* @return 实体对象
*/
TabConfigRuleEnterprise selectByPrimaryKey(Integer enterpriseRuleId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabConfigRuleEnterprise record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabConfigRuleEnterprise record);
int countRepeatName(@Param("enterpriseRuleId") Integer enterpriseRuleId, @Param("ruleName") String ruleName);
List<RuleEnterpriseDTO> listRule(String search);
List<RuleEnterpriseDTO> listEnterpriseRule(@Param("enterpriseRuleId") Integer enterpriseRuleId, @Param("search") String search);
}
\ No newline at end of file
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabConfigRuleEnterpriseRel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabConfigRuleEnterpriseRelMapper {
/**
* 根据主键删除
*
* @param enterpriseRelId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer enterpriseRelId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabConfigRuleEnterpriseRel record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabConfigRuleEnterpriseRel record);
/**
* 根据主键查询
*
* @param enterpriseRelId 主键
* @return 实体对象
*/
TabConfigRuleEnterpriseRel selectByPrimaryKey(Integer enterpriseRelId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabConfigRuleEnterpriseRel record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabConfigRuleEnterpriseRel record);
void insertBatch(@Param("list") List<TabConfigRuleEnterpriseRel> list);
void deleteByEnterpriseRuleId(Integer enterpriseRuleId);
void deleteByEnterpriseIdList(@Param("list") List<Integer> enterpriseIdList);
}
\ No newline at end of file
......@@ -57,6 +57,14 @@ public interface TabConfigRuleMapper {
int countRepeatName(@Param("ruleId") Integer ruleId, @Param("ruleLevel") Integer ruleLevel,
@Param("name") String name, @Param("parentRuleId") Integer parentRuleId);
int countRepeatAppCode(@Param("ruleId") Integer ruleId, @Param("appCode") String appCode);
List<TabConfigRule> listRule(@Param("search") String search, @Param("ruleLevel") Integer ruleLevel,
@Param("ruleId") Integer ruleId);
List<TabConfigRule> listAll(@Param("ruleId") Integer ruleId);
List<TabConfigRule> getRuleTreeByName(String search);
TabConfigRule getByAppCode(String appCode);
}
\ 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.TabConfigRuleRel;
public interface TabConfigRuleRelMapper {
/**
* 根据主键删除
*
* @param ruleRelId 主键
* @return 更新条目数
*/
int deleteByPrimaryKey(Integer ruleRelId);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabConfigRuleRel record);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabConfigRuleRel record);
/**
* 根据主键查询
*
* @param ruleRelId 主键
* @return 实体对象
*/
TabConfigRuleRel selectByPrimaryKey(Integer ruleRelId);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabConfigRuleRel record);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabConfigRuleRel record);
void insertBatch(@Param("list") List<TabConfigRuleRel> list);
void deleteByEnterpriseRuleId(Integer enterpriseRuleId);
List<TabConfigRuleRel> listRuleRel(Integer enterpriseRuleId);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* tab_config_rule_enterprise
*/
@Accessors(chain = true)
@Data
public class TabConfigRuleEnterprise {
/**
*
*/
private Integer enterpriseRuleId;
/**
* 规则名称
*/
private String ruleName;
/**
* 1:部分商户 2:全部商户
*/
private Integer enterpriseType;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
\ No newline at end of file
package com.gic.enterprise.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* tab_config_rule_enterprise_rel
*/
@Accessors(chain = true)
@Data
public class TabConfigRuleEnterpriseRel {
/**
*
*/
private Integer enterpriseRelId;
/**
* 商户规则ID
*/
private Integer enterpriseRuleId;
/**
* 商户ID
*/
private Integer enterpriseId;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
\ No newline at end of file
package com.gic.enterprise.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* tab_config_rule_rel
*/
@Accessors(chain = true)
@Data
public class TabConfigRuleRel {
/**
*
*/
private Integer ruleRelId;
/**
* 商户规则ID
*/
private Integer enterpriseRuleId;
/**
* 平台规则/分类/场景ID
*/
private Integer ruleId;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
\ No newline at end of file
package com.gic.enterprise.service;
import java.util.List;
import com.gic.enterprise.dto.rule.RuleEnterpriseDTO;
import com.gic.enterprise.entity.TabConfigRuleEnterprise;
import com.gic.enterprise.entity.TabConfigRuleEnterpriseRel;
import com.gic.enterprise.entity.TabConfigRuleRel;
import com.github.pagehelper.Page;
public interface ConfigRuleEnterpriseService {
/**
* 新增商户规则
* @Title: save

* @Description:

* @author guojuxing
* @param dto

* @return java.lang.Integer


*/
Integer save(RuleEnterpriseDTO dto);
void update(TabConfigRuleEnterprise record);
TabConfigRuleEnterprise getByEnterpriseRuleId(Integer enterpriseRuleId);
/**
* 是否重复名称
* @Title: isRepeatName

* @Description:

* @author guojuxing
* @param enterpriseRuleId
* @param ruleName

* @return boolean


*/
boolean isRepeatName(Integer enterpriseRuleId, String ruleName);
/**
* 批量新增商户和规则关联数据
* @Title: insertBatch

* @Description:

* @author guojuxing
* @param list

* @return void


*/
void insertBatch(List<TabConfigRuleEnterpriseRel> list);
/**
* 解绑规则的旧关联
* @Title: deleteByEnterpriseRuleId

* @Description:

* @author guojuxing
* @param enterpriseRuleId

* @return void


*/
void deleteByEnterpriseRuleId(Integer enterpriseRuleId);
/**
* 解绑商户之前的旧关联
* @Title: deleteByEnterpriseIdList

* @Description:

* @author guojuxing
* @param enterpriseIdList

* @return void


*/
void deleteByEnterpriseIdList(List<Integer> enterpriseIdList);
/**
* 解绑规则树和商户规则的关联
* @Title: deleteByEnterpriseRuleIdForRuleRel

* @Description:

* @author guojuxing
* @param enterpriseRuleId

* @return void


*/
void deleteByEnterpriseRuleIdForRuleRel(Integer enterpriseRuleId);
/**
* 批量新增规则树和商户规则的关联
* @Title: insertBatchForRuleRel

* @Description:

* @author guojuxing
* @param list

* @return void


*/
void insertBatchForRuleRel(List<TabConfigRuleRel> list);
/**
* 规则列表
* @Title: listRule

* @Description:

* @author guojuxing 

* @param search 规则名称/商户名称/公司名称
* @param pageNum
* @param pageSize
* @return java.util.List<com.gic.enterprise.dto.rule.RuleEnterpriseDTO>


*/
Page<RuleEnterpriseDTO> listRule(String search, Integer pageNum, Integer pageSize);
/**
* 商户列表
* @Title: listEnterpriseRule

* @Description:

* @author guojuxing 

* @param search 商户名称/公司名称
* @param enterpriseRuleId 商户规则ID
* @param pageNum
* @param pageSize
* @return java.util.List<com.gic.enterprise.dto.rule.RuleEnterpriseDTO>


*/
Page<RuleEnterpriseDTO> listEnterpriseRule(String search, Integer enterpriseRuleId, Integer pageNum, Integer pageSize);
/**
* 查询规则树数据
* @Title: listRuleRel

* @Description:

* @author guojuxing
* @param enterpriseRuleId

* @return java.util.List<com.gic.enterprise.entity.TabConfigRuleRel>


*/
List<TabConfigRuleRel> listRuleRel(Integer enterpriseRuleId);
}
......@@ -59,6 +59,8 @@ public interface ConfigRuleService {
*/
boolean isRepeatName(Integer ruleId, Integer ruleLevel, String name, Integer parentRuleId);
boolean isRepeatAppCode(Integer ruleId, String appCode);
/**
* 分页查询
* @Title: listRule

......@@ -74,4 +76,26 @@ public interface ConfigRuleService {
Page<TabConfigRule> listRule(String search, Integer ruleLevel, Integer ruleId, Integer pageNum, Integer pageSize);
List<TabConfigRule> listRule(String search, Integer ruleLevel, Integer ruleId);
List<TabConfigRule> listAll(Integer ruleId);
/**
* 应用code查询第一层规则
* @Title: getByAppCode

* @Description:

* @author guojuxing
* @param appCode

* @return com.gic.enterprise.entity.TabConfigRule


*/
TabConfigRule getByAppCode(String appCode);
/**
* 名称查询规则树
* @Title: getRuleTreeByName

* @Description:

* @author guojuxing
* @param search

* @return java.util.List<com.gic.enterprise.entity.TabConfigRule>


*/
List<TabConfigRule> getRuleTreeByName(String search);
}
package com.gic.enterprise.service.impl;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dao.mapper.TabConfigRuleEnterpriseMapper;
import com.gic.enterprise.dao.mapper.TabConfigRuleEnterpriseRelMapper;
import com.gic.enterprise.dao.mapper.TabConfigRuleRelMapper;
import com.gic.enterprise.dto.rule.RuleEnterpriseDTO;
import com.gic.enterprise.entity.TabConfigRuleEnterprise;
import com.gic.enterprise.entity.TabConfigRuleEnterpriseRel;
import com.gic.enterprise.entity.TabConfigRuleRel;
import com.gic.enterprise.service.ConfigRuleEnterpriseService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service("configRuleEnterpriseService")
public class ConfigRuleEnterpriseServiceImpl implements ConfigRuleEnterpriseService{
@Autowired
private TabConfigRuleEnterpriseMapper tabConfigRuleEnterpriseMapper;
@Autowired
private TabConfigRuleEnterpriseRelMapper tabConfigRuleEnterpriseRelMapper;
@Autowired
private TabConfigRuleRelMapper tabConfigRuleRelMapper;
@Override
public Integer save(RuleEnterpriseDTO dto) {
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
dto.setStatus(1);
TabConfigRuleEnterprise record = EntityUtil.changeEntityNew(TabConfigRuleEnterprise.class, dto);
tabConfigRuleEnterpriseMapper.insert(record);
return record.getEnterpriseRuleId();
}
@Override
public void update(TabConfigRuleEnterprise record) {
record.setUpdateTime(new Date());
tabConfigRuleEnterpriseMapper.updateByPrimaryKeySelective(record);
}
@Override
public TabConfigRuleEnterprise getByEnterpriseRuleId(Integer enterpriseRuleId) {
return tabConfigRuleEnterpriseMapper.selectByPrimaryKey(enterpriseRuleId);
}
@Override
public boolean isRepeatName(Integer enterpriseRuleId, String ruleName) {
int count = tabConfigRuleEnterpriseMapper.countRepeatName(enterpriseRuleId, ruleName);
if (count > 0) {
return true;
}
return false;
}
@Override
public void insertBatch(List<TabConfigRuleEnterpriseRel> list) {
tabConfigRuleEnterpriseRelMapper.insertBatch(list);
}
@Override
public void deleteByEnterpriseRuleId(Integer enterpriseRuleId) {
tabConfigRuleEnterpriseRelMapper.deleteByEnterpriseRuleId(enterpriseRuleId);
}
@Override
public void deleteByEnterpriseIdList(List<Integer> enterpriseIdList) {
if (CollectionUtils.isEmpty(enterpriseIdList)) {
return;
}
tabConfigRuleEnterpriseRelMapper.deleteByEnterpriseIdList(enterpriseIdList);
}
@Override
public void deleteByEnterpriseRuleIdForRuleRel(Integer enterpriseRuleId) {
tabConfigRuleRelMapper.deleteByEnterpriseRuleId(enterpriseRuleId);
}
@Override
public void insertBatchForRuleRel(List<TabConfigRuleRel> list) {
tabConfigRuleRelMapper.insertBatch(list);
}
@Override
public Page<RuleEnterpriseDTO> listRule(String search, Integer pageNum, Integer pageSize) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
pageSize = 20;
}
PageHelper.startPage(pageNum, pageSize);
List<RuleEnterpriseDTO> list = tabConfigRuleEnterpriseMapper.listRule(search);
return (Page<RuleEnterpriseDTO>) list;
}
@Override
public Page<RuleEnterpriseDTO> listEnterpriseRule(String search, Integer enterpriseRuleId, Integer pageNum, Integer pageSize) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
pageSize = 20;
}
PageHelper.startPage(pageNum, pageSize);
List<RuleEnterpriseDTO> list = tabConfigRuleEnterpriseMapper.listEnterpriseRule(enterpriseRuleId, search);
return (Page<RuleEnterpriseDTO>) list;
}
@Override
public List<TabConfigRuleRel> listRuleRel(Integer enterpriseRuleId) {
return tabConfigRuleRelMapper.listRuleRel(enterpriseRuleId);
}
}
......@@ -56,6 +56,15 @@ public class ConfigRuleServiceImpl implements ConfigRuleService{
}
@Override
public boolean isRepeatAppCode(Integer ruleId, String appCode) {
int count = tabConfigRuleMapper.countRepeatAppCode(ruleId, appCode);
if (count > 0) {
return true;
}
return false;
}
@Override
public Page<TabConfigRule> listRule(String search, Integer ruleLevel, Integer ruleId, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<TabConfigRule> list = tabConfigRuleMapper.listRule(search, ruleLevel, ruleId);
......@@ -67,6 +76,21 @@ public class ConfigRuleServiceImpl implements ConfigRuleService{
return tabConfigRuleMapper.listRule(search, ruleLevel, ruleId);
}
@Override
public List<TabConfigRule> listAll(Integer ruleId) {
return tabConfigRuleMapper.listAll(ruleId);
}
@Override
public TabConfigRule getByAppCode(String appCode) {
return tabConfigRuleMapper.getByAppCode(appCode);
}
@Override
public List<TabConfigRule> getRuleTreeByName(String search) {
return tabConfigRuleMapper.getRuleTreeByName(search);
}
private Integer save(TabConfigRule record) {
record.setStatus(1);
record.setCreateTime(new Date());
......
......@@ -122,6 +122,7 @@
<dubbo:service interface="com.gic.enterprise.service.AppletDecorationConfigApiService" ref="appletDecorationConfigApiService" timeout="6000" />
<!--平台规则配置-->
<dubbo:service interface="com.gic.enterprise.service.ConfigRuleApiService" ref="configRuleApiService" timeout="6000" />
<dubbo:service interface="com.gic.enterprise.service.ConfigRuleEnterpriseApiService" ref="configRuleEnterpriseApiService" timeout="6000" />
<dubbo:reference interface="com.gic.mall.share.api.service.ShopApiService" id="shopApiService" timeout="6000" />
......
<?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.TabConfigRuleEnterpriseMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabConfigRuleEnterprise">
<id column="enterprise_rule_id" jdbcType="INTEGER" property="enterpriseRuleId" />
<result column="rule_name" jdbcType="VARCHAR" property="ruleName" />
<result column="enterprise_type" jdbcType="INTEGER" property="enterpriseType" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
enterprise_rule_id, rule_name, enterprise_type, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_config_rule_enterprise
where enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_config_rule_enterprise
where enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterprise" useGeneratedKeys="true" keyProperty="enterpriseRuleId">
insert into tab_config_rule_enterprise (enterprise_rule_id, rule_name, enterprise_type,
status, create_time, update_time
)
values (#{enterpriseRuleId,jdbcType=INTEGER}, #{ruleName,jdbcType=VARCHAR}, #{enterpriseType,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterprise">
insert into tab_config_rule_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseRuleId != null">
enterprise_rule_id,
</if>
<if test="ruleName != null">
rule_name,
</if>
<if test="enterpriseType != null">
enterprise_type,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseRuleId != null">
#{enterpriseRuleId,jdbcType=INTEGER},
</if>
<if test="ruleName != null">
#{ruleName,jdbcType=VARCHAR},
</if>
<if test="enterpriseType != null">
#{enterpriseType,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterprise">
update tab_config_rule_enterprise
<set>
<if test="ruleName != null">
rule_name = #{ruleName,jdbcType=VARCHAR},
</if>
<if test="enterpriseType != null">
enterprise_type = #{enterpriseType,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterprise">
update tab_config_rule_enterprise
set rule_name = #{ruleName,jdbcType=VARCHAR},
enterprise_type = #{enterpriseType,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER}
</update>
<select id="countRepeatName">
select count(1) from tab_config_rule_enterprise
where status = 1
and rule_name = #{ruleName}
<if test="enterpriseRuleId != null">
and enterprise_rule_id &lt;&gt; #{enterpriseRuleId}
</if>
</select>
<select id="listRule" parameterType="com.gic.enterprise.dto.rule.RuleEnterpriseDTO">
select t1.rule_name ruleName, count(DISTINCT enterprise_id) countEnterpriseId
from tab_config_rule_enterprise t
left join tab_config_rule_enterprise_rel t2 on t1.enterprise_rule_id = t2.enterprise_rule_id
<if test="search != null and search != '' ">
left join tab_enterprise t3 on t2.enterprise_id = t3.enterprise_id
</if>
where t1.status = 1
and t2.status = 1
<if test="search != null and search != '' ">
and ( t1.rule_name like concat('%', #{search}, '%')
or t3.enterprise_name like concat('%', #{search}, '%')
or t3.company_name like concat('%', #{search}, '%') )
</if>
order by t1.create_time desc
</select>
<select id="listEnterpriseRule" parameterType="com.gic.enterprise.dto.rule.RuleEnterpriseDTO">
select t2.enterprise_name enterpriseName, t2.company_name companyName, t2.logo logo
from tab_config_rule_enterprise_rel t1
left join tab_enterprise t2 on t1.enterprise_id = t2.enterprise_id
where t1.status = 1
and t2.status = 1
and t1.enterprise_rule_id = #{enterpriseRuleId}
<if test="search != null and search != '' ">
and ( t2.enterprise_name like concat('%', #{search}, '%')
or t2.company_name like concat('%', #{search}, '%') )
</if>
order by t1.create_time desc
</select>
</mapper>
\ No newline at end of file
<?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.TabConfigRuleEnterpriseRelMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabConfigRuleEnterpriseRel">
<id column="enterprise_rel_id" jdbcType="INTEGER" property="enterpriseRelId" />
<result column="enterprise_rule_id" jdbcType="INTEGER" property="enterpriseRuleId" />
<result column="enterprise_id" jdbcType="INTEGER" property="enterpriseId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
enterprise_rel_id, enterprise_rule_id, enterprise_id, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_config_rule_enterprise_rel
where enterprise_rel_id = #{enterpriseRelId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_config_rule_enterprise_rel
where enterprise_rel_id = #{enterpriseRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterpriseRel">
insert into tab_config_rule_enterprise_rel (enterprise_rel_id, enterprise_rule_id,
enterprise_id, status, create_time,
update_time)
values (#{enterpriseRelId,jdbcType=INTEGER}, #{enterpriseRuleId,jdbcType=INTEGER},
#{enterpriseId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterpriseRel">
insert into tab_config_rule_enterprise_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseRelId != null">
enterprise_rel_id,
</if>
<if test="enterpriseRuleId != null">
enterprise_rule_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseRelId != null">
#{enterpriseRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseRuleId != null">
#{enterpriseRuleId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterpriseRel">
update tab_config_rule_enterprise_rel
<set>
<if test="enterpriseRuleId != null">
enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where enterprise_rel_id = #{enterpriseRelId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabConfigRuleEnterpriseRel">
update tab_config_rule_enterprise_rel
set enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where enterprise_rel_id = #{enterpriseRelId,jdbcType=INTEGER}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into tab_config_rule_enterprise_rel (enterprise_rel_id, enterprise_rule_id,
enterprise_id, status, create_time,
update_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.enterpriseRelId},
#{item.enterpriseRuleId},
#{item.enterpriseId},
#{item.status},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
<update id="deleteByEnterpriseRuleId">
update tab_config_rule_enterprise_rel set status = 0
where status = 1
and enterprise_rule_id = #{enterpriseRuleId}
</update>
<update id="deleteByEnterpriseIdList">
update tab_config_rule_enterprise_rel set status = 0
where status = 1
and enterprise_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
......@@ -22,6 +22,11 @@
rule_id, rule_name, app_name, app_code, classify_icon, rule_desc, remark, market_scene, market_object,
parent_rule_id, rule_level, rule_chain, status, create_time, update_time
</sql>
<sql id="Base_Column_List_alias">
${alias}.rule_id, ${alias}.rule_name, ${alias}.app_name, ${alias}.app_code, ${alias}.classify_icon,
${alias}.rule_desc, ${alias}.remark, ${alias}.market_scene, ${alias}.market_object,
${alias}.parent_rule_id, ${alias}.rule_level, ${alias}.rule_chain, ${alias}.status, ${alias}.create_time, ${alias}.update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......@@ -228,6 +233,16 @@
</if>
</select>
<select id="countRepeatAppCode" resultType="int">
select count(1) from tab_config_rule
where status = 1
and app_code = #{appCode}
and rule_level = 1
<if test="ruleId != null">
and rule_id &lt;&gt; #{ruleId}
</if>
</select>
<select id="listRule" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_config_rule
......@@ -241,4 +256,43 @@
</if>
order by create_time desc
</select>
<select id="listAll" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_config_rule
where status = 1
<if test="ruleId != null">
and parent_rule_id = #{ruleId}
</if>
</select>
<select id="getRuleTreeByName" resultMap="BaseResultMap">
select <include refid="Base_Column_List_alias"><property name="alias" value="t2"></property></include>
from
(
SELECT
rule_chain
FROM
tab_config_rule
WHERE
STATUS = 1
AND ( rule_name LIKE concat('%', #{search}, '%') or app_name like concat('%', #{search}, '%') )
) t1,
(
SELECT
*
FROM
tab_config_rule
WHERE
STATUS = 1
) t2
where t1.rule_chain LIKE concat('%', t2.rule_chain, '%')
</select>
<select id="getByAppCode"resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_config_rule
where status = 1
and app_code = #{appCode}
</select>
</mapper>
\ No newline at end of file
<?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.TabConfigRuleRelMapper">
<resultMap id="BaseResultMap" type="com.gic.enterprise.entity.TabConfigRuleRel">
<id column="rule_rel_id" jdbcType="INTEGER" property="ruleRelId" />
<result column="enterprise_rule_id" jdbcType="INTEGER" property="enterpriseRuleId" />
<result column="rule_id" jdbcType="INTEGER" property="ruleId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
rule_rel_id, enterprise_rule_id, rule_id, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_config_rule_rel
where rule_rel_id = #{ruleRelId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_config_rule_rel
where rule_rel_id = #{ruleRelId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabConfigRuleRel">
insert into tab_config_rule_rel (rule_rel_id, enterprise_rule_id, rule_id,
status, create_time, update_time
)
values (#{ruleRelId,jdbcType=INTEGER}, #{enterpriseRuleId,jdbcType=INTEGER}, #{ruleId,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabConfigRuleRel">
insert into tab_config_rule_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ruleRelId != null">
rule_rel_id,
</if>
<if test="enterpriseRuleId != null">
enterprise_rule_id,
</if>
<if test="ruleId != null">
rule_id,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ruleRelId != null">
#{ruleRelId,jdbcType=INTEGER},
</if>
<if test="enterpriseRuleId != null">
#{enterpriseRuleId,jdbcType=INTEGER},
</if>
<if test="ruleId != null">
#{ruleId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabConfigRuleRel">
update tab_config_rule_rel
<set>
<if test="enterpriseRuleId != null">
enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER},
</if>
<if test="ruleId != null">
rule_id = #{ruleId,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where rule_rel_id = #{ruleRelId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.enterprise.entity.TabConfigRuleRel">
update tab_config_rule_rel
set enterprise_rule_id = #{enterpriseRuleId,jdbcType=INTEGER},
rule_id = #{ruleId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where rule_rel_id = #{ruleRelId,jdbcType=INTEGER}
</update>
<insert id="insertBatch" parameterType="java.util.List">
insert into tab_config_rule_rel (rule_rel_id, enterprise_rule_id,
rule_id, status, create_time,
update_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.ruleRelId},
#{item.enterpriseRuleId},
#{item.ruleId},
#{item.status},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
<update id="deleteByEnterpriseRuleId">
update tab_config_rule_rel set status = 0
where status = 1
and enterprise_rule_id = #{enterpriseRuleId}
</update>
<select id="listRuleRel" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from tab_config_rule_rel
where status = 1
and enterprise_rule_id = #{enterpriseRuleId}
</select>
</mapper>
\ No newline at end of file
package com.gic.operation.web.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.operation.web.vo.configrule.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.rule.RuleClassifyDTO;
import com.gic.enterprise.dto.rule.RuleClassifySceneDTO;
import com.gic.enterprise.dto.rule.RuleDTO;
import com.gic.enterprise.dto.rule.RuleEnterpriseDTO;
import com.gic.enterprise.service.ConfigRuleApiService;
import com.gic.enterprise.service.ConfigRuleEnterpriseApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.operation.web.vo.SceneCategoryVO;
import com.gic.operation.web.vo.configrule.RuleClassifySceneVO;
import com.gic.operation.web.vo.configrule.RuleClassifyVO;
import com.gic.operation.web.vo.configrule.RuleVO;
import com.gic.rule.manage.api.service.DealOperationApiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/config/rule")
......@@ -32,6 +33,8 @@ public class ConfigRuleController {
private ConfigRuleApiService configRuleApiService;
@Autowired
private DealOperationApiService dealOperationApiService;
@Autowired
private ConfigRuleEnterpriseApiService configRuleEnterpriseApiService;
@RequestMapping("/saveRule")
public RestResponse saveRule(RuleDTO dto) {
......@@ -76,7 +79,8 @@ public class ConfigRuleController {
@RequestMapping("/getRuleClassify")
public RestResponse getRuleClassify(Integer ruleId) {
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId), RuleClassifyVO.class);
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId),
RuleClassifyVO.class);
}
@RequestMapping("/saveRuleClassifyScene")
......@@ -98,7 +102,8 @@ public class ConfigRuleController {
@RequestMapping("/getRuleClassifyScene")
public RestResponse getRuleClassifyScene(Integer ruleId) {
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId), RuleClassifySceneVO.class);
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId),
RuleClassifySceneVO.class);
}
@RequestMapping("/deleteClassify")
......@@ -127,4 +132,58 @@ public class ConfigRuleController {
result.add(map);
return RestResponse.success(result);
}
/**
* 规则树
* @param search 规则(应用)/分类/场景名称
* @return
*/
@RequestMapping("/get-rule-tree")
public RestResponse getRuleTree(String search, Integer enterpriseRuleId) {
return ResultControllerUtils.commonResult(configRuleApiService.getRuleTree(search, enterpriseRuleId));
}
/**
* 商户规则新增
* @param dto
* @return
*/
@RequestMapping("/saveEnterpriseRule")
public RestResponse saveEnterpriseRule(RuleEnterpriseDTO dto) {
return ResultControllerUtils.commonResult(configRuleEnterpriseApiService.save(dto));
}
@RequestMapping("/editEnterpriseRule")
public RestResponse editEnterpriseRule(RuleEnterpriseDTO dto) {
return ResultControllerUtils.commonResult(configRuleEnterpriseApiService.edit(dto));
}
@RequestMapping("/deleteEnterpriseRule")
public RestResponse deleteEnterpriseRule(Integer enterpriseRuleId) {
return ResultControllerUtils
.commonResult(configRuleEnterpriseApiService.deleteEnterpriseRule(enterpriseRuleId));
}
/**
* 从规则移除商户,因为一个商户只能对应一个规则,所以只需要商户ID参数
* @param enterpriseId
* @return
*/
@RequestMapping("/removeEnterprise")
public RestResponse removeEnterprise(Integer enterpriseId) {
return ResultControllerUtils.commonResult(configRuleEnterpriseApiService.removeEnterprise(enterpriseId));
}
@RequestMapping("/list-enterprise-rule")
public RestResponse listEnterpriseRule(String search, Integer pageNum, Integer pageSize) {
return ResultControllerUtils.commonPageResult(configRuleEnterpriseApiService.listRule(search, pageNum, pageSize),
EnterpriseRuleVO.class);
}
@RequestMapping("/list-enterprise")
public RestResponse listEnterprise(String search, Integer enterpriseRuleId, Integer pageNum, Integer pageSize) {
return ResultControllerUtils.commonPageResult(
configRuleEnterpriseApiService.listEnterpriseRule(search, enterpriseRuleId, pageNum, pageSize),
EnterpriseVO.class);
}
}
package com.gic.operation.web.vo.configrule;
import lombok.Data;
import java.io.Serializable;
@Data
public class EnterpriseRuleVO implements Serializable{
private static final long serialVersionUID = -2067061311561161226L;
/**
* 规则下商户个数
*/
private Integer countEnterpriseId;
/**
* 规则名称
*/
private String ruleName;
}
package com.gic.operation.web.vo.configrule;
import lombok.Data;
import java.io.Serializable;
@Data
public class EnterpriseVO implements Serializable{
private static final long serialVersionUID = -7172645508658642107L;
/**
* 企业主键
*/
private Integer enterpriseId;
/**
* 商户名称
*/
private String enterpriseName;
/**
* 公司名称
*/
private String companyName;
/**
*
*/
private String logo;
}
......@@ -81,6 +81,7 @@
<dubbo:reference interface="com.gic.enterprise.service.LinkApiService" id="linkApiService" timeout="6000" />
<!--平台规则配置-->
<dubbo:reference interface="com.gic.enterprise.service.ConfigRuleApiService" id="configRuleApiService" timeout="6000" />
<dubbo:reference interface="com.gic.enterprise.service.ConfigRuleEnterpriseApiService" id="configRuleEnterpriseApiService" timeout="6000" />
<dubbo:reference interface="com.gic.rule.manage.api.service.DealOperationApiService" id="dealOperationApiService" timeout="6000" />
<dubbo:reference interface="com.gic.auth.service.BusinessFrontResApiService" id="businessFrontResApiService" 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