Commit 400b1a89 by zhaoyang

修改代码

parent f2bb13df
......@@ -2,7 +2,6 @@ package com.abssqr.plat.biz.api.astPool;
import com.abssqr.plat.biz.support.ServiceSupport;
import com.abssqr.plat.common.dal.mysql.auto.paging.AstPoolPage;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoan;
import com.abssqr.plat.common.dal.mysql.auto.resultmap.AstPoolLoanStat;
import com.abssqr.plat.common.facade.base.BaseStringParam;
import com.abssqr.plat.common.facade.enums.AstTypeEnum;
......@@ -14,7 +13,6 @@ import com.abssqr.plat.common.facade.result.astPool.AstPoolVO;
import com.abssqr.plat.common.facade.service.AstPoolService;
import com.abssqr.plat.common.facade.validation.Valid;
import com.abssqr.plat.common.model.convertor.AstPoolConvert;
import com.abssqr.plat.common.model.convertor.LoanConvert;
import com.abssqr.plat.common.model.domain.ast.AstPoolEntity;
import com.abssqr.plat.common.model.enums.IdTypeEnum;
import com.abssqr.plat.common.model.repo.ast.LoanRepository;
......@@ -50,9 +48,12 @@ public class AstPoolServiceImpl extends ServiceSupport implements AstPoolService
return super.doOpr(astPoolOprParam,()->{
AstPoolEntity astPoolEntity=new AstPoolEntity();
astPoolEntity.setAstTypeEnum(AstTypeEnum.getByCode(astPoolOprParam.getAstType()));
//如果前端传入产品编号为空则将资产类型编号作为产品编号
if(StringUtils.isEmpty(astPoolEntity.getProdNo())){
if(StringUtils.isEmpty(astPoolOprParam.getProdNo())){
astPoolEntity.setProdNo(astPoolOprParam.getAstType());
}else {
astPoolEntity.setProdNo(astPoolOprParam.getProdNo());
}
astPoolEntity.setAstPoolNo(SequenceUtil.genId(IdTypeEnum.AST_POOL_CODE));
astPoolEntity.setAstPoolName(astPoolOprParam.getAstPoolName());
......@@ -73,7 +74,16 @@ public class AstPoolServiceImpl extends ServiceSupport implements AstPoolService
public BasePage<AstPoolVO> page(@Valid AstPoolPageQryParam astPoolPageQryParam) {
return super.doQry(astPoolPageQryParam,()->{
BasePage<AstPoolVO> result=new BasePage();
AstPoolPage page = astPoolRepository.getPage(astPoolPageQryParam);
//组装Page对象
String astPoolName = astPoolPageQryParam.getAstPoolName();
AstPoolPage astPoolPage=new AstPoolPage();
astPoolPage.setAstPoolName(astPoolName);
astPoolPage.setLimit(astPoolPageQryParam.getPageSize());
astPoolPage.setCurrPageNo(astPoolPageQryParam.getPageNum());
//组装返回Page对象
AstPoolPage page = astPoolRepository.getPage(astPoolPage);
result.setDatas(AstPoolConvert.convert2VOs(page.getDatas()));
result.setCurrPageNo(page.getCurrPageNo());
result.setTotal(page.getTotal());
......
......@@ -91,8 +91,9 @@
SELECT *
FROM ABS_AST_POOL
WHERE
1=1
<if test="astPoolName!=null and astPoolName != ''">
AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
AND AST_POOL_NAME like CONCAT(CONCAT('%',#{astPoolName,jdbcType=VARCHAR}),'%')
</if>
</operation>
......
......@@ -91,8 +91,9 @@
FROM
ABS_AST_POOL
WHERE
1=1
<if test="astPoolName!=null and astPoolName != ''">
AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
AND AST_POOL_NAME like CONCAT(CONCAT('%',#{astPoolName,jdbcType=VARCHAR}),'%')
</if>
</select>
<!--分页查找资产池 pageResult mydalgen自动生成,请勿修改-->
......@@ -106,8 +107,9 @@
SELECT /*MS-ABS-AST-POOL-GETPAGE*/ <include refid="Base_Column_List" />
FROM ABS_AST_POOL
WHERE
1=1
<if test="astPoolName!=null and astPoolName != ''">
AST_POOL_NAME = #{astPoolName,jdbcType=VARCHAR}
AND AST_POOL_NAME like CONCAT(CONCAT('%',#{astPoolName,jdbcType=VARCHAR}),'%')
</if>
) tt where ROWNUM &lt;= #{endRow}
) table_alias
......
package com.abssqr.plat.common.facade.result.astPool;
import com.abssqr.plat.common.facade.enums.AstTypeEnum;
import com.general.system.common.model.BaseEntity;
import com.general.system.common.model.Money;
......@@ -9,7 +10,7 @@ public class AstPoolVO extends BaseEntity implements Serializable {
//资产池名称
private String astPoolName;
//准入资产名称
private String astTypeName;
private AstTypeEnum astType;
//准入资产代码
private String prodNo;
......@@ -32,12 +33,12 @@ public class AstPoolVO extends BaseEntity implements Serializable {
this.astPoolName = astPoolName;
}
public String getAstTypeName() {
return astTypeName;
public AstTypeEnum getAstType() {
return astType;
}
public void setAstTypeName(String astTypeName) {
this.astTypeName = astTypeName;
public void setAstType(AstTypeEnum astType) {
this.astType = astType;
}
public String getProdNo() {
......
......@@ -49,7 +49,7 @@ public class AstPoolConvert {
return null;
}
AstPoolVO result =new AstPoolVO();
result.setAstTypeName(AstTypeEnum.getByCode(param.getAstType()).getDesc());
result.setAstType(AstTypeEnum.getByCode(param.getAstType()));
result.setAstPoolName(param.getAstPoolName());
result.setProdNo(param.getProdNo());
return result;
......@@ -60,7 +60,7 @@ public class AstPoolConvert {
return null;
}
AstPoolVO result =new AstPoolVO();
result.setAstTypeName(param.getAstTypeEnum().getDesc());
result.setAstType(param.getAstTypeEnum());
result.setProdNo(param.getProdNo());
result.setAstPoolName(param.getAstPoolName());
return result;
......
......@@ -26,7 +26,7 @@ public interface AstPoolRepository {
int create(AstPoolEntity astPoolEntity);
AstPoolPage getPage(AstPoolPageQryParam astPoolPageQryParam);
AstPoolPage getPage(AstPoolPage astPoolPage);
AstPoolEntity getByAstPoolNo(String astPoolNo);
......
......@@ -32,12 +32,7 @@ public class AstPoolRepositoryImpl implements AstPoolRepository {
}
@Override
public AstPoolPage getPage(AstPoolPageQryParam astPoolPageQryParam) {
String astPoolName = astPoolPageQryParam.getAstPoolName();
AstPoolPage astPoolPage=new AstPoolPage();
astPoolPage.setAstPoolName(astPoolName);
astPoolPage.setLimit(astPoolPageQryParam.getPageSize());
astPoolPage.setCurrPageNo(astPoolPageQryParam.getPageNum());
public AstPoolPage getPage(AstPoolPage astPoolPage) {
AstPoolPage page = astPoolDAO.getPage(astPoolPage);
return page;
}
......
package com.abssqr.plat.test.unittest.astPool; /**
* abssqr.com Inc.
* Copyright (c) 2017-2020 All Rights Reserved.
*/
import com.abssqr.plat.common.facade.param.astPool.AstPoolOprParam;
import com.abssqr.plat.common.facade.service.AstPoolService;
import com.abssqr.plat.test.BaseAutoTests;
import com.abssqr.test.annotation.XTest;
import com.abssqr.test.icase.ICase;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;
/**
* 资产池新增测试
*/
public class AstPoolAddUnitTest extends BaseAutoTests {
@Autowired
private AstPoolService astPoolService;
@XTest(relatePath = "unittest/astPool/add")
@Test(dataProvider = "YamlDataProvider", description = "资产池新增")
public void add(ICase iCase, AstPoolOprParam packOprParam) {
try {
astPoolService.add(packOprParam);
} finally {
// 校验数据
super.checkDB(iCase);
// super.clearDB(iCase);
}
}
}
package com.abssqr.plat.test.unittest.astPool;
import com.abssqr.plat.common.facade.result.astPool.AstPoolVO;
import com.abssqr.plat.common.facade.service.AstPoolService;
import com.abssqr.plat.test.BaseAutoTests;
import com.abssqr.test.annotation.XTest;
import com.abssqr.test.icase.ICase;
import com.general.system.common.util.VarChecker;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;
public class AstPoolGetUnitTest extends BaseAutoTests {
@Autowired
private AstPoolService astPoolService;
@XTest(relatePath = "unittest/astPool/get")
@Test(dataProvider = "YamlDataProvider", description = "资产池详情查询")
public void add(ICase iCase, String astPoolNo,String checkGet) {
try {
AstPoolVO astPoolVO = astPoolService.get(astPoolNo);
String s = new Gson().toJson(astPoolVO);
VarChecker.checkArgument(s.equals(checkGet),"逾期结果错误");
} finally {
// 校验数据
super.checkDB(iCase);
// super.clearDB(iCase);
}
}
}
package com.abssqr.plat.test.unittest.astPool;
import com.abssqr.plat.common.facade.param.astPool.AstPoolPageQryParam;
import com.abssqr.plat.common.facade.result.BasePage;
import com.abssqr.plat.common.facade.result.astPool.AstPoolVO;
import com.abssqr.plat.common.facade.service.AstPoolService;
import com.abssqr.plat.test.BaseAutoTests;
import com.abssqr.test.annotation.XTest;
import com.abssqr.test.icase.ICase;
import com.general.system.common.util.VarChecker;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;
public class AstPoolPageUnitTest extends BaseAutoTests {
@Autowired
private AstPoolService astPoolService;
@XTest(relatePath = "unittest/astPool/list")
@Test(dataProvider = "YamlDataProvider", description = "资产池列表查询")
public void add(ICase iCase, AstPoolPageQryParam astPoolPageQryParam, String checkGet) {
try {
BasePage<AstPoolVO> page = astPoolService.page(astPoolPageQryParam);
String s = new Gson().toJson(page);
VarChecker.checkArgument(s.equals(checkGet),"逾期结果错误");
} finally {
// 校验数据
super.checkDB(iCase);
// super.clearDB(iCase);
}
}
}
--- !!com.abssqr.test.icase.Case
id: astPool_add_case0001
desc: 资产池新增测试
context:
clearDBContext:
- ABS_AST_POOL:
AST_TYPE: BL
- ABS_AST_PACK:
AST_TYPE: BL
initDBContext:
checkDBContext:
- ABS_AST_POOL:
AST_POOL_NAME: 测试资产池
AST_TYPE: BL
PROD_NO[C]: TEST_PROD_NO1
- ABS_AST_PACK:
AST_TYPE[C]: BL
STATUS: init
PACK_TYPE: default
###
--- !!com.abssqr.plat.common.facade.param.astPool.AstPoolOprParam
astPoolName: 测试资产池
astType: BL
prodNo: TEST_PROD_NO1
\ No newline at end of file
--- !!com.abssqr.test.icase.Case
id: astPool_get_case0001
desc: 资产池详情查询测试
context:
clearDBContext:
- ABS_AST_POOL:
AST_TYPE: BL
- ABS_AST_PACK:
AST_TYPE: BL
initDBContext:
- ABS_AST_POOL:
ID: "{nextval}"
AST_POOL_NAME: 测试资产池
AST_TYPE: BL
AST_POOL_NO: ASTPOOL2020042118092600425385
PROD_NO: testProdNo1
checkDBContext:
## astPoolNo
---
"ASTPOOL2020042118092600425385"
## checkGet
---
'{"astPoolName":"测试资产池","astType":"BL","prodNo":"testProdNo1","astAmt":{"cent":0,"currency":"CNY","currencyValue":"156"},"astCnt":0,"packedAstAmt":{"cent":0,"currency":"CNY","currencyValue":"156"},"packedAstCnt":0}'
\ No newline at end of file
--- !!com.abssqr.test.icase.Case
id: astPool_list_case0001
desc: 资产池列表查询测试
context:
clearDBContext:
- ABS_AST_POOL:
- ABS_AST_PACK:
AST_TYPE: BL
initDBContext:
- ABS_AST_POOL:
ID: "{nextval}"
AST_POOL_NAME: 测试资产池
AST_TYPE: BL
AST_POOL_NO: ASTPOOL2020042118092600425385
PROD_NO: testProdNo1
checkDBContext:
## astPoolNo
--- !!com.abssqr.plat.common.facade.param.astPool.AstPoolPageQryParam
astPoolName: 测试资产池
pageNum: 1
pageSize: 21
## checkGet
---
'{"total":1,"limit":21,"currPageNo":1,"datas":[{"astPoolName":"测试资产池","astType":"BL","prodNo":"testProdNo1"}]}'
\ No newline at end of file
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