Commit f621a263 by 王德峰

bb 项目初始化

    清理部分
    清理wk任务
parent fbdb6ee1
/**
* abssqr.com Inc.
* Copyright (c) 2017-2019 All Rights Reserved.
*/
package com.abssqr.plat.common.facade.service.analyse;
import com.abssqr.plat.common.facade.model.analyse.PlanFundFile;
import com.abssqr.plat.common.facade.param.analyse.AnalyseBaseParam;
import com.abssqr.plat.common.facade.param.analyse.CalcFundParam;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQprParam;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQryParam;
import com.abssqr.plat.common.facade.param.plan.PlanPageQryParam;
import com.abssqr.plat.common.facade.result.BasePage;
import com.abssqr.plat.common.facade.result.analyse.CalcFundDefaultParam;
import com.abssqr.plat.common.facade.result.analyse.CalcFundResultVO;
import com.abssqr.plat.common.facade.result.analyse.PlanAnalyseVO;
import org.springframework.web.multipart.MultipartFile;
/**
* 资金计划 管理
* @author hanfei
* @version $Id: AnalyseFundSpvService.java, v 0.1 2019-09-19 4:24 PM hanfei Exp $
*/
public interface AnalyseFundSpvService {
/**
* 获取资金计划文件
* @param param
* @return
*/
PlanFundFile getFundPlanFile(FundPlanFileQryParam param);
/**
* 获取资金计划文件页面数据
* @return
*/
BasePage<PlanFundFile> queryFundFile(AnalyseBaseParam param);
/**
* 上传资金计划文件
* @param param
* @return
*/
String uploadPlanFile(FundPlanFileQprParam param);
/**
* 获取短期资金需求计算器 默认显示数据
* @param param
* @return
*/
CalcFundDefaultParam fundCalcView(AnalyseBaseParam param);
/**
* 短期资金需求计算器
* @param param
* @return
*/
CalcFundResultVO fundCalc(CalcFundParam param);
/**
* 查询项目计划分析列表
* @return
*/
BasePage queryAnalyseSpvPlan(PlanPageQryParam param);
/**
* 查询计划概要信息
* @param param
* @return
*/
PlanAnalyseVO getAnalyseSpvPlan(AnalyseBaseParam param);
}
package com.abssqr.plat.test.unittest.report;
import com.abssqr.plat.common.facade.model.analyse.PlanFundFile;
import com.abssqr.plat.common.facade.param.analyse.AnalyseBaseParam;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQprParam;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQryParam;
import com.abssqr.plat.common.facade.result.BasePage;
import com.abssqr.plat.common.facade.service.analyse.AnalyseFundSpvService;
import com.abssqr.plat.test.BaseAutoTests;
import com.abssqr.test.annotation.XTest;
import com.abssqr.test.icase.ICase;
import org.junit.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.testng.annotations.Test;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
* 资金计划文件
*/
public class FundPlanFileTest extends BaseAutoTests {
@Autowired
private AnalyseFundSpvService analyseFundSpvService;
@XTest(relatePath = "unittest/plan/fund/upload")
@Test(dataProvider = "YamlDataProvider", description = "上传资金计划文件", priority = 1)
public void testAnalyseUploadPlanFile(ICase iCase, FundPlanFileQprParam param) {
try {
// 读取文件
InputStream inputStream = Thread.currentThread().getContextClassLoader()
.getResourceAsStream("tmpl/export/tmpl_ast_plan_rpt.xlsx");
MockMultipartFile file = new MockMultipartFile(
"测试文件.xlsx", "测试文件.xlsx", "multipart/form-data;", inputStream);
param.setFile(file);
// 上传文件
String fileId = analyseFundSpvService.uploadPlanFile(param);
Assert.assertNotNull(fileId);
} catch (IOException e) {
}finally {
super.checkDB(iCase);
}
}
@XTest(relatePath = "unittest/plan/fund/file", testOnly = { "analyse_base_param"})
@Test(dataProvider = "YamlDataProvider", description = "获取资金计划文件页面数据", priority = 2)
public void testQueryFundFile(ICase iCase, AnalyseBaseParam param) {
try {
// 查询列表
BasePage<PlanFundFile> result = analyseFundSpvService.queryFundFile(param);
// 获取文件
List<PlanFundFile> list = result.getDatas();
Assert.assertNotNull(list);
// 获取资金计划文件
FundPlanFileQryParam qryParam = new FundPlanFileQryParam();
qryParam.setFileId(list.get(0).getFileId());
PlanFundFile fundFile = analyseFundSpvService.getFundPlanFile(qryParam);
Assert.assertNotNull(fundFile);
} finally {
// 校验数据
super.checkDB(iCase);
super.clearDB(iCase);
}
}
}
......@@ -111,7 +111,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<!--该插件主要用途:构建可执行的JAR -->
<configuration>
<finalName>wkplat</finalName>
<finalName>bbplat</finalName>
<classifier>exec</classifier>
</configuration>
</plugin>
......
/**
* abssqr.com Inc.
* Copyright (c) 2017-2019 All Rights Reserved.
*/
package com.abssqr.plat.web.controller.analyse;
import com.abssqr.plat.common.facade.param.analyse.AnalyseBaseParam;
import com.abssqr.plat.common.facade.param.analyse.CalcFundParam;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQprParam;
import com.abssqr.plat.common.facade.param.plan.PlanPageQryParam;
import com.abssqr.plat.common.facade.result.BasePage;
import com.abssqr.plat.common.facade.result.analyse.CalcFundDefaultParam;
import com.abssqr.plat.common.facade.result.analyse.CalcFundResultVO;
import com.abssqr.plat.common.facade.result.analyse.PlanAnalyseVO;
import com.abssqr.plat.common.facade.service.analyse.AnalyseFundSpvService;
import com.general.enhanced.controller.annotation.RestJsonController;
import com.general.system.common.model.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
* 资金分析
* @author hanfei
* @version $Id: AnalyseFundPlanController.java, v 0.1 2019-09-18 6:14 PM hanfei Exp $
*/
@RestJsonController
@RequestMapping("/analyse")
public class AnalyseFundSpvController {
@Autowired
private AnalyseFundSpvService analyseFundSpvService;
/**
* 项目分析列表
* @return
*/
@RequestMapping(path = "/plan/page.json", method = RequestMethod.GET)
public BasePage queryAnalysePlan(PlanPageQryParam param){
return analyseFundSpvService.queryAnalyseSpvPlan(param);
}
/**
* 资金计划文件数据
*/
@RequestMapping(path = "/fund/file.json", method = RequestMethod.GET)
public BasePage queryFundFile(AnalyseBaseParam param){
return analyseFundSpvService.queryFundFile(param);
}
/**
* 上传资金计划
* @param param
* @return
*/
@RequestMapping(path = "/fund/import.json", method = RequestMethod.POST)
public BaseResult uploadFundFile(FundPlanFileQprParam param){
// 上传资金计划文件
String fileId = analyseFundSpvService.uploadPlanFile(param);
return BaseResult.success(fileId);
}
/**
* 短期资金需求 默认显示数据
*/
@RequestMapping(path = "/fund/calc.json", method = RequestMethod.GET)
public CalcFundDefaultParam fundCalcView(AnalyseBaseParam param){
return analyseFundSpvService.fundCalcView(param);
}
/**
* 短期资金需求计算器
*/
@RequestMapping(path = "/fund/calc.json", method = RequestMethod.POST)
public CalcFundResultVO fundCalc(@RequestBody CalcFundParam param){
return analyseFundSpvService.fundCalc(param);
}
/**
* 项目计划简要信息
* @return
*/
@RequestMapping(path = "/plan.json", method = RequestMethod.GET)
public PlanAnalyseVO simplePlan(AnalyseBaseParam param){
return analyseFundSpvService.getAnalyseSpvPlan(param);
}
}
/**
* abssqr.com Inc.
* Copyright (c) 2017-2019 All Rights Reserved.
*/
package com.abssqr.plat.web.controller.analyse;
import cn.hutool.core.io.FastByteArrayOutputStream;
import cn.hutool.core.io.IoUtil;
import com.abssqr.plat.common.facade.enums.CommonErrorCodeEnum;
import com.abssqr.plat.common.facade.model.analyse.PlanFundFile;
import com.abssqr.plat.common.facade.param.analyse.FundPlanFileQryParam;
import com.abssqr.plat.common.facade.service.analyse.AnalyseFundSpvService;
import com.abssqr.plat.common.model.exception.AbssqrBizException;
import com.general.system.common.util.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
/**
* 资金计划文件下载
* @author hanfei
* @version $Id: FundFileExportController.java, v 0.1 2019-09-18 4:21 PM hanfei Exp $
*/
@Controller
@RequestMapping(value = "/export")
public class FundFileExportController {
@Autowired
private AnalyseFundSpvService analyseFundSpvService;
/**
* 下载资金计划文件
*
* @param param
* @param response
*/
@RequestMapping(value = "/fund/file.json", method = RequestMethod.GET)
public void downloadFundFile(FundPlanFileQryParam param, HttpServletResponse response) {
PlanFundFile entity = analyseFundSpvService.getFundPlanFile(param);
// 获取附件文件流
setResponseStream(entity.getFileOutStream(), response, entity.getFileName());
}
/**
* 导出文件流
*
* @param stream
* @param response
* @param fileName
*/
private void setResponseStream(FastByteArrayOutputStream stream, HttpServletResponse response, String fileName){
try {
String outfileName = new String(fileName.getBytes(), "ISO-8859-1");
response.reset();
response.setCharacterEncoding("UTF-8");
//1.设置文件ContentType类型,这样设置,会自动判断下载文件类型
response.setContentType("multipart/form-data");
//2.设置文件头:最后一个参数是设置下载文件名
response.setHeader("Content-Disposition", "attachment;fileName=" + outfileName);
// 把数据写入到输出流中
IoUtil.write(response.getOutputStream(), true, stream.toByteArray());
} catch (Exception e) {
throw new AbssqrBizException(MessageUtil.formatMsg("下载资金计划文件[{0}]失败", fileName),
CommonErrorCodeEnum.FILE_EXPORT_ERROR, e);
} finally {
IoUtil.close(stream);
}
}
}
......@@ -3,7 +3,7 @@
<!--<configuration debug="true">-->
<include resource = "org/springframework/boot/logging/logback/defaults.xml"/>
<include resource = "org/springframework/boot/logging/logback/console-appender.xml"/>
<springProperty scope = "context" name = "logPath" source = "log.path" defaultValue = "/tmp/logs/wkplat"/>
<springProperty scope = "context" name = "logPath" source = "log.path" defaultValue = "/tmp/logs/bbplat"/>
<springProperty scope = "context" name = "logLevel" source = "log.level" defaultValue = "info"/>
<springProperty scope = "context" name = "logRootAppender" source = "log.appender" defaultValue = "ConsoleAppender"/>
<property name = "log.path" value = "${logPath}"/>
......
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