Commit e60b519b authored by kevin's avatar kevin

#

parent 18ca2aa0
...@@ -754,6 +754,13 @@ public class DateUtils { ...@@ -754,6 +754,13 @@ public class DateUtils {
return getPeriodEndFormat(year, period, Constant.DateFormat.DEFAULT); return getPeriodEndFormat(year, period, Constant.DateFormat.DEFAULT);
} }
//获取当前 格式化成stirng的日期 yyyy-MM-dd
public static String nowDateFormat() {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return simpleDateFormat.format(date);
}
// /*************************************************************************** // /***************************************************************************
// * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1 // * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1
// * 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 以缩写不带其它符号形式返回 // 5 以点号.返回 // * 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 以缩写不带其它符号形式返回 // 5 以点号.返回
......
package pwc.taxtech.atms.common.util;
/**
* @ClassName FileExcelUtil
* Description TODO
* @Author pwc kevin
* @Date 3/31/2019 12:35 PM
* Version 1.0
**/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@SuppressWarnings("restriction")
public class FileExcelUtil {
private static final Logger logger = LoggerFactory.getLogger(FileExcelUtil.class);
/**
* 编译下载的文件名
* @param filename
* @param agent
* @return
* @throws IOException
*/
public static String encodeDownloadFilename(String filename, String agent)throws IOException {
if (agent.contains("Firefox")) { // 火狐浏览器
filename = "=?UTF-8?B?"
+ new BASE64Encoder().encode(filename.getBytes("utf-8"))
+ "?=";
filename = filename.replaceAll("\r\n", "");
} else { // IE及其他浏览器
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+"," ");
}
return filename;
}
/**
* 创建文件夹;
* @param path
*/
public static void createFile(String path) {
File file = new File(path);
//判断文件是否存在;
if (!file.exists()) {
//创建文件;
file.mkdirs();
}
}
/**
* 生成.zip文件;
* @param path
* @throws IOException
*/
public static ZipOutputStream craeteZipPath(String path) throws IOException{
ZipOutputStream zipOutputStream = null;
File file = new File(path+DateUtils.nowDateFormat()+".zip");
zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
File[] files = new File(path).listFiles();
FileInputStream fileInputStream = null;
byte[] buf = new byte[1024];
int len = 0;
if(files!=null && files.length > 0){
for(File excelFile:files){
String fileName = excelFile.getName();
fileInputStream = new FileInputStream(excelFile);
//放入压缩zip包中;
zipOutputStream.putNextEntry(new ZipEntry(path + "/"+fileName));
//读取文件;
while((len=fileInputStream.read(buf)) >0){
zipOutputStream.write(buf, 0, len);
}
//关闭;
zipOutputStream.closeEntry();
if(fileInputStream != null){
fileInputStream.close();
}
}
}
/*if(zipOutputStream !=null){
zipOutputStream.close();
}*/
return zipOutputStream;
}
/**
* //压缩文件
* @param srcfile 要压缩的文件数组
* @param zipfile 生成的zip文件对象
*/
public static void ZipFiles(java.io.File[] srcfile, File zipfile) throws Exception {
byte[] buf = new byte[1024];
FileOutputStream fos = new FileOutputStream(zipfile);
ZipOutputStream out = new ZipOutputStream(fos);
for (int i = 0; i < srcfile.length; i++) {
FileInputStream in = new FileInputStream(srcfile[i]);
out.putNextEntry(new ZipEntry(srcfile[i].getName()));
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
fos.flush();
fos.close();
}
/**
* 删除文件夹及文件夹下所有文件
* @param dir
* @return
*/
public static boolean deleteDir(File dir) {
if (dir == null || !dir.exists()){
return true;
}
if (dir.isDirectory()) {
String[] children = dir.list();
//递归删除目录中的子目录下
for (int i=0; i<children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
// 目录此时为空,可以删除
return dir.delete();
}
/**
* 生成html
* @param msg
* @return
*/
public static String getErrorHtml(String msg) {
StringBuffer sb = new StringBuffer();
sb.append("<html>");
sb.append("<head>");
sb.append("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
sb.append("</head>");
sb.append("<body>");
sb.append("<div id='errorInfo'> ");
sb.append("</div>");
sb.append("<script>alert('"+msg+"')</script>");
sb.append("</body>");
sb.append("</html>");
return sb.toString();
}
/**
* 设置下载excel的响应头信息
* @param response
* @param request
* @param fileName
* @throws IOException
*/
public static void setExcelHeadInfo(HttpServletResponse response, HttpServletRequest request, String fileName) {
try {
// 获取客户端浏览器的类型
String agent = request.getHeader("User-Agent");
// 对文件名重新编码
String encodingFileName = FileExcelUtil.encodeDownloadFilename(fileName, agent);
// 告诉客户端允许断点续传多线程连接下载
response.setHeader("Accept-Ranges", "bytes");
//文件后缀
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + encodingFileName);
} catch (IOException e) {
logger.error(Thread.currentThread().getStackTrace()[1].getMethodName() +"发生的异常是: ",e);
throw new RuntimeException(e);
}
}
/**
* 设置下载zip的响应头信息
* @param response
* @param fileName 文件名
* @param request
* @throws IOException
*/
public static void setZipDownLoadHeadInfo(HttpServletResponse response, HttpServletRequest request, String fileName) throws IOException {
// 获取客户端浏览器的类型
String agent = request.getHeader("User-Agent");
response.setContentType("application/octet-stream ");
// 表示不能用浏览器直接打开
response.setHeader("Connection", "close");
// 告诉客户端允许断点续传多线程连接下载
response.setHeader("Accept-Ranges", "bytes");
// 对文件名重新编码
String encodingFileName = FileExcelUtil.encodeDownloadFilename(fileName, agent);
response.setHeader("Content-Disposition", "attachment; filename=" + encodingFileName);
}
}
\ No newline at end of file
package pwc.taxtech.atms.common.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
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.net.URLEncoder;
import java.security.MessageDigest;
/**
* author kevin
* ver 1.0
*/
@Configuration
public class FileUploadUtil implements ApplicationContextAware {
protected static final Logger logger = LoggerFactory.getLogger(FileUploadUtil.class);
// Spring应用上下文环境
private static ApplicationContext applicationContext;
private static FileServiceConfig config;
private static final String HTTP_SUCCESS_CODE = "200";
protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
public static String getUploadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getUploadUrl();
}
public static String downLoadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getDownloadUrl();
}
/**
* 上传模板
*
* @param file MultipartFile
* @return Boolean
*/
public static String upload(MultipartFile file, String fileName) throws ServiceException {
if (StringUtils.isBlank(file.getOriginalFilename()) || null == file) {
throw new IllegalArgumentException("上传参数为空");
}
if (fileName == null) {
fileName = file.getOriginalFilename();
}
CloseableHttpClient httpClient = null;
String requestKey = CommonUtils.getUUID();
String requestUrl = getUploadUrl() + "/" + requestKey;
try {
/*String serverPath = serverPath();
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(serverPath);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());*/
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
String md5Str = getFileMD5String(file);
ByteArrayBody byteBody = new ByteArrayBody(file.getBytes(), ContentType.MULTIPART_FORM_DATA, StringUtils.isBlank(fileName) ? URLEncoder.encode(file.getOriginalFilename(), "UTF-8") : URLEncoder.encode(fileName, "UTF-8"));
StringBody md5 = new StringBody(md5Str, ContentType.create("text/plain"));
HttpEntity httpEntity = MultipartEntityBuilder.create().addPart("filecontent", byteBody).addPart("md5", md5).build();
httpPost.setEntity(httpEntity);
HttpResponse httpResponse = httpClient.execute(httpPost);
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (HTTP_SUCCESS_CODE.equals(resultDto.getString("status_code")))
return requestKey;
return null;
} catch (Exception e) {
e.printStackTrace();
logger.error("uploadTemplate error.", e);
return null;
} finally {
if (null != httpClient) {
try {
httpClient.close();
} catch (IOException e) {
logger.error("close httpClient error.", e);
}
}
}
}
public static boolean downLoad(String download_url) {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(downLoadUrl() + "/" + download_url);
HttpResponse httpResponse = null;
try {
httpResponse = httpClient.execute(httpGet);
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (resultDto.getString("status_code").equals(HTTP_SUCCESS_CODE))
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return false;
}
/**
* 实现ApplicationContextAware接口的回调方法。设置上下文环境
*
* @param applicationContext
*/
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
/**
* @return ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static String getFileMD5String(MultipartFile file) throws Exception {
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(file.getBytes());
byte bytes[] = messagedigest.digest();
return bufferToHex(bytes, 0, bytes.length);
}
private static String bufferToHex(byte bytes[], int m, int n) {
StringBuffer stringbuffer = new StringBuffer(2 * n);
int k = m + n;
for (int l = m; l < k; l++) {
appendHexPair(bytes[l], stringbuffer);
}
return stringbuffer.toString();
}
private static void appendHexPair(byte bt, StringBuffer stringbuffer) {
char c0 = hexDigits[(bt & 0xf0) >> 4];
char c1 = hexDigits[bt & 0xf];
stringbuffer.append(c0);
stringbuffer.append(c1);
}
}
...@@ -8,7 +8,6 @@ import org.springframework.http.ResponseEntity; ...@@ -8,7 +8,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.FileUploadUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType; import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper; import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
...@@ -20,6 +19,7 @@ import pwc.taxtech.atms.entity.OrganizationExample; ...@@ -20,6 +19,7 @@ import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample; import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.service.impl.BaseService; import pwc.taxtech.atms.service.impl.BaseService;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.ReportUploadService; import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.dao.PwcReportAttachMapper; import pwc.taxtech.atms.vat.dao.PwcReportAttachMapper;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
...@@ -29,6 +29,7 @@ import javax.annotation.Resource; ...@@ -29,6 +29,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -251,13 +252,18 @@ public class ReportController { ...@@ -251,13 +252,18 @@ public class ReportController {
} }
@Autowired
private DidiFileUploadService didiFileUploadService;
@RequestMapping(value = "doUpload", method = RequestMethod.POST) @RequestMapping(value = "doUpload", method = RequestMethod.POST)
public OperationResultDto doUploadAttach(@RequestParam("fileName") String fileName, MultipartFile file, String remarks, @RequestParam("activeCol") Long activeCol, @RequestParam("activeRow") Long activeRow, @RequestParam("activeTemplateId") String activeTemplateId) { public OperationResultDto doUploadAttach(@RequestParam("fileName") String fileName, MultipartFile file, String remarks, @RequestParam("activeCol") Long activeCol, @RequestParam("activeRow") Long activeRow, @RequestParam("activeTemplateId") String activeTemplateId) {
System.out.println(activeCol + "----" + activeRow + "-----" + activeTemplateId); FileUpload fileUpload = null;
OperationResultDto operationResultDto = reportService.doUploadAttach(file, remarks); try{
if (!"error".equals(operationResultDto.getResultMsg())) {//上传成功绑定 fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), "附件上传");
reportService.bindPwcAttach(activeCol, activeRow, activeTemplateId, (FileDto) operationResultDto.getData()); }catch(Exception e){
e.printStackTrace();
} }
operationResultDto.success();
reportService.bindPwcAttach(activeCol, activeRow, activeTemplateId, fileUpload, remarks);
return operationResultDto; return operationResultDto;
} }
...@@ -274,20 +280,19 @@ public class ReportController { ...@@ -274,20 +280,19 @@ public class ReportController {
@Resource @Resource
private PwcReportAttachMapper pwcReportAttachMapper; private PwcReportAttachMapper pwcReportAttachMapper;
@RequestMapping("") /* @RequestMapping("downLoadAttach")
public OperationResultDto downLoadAttach(Long id) { public OperationResultDto downLoadAttach(Long id) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
PwcReportAttachExample example = new PwcReportAttachExample(); PwcReportAttachExample example = new PwcReportAttachExample();
PwcReportAttachExample.Criteria criteria = example.createCriteria(); PwcReportAttachExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(id); criteria.andIdEqualTo(id);
if (FileUploadUtil.downLoad(pwcReportAttachMapper.selectByExample(example).get(0).getFileUrl()) == true) { if (didiFileUploadService.queryPage(pwcReportAttachMapper.selectByExample(example).get(0).getFileUrl()) == true) {
return operationResultDto.success(); return operationResultDto.success();
} }
;
operationResultDto.setResultMsg("附件导出失败"); operationResultDto.setResultMsg("附件导出失败");
return operationResultDto; return operationResultDto;
} }
*/
@Resource @Resource
private OrganizationMapper organizationMapper; private OrganizationMapper organizationMapper;
...@@ -342,6 +347,12 @@ public class ReportController { ...@@ -342,6 +347,12 @@ public class ReportController {
@RequestMapping("manyExport") @RequestMapping("manyExport")
public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto) { public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
String zipName = "利润表";
try {
reportService.manyExport(requestParameterDto, zipName);
} catch (URISyntaxException e) {
e.printStackTrace();
}
operationResultDto.setResult(null); operationResultDto.setResult(null);
return operationResultDto; return operationResultDto;
} }
......
...@@ -75,7 +75,7 @@ public class DidiFileUploadService extends BaseService { ...@@ -75,7 +75,7 @@ public class DidiFileUploadService extends BaseService {
private static final String PROXY_PORT = "11007"; private static final String PROXY_PORT = "11007";
public FileUpload getFileUpload(String uid){ public FileUpload getFileUpload(String uid) {
return fileUploadMapper.selectByPrimaryKey(uid); return fileUploadMapper.selectByPrimaryKey(uid);
} }
...@@ -127,8 +127,7 @@ public class DidiFileUploadService extends BaseService { ...@@ -127,8 +127,7 @@ public class DidiFileUploadService extends BaseService {
throw new ServiceException("uploadFile error."); throw new ServiceException("uploadFile error.");
} }
public FileUpload uploadFile(byte[] bytes, String fileName, String bizSource) throws ServiceException public FileUpload uploadFile(byte[] bytes, String fileName, String bizSource) throws ServiceException {
{
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
String requestKey = CommonUtils.getUUID(); String requestKey = CommonUtils.getUUID();
String requestUrl = upload_post_url + "/" + requestKey; String requestUrl = upload_post_url + "/" + requestKey;
...@@ -173,6 +172,7 @@ public class DidiFileUploadService extends BaseService { ...@@ -173,6 +172,7 @@ public class DidiFileUploadService extends BaseService {
} }
throw new ServiceException("uploadFile error."); throw new ServiceException("uploadFile error.");
} }
public static String getFileMD5String(MultipartFile file) throws Exception { public static String getFileMD5String(MultipartFile file) throws Exception {
MessageDigest messagedigest = MessageDigest.getInstance("MD5"); MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(file.getBytes()); messagedigest.update(file.getBytes());
...@@ -197,7 +197,6 @@ public class DidiFileUploadService extends BaseService { ...@@ -197,7 +197,6 @@ public class DidiFileUploadService extends BaseService {
} }
public PageInfo<DidiFileUploadDetailResult> queryPage(DidiFileIUploadParam param) { public PageInfo<DidiFileUploadDetailResult> queryPage(DidiFileIUploadParam param) {
Page page = null; Page page = null;
if (param.getPageInfo() != null && param.getPageInfo().getPageSize() != null && param.getPageInfo().getPageIndex() != null) { if (param.getPageInfo() != null && param.getPageInfo().getPageSize() != null && param.getPageInfo().getPageIndex() != null) {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java"> <javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" /> <property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator> </javaClientGenerator>
<table tableName="ebit_spread_data" domainObjectName="EbitSpreadData"> <table tableName="pwc_report_attach" domainObjectName="PwcReportAttach">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>
...@@ -548,11 +548,11 @@ ...@@ -548,11 +548,11 @@
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table>--> </table>-->
<!--
<table tableName="period_cell_data" domainObjectName="PeriodCellData"> <table tableName="period_cell_data" domainObjectName="PeriodCellData">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>-->
<!--<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource"> <!--<table tableName="period_cell_data_source" domainObjectName="PeriodCellDataSource">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
......
...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao; ...@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.EbitCellData; import pwc.taxtech.atms.vat.entity.EbitCellData;
...@@ -109,4 +110,8 @@ public interface EbitCellDataMapper extends MyVatMapper { ...@@ -109,4 +110,8 @@ public interface EbitCellDataMapper extends MyVatMapper {
int insertBatch(List<EbitCellData> pls); int insertBatch(List<EbitCellData> pls);
@Select({
"SELECT DISTINCT t.organization_id as organizationId FROM ebit_cell_data t WHERE 1=1 AND t.`period` = #{period}"
})
List<EbitCellData> selectOrgType(@Param("period") Integer period);
} }
\ No newline at end of file
...@@ -126,6 +126,17 @@ public class PwcReportAttach extends BaseEntity implements Serializable { ...@@ -126,6 +126,17 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
*/ */
private Date updateTime; private Date updateTime;
/**
* Database Column Remarks:
* 文件上传id,绑定文件库(file_upload)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
private String fileUploadId;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table pwc_report_attach * This field corresponds to the database table pwc_report_attach
...@@ -422,6 +433,30 @@ public class PwcReportAttach extends BaseEntity implements Serializable { ...@@ -422,6 +433,30 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column pwc_report_attach.file_upload_id
*
* @return the value of pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
public String getFileUploadId() {
return fileUploadId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column pwc_report_attach.file_upload_id
*
* @param fileUploadId the value for pwc_report_attach.file_upload_id
*
* @mbg.generated
*/
public void setFileUploadId(String fileUploadId) {
this.fileUploadId = fileUploadId == null ? null : fileUploadId.trim();
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table pwc_report_attach * This method corresponds to the database table pwc_report_attach
...@@ -446,6 +481,7 @@ public class PwcReportAttach extends BaseEntity implements Serializable { ...@@ -446,6 +481,7 @@ public class PwcReportAttach extends BaseEntity implements Serializable {
sb.append(", remarks=").append(remarks); sb.append(", remarks=").append(remarks);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", fileUploadId=").append(fileUploadId);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
......
...@@ -984,6 +984,76 @@ public class PwcReportAttachExample { ...@@ -984,6 +984,76 @@ public class PwcReportAttachExample {
addCriterion("update_time not between", value1, value2, "updateTime"); addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFileUploadIdIsNull() {
addCriterion("file_upload_id is null");
return (Criteria) this;
}
public Criteria andFileUploadIdIsNotNull() {
addCriterion("file_upload_id is not null");
return (Criteria) this;
}
public Criteria andFileUploadIdEqualTo(String value) {
addCriterion("file_upload_id =", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotEqualTo(String value) {
addCriterion("file_upload_id <>", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdGreaterThan(String value) {
addCriterion("file_upload_id >", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdGreaterThanOrEqualTo(String value) {
addCriterion("file_upload_id >=", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLessThan(String value) {
addCriterion("file_upload_id <", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLessThanOrEqualTo(String value) {
addCriterion("file_upload_id <=", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdLike(String value) {
addCriterion("file_upload_id like", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotLike(String value) {
addCriterion("file_upload_id not like", value, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdIn(List<String> values) {
addCriterion("file_upload_id in", values, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotIn(List<String> values) {
addCriterion("file_upload_id not in", values, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdBetween(String value1, String value2) {
addCriterion("file_upload_id between", value1, value2, "fileUploadId");
return (Criteria) this;
}
public Criteria andFileUploadIdNotBetween(String value1, String value2) {
addCriterion("file_upload_id not between", value1, value2, "fileUploadId");
return (Criteria) this;
}
} }
/** /**
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<result column="remarks" jdbcType="VARCHAR" property="remarks" /> <result column="remarks" jdbcType="VARCHAR" property="remarks" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="file_upload_id" jdbcType="VARCHAR" property="fileUploadId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -91,7 +92,7 @@ ...@@ -91,7 +92,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
id, template_id, col, `row`, del_flag, file_name, file_url, upload_user, `size`, id, template_id, col, `row`, del_flag, file_name, file_url, upload_user, `size`,
remarks, create_time, update_time remarks, create_time, update_time, file_upload_id
</sql> </sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -147,13 +148,13 @@ ...@@ -147,13 +148,13 @@
insert into pwc_report_attach (id, template_id, col, insert into pwc_report_attach (id, template_id, col,
`row`, del_flag, file_name, `row`, del_flag, file_name,
file_url, upload_user, `size`, file_url, upload_user, `size`,
remarks, create_time, update_time remarks, create_time, update_time,
) file_upload_id)
values (#{id,jdbcType=BIGINT}, #{templateId,jdbcType=VARCHAR}, #{col,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{templateId,jdbcType=VARCHAR}, #{col,jdbcType=BIGINT},
#{row,jdbcType=BIGINT}, #{delFlag,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{row,jdbcType=BIGINT}, #{delFlag,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
#{fileUrl,jdbcType=VARCHAR}, #{uploadUser,jdbcType=VARCHAR}, #{size,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR}, #{uploadUser,jdbcType=VARCHAR}, #{size,jdbcType=VARCHAR},
#{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
) #{fileUploadId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttach"> <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttach">
<!-- <!--
...@@ -198,6 +199,9 @@ ...@@ -198,6 +199,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="fileUploadId != null">
file_upload_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -236,6 +240,9 @@ ...@@ -236,6 +240,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="fileUploadId != null">
#{fileUploadId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultType="java.lang.Long">
...@@ -291,6 +298,9 @@ ...@@ -291,6 +298,9 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="record.fileUploadId != null">
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -313,7 +323,8 @@ ...@@ -313,7 +323,8 @@
`size` = #{record.size,jdbcType=VARCHAR}, `size` = #{record.size,jdbcType=VARCHAR},
remarks = #{record.remarks,jdbcType=VARCHAR}, remarks = #{record.remarks,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP} update_time = #{record.updateTime,jdbcType=TIMESTAMP},
file_upload_id = #{record.fileUploadId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -358,6 +369,9 @@ ...@@ -358,6 +369,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="fileUploadId != null">
file_upload_id = #{fileUploadId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -377,7 +391,8 @@ ...@@ -377,7 +391,8 @@
`size` = #{size,jdbcType=VARCHAR}, `size` = #{size,jdbcType=VARCHAR},
remarks = #{remarks,jdbcType=VARCHAR}, remarks = #{remarks,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP},
file_upload_id = #{fileUploadId,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap"> <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.PwcReportAttachExample" resultMap="BaseResultMap">
......
...@@ -809,7 +809,7 @@ ...@@ -809,7 +809,7 @@
.sub-title-span { .sub-title-span {
line-height: 1.42857143; line-height: 1.42857143;
font-family: 'Microsoft YaHei'; font-family: 'Microsoft YaHei';
font-weight: 409; font-weight: 409px;
font-style: normal; font-style: normal;
font-size: 13px; font-size: 13px;
color: #434343; color: #434343;
...@@ -1136,3 +1136,22 @@ ...@@ -1136,3 +1136,22 @@
} }
} }
} }
.col-sm-8{
width: 52.666667%;
text-align: left!important;
}
.col-sm-4{
width: 45.333333%;
text-align: left!important;
}
.swxx {
.col-sm-4{
width: 25.333333%;
text-align: left!important;
}
.col-sm-2{
width: 23.666667%;
}
margin-top: 20px;
}
...@@ -3068,7 +3068,7 @@ ...@@ -3068,7 +3068,7 @@
templateId : $scope.templateId templateId : $scope.templateId
} }
$timeout(function () { /* $timeout(function () {
$('#busy-indicator-container').show(); $('#busy-indicator-container').show();
var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("report"), {sheetCount: 1}); var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("report"), {sheetCount: 1});
mainSpread.isPaintSuspended(true); mainSpread.isPaintSuspended(true);
...@@ -3087,7 +3087,6 @@ ...@@ -3087,7 +3087,6 @@
} }
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) { excelIo.save(mainSpread.toJSON(), function (blob) {
if ('export' == $scope.evenType) { if ('export' == $scope.evenType) {
saveAs(blob, vatSessionService.project.name + '-' + vatSessionService.month + '-纳税申报.xlsx'); saveAs(blob, vatSessionService.project.name + '-' + vatSessionService.month + '-纳税申报.xlsx');
...@@ -3099,7 +3098,7 @@ ...@@ -3099,7 +3098,7 @@
$('.export-container').html(''); $('.export-container').html('');
$('#export').html(''); $('#export').html('');
$log.debug(mainSpread); $log.debug(mainSpread);
}, 500); }, 500);*/
vatReportService.manyExport(JSON.stringify(param)).success(function(res){ vatReportService.manyExport(JSON.stringify(param)).success(function(res){
}).error(function(error){ }).error(function(error){
......
...@@ -2487,7 +2487,7 @@ ...@@ -2487,7 +2487,7 @@
{ {
caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) { caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) {
try { try {
$('<a href="javascript:;" onClick = "downLoadAttach('+options.data.id+')" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;') $('<a href="'+options.data.fileUrl+'" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
.appendTo(container); .appendTo(container);
} }
catch (e) { catch (e) {
......
...@@ -2322,7 +2322,7 @@ ...@@ -2322,7 +2322,7 @@
{ {
caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) { caption: '文件名', dataField: "fileName", cellTemplate: function (container, options) {
try { try {
$('<a href="' + options.data.fileUrl + '" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;') $('<a href="'+options.data.fileUrl +'" target="_blank" style="cursor: pointer">"' + options.data.fileName + '"</a>&nbsp;&nbsp;')
.appendTo(container); .appendTo(container);
} }
catch (e) { catch (e) {
...@@ -2337,7 +2337,7 @@ ...@@ -2337,7 +2337,7 @@
{ {
caption: '操作', cellTemplate: function (container, options) { caption: '操作', cellTemplate: function (container, options) {
try { try {
$('<button type="button" class="btn btn-in-grid" onclick = "deleteAttach(' + options.data.id + ')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>删除</button>&nbsp;&nbsp;') $('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "deleteAttach(' + options.data.id + ')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>删除</button>&nbsp;&nbsp;')
.appendTo(container); .appendTo(container);
} }
catch (e) { catch (e) {
...@@ -2361,6 +2361,17 @@ ...@@ -2361,6 +2361,17 @@
dataSource: '_gridData' dataSource: '_gridData'
} }
}; };
window.downLoadAttach = function(id){
vatReportService.downLoadAttach(id).success(function (res) {
if(res.result){
//导出成功
}else{
SweetAlert.error(res.resultMsg);
}
}).error();
}
window.deleteAttach = function (id, data) { window.deleteAttach = function (id, data) {
swal({ swal({
title: "warning!", title: "warning!",
......
...@@ -244,9 +244,8 @@ ...@@ -244,9 +244,8 @@
}, },
downLoadAttach : function(id){ downLoadAttach : function(id){
return $http.get('/Report/downLoadAttach?id=' + id); return $http.get('/Report/downLoadAttach?id=' + id, apiConfig.createVat());
} }
}; };
}]); }]);
\ 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