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;
......
...@@ -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;
......
...@@ -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",
......
...@@ -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