Commit a655e018 by guojuxing

平台规则详情接口添加

parent 73782f69
package com.gic.enterprise.dto.rule;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Accessors(chain = true)
@Data
public class ConfigRuleDTO implements Serializable{
private static final long serialVersionUID = -2992133298716031459L;
/**
*
*/
private Integer ruleId;
/**
* 规则/分类/场景名称(场景名称是冗余数据)
*/
private String name;
/**
* 规则类型:应用名称
*/
private String appName;
/**
* 规则类型:应用code
*/
private String appCode;
/**
* 分类类型:icon
*/
private String classifyIcon;
/**
* 分类/场景描述
*/
private String desc;
/**
* 分类/场景备注
*/
private String remark;
/**
* 营销场景ID/code
*/
private String marketScene;
/**
* 营销对象 1:会员卡域 2:服务号域 3:小程序域
*/
private Integer marketObject;
/**
* 父级id
*/
private Integer parentRuleId;
/**
* 层级:1:规则 2:分类 3:场景
*/
private Integer ruleLevel;
/**
* 规则链id:_2_3_格式数据
*/
private String ruleChain;
/**
* 状态值 1:有效 0:无效
*/
private Integer status;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}
......@@ -2,6 +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;
......@@ -86,4 +87,14 @@ public interface ConfigRuleApiService {
ServiceResponse<String> deleteRule(Integer ruleId);
ServiceResponse<String> deleteRuleClassify(Integer ruleId);
ServiceResponse<String> deleteRuleClassifyScene(Integer ruleId);
/**
* 查询详情
* @Title: getDetailByRuleId

* @Description:

* @author guojuxing
* @param ruleId

* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.rule.ConfigRuleDTO>


*/
ServiceResponse<ConfigRuleDTO> getDetailByRuleId(Integer ruleId);
}
......@@ -3,6 +3,7 @@ package com.gic.enterprise.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
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;
......@@ -131,6 +132,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record.getRuleLevel() != 2) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型");
}
dto.setParentRuleId(record.getParentRuleId());
ServiceResponse valid = validRuleClassify(dto);
if (!valid.isSuccess()) {
return ServiceResponse.failure(valid.getCode(), valid.getMessage());
......@@ -173,6 +175,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record.getRuleLevel() != 3) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,不是场景类型");
}
dto.setParentRuleId(record.getParentRuleId());
ServiceResponse valid = validRuleClassifyScene(dto);
if (!valid.isSuccess()) {
return ServiceResponse.failure(valid.getCode(), valid.getMessage());
......@@ -232,6 +235,15 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
return ServiceResponse.success(record.getName());
}
@Override
public ServiceResponse<ConfigRuleDTO> getDetailByRuleId(Integer ruleId) {
TabConfigRule record = configRuleService.getByRuleId(ruleId);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "记录不存在");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(ConfigRuleDTO.class, record));
}
private ServiceResponse<Void> validRuleClassify(RuleClassifyDTO dto) {
TabConfigRule record = configRuleService.getByRuleId(dto.getParentRuleId());
if (record == null) {
......
......@@ -7,6 +7,9 @@ import com.gic.enterprise.dto.rule.RuleDTO;
import com.gic.enterprise.service.ConfigRuleApiService;
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;
......@@ -40,6 +43,16 @@ public class ConfigRuleController {
return ResultControllerUtils.commonResult(configRuleApiService.editRule(dto));
}
@RequestMapping("/listRule")
public RestResponse listRule(String search) {
return ResultControllerUtils.commonResult(configRuleApiService.listRule(search), RuleVO.class);
}
@RequestMapping("/getRule")
public RestResponse getRule(Integer ruleId) {
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId), RuleVO.class);
}
@RequestMapping("/saveRuleClassify")
public RestResponse saveRuleClassify(RuleClassifyDTO dto) {
return ResultControllerUtils.commonResult(configRuleApiService.saveRuleClassify(dto));
......@@ -50,6 +63,17 @@ public class ConfigRuleController {
return ResultControllerUtils.commonResult(configRuleApiService.editRuleClassify(dto));
}
@RequestMapping("/listRuleClassify")
public RestResponse listRuleClassify(String search, Integer ruleId, Integer pageNum, Integer pageSize) {
return ResultControllerUtils.commonResult(
configRuleApiService.listRuleClassify(search, ruleId, pageNum, pageSize), RuleClassifyVO.class);
}
@RequestMapping("/getRuleClassify")
public RestResponse getRuleClassify(Integer ruleId) {
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId), RuleClassifyVO.class);
}
@RequestMapping("/saveRuleClassifyScene")
public RestResponse saveRuleClassifyScene(RuleClassifySceneDTO dto) {
return ResultControllerUtils.commonResult(configRuleApiService.saveRuleClassifyScene(dto));
......@@ -60,6 +84,18 @@ public class ConfigRuleController {
return ResultControllerUtils.commonResult(configRuleApiService.editRuleClassifyScene(dto));
}
@RequestMapping("/listRuleClassifyScene")
public RestResponse listRuleClassifyScene(String search, Integer ruleId, Integer pageNum, Integer pageSize) {
return ResultControllerUtils.commonResult(
configRuleApiService.listRuleClassifyScene(search, ruleId, pageNum, pageSize),
RuleClassifySceneVO.class);
}
@RequestMapping("/getRuleClassifyScene")
public RestResponse getRuleClassifyScene(Integer ruleId) {
return ResultControllerUtils.commonResultOne(configRuleApiService.getDetailByRuleId(ruleId), RuleClassifySceneVO.class);
}
@RequestMapping("/deleteClassify")
public RestResponse deleteClassify(Integer ruleId) {
return ResultControllerUtils.commonResult(configRuleApiService.deleteRuleClassify(ruleId));
......
package com.gic.operation.web.vo.configrule;
import lombok.Data;
import java.io.Serializable;
@Data
public class RuleClassifySceneVO implements Serializable{
private static final long serialVersionUID = 2503067207037834122L;
/**
*
*/
private Integer ruleId;
/**
* 规则/分类/场景名称(场景名称是冗余数据)
*/
private String name;
/**
* 分类/场景描述
*/
private String desc;
/**
* 分类/场景备注
*/
private String remark;
/**
* 营销场景ID/code
*/
private String marketScene;
/**
* 营销对象 1:会员卡域 2:服务号域 3:小程序域
*/
private Integer marketObject;
}
package com.gic.operation.web.vo.configrule;
import lombok.Data;
import java.io.Serializable;
@Data
public class RuleClassifyVO implements Serializable{
private static final long serialVersionUID = -3351380808209918035L;
/**
*
*/
private Integer ruleId;
/**
* 规则/分类/场景名称(场景名称是冗余数据)
*/
private String name;
/**
* 分类类型:icon
*/
private String classifyIcon;
/**
* 分类/场景描述
*/
private String desc;
/**
* 分类/场景备注
*/
private String remark;
}
package com.gic.operation.web.vo.configrule;
import lombok.Data;
import java.io.Serializable;
@Data
public class RuleVO implements Serializable{
private static final long serialVersionUID = 5033092463325603541L;
/**
*
*/
private Integer ruleId;
/**
* 规则/分类/场景名称(场景名称是冗余数据)
*/
private String name;
/**
* 规则类型:应用名称
*/
private String appName;
/**
* 规则类型:应用code
*/
private String appCode;
}
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