Commit af0f00bb by zhaoyang

新增资产包默认筛选条件

parent 9f4d4d8c
......@@ -30,25 +30,35 @@ public class AstPoolServiceImpl extends ServiceSupport implements AstPoolService
@Autowired
AstPackManager astPackManager;
/**
* 新增资产池
* @param astPoolOprParam
* @return
*/
@Override
public int add(@Valid AstPoolOprParam astPoolOprParam) {
return super.doOpr(astPoolOprParam,()->{
AstPoolEntity astPoolEntity=new AstPoolEntity();
astPoolEntity.setAstTypeEnum(AstTypeEnum.getByCode(astPoolOprParam.getAstTypeCode()));
astPoolEntity.setAstTypeEnum(AstTypeEnum.getByCode(astPoolOprParam.getAstType()));
//如果前端传入产品编号为空则将资产类型编号作为产品编号
if(StringUtils.isEmpty(astPoolEntity.getProdNo())){
astPoolEntity.setProdNo(astPoolOprParam.getAstTypeCode());
astPoolEntity.setProdNo(astPoolOprParam.getAstType());
}
astPoolEntity.setAstPoolNo(SequenceUtil.genId(IdTypeEnum.AST_POOL_CODE));
astPoolEntity.setAstPoolName(astPoolOprParam.getAstPoolName());
VarChecker.checkArgument(astPoolRepository.checkAstPool(astPoolEntity),"资产池名称/资产池编号重复");
//创建默认资产包
astPackManager.craeteDefaultPack(astPoolOprParam.getProdNo(),astPoolEntity.getAstTypeEnum());
astPackManager.craeteDefaultPack(astPoolEntity.getAstPoolNo(),astPoolEntity.getAstTypeEnum(),astPoolEntity.getProdNo());
return astPoolRepository.create(astPoolEntity);
});
}
/**
* 分页查询资产池列表
* @param astPoolPageQryParam
* @return
*/
@Override
public BasePage<AstPoolVO> page(@Valid AstPoolPageQryParam astPoolPageQryParam) {
return super.doQry(astPoolPageQryParam,()->{
......@@ -62,6 +72,11 @@ public class AstPoolServiceImpl extends ServiceSupport implements AstPoolService
}
/**
* 查询资产池详情
* @param astPoolNo
* @return
*/
@Override
public AstPoolVO get(String astPoolNo) {
return super.doQry(new BaseStringParam(astPoolNo),()->{
......
......@@ -30,7 +30,7 @@
, #{astPoolNo,jdbcType=VARCHAR}
, sysdate
, #{astPoolName,jdbcType=VARCHAR}
, #{astTypeCode,jdbcType=VARCHAR}
, #{astType,jdbcType=VARCHAR}
, #{prodNo,jdbcType=VARCHAR}
, sysdate
)
......@@ -55,7 +55,7 @@
, #{item.astPoolNo,jdbcType=VARCHAR}
, sysdate
, #{item.astPoolName,jdbcType=VARCHAR}
, #{item.astTypeCode,jdbcType=VARCHAR}
, #{item.astType,jdbcType=VARCHAR}
, #{item.prodNo,jdbcType=VARCHAR}
, sysdate
)
......@@ -69,7 +69,7 @@
SET
AST_POOL_NO = #{astPoolNo,jdbcType=VARCHAR}
,AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
,AST_TYPE = #{astTypeCode,jdbcType=VARCHAR}
,AST_TYPE = #{astType,jdbcType=VARCHAR}
,GMT_MODIFIED = sysdate
WHERE
ID = #{id,jdbcType=DECIMAL}
......@@ -82,7 +82,7 @@
SELECT COUNT(1) AS cnt
FROM ABS_AST_POOL
WHERE AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
OR AST_POOL_NO= #{astPoolNo,jdbcType=VARCHAR}
OR PROD_NO= #{prodNo,jdbcType=VARCHAR}
]]>
</operation>
......
......@@ -40,13 +40,13 @@ public class AstPoolDAO{
}
/**
* desc:查询是否有重复资产池名称和资产池编码的资产池.<br/>
* @param astPoolNo astPoolNo
* @param prodNo prodNo
* @param astPoolName astPoolName
* @return Long
*/
public Long getDupliCnt(String astPoolNo,String astPoolName){
return astPoolDOMapper.getDupliCnt(astPoolNo, astPoolName);
public Long getDupliCnt(String prodNo,String astPoolName){
return astPoolDOMapper.getDupliCnt(prodNo, astPoolName);
}
/**
* desc:分页查找资产池.<br/>
......
......@@ -27,11 +27,11 @@ public interface AstPoolDOMapper{
int insertBatch(List<AstPoolDO> list);
/**
* desc:查询是否有重复资产池名称和资产池编码的资产池.<br/>
* @param astPoolNo astPoolNo
* @param prodNo prodNo
* @param astPoolName astPoolName
* @return Long
*/
Long getDupliCnt(@Param("astPoolNo")String astPoolNo,@Param("astPoolName")String astPoolName);
Long getDupliCnt(@Param("prodNo")String prodNo,@Param("astPoolName")String astPoolName);
/**
* desc:分页查找资产池.<br/>
* @param astPool astPool
......
......@@ -41,7 +41,7 @@
, #{astPoolNo,jdbcType=VARCHAR}
, sysdate
, #{astPoolName,jdbcType=VARCHAR}
, #{astTypeCode,jdbcType=VARCHAR}
, #{astType,jdbcType=VARCHAR}
, #{prodNo,jdbcType=VARCHAR}
, sysdate
)
......@@ -66,7 +66,7 @@
, #{item.astPoolNo,jdbcType=VARCHAR}
, sysdate
, #{item.astPoolName,jdbcType=VARCHAR}
, #{item.astTypeCode,jdbcType=VARCHAR}
, #{item.astType,jdbcType=VARCHAR}
, #{item.prodNo,jdbcType=VARCHAR}
, sysdate
)
......@@ -80,7 +80,7 @@
SELECT /*MS-ABS-AST-POOL-GETDUPLICNT*/ COUNT(1) AS cnt
FROM ABS_AST_POOL
WHERE AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
OR AST_POOL_NO= #{astPoolNo,jdbcType=VARCHAR}
OR PROD_NO= #{prodNo,jdbcType=VARCHAR}
]]>
</select>
......
......@@ -16,9 +16,7 @@ import java.util.Map;
* @version com.abssqr.plat.common.facade.enums: AstScreenRelTypeEnum.java, v 0.1 2020-04-18 6:30 PM xiachenxiang Exp $
*/
public enum AstScreenRelTypeEnum implements IEnum {
PACK("PACK","资产打包"),
;
PACK("PACK","资产打包");
private static final Map<String, AstScreenRelTypeEnum> codeMap = new HashMap<String, AstScreenRelTypeEnum>();
......
......@@ -11,7 +11,7 @@ public class AstPoolOprParam extends BaseOprParam{
private String astPoolName;
@VldEnums(enumClass= AstTypeEnum.class,message = "不支持的资产类型")
private String astTypeCode;
private String astType;
@VldString(nullable = true,maxLength = 30)
private String prodNo;
......@@ -24,12 +24,12 @@ public class AstPoolOprParam extends BaseOprParam{
this.astPoolName = astPoolName;
}
public String getAstTypeCode() {
return astTypeCode;
public String getAstType() {
return astType;
}
public void setAstTypeCode(String astTypeCode) {
this.astTypeCode = astTypeCode;
public void setAstType(String astType) {
this.astType = astType;
}
public String getProdNo() {
......
......@@ -41,7 +41,7 @@ public class AstPackParamConvert {
result.getScreenRuleList().add(rule);
//relNo 关联编号
rule.setRelNo(param.getPackNo());
//relType 关联类型 1.资产打包 PACK
//relType 关联类型 1.资产打包 PACK,2数据仓库 DW
rule.setRelType(AstScreenRelTypeEnum.PACK);
//ruleType 规则类型
rule.setRuleType(AstScreenRuleTypeEnum.getByCode(item.getRuleType()));
......
......@@ -48,7 +48,7 @@ public class AstPoolRepositoryImpl implements AstPoolRepository {
@Override
public boolean checkAstPool(AstPoolEntity astPoolEntity) {
Long dupliCnt = astPoolDAO.getDupliCnt(astPoolEntity.getAstPoolNo(), astPoolEntity.getAstPoolName());
Long dupliCnt = astPoolDAO.getDupliCnt(astPoolEntity.getProdNo(),astPoolEntity.getAstPoolName());
if(dupliCnt!=null&&dupliCnt>1){
return false;
}
......
......@@ -5,9 +5,8 @@
package com.abssqr.plat.core.service.ast;
import com.abssqr.plat.common.facade.enums.AstPackStatusEnum;
import com.abssqr.plat.common.facade.enums.AstPackTypeEnum;
import com.abssqr.plat.common.facade.enums.CommonTaskTypeEnum;
import com.abssqr.plat.common.facade.enums.*;
import com.abssqr.plat.common.facade.model.rule.AstScreenRule;
import com.abssqr.plat.common.facade.param.ast.AstPackOprParam;
import com.abssqr.plat.common.model.convertor.web.AstPackParamConvert;
import com.abssqr.plat.common.model.domain.ast.AstPack;
......@@ -18,9 +17,12 @@ import com.abssqr.plat.common.model.repo.task.CommonTaskRepository;
import com.abssqr.plat.core.service.util.CommonTaskUtil;
import com.general.system.common.util.VarChecker;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author xiachenxiang
* @version com.abssqr.plat.core.service.ast: AstPackManager.java, v 0.1 2020-04-18 4:16 PM xiachenxiang Exp $
......@@ -59,12 +61,34 @@ public class AstPackManager {
return param.getPackNo();
}
public void craeteDefaultPack(String astPoolNo) {
/**
* 创建产品默认的资产池
* @param astPoolNo
* @param astTypeEnum
*/
public void craeteDefaultPack(String astPoolNo, AstTypeEnum astTypeEnum,String prodNo) {
AstPack astPack = new AstPack();
astPack.setAstPoolNo(astPoolNo);
astPack.setPackNo(astPoolNo);
astPack.setPackType(AstPackTypeEnum.DEFAULT);
astPack.setStatus(AstPackStatusEnum.INIT);
astPack.setAstType(astTypeEnum);
createDefaultScreenRule(prodNo,astPack.getPackNo());
astPackRepository.insert(astPack);
}
/**
* 创建产品默认的筛选规则(去数据仓库筛选产品编码对应的的资产)
* @param prodNo
* @param packNo
*/
//TODO 加筛选规则
public void createDefaultScreenRule(String prodNo,String packNo){
AstScreenRule astScreenRule=new AstScreenRule();
astScreenRule.setRelNo(packNo);
astScreenRule.setRelType(AstScreenRelTypeEnum.PACK);
astScreenRule.setRightCondition(AstScRuleRightCondEnum.eq);
astScreenRule.setRightValue(prodNo);
astScreenRuleRepo.insertBatch(Lists.newArrayList(astScreenRule));
}
}
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