Commit 98b3869a authored by 吴泽佳's avatar 吴泽佳

添加社区使用两个接口 查询公司简单信息 和所持有的的基金数量

parent a4a48950
package com.tanpu.fund.api;
import com.tanpu.common.model.product.resp.FundCompanySimpleVO;
import com.tanpu.common.model.product.resp.FundCompanyVO;
import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @description: 社区调用API服务
* @author: zejia zj wu
* @create: 2021-07-29 10:13
**/
@Api(tags = "社区调用API服务")
public interface ProductForCommunityApi {
@ApiOperation("基金公司-简单信息")
@GetMapping("/fund/companyInfoSimple")
CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(@ApiParam("基金公司id") @RequestParam("id") String id);
@ApiOperation("私募类型基金公司-持有产品数")
@GetMapping("/fund/companyFundCount")
CommonResp<FundCompanySimpleVO> getCompanyFundCount(@ApiParam("基金公司id") @RequestParam("id") String id);
}
package com.tanpu.fund.controller;
import com.tanpu.common.model.product.resp.FundCompanySimpleVO;
import com.tanpu.common.resp.CommonResp;
import com.tanpu.fund.api.ProductForCommunityApi;
import com.tanpu.fund.entity.generator.CompanyInfo;
import com.tanpu.fund.entity.generator.FundInfoExample;
import com.tanpu.fund.mapper.generator.CompanyInfoMapper;
import com.tanpu.fund.mapper.generator.FundInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @description:
* @author: zejia zj wu
* @create: 2021-07-29 10:22
**/
@RestController
@Slf4j
public class ProductForCommunityController implements ProductForCommunityApi {
@Resource
private CompanyInfoMapper companyInfoMapper;
@Resource
private FundInfoMapper fundInfoMapper;
@Override
public CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(String id) {
CompanyInfo companyInfo = this.companyInfoMapper.selectByPrimaryKey(id);
if (companyInfo == null) {
return CommonResp.error(CommonResp.OBJECT_NOT_FOUND_EXCEPTION_STATUS_CODE, CommonResp.OBJECT_NOT_FOUND_EXCEPTION_MESSAGE);
}
FundCompanySimpleVO build = FundCompanySimpleVO.builder().establishDate(companyInfo.getEstablishDate().getTime())
.registerNumber(companyInfo.getRegisterNumber()).build();
return CommonResp.success(build);
}
@Override
public CommonResp<FundCompanySimpleVO> getCompanyFundCount(String id) {
FundInfoExample fundInfoExample = new FundInfoExample();
fundInfoExample.createCriteria().andTrustIdEqualTo(id);
long l = fundInfoMapper.countByExample(fundInfoExample);
FundCompanySimpleVO build = FundCompanySimpleVO.builder().fundCount(l).build();
return CommonResp.success(build);
}
}
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