Commit 12ac07af authored by kevin's avatar kevin

#

parent eded4cfd
...@@ -69,7 +69,7 @@ public class FileExcelUtil { ...@@ -69,7 +69,7 @@ public class FileExcelUtil {
* @param path * @param path
* @throws IOException * @throws IOException
*/ */
public static ZipOutputStream craeteZipPath(String path) throws IOException { public static File craeteZipPath(String path) throws IOException {
ZipOutputStream zipOutputStream = null; ZipOutputStream zipOutputStream = null;
File file = new File(path + DateUtils.nowDateFormat() + ".zip"); File file = new File(path + DateUtils.nowDateFormat() + ".zip");
zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file))); zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
...@@ -98,7 +98,7 @@ public class FileExcelUtil { ...@@ -98,7 +98,7 @@ public class FileExcelUtil {
/*if(zipOutputStream !=null){ /*if(zipOutputStream !=null){
zipOutputStream.close(); zipOutputStream.close();
}*/ }*/
return zipOutputStream; return file;
} }
...@@ -195,15 +195,15 @@ public class FileExcelUtil { ...@@ -195,15 +195,15 @@ public class FileExcelUtil {
* @throws Exception * @throws Exception
*/ */
public static File generateExcelToPath(Workbook wb, String path) throws Exception { public static File generateExcelToPath(Workbook wb, String path) throws Exception {
String[] pathArr = path.split("\\\\"); /* String[] pathArr = path.split("\\\\");
String zipDir = pathArr[0]; String zipDir = pathArr[0];
FileExcelUtil.createFile(zipDir); FileExcelUtil.createFile(zipDir);*/
File file = new File(path);
FileOutputStream fos = null; FileOutputStream fos = null;
List<File> listFile = Lists.newArrayList();
try { try {
fos = new FileOutputStream(path); fos = new FileOutputStream(file);
wb.write(fos); wb.write(fos);
return new File(path); return file;
}catch (Exception e ){ }catch (Exception e ){
e.printStackTrace(); e.printStackTrace();
return null; return null;
...@@ -235,6 +235,8 @@ public class FileExcelUtil { ...@@ -235,6 +235,8 @@ public class FileExcelUtil {
srcfile[i] = files.get(i); srcfile[i] = files.get(i);
} }
//生成.zip文件; //生成.zip文件;
//File zip = craeteZipPath(zipPath);
FileInputStream inStream = null; FileInputStream inStream = null;
ServletOutputStream os = null; ServletOutputStream os = null;
try { try {
......
...@@ -8,6 +8,9 @@ public final class Constant { ...@@ -8,6 +8,9 @@ public final class Constant {
public static final String Other = "其他"; public static final String Other = "其他";
public static final int WholeYear = -1; public static final int WholeYear = -1;
/* ----------------------------- kevin insert -----------------*/
public static String ebitRate = "1%";
/*-----------------------------------------------------------------*/
public static final int CREATE_DB_SUCCESS = 1; public static final int CREATE_DB_SUCCESS = 1;
public static final int CREATE_DB_EXISTS = 0; public static final int CREATE_DB_EXISTS = 0;
public static final int CREATE_DB_FAILED = -1; public static final int CREATE_DB_FAILED = -1;
......
...@@ -5,6 +5,7 @@ import org.apache.poi.ss.usermodel.Workbook; ...@@ -5,6 +5,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
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 org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
...@@ -15,6 +16,7 @@ import pwc.taxtech.atms.dao.OrganizationMapper; ...@@ -15,6 +16,7 @@ import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.ReportDto; import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.*; import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.periodReport.PeriodReportDataParam; import pwc.taxtech.atms.dto.periodReport.PeriodReportDataParam;
import pwc.taxtech.atms.dto.vatdto.*; import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.OrganizationExample; import pwc.taxtech.atms.entity.OrganizationExample;
...@@ -22,7 +24,9 @@ import pwc.taxtech.atms.entity.Project; ...@@ -22,7 +24,9 @@ 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.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.ReportUploadService; import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.dao.EbitSpreadDataMapper;
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.*;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl; import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
...@@ -34,6 +38,7 @@ import java.io.ByteArrayOutputStream; ...@@ -34,6 +38,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
...@@ -331,18 +336,19 @@ public class ReportController { ...@@ -331,18 +336,19 @@ public class ReportController {
} }
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "saveAndRefresh", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto saveAndRefresh(@RequestParam(value = "orgId") String orgId, public OperationResultDto saveAndRefresh(/*@RequestParam(value = "orgId") String orgId,
@RequestParam(value = "period") Integer period, @RequestParam(value = "period") Integer period,
@RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations, @RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations,
@RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate, @RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate,
@RequestParam(value = "reportId") Long reportId) { @RequestParam(value = "reportId") Long reportId,*/ @RequestBody RequestParameterDto requestParameterDto) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
String projId = getProjId(requestParameterDto.getOrgId(), requestParameterDto.getPeriod());
try{ try{
operationResultDto.setData(reportService.loadEbitData(orgId, period, specialConsiderations, ebitRate)); operationResultDto.setData(reportService.loadEbitData(requestParameterDto.getOrgId(), requestParameterDto.getPeriod(), requestParameterDto.getSpecialConsiderations(), requestParameterDto.getEbitRate()));
new Thread(()->{ /* new Thread(()->{
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto, BaseService._cellData); reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto, reportService.getCellData(Long.parseLong(requestParameterDto.getReportId()),projId ).getData().getCellData());
}).start(); }).start();*/
}catch (Exception e){ }catch (Exception e){
return operationResultDto.error(); return operationResultDto.error();
} }
...@@ -356,30 +362,35 @@ public class ReportController { ...@@ -356,30 +362,35 @@ public class ReportController {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
String zipName = "利润表"; String zipName = "利润表";
try { try {
String zipPath = "/zipDir"; reportService.manyExport(requestParameterDto, zipName,request, response);
//生成zip文件夹 } catch (Exception e) {
FileExcelUtil.createFile(zipPath);
reportService.manyExport(requestParameterDto, zipName,request, response, zipPath);
} catch (URISyntaxException e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.error(e.getMessage()); operationResultDto.error(e.getMessage());
return operationResultDto; return operationResultDto;
} }
return operationResultDto; return operationResultDto.success();
} }
@Autowired
private EbitSpreadDataMapper ebitSpreadDataMapper;
@Autowired
protected DistributedIdService idService;
/** /**
* 将spread序列化字符串保存到数据库
*/ */
@RequestMapping("spreadToDb") @RequestMapping("spreadToDb")
public OperationResultDto spreadToDb(@RequestBody HttpServletRequest request) { public OperationResultDto spreadToDb( HttpServletRequest request, Integer period, String orgId) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String,MultipartFile> fileMap = multipartRequest.getFileMap(); OperationResultDto operationResultDto = new OperationResultDto();
MultipartFile file = fileMap.get("llb.xlsx"); try{
//didiFileUploadService.uploadFile(file, );
return null; reportService.spreadToDb(request, period, orgId);
//return reportService.spreadToDb(ebitParam);
}catch (Exception e){
e.printStackTrace();
operationResultDto.error("保存失败");
}
return operationResultDto.success();
} }
} }
\ No newline at end of file
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -36,6 +37,9 @@ import pwc.taxtech.atms.service.impl.DidiFileUploadService; ...@@ -36,6 +37,9 @@ import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.HttpFileService; import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.service.impl.ReportUploadService; import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.service.impl.TemplateServiceImpl; import pwc.taxtech.atms.service.impl.TemplateServiceImpl;
import pwc.taxtech.atms.vat.dao.EbitSpreadDataMapper;
import pwc.taxtech.atms.vat.entity.EbitSpreadData;
import pwc.taxtech.atms.vat.entity.EbitSpreadDataExample;
import pwc.taxtech.atms.vat.entity.PeriodTemplate; import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import pwc.taxtech.atms.vat.entity.ReportUpload; import pwc.taxtech.atms.vat.entity.ReportUpload;
...@@ -66,6 +70,7 @@ public class TemplateController extends BaseController { ...@@ -66,6 +70,7 @@ public class TemplateController extends BaseController {
@Autowired @Autowired
DidiFileUploadService didiFileUploadService; DidiFileUploadService didiFileUploadService;
@RequestMapping(value = "get", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "get", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody public @ResponseBody
List<TemplateDto> get(@RequestParam(name = "templateGroupID") Long templateGroupId, @RequestParam(name = "reportType") String reportType) { List<TemplateDto> get(@RequestParam(name = "templateGroupID") Long templateGroupId, @RequestParam(name = "reportType") String reportType) {
...@@ -93,11 +98,11 @@ public class TemplateController extends BaseController { ...@@ -93,11 +98,11 @@ public class TemplateController extends BaseController {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) { for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r); Row row = sheet.getRow(r);
if(row == null){ if (row == null) {
continue; continue;
} }
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) { for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
if(c < 0){ if (c < 0) {
continue; continue;
} }
Cell cell = row.getCell(c); Cell cell = row.getCell(c);
...@@ -189,15 +194,17 @@ public class TemplateController extends BaseController { ...@@ -189,15 +194,17 @@ public class TemplateController extends BaseController {
@Autowired @Autowired
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
private String getProjId(String orgId, Integer tmsPeriod) { private String getProjId(String orgId, Integer tmsPeriod) {
ProjectExample pExample = new ProjectExample(); ProjectExample pExample = new ProjectExample();
pExample.createCriteria().andOrganizationIdEqualTo(orgId).andYearEqualTo(tmsPeriod/100); pExample.createCriteria().andOrganizationIdEqualTo(orgId).andYearEqualTo(tmsPeriod / 100);
List<Project> pList = projectMapper.selectByExample(pExample); List<Project> pList = projectMapper.selectByExample(pExample);
if(!pList.isEmpty()){ if (!pList.isEmpty()) {
return pList.get(0).getId(); return pList.get(0).getId();
} }
return ""; return "";
} }
@RequestMapping(value = "getPeriodTemplateJson", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @RequestMapping(value = "getPeriodTemplateJson", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody public @ResponseBody
void getPeriodTemplateBlob(@RequestParam(name = "templateId") Long templateId, void getPeriodTemplateBlob(@RequestParam(name = "templateId") Long templateId,
...@@ -208,10 +215,10 @@ public class TemplateController extends BaseController { ...@@ -208,10 +215,10 @@ public class TemplateController extends BaseController {
File templateFile; File templateFile;
InputStream inputStream = null; InputStream inputStream = null;
List<PeriodTemplate> templates = null; List<PeriodTemplate> templates = null;
if(period == null || projectId == null){ if (period == null || projectId == null) {
templates = templateService.getTemplates(templateId); templates = templateService.getTemplates(templateId);
}else{ } else {
templates = templateService.getPeriodTemplates(templateId,period,projectId); templates = templateService.getPeriodTemplates(templateId, period, projectId);
} }
MyAsserts.assertNotEmpty(templates, new NotFoundException()); MyAsserts.assertNotEmpty(templates, new NotFoundException());
PeriodTemplate template = templates.get(0); PeriodTemplate template = templates.get(0);
...@@ -277,6 +284,9 @@ public class TemplateController extends BaseController { ...@@ -277,6 +284,9 @@ public class TemplateController extends BaseController {
} }
} }
@Autowired
private EbitSpreadDataMapper ebitSpreadDataMapper;
@RequestMapping(value = "getPeriodTemplateJsonOrg", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @RequestMapping(value = "getPeriodTemplateJsonOrg", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody public @ResponseBody
void getPeriodTemplateJsonOrg(@RequestParam(name = "templateId") Long templateId, void getPeriodTemplateJsonOrg(@RequestParam(name = "templateId") Long templateId,
...@@ -284,14 +294,78 @@ public class TemplateController extends BaseController { ...@@ -284,14 +294,78 @@ public class TemplateController extends BaseController {
@RequestParam(name = "orgId") String orgId, @RequestParam(name = "orgId") String orgId,
HttpServletResponse response) throws URISyntaxException { HttpServletResponse response) throws URISyntaxException {
String projectId = null; String projectId = null;
if(orgId != null) if (orgId != null)
projectId = getProjId(orgId, period); projectId = getProjId(orgId, period);
projectId = "1942295d-6fe6-4aa7-b2e7-b66a5772697c";
String filePath; String filePath;
File templateFile; File templateFile;
InputStream inputStream = null; InputStream inputStream = null;
period = 0; OperationResultDto operationResultDto = new OperationResultDto();
List<PeriodTemplate> templates = templateService.getPeriodTemplates(templateId,period,projectId); EbitSpreadDataExample ebitSpreadData = new EbitSpreadDataExample();
ebitSpreadData.createCriteria().andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
List<EbitSpreadData> ebitSpreadData1 = ebitSpreadDataMapper.selectByExample(ebitSpreadData);
OutputStream out = null;
//客户端保存的文件名
String customFileName = "template_" + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName + "\""));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
// int len = 0;
// byte[] buffer = new byte[1024];
// out = response.getOutputStream();
// while ((len = inputStream.read(buffer)) > 0) {
// out.write(buffer, 0, len);
// }
try {
out = response.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
if (ebitSpreadData1.size() != 0) {
DidiFileIUploadParam didiFileIUploadParam = new DidiFileIUploadParam();
didiFileIUploadParam.setUuids(Arrays.asList(ebitSpreadData1.get(0).getFileKey()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(didiFileIUploadParam);
String path = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
path = uploadDetail.getList().get(0).getViewHttpUrl();
}
InputStream inputStream1 = httpFileService.getUserTemplate(path);
try {
IOUtils.copy(inputStream1, out);
} catch (IOException e) {
e.printStackTrace();
}
try {
out.flush();
return;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
out = null;
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
inputStream = null;
}
}
}
List<PeriodTemplate> templates = Lists.newArrayList();
if (projectId == null || "".equals(projectId)) {
templates = templateService.getTemplates(templateId);
} else {
templates = templateService.getPeriodTemplates(templateId, period, projectId);
}
MyAsserts.assertNotEmpty(templates, new NotFoundException()); MyAsserts.assertNotEmpty(templates, new NotFoundException());
PeriodTemplate template = templates.get(0); PeriodTemplate template = templates.get(0);
String templatePath = template.getPath(); String templatePath = template.getPath();
...@@ -299,7 +373,7 @@ public class TemplateController extends BaseController { ...@@ -299,7 +373,7 @@ public class TemplateController extends BaseController {
filePath = this.getClass().getResource("").toURI().getPath(); filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length()); String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templateFile = new File(tempPath + templatePath); templateFile = new File(tempPath + templatePath);
OutputStream out = null;
try { try {
//如果是系统报表就取本地文件夹,如果不是就取FTP //如果是系统报表就取本地文件夹,如果不是就取FTP
if (template.getIsSystemType()) { if (template.getIsSystemType()) {
...@@ -316,21 +390,9 @@ public class TemplateController extends BaseController { ...@@ -316,21 +390,9 @@ public class TemplateController extends BaseController {
} }
inputStream = httpFileService.getUserTemplate(templatePath); inputStream = httpFileService.getUserTemplate(templatePath);
} }
//客户端保存的文件名
String customFileName = "template_" + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName + "\""));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
// int len = 0;
// byte[] buffer = new byte[1024];
// out = response.getOutputStream();
// while ((len = inputStream.read(buffer)) > 0) {
// out.write(buffer, 0, len);
// }
out = response.getOutputStream();
IOUtils.copy(handleFomularView(inputStream), out); IOUtils.copy(handleFomularView(inputStream), out);
out.flush(); out.flush();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
...@@ -355,6 +417,7 @@ public class TemplateController extends BaseController { ...@@ -355,6 +417,7 @@ public class TemplateController extends BaseController {
} }
} }
} }
private File getTempFile(String templatePath) throws URISyntaxException { private File getTempFile(String templatePath) throws URISyntaxException {
String filePath = this.getClass().getResource("").toURI().getPath(); String filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length()); String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
...@@ -458,7 +521,7 @@ public class TemplateController extends BaseController { ...@@ -458,7 +521,7 @@ public class TemplateController extends BaseController {
//获取网站部署路径(通过ServletContext对象),用于确定下载文件位置,从而实现下载 //获取网站部署路径(通过ServletContext对象),用于确定下载文件位置,从而实现下载
String fileName = ""; String fileName = "";
fileName = EnumAnalysisImportType.getNameByCode(fileType); fileName = EnumAnalysisImportType.getNameByCode(fileType);
if(StringUtils.isEmpty(fileName)){ if (StringUtils.isEmpty(fileName)) {
throw new ServiceException(ErrorMessage.SystemError); throw new ServiceException(ErrorMessage.SystemError);
} }
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
......
...@@ -9,10 +9,5 @@ package pwc.taxtech.atms.dto; ...@@ -9,10 +9,5 @@ package pwc.taxtech.atms.dto;
**/ **/
public class RequestParameterBaseDto { public class RequestParameterBaseDto {
public String orgId;
public Integer period;
public String templateId;
public String projectId;
public String reportId;
} }
...@@ -10,23 +10,27 @@ import java.io.Serializable; ...@@ -10,23 +10,27 @@ import java.io.Serializable;
* Version 1.0 * Version 1.0
* 请求参数封装 * 请求参数封装
**/ **/
public class RequestParameterDto extends RequestParameterBaseDto implements Serializable { public class RequestParameterDto implements Serializable {
public class EbitParam extends RequestParameterDto{
private String jsonString;//excel传过来的数据 已经被序列化成字符串了 private String jsonString;//excel传过来的数据 已经被序列化成字符串了
private Integer specialConsiderations; private Integer specialConsiderations;
private String ebitRate; private String ebitRate;
public String getEbitRate() { public String orgId;
return ebitRate; public Integer period;
public String templateId;
public String projectId;
public String reportId;
public String getJsonString() {
return jsonString;
} }
public void setEbitRate(String ebitRate) { public void setJsonString(String jsonString) {
this.ebitRate = ebitRate; this.jsonString = jsonString;
} }
public Integer getSpecialConsiderations() { public Integer getSpecialConsiderations() {
return specialConsiderations; return specialConsiderations;
} }
...@@ -34,21 +38,12 @@ public class RequestParameterDto extends RequestParameterBaseDto implements Se ...@@ -34,21 +38,12 @@ public class RequestParameterDto extends RequestParameterBaseDto implements Se
this.specialConsiderations = specialConsiderations; this.specialConsiderations = specialConsiderations;
} }
public String getJsonString() { public String getEbitRate() {
return jsonString; return ebitRate;
}
public void setJsonString(String jsonString) {
this.jsonString = jsonString;
}
}
public String getReportId() {
return reportId;
} }
public void setReportId(String reportId) { public void setEbitRate(String ebitRate) {
this.reportId = reportId; this.ebitRate = ebitRate;
} }
public String getOrgId() { public String getOrgId() {
...@@ -83,15 +78,25 @@ public class RequestParameterDto extends RequestParameterBaseDto implements Se ...@@ -83,15 +78,25 @@ public class RequestParameterDto extends RequestParameterBaseDto implements Se
this.projectId = projectId; this.projectId = projectId;
} }
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
@Override @Override
public String toString() { public String toString() {
return "RequestParameterDto{" + return "RequestParameterDto{" +
"reportId='" + reportId + '\'' + "jsonString='" + jsonString + '\'' +
", specialConsiderations=" + specialConsiderations +
", ebitRate='" + ebitRate + '\'' +
", orgId='" + orgId + '\'' + ", orgId='" + orgId + '\'' +
", period=" + period + ", period=" + period +
", templateId='" + templateId + '\'' + ", templateId='" + templateId + '\'' +
", projectId='" + projectId + '\'' + ", projectId='" + projectId + '\'' +
", reportId='" + reportId + '\'' +
'}'; '}';
} }
} }
...@@ -12,9 +12,9 @@ import java.math.BigDecimal; ...@@ -12,9 +12,9 @@ import java.math.BigDecimal;
public class EbitDataDto { public class EbitDataDto {
private BigDecimal ebitSubtraction; // 1. EBIT(考虑资产减值损失) private BigDecimal ebitSubtraction; // 1. EBIT(考虑资产减值损失)
private BigDecimal specialFactors; //考虑特殊因素 private BigDecimal specialFactors; //考虑特殊因素
private double ebitRate;// ebit比率 默认1%(可更改) private String ebitRate;// ebit比率 默认1%(可更改)
private BigDecimal transactionAmount; //关联交易金额 private BigDecimal transactionAmount; //关联交易金额
private String sixAddTax; //6%增值税 private BigDecimal sixAddTax; //6%增值税
private BigDecimal totalAmountTax;// 价税合计金额 private BigDecimal totalAmountTax;// 价税合计金额
private String specialConsiderations;//特殊因素考虑 private String specialConsiderations;//特殊因素考虑
public String getSpecialConsiderations() { public String getSpecialConsiderations() {
...@@ -44,11 +44,11 @@ public class EbitDataDto { ...@@ -44,11 +44,11 @@ public class EbitDataDto {
this.specialFactors = specialFactors; this.specialFactors = specialFactors;
} }
public double getEbitRate() { public String getEbitRate() {
return ebitRate; return ebitRate;
} }
public void setEbitRate(double ebitRate) { public void setEbitRate(String ebitRate) {
this.ebitRate = ebitRate; this.ebitRate = ebitRate;
} }
...@@ -60,11 +60,11 @@ public class EbitDataDto { ...@@ -60,11 +60,11 @@ public class EbitDataDto {
this.transactionAmount = transactionAmount; this.transactionAmount = transactionAmount;
} }
public String getSixAddTax() { public BigDecimal getSixAddTax() {
return sixAddTax; return sixAddTax;
} }
public void setSixAddTax(String sixAddTax) { public void setSixAddTax(BigDecimal sixAddTax) {
this.sixAddTax = sixAddTax; this.sixAddTax = sixAddTax;
} }
......
...@@ -5,15 +5,11 @@ import org.springframework.jdbc.core.JdbcTemplate; ...@@ -5,15 +5,11 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.common.util.MyAsserts; import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.common.util.StringUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.CitTbamMapper; import pwc.taxtech.atms.dao.CitTbamMapper;
import pwc.taxtech.atms.dao.FormulaAdminMapper; import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.ProjectServiceTypeMapper; import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dpo.GroupId;
import pwc.taxtech.atms.dto.TableRule; import pwc.taxtech.atms.dto.TableRule;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
......
...@@ -8,6 +8,7 @@ import com.google.common.collect.Lists; ...@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
...@@ -19,6 +20,8 @@ import org.springframework.beans.BeanUtils; ...@@ -19,6 +20,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil; import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
...@@ -305,7 +308,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -305,7 +308,7 @@ public class ReportServiceImpl extends BaseService {
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) { private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate(); List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
//根据收入类型映射生成开票记录关联数据 //根据收入类型映射生成开票记录关联数据
assembleInvoiceRecord(projectId, period,isMergeManualData); assembleInvoiceRecord(projectId, period, isMergeManualData);
//生成trial_balance_final数据 //生成trial_balance_final数据
assembleTrialBalanceFinal(projectId, period); assembleTrialBalanceFinal(projectId, period);
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
...@@ -333,7 +336,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -333,7 +336,7 @@ public class ReportServiceImpl extends BaseService {
trialBalanceFinalMapper.generateFinalData(projectId, Integer.valueOf(queryPeriod), lastProject == null ? "0" : lastProject.getId(), Integer.valueOf(lastPeriod)); trialBalanceFinalMapper.generateFinalData(projectId, Integer.valueOf(queryPeriod), lastProject == null ? "0" : lastProject.getId(), Integer.valueOf(lastPeriod));
} }
public void assembleInvoiceRecord(String projectId, Integer period,Boolean isMergeManualData) { public void assembleInvoiceRecord(String projectId, Integer period, Boolean isMergeManualData) {
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION); MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + "")); String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + ""));
...@@ -345,7 +348,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -345,7 +348,7 @@ public class ReportServiceImpl extends BaseService {
//先清除数据 //先清除数据
InvoiceRecord delRecord = new InvoiceRecord(); InvoiceRecord delRecord = new InvoiceRecord();
delRecord.setRevenueCofId(null); delRecord.setRevenueCofId(null);
if(!isMergeManualData){ if (!isMergeManualData) {
delRecord.setModifyRevenueCofId(null); delRecord.setModifyRevenueCofId(null);
} }
InvoiceRecordExample delExample = new InvoiceRecordExample(); InvoiceRecordExample delExample = new InvoiceRecordExample();
...@@ -1227,7 +1230,6 @@ public class ReportServiceImpl extends BaseService { ...@@ -1227,7 +1230,6 @@ public class ReportServiceImpl extends BaseService {
} }
private static final Integer specialConsideration = 0;//特殊因素考虑 private static final Integer specialConsideration = 0;//特殊因素考虑
private static final String ebitRate = "1%";//ebit 比率
public List<CellTemplateReferenceDto> getTemplateReferences(int period) { public List<CellTemplateReferenceDto> getTemplateReferences(int period) {
return new ArrayList<>(); return new ArrayList<>();
...@@ -1242,7 +1244,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1242,7 +1244,7 @@ public class ReportServiceImpl extends BaseService {
OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period)); OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period));
ReportDataDto reportDataDto = new ReportDataDto(); ReportDataDto reportDataDto = new ReportDataDto();
//特殊因素考虑 默认为0 rate 默认为1% //特殊因素考虑 默认为0 rate 默认为1%
EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, ebitRate); EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, Constant.ebitRate);
if (cellData.getData() != null) { if (cellData.getData() != null) {
cellData.getData().setEbitData(ebitDataDto1); cellData.getData().setEbitData(ebitDataDto1);
} else { } else {
...@@ -1252,7 +1254,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1252,7 +1254,7 @@ public class ReportServiceImpl extends BaseService {
return cellData; return cellData;
} }
} else if (operationResultDto1.getData().getEbitData() == null && operationResultDto1.getData().getCellData() != null) { } else if (operationResultDto1.getData().getEbitData() == null && operationResultDto1.getData().getCellData() != null) {
EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, ebitRate); EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, Constant.ebitRate);
operationResultDto1.getData().setEbitData(ebitDataDto1); operationResultDto1.getData().setEbitData(ebitDataDto1);
} else { } else {
OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period)); OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period));
...@@ -1293,7 +1295,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1293,7 +1295,7 @@ public class ReportServiceImpl extends BaseService {
case 40: case 40:
if (ebitCellData1.getData() == null) if (ebitCellData1.getData() == null)
break; break;
ebitDataDto.setEbitRate(Double.parseDouble(ebitCellData1.getData())); ebitDataDto.setEbitRate(ebitCellData1.getData());
break; break;
case 41: case 41:
if (ebitCellData1.getData() == null) if (ebitCellData1.getData() == null)
...@@ -1303,7 +1305,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1303,7 +1305,7 @@ public class ReportServiceImpl extends BaseService {
case 42: case 42:
if (ebitCellData1.getData() == null) if (ebitCellData1.getData() == null)
break; break;
ebitDataDto.setSixAddTax(ebitCellData1.getData()); ebitDataDto.setSixAddTax(new BigDecimal(ebitCellData1.getData()));
break; break;
case 43: case 43:
if (ebitCellData1.getData() == null) if (ebitCellData1.getData() == null)
...@@ -1556,10 +1558,11 @@ public class ReportServiceImpl extends BaseService { ...@@ -1556,10 +1558,11 @@ public class ReportServiceImpl extends BaseService {
@Resource @Resource
private EbitCellDataMapper ebitCellDataMapper; private EbitCellDataMapper ebitCellDataMapper;
//加载Ebit数据 //加载Ebit数据
public EbitDataDto loadEbitData(String orgId, Integer period, Integer specialConsiderations, String ebitRate) { public EbitDataDto loadEbitData(String orgId, Integer period, Integer specialConsiderations, String ebitRate) {
double rate = 0.1;
BigDecimal spec = new BigDecimal(0); BigDecimal spec = new BigDecimal(0);
double rate = 0.01; //ebitRate
if (!ebitRate.isEmpty()) { if (!ebitRate.isEmpty()) {
int _index = ebitRate.indexOf("%"); int _index = ebitRate.indexOf("%");
spec = new BigDecimal(specialConsiderations); spec = new BigDecimal(specialConsiderations);
...@@ -1583,12 +1586,12 @@ public class ReportServiceImpl extends BaseService { ...@@ -1583,12 +1586,12 @@ public class ReportServiceImpl extends BaseService {
BigDecimal yffy = new BigDecimal(0);//研发费用 BigDecimal yffy = new BigDecimal(0);//研发费用
BigDecimal zcjzss = new BigDecimal(0); //资产减值损失 BigDecimal zcjzss = new BigDecimal(0); //资产减值损失
for (ProfitLossStatement profitLossStatement : profitLossStatements) { for (ProfitLossStatement profitLossStatement : profitLossStatements) {
BigDecimal value = profitLossStatement.getPeriodAmt(); BigDecimal value = profitLossStatement.getYtdAmt();
switch (profitLossStatement.getItemName()) { switch (profitLossStatement.getItemName()) {
case "加:营业外收入": case "一、营业收入":
yysr = value; yysr = value;
break; break;
case "减:营业外支出": case "减:营业成本":
yycb = value; yycb = value;
case "营业税金及附加": case "营业税金及附加":
yysjfj = value; yysjfj = value;
...@@ -1604,26 +1607,14 @@ public class ReportServiceImpl extends BaseService { ...@@ -1604,26 +1607,14 @@ public class ReportServiceImpl extends BaseService {
zcjzss = value; zcjzss = value;
} }
EbitDataDto ebitDataDto = new EbitDataDto(); EbitDataDto ebitDataDto = new EbitDataDto();
BigDecimal subtract = yysr.subtract(yycb).subtract(yysjfj).subtract(xsfy).subtract(glfy).subtract(yffy).subtract(zcjzss); BigDecimal subtract = yysr.subtract(yycb).add(yysjfj).add(xsfy).add(glfy).add(yffy).add(zcjzss);
ebitDataDto.setEbitSubtraction(subtract); ebitDataDto.setEbitSubtraction(subtract);
ebitDataDto.setSpecialFactors(subtract.add(spec)); ebitDataDto.setSpecialFactors(subtract.add(spec));
ebitDataDto.setEbitRate(rate); ebitDataDto.setEbitRate(String.valueOf(rate*100 + "%"));
ebitDataDto.setTransactionAmount(ebitDataDto.getSpecialFactors().multiply(new BigDecimal(ebitDataDto.getEbitRate()))); ebitDataDto.setTransactionAmount(ebitDataDto.getSpecialFactors().multiply(new BigDecimal(ebitDataDto.getEbitRate())));
ebitDataDto.setTransactionAmount(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.06))); ebitDataDto.setEbitRate(ebitRate);
ebitDataDto.setSixAddTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.06)));
ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.16))); ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.16)));
/*//保存
for (int i = 37; i <= 43; i++) {
EbitCellData ebitCellData = new EbitCellData();
ebitCellData.setData(arr[i - 37]);
ebitCellData.setRow(i);
ebitCellData.setCol(3);
ebitCellData.setCreateTime(now);
ebitCellData.setOrganizationId(orgId);
ebitCellData.setPeriod(period);
ebitCellDataMapper.insert(ebitCellData);
}*/
return ebitDataDto; return ebitDataDto;
} }
return null; return null;
...@@ -2324,7 +2315,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -2324,7 +2315,7 @@ public class ReportServiceImpl extends BaseService {
ebitCellData1.setData(operationResultDto.getData().getEbitData().getTransactionAmount().toString()); ebitCellData1.setData(operationResultDto.getData().getEbitData().getTransactionAmount().toString());
ebitCellData1.setRow(i); ebitCellData1.setRow(i);
case 42: case 42:
ebitCellData1.setData(operationResultDto.getData().getEbitData().getSixAddTax()); ebitCellData1.setData(operationResultDto.getData().getEbitData().getSixAddTax().toString());
ebitCellData1.setRow(i); ebitCellData1.setRow(i);
case 43: case 43:
ebitCellData1.setData(operationResultDto.getData().getEbitData().getTotalAmountTax().toString()); ebitCellData1.setData(operationResultDto.getData().getEbitData().getTotalAmountTax().toString());
...@@ -2341,8 +2332,9 @@ public class ReportServiceImpl extends BaseService { ...@@ -2341,8 +2332,9 @@ public class ReportServiceImpl extends BaseService {
@Resource @Resource
private EbitSpreadDataMapper ebitSpreadDataMapper; private EbitSpreadDataMapper ebitSpreadDataMapper;
public OperationResultDto spreadToDb(RequestParameterDto.EbitParam ebitParam) { @Transactional
try { public synchronized OperationResultDto spreadToDb(HttpServletRequest request, Integer period, String orgId) {
/* try {
EbitSpreadDataExample example = new EbitSpreadDataExample(); EbitSpreadDataExample example = new EbitSpreadDataExample();
EbitSpreadDataExample.Criteria criteria = example.createCriteria(); EbitSpreadDataExample.Criteria criteria = example.createCriteria();
EbitSpreadDataExample.Criteria criteria1 = criteria.andOrganizationIdEqualTo(ebitParam.getOrgId()).andPeriodEqualTo(ebitParam.getPeriod()); EbitSpreadDataExample.Criteria criteria1 = criteria.andOrganizationIdEqualTo(ebitParam.getOrgId()).andPeriodEqualTo(ebitParam.getPeriod());
...@@ -2367,7 +2359,29 @@ public class ReportServiceImpl extends BaseService { ...@@ -2367,7 +2359,29 @@ public class ReportServiceImpl extends BaseService {
operationResultDto.error(); operationResultDto.error();
operationResultDto.setResultMsg("spread【json序列化字符串】保存失败"); operationResultDto.setResultMsg("spread【json序列化字符串】保存失败");
return operationResultDto; return operationResultDto;
}*/
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String,MultipartFile> fileMap = multipartRequest.getFileMap();
MultipartFile file = fileMap.get("llb.xlsx");
String fileName = orgId + period + "利润表";
EbitSpreadDataExample example = new EbitSpreadDataExample();
example.createCriteria().andPeriodEqualTo(period).andOrganizationIdEqualTo(orgId);
List<EbitSpreadData> ebitSpreadData1 = ebitSpreadDataMapper.selectByExample(example);
if(ebitSpreadData1.size() != 0){
didiFileUploadService.delData(ebitSpreadData1.get(0).getFileKey());
ebitSpreadDataMapper.deleteByExample(example);
} }
FileUpload fileUpload = didiFileUploadService.uploadFile(file, fileName, "ebit利润表");
EbitSpreadData ebitSpreadData = new EbitSpreadData();
ebitSpreadData.setPeriod(period);
ebitSpreadData.setOrganizationId(orgId);
ebitSpreadData.setFileKey(fileUpload.getUid());
ebitSpreadData.setFileName(fileName);
ebitSpreadData.setId(idService.nextId());
ebitSpreadDataMapper.insert(ebitSpreadData);
return operationResultDto.success(); return operationResultDto.success();
} }
...@@ -2389,8 +2403,11 @@ public class ReportServiceImpl extends BaseService { ...@@ -2389,8 +2403,11 @@ public class ReportServiceImpl extends BaseService {
* *
* @param requestParameterDto * @param requestParameterDto
*/ */
public void manyExport(RequestParameterDto requestParameterDto, String zipFileName, HttpServletRequest request, HttpServletResponse response, String zipPath) throws Exception { public void manyExport(RequestParameterDto requestParameterDto, String zipFileName, HttpServletRequest request, HttpServletResponse response) throws Exception {
try { String zipPath = this.getClass().getResource("/").getPath().substring(1) + "zipDir";
String fileName = null;
FileExcelUtil.createFile(zipPath);
/* try {
FileOutputStream out = new FileOutputStream(zipFileName);//要输出的文件名字 FileOutputStream out = new FileOutputStream(zipFileName);//要输出的文件名字
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -2447,12 +2464,14 @@ public class ReportServiceImpl extends BaseService { ...@@ -2447,12 +2464,14 @@ public class ReportServiceImpl extends BaseService {
} }
} }
inputStream = httpFileService.getUserTemplate(templatePath); inputStream = httpFileService.getUserTemplate(templatePath);
Workbook workbook = WorkbookFactory.create(inputStream);
Sheet sheet = workbook.getSheetAt(0);
try { try {
Cell cell = null; Cell cell = null;
List<Workbook> workbooksList = Lists.newArrayList(); List<Workbook> workbooksList = Lists.newArrayList();
for (List<EbitCellData> ebitCellDataList1 : dataList) { for (List<EbitCellData> ebitCellDataList1 : dataList) {
Workbook workbook = WorkbookFactory.create(inputStream); Workbook newworkbook = new XSSFWorkbook();
Sheet sheet = workbook.getSheetAt(0); Sheet sheet1 = newworkbook.getSheetAt(0);
if (isSheetEmpty(sheet)) throw new Exception("模板异常"); if (isSheetEmpty(sheet)) throw new Exception("模板异常");
for (EbitCellData ebitCellData : ebitCellDataList1) { for (EbitCellData ebitCellData : ebitCellDataList1) {
loop1: loop1:
...@@ -2467,28 +2486,51 @@ public class ReportServiceImpl extends BaseService { ...@@ -2467,28 +2486,51 @@ public class ReportServiceImpl extends BaseService {
} }
} }
} }
sheet1.getRow(ebitCellData.getRow()).getCell(ebitCellData.getCol()).setCellValue(ebitCellData.getData());
} }
POIUtil.cloneSheetAndStyle(workbook.getSheetAt(0), workbook.createSheet("利润表"),newworkbook);
workbooksList.add(workbook); workbooksList.add(workbook);
//将workbook生成file文件 //将workbook生成file文件
String path = "\\\\zipDir\\\\" + requestParameterDto.getPeriod() + Math.random() + "利润表"; String path = "\\\\zipDir\\\\" + requestParameterDto.getPeriod() + Math.random() + "利润表";
file = FileExcelUtil.generateExcelToPath(workbook, path); file = FileExcelUtil.generateExcelToPath(workbook, path);
if (file != null) if (file != null)
filesList.add(file); filesList.add(file);
} }
FileExcelUtil.downloadZip(request, response, zipFileName, filesList, zipPath); FileExcelUtil.downloadZip(request, response, zipFileName, filesList, zipPath);
//将workbook转成流
/* ByteArrayOutputStream bos = new ByteArrayOutputStream();
workbook.write(bos);
byte[] barray = bos.toByteArray();
InputStream is = new ByteArrayInputStream(barray);*/
// FileOutputStream fileOut = new FileOutputStream(path);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
throw new Exception(ErrorMessage.SystemError); throw new Exception(ErrorMessage.SystemError);
} }
}*/
EbitSpreadDataExample example = new EbitSpreadDataExample();
example.createCriteria().andPeriodEqualTo(requestParameterDto.getPeriod());
List<EbitSpreadData> ebitSpreadData = ebitSpreadDataMapper.selectByExample(example);
List<File> fileList = Lists.newArrayList();
if (ebitSpreadData.size() == 0)
throw new Exception("没有可导出的数据");
for (int i = 0; i < ebitSpreadData.size(); i++) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(ebitSpreadData.get(i).getFileKey()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
String path = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
path = uploadDetail.getList().get(0).getViewHttpUrl();
}
InputStream inputStream = httpFileService.getUserTemplate(path);
Workbook workbook1 = WorkbookFactory.create(inputStream);
fileName = zipPath + "/" + requestParameterDto.getPeriod() + ".xlsx";
fileList.add(FileExcelUtil.generateExcelToPath(workbook1, fileName));
} }
String zipPath1 = zipPath + "/sizegang.zip";
FileExcelUtil.downloadZip(request, response, zipFileName, fileList, zipPath1);
//将workbook转成流
/* ByteArrayOutputStream bos = new ByteArrayOutputStream();
workbook.write(bos);
byte[] barray = bos.toByteArray();6
InputStream is = new ByteArrayInputStream(barray);*/
// FileOutputStream fileOut = new FileOutputStream(path);
} }
private String getCellStringValue(Cell cell) { private String getCellStringValue(Cell cell) {
......
...@@ -40,15 +40,15 @@ ...@@ -40,15 +40,15 @@
<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="pwc_report_attach" domainObjectName="PwcReportAttach"> <table tableName="ebit_spread_data" domainObjectName="EbitSpreadData">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>
<table tableName="invoice_record" domainObjectName="InvoiceRecord"> <!--<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<property name="useActualColumnNames" value="false"/> <property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/> <property name="ignoreQualifiersAtRuntime" value="true"/>
</table> </table>-->
<!-- <!--
......
...@@ -50,22 +50,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper { ...@@ -50,22 +50,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/ */
int insertSelective(EbitSpreadData record); int insertSelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBsWithRowbounds(EbitSpreadDataExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBs(EbitSpreadDataExample example);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data * This method corresponds to the database table ebit_spread_data
...@@ -98,14 +82,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper { ...@@ -98,14 +82,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/ */
int updateByExampleSelective(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example); int updateByExampleSelective(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data * This method corresponds to the database table ebit_spread_data
...@@ -122,14 +98,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper { ...@@ -122,14 +98,6 @@ public interface EbitSpreadDataMapper extends MyVatMapper {
*/ */
int updateByPrimaryKeySelective(EbitSpreadData record); int updateByPrimaryKeySelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(EbitSpreadData record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data * This method corresponds to the database table ebit_spread_data
......
...@@ -21,6 +21,17 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -21,6 +21,17 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
*/ */
private Long id; private Long id;
/**
* Database Column Remarks:
* file下载地址
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ebit_spread_data.file_key
*
* @mbg.generated
*/
private String fileKey;
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -112,17 +123,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -112,17 +123,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
*/ */
private String fileName; private String fileName;
/**
* Database Column Remarks:
* spread json字符串(序列化之后)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
private byte[] spreadJsonString;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table ebit_spread_data * This field corresponds to the database table ebit_spread_data
...@@ -155,6 +155,30 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -155,6 +155,30 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
this.id = id; this.id = id;
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.file_key
*
* @return the value of ebit_spread_data.file_key
*
* @mbg.generated
*/
public String getFileKey() {
return fileKey;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ebit_spread_data.file_key
*
* @param fileKey the value for ebit_spread_data.file_key
*
* @mbg.generated
*/
public void setFileKey(String fileKey) {
this.fileKey = fileKey == null ? null : fileKey.trim();
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.create_by * This method returns the value of the database column ebit_spread_data.create_by
...@@ -371,30 +395,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -371,30 +395,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
this.fileName = fileName == null ? null : fileName.trim(); this.fileName = fileName == null ? null : fileName.trim();
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ebit_spread_data.spread_json_string
*
* @return the value of ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
public byte[] getSpreadJsonString() {
return spreadJsonString;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column ebit_spread_data.spread_json_string
*
* @param spreadJsonString the value for ebit_spread_data.spread_json_string
*
* @mbg.generated
*/
public void setSpreadJsonString(byte[] spreadJsonString) {
this.spreadJsonString = spreadJsonString;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data * This method corresponds to the database table ebit_spread_data
...@@ -408,6 +408,7 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -408,6 +408,7 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", fileKey=").append(fileKey);
sb.append(", createBy=").append(createBy); sb.append(", createBy=").append(createBy);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateBy=").append(updateBy); sb.append(", updateBy=").append(updateBy);
...@@ -417,7 +418,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable { ...@@ -417,7 +418,6 @@ public class EbitSpreadData extends BaseEntity implements Serializable {
sb.append(", organizationId=").append(organizationId); sb.append(", organizationId=").append(organizationId);
sb.append(", sheetName=").append(sheetName); sb.append(", sheetName=").append(sheetName);
sb.append(", fileName=").append(fileName); sb.append(", fileName=").append(fileName);
sb.append(", spreadJsonString=").append(spreadJsonString);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
......
...@@ -255,6 +255,76 @@ public class EbitSpreadDataExample { ...@@ -255,6 +255,76 @@ public class EbitSpreadDataExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFileKeyIsNull() {
addCriterion("file_key is null");
return (Criteria) this;
}
public Criteria andFileKeyIsNotNull() {
addCriterion("file_key is not null");
return (Criteria) this;
}
public Criteria andFileKeyEqualTo(String value) {
addCriterion("file_key =", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotEqualTo(String value) {
addCriterion("file_key <>", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyGreaterThan(String value) {
addCriterion("file_key >", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyGreaterThanOrEqualTo(String value) {
addCriterion("file_key >=", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLessThan(String value) {
addCriterion("file_key <", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLessThanOrEqualTo(String value) {
addCriterion("file_key <=", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyLike(String value) {
addCriterion("file_key like", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotLike(String value) {
addCriterion("file_key not like", value, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyIn(List<String> values) {
addCriterion("file_key in", values, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotIn(List<String> values) {
addCriterion("file_key not in", values, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyBetween(String value1, String value2) {
addCriterion("file_key between", value1, value2, "fileKey");
return (Criteria) this;
}
public Criteria andFileKeyNotBetween(String value1, String value2) {
addCriterion("file_key not between", value1, value2, "fileKey");
return (Criteria) this;
}
public Criteria andCreateByIsNull() { public Criteria andCreateByIsNull() {
addCriterion("create_by is null"); addCriterion("create_by is null");
return (Criteria) this; return (Criteria) this;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="file_key" jdbcType="VARCHAR" property="fileKey" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> <result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
...@@ -17,13 +18,6 @@ ...@@ -17,13 +18,6 @@
<result column="sheet_name" jdbcType="VARCHAR" property="sheetName" /> <result column="sheet_name" jdbcType="VARCHAR" property="sheetName" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" /> <result column="file_name" jdbcType="VARCHAR" property="fileName" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="pwc.taxtech.atms.vat.entity.EbitSpreadData">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="spread_json_string" jdbcType="LONGVARBINARY" property="spreadJsonString" />
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -95,36 +89,9 @@ ...@@ -95,36 +89,9 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
id, create_by, create_time, update_by, update_time, project_id, period, organization_id, id, file_key, create_by, create_time, update_by, update_time, project_id, period,
sheet_name, file_name organization_id, sheet_name, file_name
</sql> </sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
spread_json_string
</sql>
<select id="selectByExampleWithBLOBs" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ebit_spread_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -143,15 +110,13 @@ ...@@ -143,15 +110,13 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ebit_spread_data from ebit_spread_data
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
...@@ -178,14 +143,14 @@ ...@@ -178,14 +143,14 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
insert into ebit_spread_data (id, create_by, create_time, insert into ebit_spread_data (id, file_key, create_by,
update_by, update_time, project_id, create_time, update_by, update_time,
period, organization_id, sheet_name, project_id, period, organization_id,
file_name, spread_json_string) sheet_name, file_name)
values (#{id,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, values (#{id,jdbcType=BIGINT}, #{fileKey,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{period,jdbcType=INTEGER}, #{organizationId,jdbcType=VARCHAR}, #{sheetName,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{period,jdbcType=INTEGER}, #{organizationId,jdbcType=VARCHAR},
#{fileName,jdbcType=VARCHAR}, #{spreadJsonString,jdbcType=LONGVARBINARY}) #{sheetName,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadData"> <insert id="insertSelective" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadData">
<!-- <!--
...@@ -197,6 +162,9 @@ ...@@ -197,6 +162,9 @@
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="fileKey != null">
file_key,
</if>
<if test="createBy != null"> <if test="createBy != null">
create_by, create_by,
</if> </if>
...@@ -224,14 +192,14 @@ ...@@ -224,14 +192,14 @@
<if test="fileName != null"> <if test="fileName != null">
file_name, file_name,
</if> </if>
<if test="spreadJsonString != null">
spread_json_string,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id,jdbcType=BIGINT},
</if> </if>
<if test="fileKey != null">
#{fileKey,jdbcType=VARCHAR},
</if>
<if test="createBy != null"> <if test="createBy != null">
#{createBy,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
</if> </if>
...@@ -259,9 +227,6 @@ ...@@ -259,9 +227,6 @@
<if test="fileName != null"> <if test="fileName != null">
#{fileName,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
</if> </if>
<if test="spreadJsonString != null">
#{spreadJsonString,jdbcType=LONGVARBINARY},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultType="java.lang.Long">
...@@ -284,6 +249,9 @@ ...@@ -284,6 +249,9 @@
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="record.fileKey != null">
file_key = #{record.fileKey,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null"> <if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR}, create_by = #{record.createBy,jdbcType=VARCHAR},
</if> </if>
...@@ -311,35 +279,11 @@ ...@@ -311,35 +279,11 @@
<if test="record.fileName != null"> <if test="record.fileName != null">
file_name = #{record.fileName,jdbcType=VARCHAR}, file_name = #{record.fileName,jdbcType=VARCHAR},
</if> </if>
<if test="record.spreadJsonString != null">
spread_json_string = #{record.spreadJsonString,jdbcType=LONGVARBINARY},
</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" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update ebit_spread_data
set id = #{record.id,jdbcType=BIGINT},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
project_id = #{record.projectId,jdbcType=VARCHAR},
period = #{record.period,jdbcType=INTEGER},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
sheet_name = #{record.sheetName,jdbcType=VARCHAR},
file_name = #{record.fileName,jdbcType=VARCHAR},
spread_json_string = #{record.spreadJsonString,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
...@@ -347,6 +291,7 @@ ...@@ -347,6 +291,7 @@
--> -->
update ebit_spread_data update ebit_spread_data
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
file_key = #{record.fileKey,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR}, create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_by = #{record.updateBy,jdbcType=VARCHAR}, update_by = #{record.updateBy,jdbcType=VARCHAR},
...@@ -367,6 +312,9 @@ ...@@ -367,6 +312,9 @@
--> -->
update ebit_spread_data update ebit_spread_data
<set> <set>
<if test="fileKey != null">
file_key = #{fileKey,jdbcType=VARCHAR},
</if>
<if test="createBy != null"> <if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR},
</if> </if>
...@@ -394,37 +342,17 @@ ...@@ -394,37 +342,17 @@
<if test="fileName != null"> <if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR}, file_name = #{fileName,jdbcType=VARCHAR},
</if> </if>
<if test="spreadJsonString != null">
spread_json_string = #{spreadJsonString,jdbcType=LONGVARBINARY},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadData">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update ebit_spread_data
set create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
project_id = #{projectId,jdbcType=VARCHAR},
period = #{period,jdbcType=INTEGER},
organization_id = #{organizationId,jdbcType=VARCHAR},
sheet_name = #{sheetName,jdbcType=VARCHAR},
file_name = #{fileName,jdbcType=VARCHAR},
spread_json_string = #{spreadJsonString,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadData"> <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadData">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
update ebit_spread_data update ebit_spread_data
set create_by = #{createBy,jdbcType=VARCHAR}, set file_key = #{fileKey,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR}, update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
...@@ -435,26 +363,6 @@ ...@@ -435,26 +363,6 @@
file_name = #{fileName,jdbcType=VARCHAR} file_name = #{fileName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectByExampleWithBLOBsWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ebit_spread_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="BaseResultMap"> <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.EbitSpreadDataExample" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
......
...@@ -847,7 +847,7 @@ ...@@ -847,7 +847,7 @@
"Form":"Form", "Form":"Form",
"DomesticDataImport":"Domestic Data Import", "DomesticDataImport":"Domestic Data Import",
"InternationalDataImport":"International Data Import", "InternationalDataImport":"International Data Import",
"TBEBITForm":"TB EBIT Form", "TBEBITForm":"TP EBIT Form",
"ClickEnsureTip": "Click Ensure Button!", "ClickEnsureTip": "Click Ensure Button!",
"ApproveCommitted":"Committed", "ApproveCommitted":"Committed",
......
analysisModule.controller('internationalDataImportController', ['$scope','$filter', '$log', '$translate', '$timeout', '$q', '$interval' analysisModule.controller('internationalDataImportController', ['$scope', '$filter', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal' , 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService' , 'vatSessionService', 'enums', 'vatOperationLogService'
, 'projectService', 'vatCommonService','templateService','orgService', , 'projectService', 'vatCommonService', 'templateService', 'orgService',
function ($scope,$filter, $log, $translate, $timeout, $q, $interval function ($scope, $filter, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal , apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService , vatSessionService, enums, vatOperationLogService
, projectService, vatCommonService,templateService,orgService) { , projectService, vatCommonService, templateService, orgService) {
'use strict'; 'use strict';
var comment = vatSessionService.project.name + " " + vatSessionService.project.year + "年" + vatSessionService.month + "月"; var comment = vatSessionService.project.name + " " + vatSessionService.project.year + "年" + vatSessionService.month + "月";
...@@ -21,17 +21,17 @@ ...@@ -21,17 +21,17 @@
$scope.projectID = vatSessionService.project.id; $scope.projectID = vatSessionService.project.id;
$scope.startRowNum = 2; $scope.startRowNum = 2;
$scope.validationType = 0; $scope.validationType = 0;
$scope.sheetData = { sheetNameList: [], dataList: [], selectedSheetIndex: 0 }; $scope.sheetData = {sheetNameList: [], dataList: [], selectedSheetIndex: 0};
$scope.sheetInfo = { selectedSheetName: '', selectedSheetIndex: 0 }; $scope.sheetInfo = {selectedSheetName: '', selectedSheetIndex: 0};
$scope.balanceInputList = []; $scope.balanceInputList = [];
$scope.toInputList = []; $scope.toInputList = [];
$scope.importEnum = { Import: 0, CoverImport: 1, AddImport: 2 }; //导入方式 $scope.importEnum = {Import: 0, CoverImport: 1, AddImport: 2}; //导入方式
$scope.selectedPeriod = null; $scope.selectedPeriod = null;
$scope.showTotalSecondRow = false; $scope.showTotalSecondRow = false;
$scope.importExcelFileUrlList = { $scope.importExcelFileUrlList = {
internationalBU : apiInterceptor.webApiHostUrl + '/Analysis/InternationalExcelFile', internationalBU: apiInterceptor.webApiHostUrl + '/Analysis/InternationalExcelFile',
internationalTax : apiInterceptor.webApiHostUrl + '/Analysis/InternationalExcelFile' internationalTax: apiInterceptor.webApiHostUrl + '/Analysis/InternationalExcelFile'
}; };
$scope.maxTitleLength = constant.maxButtonTitleLength; $scope.maxTitleLength = constant.maxButtonTitleLength;
...@@ -53,17 +53,17 @@ ...@@ -53,17 +53,17 @@
var date = new Date(); var date = new Date();
var year = date.getFullYear(); var year = date.getFullYear();
var month = date.getMonth()+1; var month = date.getMonth() + 1;
$scope.selectedDate = new Date(year,date.getMonth(),1); $scope.selectedDate = new Date(year, date.getMonth(), 1);
$scope.startDate = new Date(year - 20, 1, 1); $scope.startDate = new Date(year - 20, 1, 1);
$scope.endDate = new Date(year + 20, 1, 1); $scope.endDate = new Date(year + 20, 1, 1);
$scope.viewMode = 1; $scope.viewMode = 1;
$scope.dateFormat = $translate.instant('dateFormat4YearMonth'); $scope.dateFormat = $translate.instant('dateFormat4YearMonth');
if(month.length<2){ if (month.length < 2) {
$scope.UploadPeriodTime = year+" - 0"+month; $scope.UploadPeriodTime = year + " - 0" + month;
}else{ } else {
$scope.UploadPeriodTime = year+" - "+month; $scope.UploadPeriodTime = year + " - " + month;
} }
$scope.importExcelFile = null; $scope.importExcelFile = null;
...@@ -87,10 +87,10 @@ ...@@ -87,10 +87,10 @@
}; };
var param = { var param = {
type : $scope.importType, type: $scope.importType,
period : $scope.UploadPeriodTime, period: $scope.UploadPeriodTime,
country : $scope.selectCountry, country: $scope.selectCountry,
companyName : $scope.selectCountry companyName: $scope.selectCountry
}; };
//初始化ack-pagination //初始化ack-pagination
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
var url = urlCreator.createObjectURL(blob); var url = urlCreator.createObjectURL(blob);
a.href = url; a.href = url;
a.target = '_blank'; a.target = '_blank';
a.download = fileName+".xlsx"; a.download = fileName + ".xlsx";
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
} }
...@@ -163,18 +163,18 @@ ...@@ -163,18 +163,18 @@
}; };
var doExport = function () { var doExport = function () {
var localDate=$filter('date')(new Date(), 'yyyyMMddHHmmss'); var localDate = $filter('date')(new Date(), 'yyyyMMddHHmmss');
var fileName = ''; var fileName = '';
constant.anlDownLoadFileNameList.forEach(function (m) { constant.anlDownLoadFileNameList.forEach(function (m) {
if (m.code === $scope.importType) { if (m.code === $scope.importType) {
fileName = m.name + $scope.UploadPeriodTime+"_" +localDate; fileName = m.name + $scope.UploadPeriodTime + "_" + localDate;
} }
}); });
param.companyName = $scope.selectCompany; param.companyName = $scope.selectCompany;
param.country = $scope.selectCountry; param.country = $scope.selectCountry;
param.type = $scope.importType; param.type = $scope.importType;
param.period = $scope.UploadPeriodTime; param.period = $scope.UploadPeriodTime;
vatImportService.downloadInternationalFile(param,fileName).then(function (data) { vatImportService.downloadInternationalFile(param, fileName).then(function (data) {
if (data) { if (data) {
ackMessageBox.success(translate('FileExportSuccess')); ackMessageBox.success(translate('FileExportSuccess'));
} }
...@@ -194,12 +194,12 @@ ...@@ -194,12 +194,12 @@
return; return;
} }
if (!$scope.selectCountry||''===$scope.selectCountry){ if (!$scope.selectCountry || '' === $scope.selectCountry) {
SweetAlert.warning($translate.instant('PleaseSelectFileFirst')); SweetAlert.warning($translate.instant('PleaseSelectFileFirst'));
return; return;
} }
if (!$scope.selectCompany||''===$scope.selectCompany){ if (!$scope.selectCompany || '' === $scope.selectCompany) {
SweetAlert.warning($translate.instant('PleaseSelectFileFirst')); SweetAlert.warning($translate.instant('PleaseSelectFileFirst'));
return; return;
} }
...@@ -212,8 +212,8 @@ ...@@ -212,8 +212,8 @@
Upload.upload({ Upload.upload({
url: url, url: url,
data: { data: {
companyName :$scope.selectCompany, companyName: $scope.selectCompany,
country : $scope.selectCountry, country: $scope.selectCountry,
period: period, period: period,
type: $scope.importType type: $scope.importType
}, },
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
}, },
__RequestVerificationToken: token, __RequestVerificationToken: token,
withCredentials: true withCredentials: true
}).then(function(resp) { }).then(function (resp) {
var ret = resp.data; var ret = resp.data;
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
...@@ -237,12 +237,12 @@ ...@@ -237,12 +237,12 @@
} else { } else {
if (ret.resultMsg && ret.resultMsg.length > 0) { if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(ret.resultMsg)); SweetAlert.warning($translate.instant(ret.resultMsg));
}else{ } else {
SweetAlert.error($translate.instant('ImportFailed')); SweetAlert.error($translate.instant('ImportFailed'));
} }
} }
refreshGrid(); refreshGrid();
}, function(resp) { }, function (resp) {
deferred.resolve(); deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') { if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException')); SweetAlert.warning($translate.instant('HttpRequestValidationException'));
...@@ -251,14 +251,14 @@ ...@@ -251,14 +251,14 @@
} }
SweetAlert.error($translate.instant('ImportFail')); SweetAlert.error($translate.instant('ImportFail'));
console.log('Error status: ' + resp.status); console.log('Error status: ' + resp.status);
}, function(evt) { }, function (evt) {
deferred.resolve(); deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
$log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name); $log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
}); });
}; };
var getUploadUrl = function(){ var getUploadUrl = function () {
var url = ""; var url = "";
switch ($scope.importType) { switch ($scope.importType) {
case 100: case 100:
...@@ -292,10 +292,10 @@ ...@@ -292,10 +292,10 @@
var getGridHeight = function () { var getGridHeight = function () {
if ($scope.isLoadComplete) { if ($scope.isLoadComplete) {
return { height: ($('.balance-ouput-grid-wrapper').height()) + "px" }; return {height: ($('.balance-ouput-grid-wrapper').height()) + "px"};
} }
else { else {
return { height: 0 + "px" }; return {height: 0 + "px"};
} }
}; };
...@@ -354,7 +354,7 @@ ...@@ -354,7 +354,7 @@
autoExpandAll: false autoExpandAll: false
}, },
allowColumnResizing: true, allowColumnResizing: true,
allowColumnReordering:true, allowColumnReordering: true,
columnAutoWidth: true, columnAutoWidth: true,
showRowLines: true, showRowLines: true,
showColumnLines: true, showColumnLines: true,
...@@ -386,7 +386,7 @@ ...@@ -386,7 +386,7 @@
vatImportService.displayAnalysisInternationalImportData(param).success(function (data) { vatImportService.displayAnalysisInternationalImportData(param).success(function (data) {
if (data.data) { if (data.data) {
$scope.internationalBUDataGridSource = data.data; $scope.internationalBUDataGridSource = data.data;
}else { } else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
}); });
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
autoExpandAll: false autoExpandAll: false
}, },
allowColumnResizing: true, allowColumnResizing: true,
allowColumnReordering:true, allowColumnReordering: true,
columnAutoWidth: true, columnAutoWidth: true,
showRowLines: true, showRowLines: true,
showColumnLines: true, showColumnLines: true,
...@@ -464,7 +464,7 @@ ...@@ -464,7 +464,7 @@
vatImportService.displayAnalysisInternationalImportData(param).success(function (data) { vatImportService.displayAnalysisInternationalImportData(param).success(function (data) {
if (data.data) { if (data.data) {
$scope.internationalTaxDataGridSource = data.data; $scope.internationalTaxDataGridSource = data.data;
}else { } else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
}); });
...@@ -524,16 +524,16 @@ ...@@ -524,16 +524,16 @@
var setButtonWrapStyle = function () { var setButtonWrapStyle = function () {
if ($scope.fileName) { if ($scope.fileName) {
return { width: "100%" }; return {width: "100%"};
} }
}; };
var setGridStyle = function () { var setGridStyle = function () {
if ($scope.showTotalSecondRow) { if ($scope.showTotalSecondRow) {
return { 'margin-top': '60px' } return {'margin-top': '60px'}
} }
else { else {
return { 'margin-top': '55px' } return {'margin-top': '55px'}
} }
}; };
...@@ -571,23 +571,23 @@ ...@@ -571,23 +571,23 @@
}); });
}; };
$scope.selectCompanyEvent = function(i){ $scope.selectCompanyEvent = function (i) {
$scope.selectCompany=i.name; $scope.selectCompany = i.name;
refreshGrid(); refreshGrid();
}; };
$scope.selectCountryEvent = function(country){ $scope.selectCountryEvent = function (country) {
$scope.selectCountry=country; $scope.selectCountry = country;
refreshGrid(); refreshGrid();
}; };
$scope.selectOne = function () { $scope.selectOne = function () {
$scope.checkedCompanyList = []; $scope.checkedCompanyList = [];
angular.forEach($scope.companyList , function (i) { angular.forEach($scope.companyList, function (i) {
var index = $scope.checkedCompanyList.indexOf(i.id); var index = $scope.checkedCompanyList.indexOf(i.id);
if(i.checked && index === -1) { if (i.checked && index === -1) {
$scope.checkedCompanyList.push(i); $scope.checkedCompanyList.push(i);
} else if (!i.checked && index !== -1){ } else if (!i.checked && index !== -1) {
$scope.checkedCompanyList.splice(index, 1); $scope.checkedCompanyList.splice(index, 1);
} }
}); });
...@@ -596,22 +596,22 @@ ...@@ -596,22 +596,22 @@
$scope.checkedCompanyTypeList = ""; $scope.checkedCompanyTypeList = "";
$scope.checkedCompanyCodeList = []; $scope.checkedCompanyCodeList = [];
angular.forEach($scope.checkedCompanyList,function (i) { angular.forEach($scope.checkedCompanyList, function (i) {
$scope.checkedCompanyTypeList += i.name+";"; $scope.checkedCompanyTypeList += i.name + ";";
$scope.checkedCompanyCodeList.push(i.id); $scope.checkedCompanyCodeList.push(i.id);
}); });
console.log($scope.checkedCompanyList); console.log($scope.checkedCompanyList);
}; };
$scope.selectAll = function () { $scope.selectAll = function () {
if($scope.selectedAll) { if ($scope.selectedAll) {
$scope.selectedOne = true; $scope.selectedOne = true;
$scope.checkedCompanyList = []; $scope.checkedCompanyList = [];
angular.forEach($scope.companyList, function (i, index) { angular.forEach($scope.companyList, function (i, index) {
$scope.checkedCompanyList.push(i); $scope.checkedCompanyList.push(i);
i.checked = true; i.checked = true;
}) })
}else { } else {
$scope.selectedOne = false; $scope.selectedOne = false;
$scope.checkedCompanyList = []; $scope.checkedCompanyList = [];
angular.forEach($scope.companyList, function (i, index) { angular.forEach($scope.companyList, function (i, index) {
...@@ -620,14 +620,14 @@ ...@@ -620,14 +620,14 @@
} }
$scope.checkedCompanyTypeList = ""; $scope.checkedCompanyTypeList = "";
$scope.checkedCompanyCodeList = []; $scope.checkedCompanyCodeList = [];
angular.forEach($scope.checkedCompanyList,function (i) { angular.forEach($scope.checkedCompanyList, function (i) {
$scope.checkedCompanyTypeList += i.name; $scope.checkedCompanyTypeList += i.name;
$scope.checkedCompanyCodeList.push(i.id); $scope.checkedCompanyCodeList.push(i.id);
}); });
console.log($scope.checkedCompanyList); console.log($scope.checkedCompanyList);
}; };
$scope.changeTab = function(i){ $scope.changeTab = function (i) {
$scope.importType = i.code; $scope.importType = i.code;
$scope.selectType = i.type; $scope.selectType = i.type;
$scope.showInternationalBUDataGrid = false; $scope.showInternationalBUDataGrid = false;
...@@ -636,20 +636,48 @@ ...@@ -636,20 +636,48 @@
case 100: case 100:
$scope.showInternationalBUDataGrid = true; $scope.showInternationalBUDataGrid = true;
loadinternationalBUDatagrid(); loadinternationalBUDatagrid();
$scope.selectCountry=''; $scope.selectCountry = '';
$scope.selectCompany=''; $scope.selectCompany = '';
break; break;
case 101: case 101:
$scope.showInternationalTaxDataGrid = true; $scope.showInternationalTaxDataGrid = true;
loadInternationalTaxDataGrid(); loadInternationalTaxDataGrid();
$scope.selectCountry=''; $scope.selectCountry = '';
$scope.selectCompany=''; $scope.selectCompany = '';
break; break;
default: default:
break; break;
} }
}; };
/*------------------------------kevin insert ----------------------------------------------------------------*/
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
bindingOptions: {
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
});
}
};
/*------------------------------------------------------------------------------------------------------------*/
//开始 //开始
(function initialize() { (function initialize() {
$log.debug('internationalDataImportController.ctor()...'); $log.debug('internationalDataImportController.ctor()...');
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<div id="tab_total"> <div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm"> <form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()"> <div class="form-group" ng-style="setButtonWrapStyle()">
<div class="import-wrapper"> <div class="import-wrapper" style="margin-left: 17px;">
<div class="row">
<span class="text-bold" translate="SelectedImportType"></span>: <span class="text-bold" translate="SelectedImportType"></span>:
<div class="dropdown" style="margin-left:10px"> <div class="dropdown" style="margin-left:10px">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2"
...@@ -28,15 +29,38 @@ ...@@ -28,15 +29,38 @@
</ul> </ul>
</div> </div>
<span class="text-bold" translate="Period"></span>: <span class="text-bold" translate="Period"></span>:
<div class="period-picker" style="margin-left:10px"> <div class="period-picker" style="margin-left:10px; width:141px;">
<input type="text" id="periodDatepicker" class="datepicker imp-subheader" style="width:80px;" <input type="text" id="periodDatepicker" class="datepicker imp-subheader" style=" width: 111px;"
readonly="readonly" ng-model="UploadPeriodTime"/> readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i> <i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div> </div>
<button type="button"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" >
{{fileName ? ((fileName)|limitString:5):'SelectFile' | translate}}
</button>
<button type="button"
class="btn btn-vat-primary" style=""
translate="TemplateBtn"
ng-click="downloadTemplate()"></button>
<button type="button"
class="btn btn-vat-primary" style=""
translate="ImportBtn"
ng-click="doUpload()"></button>
<button type="button"
class="btn btn-vat-primary" style="margin-right:0px;"
translate="ExportBtn"
ng-click="doExport()"></button>
</div>
<div class="row" style="margin-top: 10px;">
<span class="text-bold" translate="Country"></span>: <span class="text-bold" translate="Country"></span>:
<div class="dropdown" style="margin-left:10px"> <div class="dropdown" style="margin-left:10px">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu3" <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu3"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 150px;"> data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 150px;margin-left: 28px;">
{{selectCountry ? ((selectCountry)|translate):('PleaseSelect' | translate)}} {{selectCountry ? ((selectCountry)|translate):('PleaseSelect' | translate)}}
<span class="caret" style="float: right "></span> <span class="caret" style="float: right "></span>
</button> </button>
...@@ -49,7 +73,7 @@ ...@@ -49,7 +73,7 @@
</ul> </ul>
</div> </div>
<span class="text-bold" translate="Company"></span>: <span class="text-bold" translate="Company"></span>:
<div class="dropdown" style="margin-left:10px"> <div class="dropdown" style="margin-left:38px">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu4" <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu4"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 320px;"> data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 320px;">
{{selectCompany ? ((selectCompany)|translate):('PleaseSelect' | translate)}} {{selectCompany ? ((selectCompany)|translate):('PleaseSelect' | translate)}}
...@@ -63,27 +87,7 @@ ...@@ -63,27 +87,7 @@
</li> </li>
</ul> </ul>
</div> </div>
</div>
<button type="button"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:10px;max-width: 30px;">
{{fileName ? ((fileName)|limitString:5):'SelectFile' | translate}}
</button>
<button type="button"
class="btn btn-vat-primary" style=""
translate="TemplateBtn"
ng-click="downloadTemplate()"></button>
<button type="button"
class="btn btn-vat-primary" style=""
translate="ImportBtn"
ng-click="doUpload()"></button>
<button type="button"
class="btn btn-vat-primary" style="margin-top: 8px;margin-right:0px;"
translate="ExportBtn"
ng-click="doExport()"></button>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -330,3 +330,8 @@ ...@@ -330,3 +330,8 @@
padding-left: 15px; padding-left: 15px;
} }
} }
.dropdown-menu{
span{
white-space: nowrap;
}
}
\ No newline at end of file
...@@ -76,30 +76,42 @@ ...@@ -76,30 +76,42 @@
scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function (newValue, oldValue) { scope.$watchGroup(['relation.period', 'relation.orgId', 'relation.data'], function (newValue, oldValue) {
if (scope.relation.orgId != null && scope.relation.period != null) { if (scope.relation.orgId != null && scope.relation.period != null) {
setTimeout(function () { /* setTimeout(function () {
if ((scope.relation.broadcast && scope.relation.broadcast == true) || scope.spread != undefined) { if ((scope.relation.broadcast && scope.relation.broadcast == true) || scope.spread != undefined) {
loadSheet(scope.templateId, false) loadSheet(scope.templateId, false)
} else { } else {
loadSheet(scope.templateId, true); loadSheet(scope.templateId, true);
} }
}, 200); }, 200);*/
loadSheet(scope.templateId);
} }
}); });
scope.$watch('relation.broadcast', function (newValue, oldValue) { scope.$watch('relation.broadcast', function (newValue, oldValue) {
if (scope.relation.orgId != null && scope.relation.period != null) { if (scope.relation.orgId != null && scope.relation.period != null) {
loadSheet(scope.templateId, false) // loadSheet(scope.templateId, false)
loadSheet(scope.templateId)
} }
}); });
var loadSheet = function (templateId, init) {
var loadSheet = function (templateId) {
//var prokjectId = vatSessionService.project.id; //var prokjectId = vatSessionService.project.id;
//var period = vatSessionService.month; //var period = vatSessionService.month;
if (!init) { /* if (!init) {
addEbitRow(); addEbitRow();
setData(init) setData(init)
return; return;
}*/
if(scope.relation.orgId == undefined){
scope.relation.orgId = null;
} }
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) { return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
if (!_.isEmpty(reportSpread)) { if (!_.isEmpty(reportSpread)) {
initSpreadExcel(reportSpread).then(function (spread) { initSpreadExcel(reportSpread).then(function (spread) {
/* return locateCell(spread, true);*/ /* return locateCell(spread, true);*/
...@@ -111,21 +123,27 @@ ...@@ -111,21 +123,27 @@
}; };
//初始化spread //初始化spread
var _init = function(){ /* var _init = function(){
return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) { return templateService.getPeriodTemplateJsonByOrg(templateId, scope.relation.period, scope.relation.orgId).then(function (reportSpread) {
if (!_.isEmpty(reportSpread)) { if (!_.isEmpty(reportSpread)) {
var spreadCtrl = getSpreadControl();
if (spreadCtrl) {
spreadCtrl.destroy();
}
spreadCtrl = null;
initSpreadExcel(reportSpread, true).then(function (spread) { initSpreadExcel(reportSpread, true).then(function (spread) {
/* return locateCell(spread, true);*/ /!* return locateCell(spread, true);*!/
}); });
} }
}, function (data) { }, function (data) {
$log.info(data); $log.info(data);
}); });
} }*/
var initSpreadExcel = function (reportSpread, noCycle) { var initSpreadExcel = function (reportSpread) {
var spread = getSpreadControl(); var spread = getSpreadControl();
spread.suspendPaint(); spread.suspendPaint();
spread.fromJSON(reportSpread); spread.fromJSON(reportSpread);
spread.options.showVerticalScrollbar = true; spread.options.showVerticalScrollbar = true;
...@@ -164,14 +182,12 @@ ...@@ -164,14 +182,12 @@
sheet.clearSelection(); sheet.clearSelection();
} }
scope.spread = spread; scope.spread = spread;
if(sheet.getRowCount() <= 38)
addEbitRow(sheet) addEbitRow(sheet)
if (scope.templateId && scope.reportSource&& !noCycle) { if (scope.templateId && scope.reportSource) {
setData(true); setData(true);
} }
spread.resumePaint(); spread.resumePaint();
return $q.when(spread); return $q.when(spread);
}; };
...@@ -180,7 +196,7 @@ ...@@ -180,7 +196,7 @@
sheet = scope.spread.getActiveSheet(); sheet = scope.spread.getActiveSheet();
sheet.setColumnWidth(0, 400) sheet.setColumnWidth(0, 400)
//添加单元格 //添加单元格
if (sheet.getRowCount > 43) if (sheet.getRowCount() > 43)
return; return;
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
...@@ -189,9 +205,10 @@ ...@@ -189,9 +205,10 @@
sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1); sheet.addRows(sheet.getRowCount(scope.relation.sheetArea.viewport), 1);
sheet.setValue(i + 37, 0, profileList[i]); sheet.setValue(i + 37, 0, profileList[i]);
} }
lockCell(scope.spread);
} }
var setEditable = function (spread) { var lockCell = function (spread) {
//todo:注册之后这里去掉注释 //todo:注册之后这里去掉注释
var sheet; var sheet;
if (constant.regesterInformation.active) { if (constant.regesterInformation.active) {
...@@ -205,6 +222,9 @@ ...@@ -205,6 +222,9 @@
sheet.getCell(i, j).locked(true); sheet.getCell(i, j).locked(true);
} }
} }
///解锁指定单元格
sheet.getCell(38, 2).locked(false);//特殊因素
sheet.getCell(40, 2).locked(false);//ebit比率
}; };
// 每个单元格大致由以下部分构成:_SumAll(_Inter(...)+_Manual(...)+C1) // 每个单元格大致由以下部分构成:_SumAll(_Inter(...)+_Manual(...)+C1)
...@@ -280,26 +300,26 @@ ...@@ -280,26 +300,26 @@
// 根据已有信息通过spreadJS计算各单元格的值 // 根据已有信息通过spreadJS计算各单元格的值
var setData = function (init) { var setData = function (init) {
var sheet = scope.spread.sheets[0]; var sheet = scope.spread.sheets[0];
if (!init && scope.relation.broadcast == true) { /* if (!init && scope.relation.broadcast == true) {
loadEbitCell(sheet); scope.relation.loadEbitCell(sheet);
return; return;
} }*/
if (angular.isArray(scope.reportSource)) { if (angular.isArray(scope.reportSource)) {
//spreadJsTipService.initialize(sheet); //spreadJsTipService.initialize(sheet);
/*if (!scope.isReadOnly) { /*if (!scope.isReadOnly) {
setEditable(scope.spread, false, true); lockCell(scope.spread, false, true);
}*/ }*/
scope.spread.suspendPaint(); scope.spread.suspendPaint();
scope.relation.loadEbitCell(sheet); scope.relation.loadEbitCell(sheet);
if (scope.reportSource.length == 0 && scope.relation.emptyData && scope.relation.emptyData == true) { /* if (scope.reportSource.length == 0 && scope.relation.emptyData && scope.relation.emptyData == true) {
_init(scope.templateId, true);///如果没有数据,需要重新加载 _init(scope.templateId, true);///如果没有数据,需要重新加载
setEditable(scope.spread); lockCell(scope.spread);
return; return;
} }
*/
scope.reportSource.forEach(function (data) { scope.reportSource.forEach(function (data) {
scope.relation.emptyData == true; scope.relation.emptyData == true;
//fix bug11737 导出需要显示千分位 //fix bug11737 导出需要显示千分位
...@@ -323,14 +343,14 @@ ...@@ -323,14 +343,14 @@
} }
} }
} }
setEditable(scope.spread); lockCell(scope.spread);
scope.spread.resumePaint(); scope.spread.resumePaint();
scope.relation.saveToDbFlag = Math.random(); scope.relation.saveToDbFlag = Math.random();
} }
}; };
(function initialize() { (function initialize() {
loadSheet(scope.templateId, true); loadSheet(scope.templateId);
})(); })();
} }
......
...@@ -2833,7 +2833,7 @@ ...@@ -2833,7 +2833,7 @@
//--------------------------------------kevin insert ------------------------------------- //--------------------------------------kevin insert -------------------------------------
$scope.relation = {}; $scope.relation = {};
var loadIndustry = function () { /* var loadIndustry = function () {
vatReportService.getOrgLists().success(function (industryData) { vatReportService.getOrgLists().success(function (industryData) {
var _data = industryData.data; var _data = industryData.data;
$scope.relation.orgId = _data[0].id; $scope.relation.orgId = _data[0].id;
...@@ -2860,7 +2860,7 @@ ...@@ -2860,7 +2860,7 @@
$('#dx-select-industry').dxSelectBox('instance').option('value', $scope.relation.id); $('#dx-select-industry').dxSelectBox('instance').option('value', $scope.relation.id);
} }
}); });
}; };*/
$scope.changeDate = function (e) { $scope.changeDate = function (e) {
if (e && e.date) { if (e && e.date) {
...@@ -2901,10 +2901,34 @@ ...@@ -2901,10 +2901,34 @@
$scope.changeDate(e); $scope.changeDate(e);
}); });
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
$scope.templateId ="100610523201314816";//这里先写死 todo 这里先写死利润表模板,后续会修改模板id
//初始化 //初始化
$scope.relation.period = year.toString() + monthRevert(mon); $scope.relation.period = year.toString() + monthRevert(mon);
loadCellData($scope.relation.period, $scope.relation.orgId, function(){ loadCellData($scope.selectedDate, $scope.relation.orgId, function(){
});//初始化数据,默认是当前period
};
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
bindingOptions: {
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
}); });
}
}; };
var monthRevert = function(mon){ var monthRevert = function(mon){
...@@ -2916,14 +2940,21 @@ ...@@ -2916,14 +2940,21 @@
//保存并刷新,加载数据 //保存并刷新,加载数据
$scope.saveAndRefresh = function(){ $scope.saveAndRefresh = function(){
var sheet = $scope.spread.sheets[0]; var sheet = $scope.spread.sheets[0];
var specialConsiderations = sheet.getCell(38,3).value(); var specialConsiderations = (sheet.getCell(38,2).value() == null ? 0 : sheet.getCell(38,2).value()); //如果有值取值,没有则取默认值(EBIT考虑资产减值损失)
var ebitRate = sheet.getCell(40,3).value(); var ebitRate = (sheet.getCell(40,2).value() == null ? "1" : sheet.getCell(40,2).value()); //如果有值取值,没有则取默认值(EBIT rate)
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate).success(function(res){ if($scope.relation.period != undefined)
$scope.relation.period = Number($scope.relation.period);
if($scope.relation.orgId == undefined || $scope.relation.orgId == null){
SweetAlert.error("没有选择机构,无法保存刷新");
return;
}
vatReportService.saveAndRefresh($scope.relation.orgId, $scope.relation.period, specialConsiderations, ebitRate ).success(function(res){
if(res.result){ if(res.result){
$scope.relation.data = res.data; $scope.relation.data = res.data;
$timeout(function(){ $timeout(function(){
spreadTODb(); spreadTODb();
}, 7000); }, 3000);
} }
}).error(function(error){ }).error(function(error){
...@@ -2949,7 +2980,9 @@ ...@@ -2949,7 +2980,9 @@
});*/ });*/
var json = $scope.spread.toJSON({includeBindingSource: true}); var json = $scope.spread.toJSON({includeBindingSource: true});
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb'; var url = apiInterceptor.webApiHostUrl + '/Report/spreadToDb?orgId='+ $scope.relation.orgId + "&period=" +$scope.relation.period;
//var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
//xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// here is excel IO API // here is excel IO API
excelIo.save(json, function (blob) { excelIo.save(json, function (blob) {
var fd = new FormData(document.forms.namedItem("myform")); var fd = new FormData(document.forms.namedItem("myform"));
...@@ -2960,6 +2993,10 @@ ...@@ -2960,6 +2993,10 @@
contentType:false, contentType:false,
processData: false, processData: false,
data:fd, data:fd,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken()
},
success: function (data) { success: function (data) {
if(data.result){ if(data.result){
//alert("上传成功!"); //alert("上传成功!");
...@@ -2971,6 +3008,7 @@ ...@@ -2971,6 +3008,7 @@
alert("上传失败:"+ex); alert("上传失败:"+ex);
} }
}); });
});
} }
$scope.$watch('file', function (file) { $scope.$watch('file', function (file) {
...@@ -2978,7 +3016,8 @@ ...@@ -2978,7 +3016,8 @@
}); });
//上传模板 //上传模板
$scope.upload = function (file) { $scope.upload = function (file) {
if(file.length == 0) frontImport(file);//前端导入
/*if(file.length == 0)
return return
file = file[0]; file = file[0];
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
...@@ -3015,7 +3054,7 @@ ...@@ -3015,7 +3054,7 @@
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
SweetAlert.error(status + "上传失败") SweetAlert.error(status + "上传失败")
}) })*/
}; };
//加载Ebit数据 //加载Ebit数据
...@@ -3123,39 +3162,11 @@ ...@@ -3123,39 +3162,11 @@
$('#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)).error(function(error){
if(!res.result) SweetAlert.error(error);
SweetAlert.error(res.resultMsg);
}).error(function(error){
SweetAlert.error("批量导出失败")
}); });
}; };
$scope.relation._orgId = null; $scope.relation._orgId = null;
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
bindingOptions: {
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
});
}
};
$scope.$watch('relation._orgId', function(n, o){ $scope.$watch('relation._orgId', function(n, o){
if(n != undefined ) if(n != undefined )
$scope.relation.orgId = n.pop(); $scope.relation.orgId = n.pop();
...@@ -3256,9 +3267,9 @@ ...@@ -3256,9 +3267,9 @@
//load cell data //load cell data
var date=new Date; /* var date=new Date;
var month=date.getMonth()+1; var month=date.getMonth()+1;*/
$scope.templateId ="100610523201314816";//这里先写死 todo 这里先写死利润表模板,后续会修改模板id
///loadCellData($scope.relation.period);//默认当前月 ///loadCellData($scope.relation.period);//默认当前月
/***************************************************************************************************************/ /***************************************************************************************************************/
......
<div class="vat-report-view"> <div class="vat-report-view">
<!--Report SpreadJS--> <!--Report SpreadJS-->
<div class="row" style=" height: 71px; background: #ccc;"> <div class="row" style=" height: 53px; background: #ccc;">
<div class="col-sm-7" style=" margin-top: 20px;"> <div class="col-sm-7" style=" margin-top: 10px;">
<div class="col-sm-8"> <div class="col-sm-8">
<span class="text-bold" translate="SelectedOrganization" style=" top: -7px; display: inline!important; position: relative; ">:</span> <span class="text-bold" translate="SelectedOrganization" style=" top: -7px; display: inline!important; position: relative; ">:</span>
<!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;" <!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;"> <div class="col-sm-5" class="bar-export navRight" style=" margin-top: 20px;width: 30%;; float: right;">
<span ngf-select="" ngf-change="upload($files)" accept=".xls,.xlsx" ngf-multiple="false" <span ngf-select="" ngf-change="upload($files)" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span> ngf-allow-dir="false" class="" ><i class="fa fa-file">&nbsp;{{'uploadProfileTable' | translate}}</i></span>
<span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span> <span ng-click="saveAndRefresh()"><i class="fa fa-refresh"></i>&nbsp;{{'saveAndRefresh' | translate}}</span>
...@@ -42,5 +42,6 @@ ...@@ -42,5 +42,6 @@
<form name="myform" style="disply:none;" id="myform" enctype="multipart/form-data" method="post"> <form name="myform" style="disply:none;" id="myform" enctype="multipart/form-data" method="post">
         
   </form>    </form>
<a href="#" id = "a"></a>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -109,3 +109,10 @@ ...@@ -109,3 +109,10 @@
} }
} }
} }
@media screen and (max-width:1400px) {
.navRight{
width: 40%!important;
}
}
\ No newline at end of file
webservices.factory('vatReportService', ['$q', '$log', '$http', '$translate', 'apiConfig', 'enums', 'SweetAlert', 'vatOperationLogService', webservices.factory('vatReportService', ['$q', '$log', '$http', '$translate', 'apiConfig', 'enums', 'SweetAlert', 'vatOperationLogService',
'vatSessionService', 'vatSessionService','FileSaver',
function ($q, $log, $http, $translate, apiConfig, enums, SweetAlert, vatOperationLogService, vatSessionService) { function ($q, $log, $http, $translate, apiConfig, enums, SweetAlert, vatOperationLogService, vatSessionService, FileSaver) {
'use strict'; 'use strict';
$log.debug('vatReportService.ctor()...'); $log.debug('vatReportService.ctor()...');
return { return {
...@@ -70,11 +70,24 @@ ...@@ -70,11 +70,24 @@
return $http.post('/Report/reportEbitData',param, apiConfig.createVat({ contentType:"application/json"})); return $http.post('/Report/reportEbitData',param, apiConfig.createVat({ contentType:"application/json"}));
} , } ,
manyExport : function(param){ manyExport : function(param){
return $http.post('/Report/manyExport', param, apiConfig.createVat()); return $http.post('/Report/manyExport', param, apiConfig.createVat({responseType: 'arraybuffer'})).then(function (response) {
var a = document.createElement('a');
var blob = new Blob([response.data], {'type':"application/octet-stream" });
//FileSaver.saveAs(data, '利润表.zip');
a.href = URL.createObjectURL(blob);
a.download = "利润表.zip";
a.click();
});
} }
, ,
saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) { saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) {
return $http.get('/Report/specialConsiderations?=' + orgId + '&period=' + period + "&specialConsiderations=" + specialConsiderations + "&ebitRate=" + ebitRate, apiConfig.createVat()); var paramObj = {
orgId: orgId,
period : period,
specialConsiderations : specialConsiderations,
ebitRate : ebitRate
};
return $http.post('/Report/saveAndRefresh', paramObj , apiConfig.createVat());
}, },
calculateKeyValue: function (projectId, period) { calculateKeyValue: function (projectId, period) {
return $http.post('/Report/calculateKeyValue/' + projectId + '/' + period, {}, apiConfig.createVat({ignoreLoadingBar: true})); return $http.post('/Report/calculateKeyValue/' + projectId + '/' + period, {}, apiConfig.createVat({ignoreLoadingBar: true}));
......
...@@ -18,7 +18,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -18,7 +18,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
}; };
var getPeriodTemplateJsonByOrg = function (templateId,period,orgId) { var getPeriodTemplateJsonByOrg = function (templateId,period,orgId) {
return getJsonFromExcelForPeriod(templateId,period,orgId, true); return getJsonFromExcelForPeriodOrg(templateId,period,orgId);
}; };
var getPeriodTemplateJsonByInit = function (templateId,period,orgId) { var getPeriodTemplateJsonByInit = function (templateId,period,orgId) {
...@@ -115,15 +115,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -115,15 +115,10 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
}; };
var getJsonFromExcelForPeriod = function (templateID,period,projectIdOrOrgId, ebit) { var getJsonFromExcelForPeriod = function (templateID,period,projectIdOrOrgId) {
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period; var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period + "&projectId=" +projectIdOrOrgId;
if(ebit){
url += "&orgId="+projectIdOrOrgId
}else{
url += "&projectId=" +projectIdOrOrgId;
}
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口 xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob xhr.responseType = "blob"; // 返回类型blob
...@@ -172,6 +167,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt ...@@ -172,6 +167,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var blob = this.response; var blob = this.response;
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
excelIo.open(blob, function (json) { excelIo.open(blob, function (json) {
deferred.resolve(json); deferred.resolve(json);
}, function (e) { }, function (e) {
// console.error(e.errorMessage); // console.error(e.errorMessage);
......
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