Commit 85ef16e1 authored by eddie.woo's avatar eddie.woo

模板上传下载

parent 3fc51e8f
......@@ -333,6 +333,13 @@
<artifactId>httpclient</artifactId>
<version>4.5.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcomponents-client -->
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
<dependency>
......
package pwc.taxtech.atms.common.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FileServiceConfig {
@Value("${file.server.url}")
private String serverUrl;
@Value("${file.server.upload}")
private String uploadUrl;
public String getServerUrl() {
return serverUrl;
}
public void setServerUrl(String serverUrl) {
this.serverUrl = serverUrl;
}
public String getUploadUrl() {
return uploadUrl;
}
public void setUploadUrl(String uploadUrl) {
this.uploadUrl = uploadUrl;
}
}
package pwc.taxtech.atms.common.ftp;
public class FTPClientConfig {
private String host;
private Integer port;
private String username;
private String password;
private String passiveMode;
private String encoding;
private Integer clientTimeout;
private Integer threadNum;
private Integer transferFileType;
private boolean renameUploaded;
private Integer retryTimes;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassiveMode() {
return passiveMode;
}
public void setPassiveMode(String passiveMode) {
this.passiveMode = passiveMode;
}
public String getEncoding() {
return encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public Integer getClientTimeout() {
return clientTimeout;
}
public void setClientTimeout(Integer clientTimeout) {
this.clientTimeout = clientTimeout;
}
public Integer getThreadNum() {
return threadNum;
}
public void setThreadNum(Integer threadNum) {
this.threadNum = threadNum;
}
public Integer getTransferFileType() {
return transferFileType;
}
public void setTransferFileType(Integer transferFileType) {
this.transferFileType = transferFileType;
}
public boolean isRenameUploaded() {
return renameUploaded;
}
public void setRenameUploaded(boolean renameUploaded) {
this.renameUploaded = renameUploaded;
}
public Integer getRetryTimes() {
return retryTimes;
}
public void setRetryTimes(Integer retryTimes) {
this.retryTimes = retryTimes;
}
}
package pwc.taxtech.atms.common.ftp;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.PooledObjectFactory;
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.IOException;
public class FtpClientFactory implements PooledObjectFactory<FTPClient> {
private static final Logger logger = LoggerFactory.getLogger(FtpClientFactory.class);
private FTPClientConfig config;
public FtpClientFactory(FTPClientConfig config) {
this.config = config;
}
public FTPClientConfig getConfig() {
return config;
}
@Override
public PooledObject<FTPClient> makeObject() throws Exception {
FTPClient ftpClient = new FTPClient();
// if (null != config.getClientTimeout()) {
// ftpClient.setConnectTimeout(config.getClientTimeout());
// }
// ftpClient.connect(config.getHost(), config.getPort());
// int reply = ftpClient.getReplyCode();
// if (!FTPReply.isPositiveCompletion(reply)) {
// ftpClient.disconnect();
// logger.warn("FTPServer refused connection");
// throw new ServiceException("FTPServer refused connection");
// }
// boolean result = ftpClient.login(StringUtils.defaultString(config.getUsername()),
// StringUtils.defaultString(config.getPassword()));
// if (!result) {
// throw new ServiceException("ftpClient登陆失败! userName:" + config.getUsername() + " ; password:" + config.getPassword());
// }
// ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
// if (null != config.getTransferFileType()) {
// ftpClient.setFileType(config.getTransferFileType());
// }
// ftpClient.setBufferSize(1024);
// ftpClient.setControlEncoding(StringUtils.defaultString(config.getEncoding(), "UTF-8"));
// ftpClient.enterLocalPassiveMode();
//// if (StringUtils.equals(config.getPassiveMode(), "true")) {
//// ftpClient.enterLocalPassiveMode();
//// }
//
// logger.debug("mk objec ftp client {}", ftpClient.toString());
return new DefaultPooledObject<>(ftpClient);
}
@Override
public void destroyObject(PooledObject<FTPClient> pooledObject) throws Exception {
FTPClient ftpClient = pooledObject.getObject();
try {
if (ftpClient != null && ftpClient.isConnected()) {
logger.debug("destroy ftp client {}", ftpClient.toString());
ftpClient.logout();
}
} finally {
try {
if (ftpClient != null && ftpClient.isConnected())
ftpClient.disconnect();
} catch (IOException io) {
io.printStackTrace();
}
}
}
@Override
public boolean validateObject(PooledObject<FTPClient> pooledObject) {
try {
logger.debug("validateObject {}", pooledObject.getObject().toString());
return pooledObject.getObject().sendNoOp() && pooledObject.getObject().isAvailable()
&& pooledObject.getObject().isConnected();
} catch (IOException e) {
throw new RuntimeException("Failed to validate client: " + e, e);
}
}
@Override
public void activateObject(PooledObject<FTPClient> pooledObject) throws Exception {
logger.debug("activateObject {}", pooledObject.getObject().toString());
}
@Override
public void passivateObject(PooledObject<FTPClient> pooledObject) throws Exception {
logger.debug("passivateObject {}", pooledObject.getObject().toString());
}
}
package pwc.taxtech.atms.common.ftp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FtpConfig {
@Value("${ftp.host}")
private String ftpHost;
@Value("${ftp.port}")
private Integer ftpPort;
@Value("${ftp.user}")
private String ftpUser;
@Value("${ftp.pwd}")
private String ftpPwd;
public String getFtpHost() {
return ftpHost;
}
public void setFtpHost(String ftpHost) {
this.ftpHost = ftpHost;
}
public Integer getFtpPort() {
return ftpPort;
}
public void setFtpPort(Integer ftpPort) {
this.ftpPort = ftpPort;
}
public String getFtpUser() {
return ftpUser;
}
public void setFtpUser(String ftpUser) {
this.ftpUser = ftpUser;
}
public String getFtpPwd() {
return ftpPwd;
}
public void setFtpPwd(String ftpPwd) {
this.ftpPwd = ftpPwd;
}
}
package pwc.taxtech.atms.common.ftp;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.*;
@Service
public class FtpService {
static String SYMBOL = "/";
@Autowired
FtpConfig config;
String ftpRootPath;
private String requestPrefix = "http://";
public void upload(String filePath, String fileName, InputStream inputStream) throws Exception {
String upPath;
try (WrapFtpClient wrapFtpClient = new WrapFtpClient(config)) {
if (StringUtils.isBlank(filePath)) {
upPath = ftpRootPath;
} else {
upPath = filePath;
}
if (!StringUtils.endsWith(upPath, SYMBOL)) {
upPath = upPath + SYMBOL;
}
if (!isExist(upPath, wrapFtpClient.ftpClient)) {
mkDir(upPath, wrapFtpClient.ftpClient);
}
wrapFtpClient.ftpClient.storeFile(upPath + fileName, inputStream);
}
}
/**
* 下载
*
* @param filePath 相对路径 + 文件名
* @return InputStream
* @throws Exception Exception
*/
public InputStream download(String filePath) throws Exception {
try (WrapFtpClient wrapFtpClient = new WrapFtpClient(config); OutputStream out = new ByteArrayOutputStream();) {
getRootPath(wrapFtpClient);
if (StringUtils.isBlank(filePath)) throw new ServiceException("file path should not empty");
wrapFtpClient.ftpClient.changeWorkingDirectory(ftpRootPath);
InputStream in = wrapFtpClient.ftpClient.retrieveFileStream(filePath);
int len = 0;
byte[] bytes = new byte[1024];
while ((len = in.read(bytes)) != -1) {
out.write(bytes, 0, len);
}
return new ByteArrayInputStream(((ByteArrayOutputStream) out).toByteArray());
}
}
private void mkDir(String path, FTPClient ftpClient) throws IOException {
if (StringUtils.isNotBlank(path)) {
ftpClient.changeWorkingDirectory(ftpRootPath);
String[] paths = path.split("/");
for (String p : paths) {
if (StringUtils.isNotBlank(p) && !StringUtils.equals(p, ".")) {
if (!ftpClient.changeWorkingDirectory(p)) {
ftpClient.makeDirectory(p);
if (!ftpClient.changeWorkingDirectory(p)) {
throw new IOException("changeWorkingDirectory error.");
}
}
}
}
}
}
private boolean isExist(String path, FTPClient ftpClient) throws IOException {
String pwd = ftpClient.printWorkingDirectory();
try {
return ftpClient.changeWorkingDirectory(path);
} finally {
ftpClient.changeWorkingDirectory(pwd);
}
}
/**
* 删除ftp文件
*
* @param filePath
*/
public void delete(String filePath) throws Exception {
try (WrapFtpClient wrapFtpClient = new WrapFtpClient(config);) {
getRootPath(wrapFtpClient);
if (StringUtils.isBlank(filePath)) {
return;
}
if (!isExist(filePath, wrapFtpClient.ftpClient)) {
return;
} else {
wrapFtpClient.ftpClient.deleteFile(filePath);
}
}
}
private void getRootPath(WrapFtpClient wrapFtpClient) throws Exception {
if (ftpRootPath == null || ftpRootPath.isEmpty())
ftpRootPath = wrapFtpClient.ftpClient.printWorkingDirectory();
}
public InputStream getFtpFileWithStaticUrl(String fileUrl) throws IOException {
if (StringUtils.isBlank(fileUrl)) {
return null;
}
if (StringUtils.isNotBlank(config.getFtpHost())) {
CloseableHttpClient client = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(requestPrefix + config.getFtpHost() + ":1886/" + fileUrl);
CloseableHttpResponse response = null;
try {
response = client.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200) {
return response.getEntity().getContent();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
//client.close();
//response.close();
}
}
return null;
}
}
package pwc.taxtech.atms.common.ftp;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.IOException;
public class WrapFtpClient implements AutoCloseable {
private static Logger logger = LoggerFactory.getLogger(WrapFtpClient.class);
FTPClient ftpClient;
GenericObjectPool<FTPClient> pool;
public WrapFtpClient(FtpConfig config) throws Exception {
FTPClient ftpClient = new FTPClient();
ftpClient.connect(config.getFtpHost(), config.getFtpPort());
int reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftpClient.disconnect();
logger.warn("FTPServer refused connection");
throw new ServiceException("FTPServer refused connection");
}
boolean result = ftpClient.login(StringUtils.defaultString(config.getFtpUser()),
StringUtils.defaultString(config.getFtpPwd()));
if (!result) {
throw new ServiceException("ftpClient登陆失败! userName:" + config.getFtpUser() + " ; password:" + config.getFtpPwd());
}
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.setBufferSize(1024);
ftpClient.setControlEncoding("UTF-8");
ftpClient.enterLocalPassiveMode();
this.ftpClient = ftpClient;
}
@Override
public void close() throws Exception {
try {
if (ftpClient != null && ftpClient.isConnected()) {
logger.debug("destroy ftp client {}", ftpClient.toString());
ftpClient.logout();
}
} finally {
try {
if (ftpClient != null && ftpClient.isConnected())
ftpClient.disconnect();
} catch (IOException io) {
io.printStackTrace();
}
}
}
}
......@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.ftp.FtpService;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.CellBriefDto;
......@@ -26,6 +25,7 @@ import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.BadParameterException;
import pwc.taxtech.atms.exception.NotFoundException;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.service.impl.TemplateServiceImpl;
import javax.servlet.http.HttpServletResponse;
......@@ -49,7 +49,7 @@ public class TemplateController extends BaseController {
TemplateServiceImpl templateService;
@Autowired
FtpService ftpService;
private HttpFileService httpFileService;
@RequestMapping(value = "get", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
......@@ -85,7 +85,7 @@ public class TemplateController extends BaseController {
if (template.getIsSystemType()) {
inputStream = new BufferedInputStream(new FileInputStream(templateFile));
} else {
inputStream = ftpService.getFtpFileWithStaticUrl(templatePath);
inputStream = httpFileService.getUserTemplate(templatePath);
}
//客户端保存的文件名
String customFileName = "template_" + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";
......@@ -150,7 +150,8 @@ public class TemplateController extends BaseController {
OperationResultDto<String> result = templateService.deleteTemplate(param);
if (result.getResult() && StringUtils.isNotBlank(result.getData())) {
try {
ftpService.delete(result.getData());
//todo
// httpFileService.delete(result.getData());
} catch (Exception e) {
}
}
......
......@@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.ftp.FtpService;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.service.impl.TemplateGroupServiceImpl;
import java.util.List;
......@@ -33,7 +33,7 @@ public class TemplateGroupController {
TemplateGroupServiceImpl templateGroupService;
@Autowired
FtpService ftpService;
private HttpFileService httpFileService;
@ApiOperation(value = "获取所有的模板分组")
@RequestMapping(value = "getall", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......@@ -65,7 +65,8 @@ public class TemplateGroupController {
if (pathList != null && pathList.size() > 0) {
for (String path : pathList) {
try {
//ftpService.delete(path);
//todo
//httpFileService.delete(path);
} catch (Exception e) {
}
}
......
package pwc.taxtech.atms.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.ftp.FtpService;
import java.io.InputStream;
@Service
public class FTPFileSystemServiceImpl {
private static final String USER_TEMPLATE_PATH = "pwc/userTemplate/";
@Autowired
private FtpService ftpService;
public String uploadUserTemplate(String fileName, InputStream inputStream) throws Exception {
ftpService.upload(USER_TEMPLATE_PATH, fileName, inputStream);
return USER_TEMPLATE_PATH + fileName;
}
public InputStream downloadUserTemplate(String filePath) throws Exception {
return ftpService.getFtpFileWithStaticUrl(filePath);
}
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.config.FileServiceConfig;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.IOException;
import java.io.InputStream;
@Service
public class HttpFileService extends BaseService {
@Autowired
private FileServiceConfig config;
private static final String USER_TEMPLATE_PATH = "pwc/userTemplate/";
/**
* 上传模板
*
* @param fileName 文件名
* @param inputStream inputStream
* @return Boolean
*/
public String uploadTemplate(String fileName, InputStream inputStream) throws ServiceException {
if (StringUtils.isBlank(fileName) || null == inputStream) {
throw new IllegalArgumentException("上传参数为空");
}
CloseableHttpClient httpClient = null;
String fullPath = USER_TEMPLATE_PATH + fileName;
try {
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(config.getServerUrl() + config.getUploadUrl());
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.addTextBody("path", fullPath);
multipartEntityBuilder.addBinaryBody("file", inputStream);
HttpEntity httpEntity = multipartEntityBuilder.build();
httpPost.setEntity(httpEntity);
HttpResponse httpResponse = httpClient.execute(httpPost);
ApiResultDto resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"), ApiResultDto.class);
if (resultDto.getCode() == ApiResultDto.SUCCESS) {
return fullPath;
}
} catch (Exception e) {
logger.error("uploadTemplate error.", e);
} finally {
if (null != httpClient) {
try {
httpClient.close();
} catch (IOException e) {
logger.error("close httpClient error.", e);
}
}
}
throw new ServiceException("uploadTemplate error.");
}
/**
* 下载模板
*
* @param filePath 模板路径
* @return InputStream
*/
public InputStream getUserTemplate(String filePath) {
if (StringUtils.isBlank(filePath)) {
return null;
}
if (StringUtils.isNotBlank(config.getServerUrl())) {
CloseableHttpClient client = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(StringUtils.appendIfMissing(config.getServerUrl(), "/") + filePath);
CloseableHttpResponse response = null;
try {
response = client.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200) {
return response.getEntity().getContent();
}
} catch (Exception e) {
logger.error("getUserTemplate error.", e);
} finally {
if (null != client) {
try {
client.close();
} catch (IOException e) {
logger.error("close httpClient error.", e);
}
}
}
}
return null;
}
}
......@@ -54,7 +54,7 @@ import java.util.stream.Collectors;
@Service
public class TemplateGroupServiceImpl extends AbstractService {
@Autowired
private FTPFileSystemServiceImpl fileSystemService;
private HttpFileService httpFileService;
@Autowired
private TemplateGroupDao templateGroupDao;
@Autowired
......@@ -222,7 +222,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
optional.get().write(bos);
String tmpPath = fileSystemService.uploadUserTemplate(newName, new ByteArrayInputStream(bos.toByteArray()));
String tmpPath = httpFileService.uploadTemplate(newName, new ByteArrayInputStream(bos.toByteArray()));
String[] arr = sheetName.split("_");
String name = arr.length >= 2 ? arr[1] : arr[0];
Template template = new Template();
......@@ -320,7 +320,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
optional.get().write(bos);
String tmpPath = fileSystemService.uploadUserTemplate(newName, new ByteArrayInputStream(bos.toByteArray()));
String tmpPath = httpFileService.uploadTemplate(newName, new ByteArrayInputStream(bos.toByteArray()));
String[] arr = sheetName.split("_");
String name = arr.length >= 2 ? arr[1] : arr[0];
Template template = new Template();
......
......@@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.ftp.FtpService;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
......@@ -24,6 +23,7 @@ import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.dto.vatdto.CellTemplateConfigGroupDto;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import pwc.taxtech.atms.vat.entity.*;
......@@ -47,7 +47,7 @@ public class ReportGeneratorImpl {
@Autowired
private ProjectMapper projectMapper;
@Autowired
private FtpService ftpService;
private HttpFileService httpFileService;
@Autowired
private FormulaAgent formulaAgent;
@Autowired
......@@ -471,7 +471,7 @@ public class ReportGeneratorImpl {
} else {
InputStream is = null;
try {
is = ftpService.getFtpFileWithStaticUrl(a.getPath());
is = httpFileService.getUserTemplate(a.getPath());
tWorkbook = WorkbookFactory.create(is);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -5,10 +5,39 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- See: https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_DruidDataSource%E5%8F%82%E8%80%83%E9%85%8D%E7%BD%AE -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<property name="url" value="${jdbc_url}"/>
<property name="username" value="${jdbc_user}"/>
<property name="password" value="${jdbc_password}"/>
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="url" value="${jdbc_url}" />
<property name="username" value="${jdbc_user}" />
<property name="password" value="${jdbc_password}" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="${atms.config.druid.initialSize:1}" />
<property name="minIdle" value="${atms.config.druid.minIdle:1}" />
<property name="maxActive" value="${atms.config.druid.maxActive:20}" />
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="${atms.config.druid.maxWait:60000}" />
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="${atms.config.druid.timeBetweenEvictionRunsMillis:60000}" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="${atms.config.druid.minEvictableIdleTimeMillis:300000}" />
<property name="validationQuery" value="SELECT 'x' FROM DUAL" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="true" />
<property name="maxPoolPreparedStatementPerConnectionSize"
value="20" />
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
......
......@@ -26,11 +26,9 @@ jwt.powerToken=${jwt.powerToken}
jwt.expireSecond=${jwt.expireSecond}
jwt.refreshSecond=${jwt.refreshSecond}
#FTP Config
ftp.host=${ftp.host}
ftp.port=${ftp.port}
ftp.user=${ftp.user}
ftp.pwd=${ftp.pwd}
#File Server Config
file.server.url=${file.server.url}
file.server.upload=${file.server.upload}
#upload
max_file_length=${max_file_length}
......
......@@ -27,10 +27,9 @@ jwt.powerToken=xxxx
jwt.expireSecond=180000
jwt.refreshSecond=600
ftp.host=10.158.230.144
ftp.port=2121
ftp.user=admin
ftp.pwd=admin
#File Server Config
file.server.url=http://10.158.230.144:1886
file.server.upload=/api/v1/upload
#upload
max_file_length=104857600
......
......@@ -16,10 +16,9 @@ jwt.powerToken=
jwt.expireSecond=1800
jwt.refreshSecond=900
ftp.host=cnshaappulv004.asia.pwcinternal.com
ftp.port=21
ftp.user=ftpuser
ftp.pwd=12345678
#File Server Config
file.server.url=http://10.158.230.144:1886
file.server.upload=/api/v1/upload
#upload
max_file_length=104857600
......
......@@ -16,10 +16,9 @@ jwt.powerToken=xxxx
jwt.expireSecond=1800
jwt.refreshSecond=900
ftp.host=cnshaappulv003.asia.pwcinternal.com
ftp.port=21
ftp.user=ftpuser
ftp.pwd=12345678
#File Server Config
file.server.url=http://10.158.230.144:1886
file.server.upload=/api/v1/upload
#upload
max_file_length=104857600
......
......@@ -51,6 +51,16 @@ grunt.initConfig({
'<%= pkg.bundleDest %>/less/infrastructure.less': ['app/admin/infrastructure/**/*.less']
}
},
noPermissionPageJs: {
src: ['app/admin/noPermissionPage/**/*.js'],
dest: '<%= pkg.bundleTemp %>/noPermissionPage.js'
},
noPermissionPageLess: {
options: {process},
files: {
'<%= pkg.bundleDest %>/less/noPermissionPage.less': ['app/admin/noPermissionPage/**/*.less']
}
},
contentCss: {
src: ["Content/bootstrap.css",
"Content/bootstrap-switch/bootstrap3/bootstrap-switch.css",
......@@ -367,6 +377,11 @@ grunt.initConfig({
"<%= pkg.bundleDest %>/infrastructure.less": "<%= pkg.bundleDest %>/less/infrastructure.less"
}
},
noPermissionPage: {
files: {
"<%= pkg.bundleDest %>/noPermissionPage.less": "<%= pkg.bundleDest %>/less/noPermissionPage.less"
}
},
appresources: {
files: {
'<%= pkg.bundleDest %>/appresources.less': '<%= pkg.bundleDest %>/less/appresources.less'
......@@ -481,7 +496,7 @@ grunt.registerTask('dev', '开发环境', function () {
grunt.task.run(['concat:adminHomePageJs', 'concat:adminHomePageLess','concat:basicDataJs',
'concat:basicDataLess', 'concat:systemConfigurationJs','concat:systemConfigurationLess',
'concat:basicDataCss', 'concat:infrastructureJs','concat:infrastructureLess',
'concat:commonCss', 'concat:commonLess','concat:adminApp',
'concat:commonCss', 'concat:commonLess','concat:adminApp','concat:noPermissionPageJs','concat:noPermissionPageLess',
'concat:commonJs', 'concat:frameworkJs','concat:frameworkLess',
'concat:taxDocumentManageLess', 'concat:taxDocumentManageJs','concat:appJs',
'concat:vatJs', 'concat:vatCss','concat:vatLess',
......
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