Commit 2c4b5660 authored by zp's avatar zp

merge

parent 12f3835a
......@@ -208,7 +208,11 @@
<artifactId>hutool-all</artifactId>
<version>5.3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
......
package com.tanpu.fund.api;
import com.tanpu.common.auth.mapping.TanpuInterfaceLoginAuth;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.privatefund.resp.FundNavMessage;
import com.tanpu.common.model.product.req.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq;
import com.tanpu.common.model.product.req.ProductListReq;
......@@ -11,11 +13,14 @@ import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Api(tags = "产品服务")
......@@ -159,4 +164,9 @@ public interface ProductApi {
@ApiOperation("查询同类基金")
@GetMapping("/query/samefund")
CommonResp<List<FundSameResp>> querySamefund(@RequestParam("fundId") String fundId);
@ApiOperation("理财师净值导入")
@GetMapping("/ifa/net/import")
CommonResp<List<FundNavMessage>> importNetInfo(@RequestParam("file") MultipartFile file,
@RequestParam("fundId") @Validated @NotEmpty String fundId);
}
......@@ -3,6 +3,7 @@ package com.tanpu.fund.controller;
import com.tanpu.common.auth.mapping.TanpuInterfaceLoginAuth;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.privatefund.resp.FundNavMessage;
import com.tanpu.common.model.product.req.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq;
import com.tanpu.common.model.product.req.ProductListReq;
......@@ -16,6 +17,7 @@ import com.tanpu.fund.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
......@@ -208,4 +210,9 @@ public class ProductController implements ProductApi {
}
return CommonResp.success(this.productService.querySamefund(fundId));
}
@Override
public CommonResp<List<FundNavMessage>> importNetInfo(MultipartFile file, String fundId) {
return this.productService.importNet(file, fundId);
}
}
......@@ -2,6 +2,7 @@ package com.tanpu.fund.service;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.privatefund.resp.FundNavMessage;
import com.tanpu.common.model.product.req.ProductListReq;
import com.tanpu.common.model.product.resp.DynamicRetreatVO;
import com.tanpu.common.model.product.resp.FundInfoSimpleListResp;
......@@ -9,6 +10,8 @@ import com.tanpu.common.model.product.resp.ProductInfoVO;
import com.tanpu.common.model.product.req.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq;
import com.tanpu.common.model.product.resp.*;
import com.tanpu.common.resp.CommonResp;
import org.springframework.web.multipart.MultipartFile;
import com.tanpu.common.model.tanpuroom.Type;
import java.util.List;
......@@ -70,5 +73,7 @@ public interface ProductService {
List<FundSameResp> getRemmendPrivateFundList(String fundId);
CommonResp<List<FundNavMessage>> importNet(MultipartFile file, String fundId);
List<Type> getSimpleFundList(List<String> list);
}
......@@ -2,6 +2,8 @@ package com.tanpu.fund.service.impl;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.github.pagehelper.page.PageMethod;
import com.google.common.collect.Lists;
import com.tanpu.common.auth.UserInfoThreadLocalHolder;
......@@ -11,6 +13,7 @@ import com.tanpu.common.enums.SysConstEnums;
import com.tanpu.common.enums.product.ProductEnums;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.privatefund.resp.FundNavMessage;
import com.tanpu.common.model.product.FundInfoVO;
import com.tanpu.common.model.product.req.NetReq;
import com.tanpu.common.model.product.req.ProductInfoReq;
......@@ -33,8 +36,11 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -831,7 +837,7 @@ public class ProductServiceImpl implements ProductService, Constant {
public List<FundManagerVO> getFundManager(String id) {
FundManagerMappingExample example = new FundManagerMappingExample();
example.createCriteria().andFundIdEqualTo(id).andIsvisibleEqualTo(ONE_NUM).andDeleteTagEqualTo(ZERO_NUM);
example.setOrderByClause("update_time desc");
example.setOrderByClause("management_start_date desc,id desc");
List<String> list = this.fundManagerMappingMapper.selectByExample(example).stream()
.map(FundManagerMapping::getFundManagerId).collect(Collectors.toList());
......@@ -1669,6 +1675,25 @@ public class ProductServiceImpl implements ProductService, Constant {
return fundInfoCustomMapper.getSimpleFundList(list.stream().collect(Collectors.joining("','", "'", "'")));
}
@Override
public CommonResp<List<FundNavMessage>> importNet(MultipartFile file, String fundId) {
/*FundInfo fundInfo = this.fundInfoMapper.selectByPrimaryKey(fundId);
if (fundInfo==null){
return CommonResp.error("获取不到基金信息");
}*/
try (InputStream inputStream = file.getInputStream()) {
ExcelReader reader = ExcelUtil.getReader(inputStream);
List<Map<String, Object>> readAll = reader.readAll();
int size = readAll.size();
return CommonResp.success();
} catch (IOException e) {
return CommonResp.error("文件格式错误,无法读取,请您重新下载导入模板");
}
}
private ArrayList<TrackRecordVO> getPrivateFundTrackRecordVOS(IfaImportedFundCount fundCount) {
return Lists.newArrayList(
new TrackRecordVO("近三个月", multiply100(fundCount.getRet3m()), multiply100(fundCount.getRet3mBm1()), fundCount.getEndDate() == null ? null : fundCount.getEndDate().getTime()),
......
package com.tanpu.fund;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author: zhoupeng
* @email: zhoupeng_08@163.com
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = FundApplication.class)
@ActiveProfiles("dev")
public class BaseTest {
}
package com.tanpu.fund.excel;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.tanpu.fund.BaseTest;
import org.junit.Test;
import java.util.List;
/**
* @author: zhoupeng
* @email: zhoupeng_08@163.com
*/
public class NetExcel extends BaseTest {
public static final String URL = "https://mylolis-my.sharepoint.com/personal/f3101_365up_site/Documents/工作簿2.xlsx";
@Test
public void productNetAnalysis() {
ExcelReader reader = ExcelUtil.getReader(URL);
List<List<Object>> read = reader.read();
System.out.println(read);
}
}
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