Commit 35a53741 authored by eddie.woo's avatar eddie.woo

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents be16c663 6059beec
......@@ -9,6 +9,16 @@ public class FileServiceConfig {
private String serverUrl;
@Value("${file.server.upload}")
private String uploadUrl;
@Value("${file_upload_post_url}")
private String upload_post_url;
public String getUpload_post_url() {
return upload_post_url;
}
public void setUpload_post_url(String upload_post_url) {
this.upload_post_url = upload_post_url;
}
public String getServerUrl() {
return serverUrl;
......
......@@ -17,5 +17,6 @@ public class ErrorMessageCN {
public static final String OrgStructureNameExist = "层级名称已存在!";
public static final String NoLedgerID = "该机构未同步主数据账套ID!";
public static final String NoCompanyCode = "该机构缺少机构代码字段!";
public static final String ErrorFileFormat="文件样式错误";
}
......@@ -41,10 +41,15 @@ public class FileUploadUtil implements ApplicationContextAware {
return upload( file, false);
}
public static String serverPath(){
public static String serverPath(boolean newUrl){
config = (FileServiceConfig)applicationContext.getBean("fileServiceConfig");
if(newUrl)
return config.getUpload_post_url();
return config.getServerUrl() + config.getUploadUrl();
}
public static String serverPath(){
return serverPath(true);
}
/**
* 上传模板
*
......
......@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.PagingDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.dataimport.DataImportAllParam;
......@@ -13,6 +14,8 @@ import pwc.taxtech.atms.dto.dataimport.DataProcessParam;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.DataImportService;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
......@@ -126,6 +129,7 @@ public class DataImportController extends BaseController {
}
}
@ResponseBody
@RequestMapping(value = "CFExcelFile", method = RequestMethod.POST)
public OperationResultDto importCFExcelFile(@RequestParam MultipartFile file,@RequestParam String orgIds,@RequestParam String periodDate,@RequestParam Integer importType) {
......
......@@ -7,15 +7,19 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.FileDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.PeriodReportDto;
import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import pwc.taxtech.atms.vat.entity.PeriodJob;
import pwc.taxtech.atms.vat.entity.PwcReportAttach;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.service.impl.DataImportService;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
import java.util.List;
......@@ -82,6 +86,48 @@ public class ReportController {
return reportService.getCellData(reportId, from);
}
private static OperationResultDto<ReportDataDto> operationResultDto = null;
@RequestMapping(value = "reportEbitData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDataDto> reportEbitData(Long reportId, String orgId, Integer period) {
OperationResultDto resultDto = new OperationResultDto();
if (reportId == null || reportId == 0L) {
resultDto.setResult(false);
return resultDto;
}
operationResultDto = reportService.getCellData(reportId, orgId, period);
return operationResultDto;
}
@Autowired
private ProjectMapper projectMapper;
private String getProjId(String orgId, Integer tmsPeriod) {
ProjectExample pExample = new ProjectExample();
pExample.createCriteria().andOrganizationIdEqualTo(orgId).andYearEqualTo(tmsPeriod / 100);
List<Project> pList = projectMapper.selectByExample(pExample);
if (!pList.isEmpty()) {
return pList.get(0).getId();
}
return "";
}
public static void main(String[] args) {
System.out.println(201833 % 100);
}
private DataImportService dataImportService;
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<EbitDataDto> saveAndRefresh(@RequestParam(value ="orgId") String orgId, @RequestParam(value ="period") Integer period, @RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations, @RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate) {
OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setData(reportService.loadEbitData(orgId, period, specialConsiderations, ebitRate));
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto);
return operationResultDto;
}
@RequestMapping(value = "report/{templateId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDto> getReportByTemplate(@PathVariable Long templateId, @PathVariable Integer period, @RequestHeader String from) {
OperationResultDto resultDto = new OperationResultDto();
......@@ -93,6 +139,18 @@ public class ReportController {
return reportService.getReportByTemplate(templateId, period, from);
}
@RequestMapping(value = "getReportByTemplateEbit/{templateId}/{period}/{orgId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodReportDto> getReportByTemplateEbit(@PathVariable String templateId, @PathVariable Integer period, @PathVariable String orgId) {
OperationResultDto resultDto = new OperationResultDto();
if (templateId == null || period == null || period == 0) {
resultDto.setResult(false);
resultDto.setResultMsg("templateId or period is invalid");
return resultDto;
}
return reportService.getReportByTemplateEbit(Long.parseLong(templateId), period % 100, getProjId(orgId, period));
}
@RequestMapping(value = "getCellTemplateConfig/{reportTemplateId}/{period}/{rowIndex}/{columnIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodCellTemplateConfig> getCellTemplateConfig(@PathVariable Long reportTemplateId,
@PathVariable Integer period,
......@@ -157,25 +215,35 @@ public class ReportController {
@RequestMapping(value = "doUpload", method = RequestMethod.POST)
public OperationResultDto doUploadAttach(@RequestParam("fileName") String fileName, MultipartFile file, String remarks, @RequestParam("activeCol")Long activeCol, @RequestParam("activeRow")Long activeRow, @RequestParam("activeTemplateId")String activeTemplateId){
System.out.println(activeCol + "----" + activeRow + "-----" + activeTemplateId);
public OperationResultDto doUploadAttach(@RequestParam("fileName") String fileName, MultipartFile file, String remarks, @RequestParam("activeCol") Long activeCol, @RequestParam("activeRow") Long activeRow, @RequestParam("activeTemplateId") String activeTemplateId) {
System.out.println(activeCol + "----" + activeRow + "-----" + activeTemplateId);
OperationResultDto operationResultDto = reportService.doUploadAttach(file, remarks);
if(!"error".equals(operationResultDto.getResultMsg())){//上传成功绑定
if (!"error".equals(operationResultDto.getResultMsg())) {//上传成功绑定
reportService.bindPwcAttach(activeCol, activeRow, activeTemplateId, (FileDto) operationResultDto.getData());
}
return operationResultDto;
}
@RequestMapping("loadAttachList")
public List<PwcReportAttach> loadAttachList(@RequestBody ReportAttachDto reportAttachDto){
public List<PwcReportAttach> loadAttachList(@RequestBody ReportAttachDto reportAttachDto) {
System.out.println("sdsdfsd");
return reportService.loadAttachList(reportAttachDto);
}
@RequestMapping("deleteAttach")
public OperationResultDto deleteAttach(Long id){
return reportService.deleteAttach(id);
public OperationResultDto deleteAttach(Long id) {
return reportService.deleteAttach(id);
}
@Autowired
private OrganizationMapper organizationMapper;
@RequestMapping("getOrgLists")
public OperationResultDto getOrgLists() {
OperationResultDto operationResultDto = new OperationResultDto();
OrganizationExample organizationExample = new OrganizationExample();
operationResultDto.setData(organizationMapper.selectByExample(organizationExample));
return operationResultDto;
}
}
\ No newline at end of file
......@@ -108,6 +108,7 @@ public class TaxDocumentController {
response.setHeader("Content-Disposition", "attachment;fileName=" + new String("taxDocument.xlsx".getBytes("GB2312"), "ISO-8859-1"));
OutputStream ouputStream = response.getOutputStream();
ExcelUtil.exportExcel(headers, TaxDocument, ouputStream);
ouputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -19,11 +19,14 @@ import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.EnumAnalysisImportType;
import pwc.taxtech.atms.constant.enums.EnumCitImportType;
import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.BadParameterException;
......@@ -184,16 +187,110 @@ public class TemplateController extends BaseController {
}
}
@Autowired
private ProjectMapper projectMapper;
private String getProjId(String orgId, Integer tmsPeriod) {
ProjectExample pExample = new ProjectExample();
pExample.createCriteria().andOrganizationIdEqualTo(orgId).andYearEqualTo(tmsPeriod/100);
List<Project> pList = projectMapper.selectByExample(pExample);
if(!pList.isEmpty()){
return pList.get(0).getId();
}
return "";
}
@RequestMapping(value = "getPeriodTemplateJson", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody
void getPeriodTemplateBlob(@RequestParam(name = "templateId") Long templateId,
@RequestParam(name = "period") Integer period,
@RequestParam(name = "projectId") String projectId,
@RequestParam(name = "period", required = false) Integer period,
@RequestParam(name = "projectId", required = false) String projectId,
HttpServletResponse response) throws URISyntaxException {
String filePath;
File templateFile;
InputStream inputStream = null;
List<PeriodTemplate> templates = null;
if(period == null || projectId == null){
templates = templateService.getTemplates(templateId);
}else{
templates = templateService.getPeriodTemplates(templateId,period,projectId);
}
MyAsserts.assertNotEmpty(templates, new NotFoundException());
PeriodTemplate template = templates.get(0);
String templatePath = template.getPath();
MyAsserts.assertNotEmpty(templatePath, new NotFoundException());
filePath = this.getClass().getResource("").toURI().getPath();
String tempPath = filePath.substring(0, filePath.indexOf("classes") + "\\classes".length());
templateFile = new File(tempPath + templatePath);
OutputStream out = null;
try {
//如果是系统报表就取本地文件夹,如果不是就取FTP
if (template.getIsSystemType()) {
inputStream = new BufferedInputStream(new FileInputStream(templateFile));
} else {
if (templatePath.indexOf("/") <= 0) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(templatePath));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String, String> urlMap = null;
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
templatePath = uploadDetail.getList().get(0).getViewHttpUrl();
}
}
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);
out.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error("Error downloading template file template.xlsx", e);
throw new ApplicationException("Error downloading template file template.xlsx", e);
} 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;
}
}
}
@RequestMapping(value = "getPeriodTemplateJsonOrg", method = RequestMethod.POST, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public @ResponseBody
void getPeriodTemplateJsonOrg(@RequestParam(name = "templateId") Long templateId,
@RequestParam(name = "period") Integer period,
@RequestParam(name = "orgId") String orgId,
HttpServletResponse response) throws URISyntaxException {
String projectId = null;
if(orgId != null)
projectId = getProjId(orgId, period);
projectId = "1942295d-6fe6-4aa7-b2e7-b66a5772697c";
String filePath;
File templateFile;
InputStream inputStream = null;
period = 0;
List<PeriodTemplate> templates = templateService.getPeriodTemplates(templateId,period,projectId);
MyAsserts.assertNotEmpty(templates, new NotFoundException());
PeriodTemplate template = templates.get(0);
......
......@@ -141,6 +141,24 @@ public class TemplateGroupController {
return OperationResultDto.error(ErrorMessage.SystemError);
}
@ResponseBody
@RequestMapping(value = "ebitTemplateImport", method = RequestMethod.POST)
public OperationResultDto ebitTemplateImport(@RequestParam MultipartFile file,
@RequestParam String orgId,
@RequestParam Integer period) {
try {
templateGroupService.ebitTemplateImport(file, orgId,period);
return OperationResultDto.success();
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("ebitTemplateImport error.", e);
}
return OperationResultDto.error(ErrorMessage.SystemError);
}
@ResponseBody
// @ApiOperation(value = "模板另存为")
@RequestMapping(value = "addTemplateGroup", method = RequestMethod.POST)
......
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table TAX_ADMIN.PERIOD_REPORT
*
* @mbg.generated do_not_delete_during_merge
*/
public class PeriodReportDto implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.ID
*
* @mbg.generated
*/
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
private List<EbitCellData> cellDataList;
public List<EbitCellData> getCellDataList() {
return cellDataList;
}
public void setCellDataList(List<EbitCellData> cellDataList) {
this.cellDataList = cellDataList;
}
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.TEMPLATE_ID
*
* @mbg.generated
*/
private Long templateId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.PERIOD
*
* @mbg.generated
*/
private Integer period;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.PROJECT_ID
*
* @mbg.generated
*/
private String projectId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.CREATE_BY
*
* @mbg.generated
*/
private String createBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.CREATE_TIME
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_BY
*
* @mbg.generated
*/
private String updateBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_TIME
*
* @mbg.generated
*/
private Date updateTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table TAX_ADMIN.PERIOD_REPORT
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.ID
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.ID
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.ID
*
* @param id the value for TAX_ADMIN.PERIOD_REPORT.ID
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.TEMPLATE_ID
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.TEMPLATE_ID
*
* @mbg.generated
*/
public Long getTemplateId() {
return templateId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.TEMPLATE_ID
*
* @param templateId the value for TAX_ADMIN.PERIOD_REPORT.TEMPLATE_ID
*
* @mbg.generated
*/
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.PERIOD
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.PERIOD
*
* @mbg.generated
*/
public Integer getPeriod() {
return period;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.PERIOD
*
* @param period the value for TAX_ADMIN.PERIOD_REPORT.PERIOD
*
* @mbg.generated
*/
public void setPeriod(Integer period) {
this.period = period;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.PROJECT_ID
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.PROJECT_ID
*
* @mbg.generated
*/
public String getProjectId() {
return projectId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.PROJECT_ID
*
* @param projectId the value for TAX_ADMIN.PERIOD_REPORT.PROJECT_ID
*
* @mbg.generated
*/
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.CREATE_BY
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.CREATE_BY
*
* @mbg.generated
*/
public String getCreateBy() {
return createBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.CREATE_BY
*
* @param createBy the value for TAX_ADMIN.PERIOD_REPORT.CREATE_BY
*
* @mbg.generated
*/
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.CREATE_TIME
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.CREATE_TIME
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.CREATE_TIME
*
* @param createTime the value for TAX_ADMIN.PERIOD_REPORT.CREATE_TIME
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_BY
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.UPDATE_BY
*
* @mbg.generated
*/
public String getUpdateBy() {
return updateBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_BY
*
* @param updateBy the value for TAX_ADMIN.PERIOD_REPORT.UPDATE_BY
*
* @mbg.generated
*/
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_TIME
*
* @return the value of TAX_ADMIN.PERIOD_REPORT.UPDATE_TIME
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column TAX_ADMIN.PERIOD_REPORT.UPDATE_TIME
*
* @param updateTime the value for TAX_ADMIN.PERIOD_REPORT.UPDATE_TIME
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table TAX_ADMIN.PERIOD_REPORT
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", templateId=").append(templateId);
sb.append(", period=").append(period);
sb.append(", projectId=").append(projectId);
sb.append(", createBy=").append(createBy);
sb.append(", createTime=").append(createTime);
sb.append(", updateBy=").append(updateBy);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
......@@ -23,6 +23,17 @@ public class DidiFileIUploadParam implements Serializable {
private List<Integer> uploadYears;
//是否转换url为本地url
private boolean isParseUrl = true;
public boolean isParseUrl() {
return isParseUrl;
}
public void setParseUrl(boolean parseUrl) {
isParseUrl = parseUrl;
}
public List<String> getBizSources() {
return bizSources;
}
......
package pwc.taxtech.atms.dto.vatdto;
import java.math.BigDecimal;
/**
* @ClassName EbitDataDto
* Description TODO
* @Author pwc kevin
* @Date 3/26/2019 11:00 AM
* Version 1.0
**/
public class EbitDataDto {
private BigDecimal ebitSubtraction; // 1. EBIT(考虑资产减值损失)
private BigDecimal specialFactors; //考虑特殊因素
private double ebitRate;// ebit比率 默认1%(可更改)
private BigDecimal transactionAmount; //关联交易金额
private String sixAddTax; //6%增值税
private BigDecimal totalAmountTax;// 价税合计金额
private String specialConsiderations;//特殊因素考虑
public String getSpecialConsiderations() {
return specialConsiderations;
}
public void setSpecialConsiderations(String specialConsiderations) {
this.specialConsiderations = specialConsiderations;
}
public BigDecimal getEbitSubtraction() {
return ebitSubtraction;
}
public void setEbitSubtraction(BigDecimal ebitSubtraction) {
this.ebitSubtraction = ebitSubtraction;
}
public BigDecimal getSpecialFactors() {
return specialFactors;
}
public void setSpecialFactors(BigDecimal specialFactors) {
this.specialFactors = specialFactors;
}
public double getEbitRate() {
return ebitRate;
}
public void setEbitRate(double ebitRate) {
this.ebitRate = ebitRate;
}
public BigDecimal getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(BigDecimal transactionAmount) {
this.transactionAmount = transactionAmount;
}
public String getSixAddTax() {
return sixAddTax;
}
public void setSixAddTax(String sixAddTax) {
this.sixAddTax = sixAddTax;
}
public BigDecimal getTotalAmountTax() {
return totalAmountTax;
}
public void setTotalAmountTax(BigDecimal totalAmountTax) {
this.totalAmountTax = totalAmountTax;
}
@Override
public String toString() {
return "EbitDataDto{" +
"ebitSubtraction=" + ebitSubtraction +
", specialFactors=" + specialFactors +
", ebitRate='" + ebitRate + '\'' +
", transactionAmount=" + transactionAmount +
", sixAddTax='" + sixAddTax + '\'' +
", totalAmountTax=" + totalAmountTax +
'}';
}
}
......@@ -8,6 +8,15 @@ public class ReportDataDto {
private List<CellDataDto> cellData;
private List<PeriodFormulaBlock> formulaBlocks;
private List<DataSourceDtoExtend> manualDataSources;
private EbitDataDto ebitData;
public EbitDataDto getEbitData() {
return ebitData;
}
public void setEbitData(EbitDataDto ebitData) {
this.ebitData = ebitData;
}
public List<CellDataDto> getCellData() {
return this.cellData;
......
......@@ -748,7 +748,8 @@ public class AnalysisServiceImpl extends BaseService {
private BigDecimal getCellBigDecimalValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return new BigDecimal(cell.getStringCellValue());
String replace = cell.getStringCellValue().replace("%", "");
return new BigDecimal(Double.parseDouble(replace)/100);
} else if(cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
return new BigDecimal(cell.getNumericCellValue());
}
......
......@@ -1962,7 +1962,7 @@ public class DataImportService extends BaseService {
return false;
}
private String getProjId(String orgId, Integer tmsPeriod) {
private String getProjId(String orgId, Integer tmsPeriod) {
ProjectExample pExample = new ProjectExample();
pExample.createCriteria().andOrganizationIdEqualTo(orgId).andYearEqualTo(tmsPeriod/100);
List<Project> pList = projectMapper.selectByExample(pExample);
......
......@@ -35,6 +35,7 @@ import pwc.taxtech.atms.vat.entity.FileUploadLog;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Calendar;
......@@ -74,6 +75,10 @@ public class DidiFileUploadService extends BaseService {
private static final String PROXY_PORT = "11007";
public FileUpload getFileUpload(String uid){
return fileUploadMapper.selectByPrimaryKey(uid);
}
public FileUpload uploadFile(MultipartFile file, String fileName, String bizSource) throws ServiceException {
CloseableHttpClient httpClient = null;
String requestKey = CommonUtils.getUUID();
......@@ -86,7 +91,7 @@ public class DidiFileUploadService extends BaseService {
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
String md5Str = getFileMD5String(file);
ByteArrayBody byteBody = new ByteArrayBody(file.getBytes(), ContentType.MULTIPART_FORM_DATA, StringUtils.isBlank(fileName) ? file.getOriginalFilename() : fileName);
ByteArrayBody byteBody = new ByteArrayBody(file.getBytes(), ContentType.MULTIPART_FORM_DATA, StringUtils.isBlank(fileName) ? URLEncoder.encode(file.getOriginalFilename(), "UTF-8") : URLEncoder.encode(fileName, "UTF-8"));
StringBody md5 = new StringBody(md5Str, ContentType.create("text/plain"));
HttpEntity httpEntity = MultipartEntityBuilder.create().addPart("filecontent", byteBody).addPart("md5", md5).build();
httpPost.setEntity(httpEntity);
......@@ -134,7 +139,7 @@ public class DidiFileUploadService extends BaseService {
try {
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
ByteArrayBody byteBody = new ByteArrayBody(bytes, ContentType.MULTIPART_FORM_DATA, fileName);
ByteArrayBody byteBody = new ByteArrayBody(bytes, ContentType.MULTIPART_FORM_DATA, URLEncoder.encode(fileName, "UTF-8"));
HttpEntity httpEntity = MultipartEntityBuilder.create().addPart("filecontent", byteBody).build();
httpPost.setEntity(httpEntity);
HttpResponse httpResponse = httpClient.execute(httpPost);
......@@ -192,6 +197,7 @@ public class DidiFileUploadService extends BaseService {
}
public PageInfo<DidiFileUploadDetailResult> queryPage(DidiFileIUploadParam param) {
Page page = null;
if (param.getPageInfo() != null && param.getPageInfo().getPageSize() != null && param.getPageInfo().getPageIndex() != null) {
......@@ -219,7 +225,11 @@ public class DidiFileUploadService extends BaseService {
}
refreshViewUrl(param);
PageInfo<DidiFileUploadDetailResult> pageInfo = new PageInfo<>(fileUploadMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new DidiFileUploadDetailResult())).collect(Collectors.toList()));
.map(o -> {
DidiFileUploadDetailResult item = new DidiFileUploadDetailResult();
beanUtil.copyProperties(o, item);
return item;
}).collect(Collectors.toList()));
if (page != null) {
pageInfo.setTotal(page.getTotal());
}
......
......@@ -352,15 +352,18 @@ public class TaxDocumentServiceImpl {
TaxDocumentExample.Criteria criteria = example.createCriteria();
criteria.andIdIn(ids);
TaxDocument taxDocument = taxDocumentMapper.selectByExample(example).get(0);
String urlPath = taxDocument.getFilePositionUrl();
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(Arrays.asList(taxDocument.getFileUploadId()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
String urlPath = uploadDetail.getList().get(0).getViewHttpUrl();
//如果url为null或空字符串而抛出异常
if (StringUtils.isBlank(urlPath)) {
throw new RuntimeException("文件url为空,id为:" + taxDocument.getId());
}
//文件名称(带后缀) 文件名前+7位uuid截取码以防文件名相同
String fileName = StringUtils.isBlank(taxDocument.getFileName())
String fileName = StringUtils.isBlank(uploadDetail.getList().get(0).getFileName())
? "未知文件(请修改后缀名).xlsx"
: taxDocument.getFileOriginalName();//设置输出流信息
: uploadDetail.getList().get(0).getFileName();//设置输出流信息
try {
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8"));
......@@ -476,15 +479,20 @@ public class TaxDocumentServiceImpl {
criteria.andIdIn(ids);
//查询出根据条件过滤后需要下载的附件数据信息
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(example);
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(taxDocuments.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
//新建一个空集合,记录下载的名字,并用于判断是否重名,重名则修改名字为(n)
List<String> fileNameList = new ArrayList<>();
for (TaxDocument item : taxDocuments) {
for (DidiFileUploadDetailResult item : uploadDetail.getList()) {
//文件url
String urlPath = item.getFilePositionUrl();
//如果url为null或空字符串而抛出异常
if (StringUtils.isBlank(urlPath)) {
throw new RuntimeException("文件url为空,id为:" + item.getId());
}
String urlPath = item.getViewHttpUrl();
// //如果url为null或空字符串而抛出异常
// if (StringUtils.isBlank(urlPath)) {
// throw new RuntimeException("文件url为空,id为:" + item.getId());
// }
//检查文件名是否有重复
int fileNameRepeatTimes = 0;
if (fileNameList.size()>0){
......
......@@ -123,6 +123,12 @@ public class TemplateServiceImpl extends AbstractService {
example.createCriteria().andProjectIdEqualTo(projectId).andTemplateIdEqualTo(templateId).andPeriodEqualTo(period);
return periodTemplateMapper.selectByExample(example);
}
public List<PeriodTemplate> getTemplates(Long templateId){
PeriodTemplateExample example = new PeriodTemplateExample();
example.createCriteria().andTemplateIdEqualTo(templateId);
return periodTemplateMapper.selectByExample(example);
}
public String getTemplatePath(Long templateId) {
String result = "";
......
......@@ -24,6 +24,7 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -151,7 +152,6 @@ public class FormulaAgent {
}
public static String buildSql(String tableName, String getField, String filter, String filterValue, Integer period, Integer year, FormulaContext formulaContext) {
/*
......@@ -183,12 +183,12 @@ public class FormulaAgent {
public static String _buildSql(String getField, String tableName, String filter, String filterValue, Integer period, FormulaContext formulaContext, Integer year, boolean bool, boolean getSql) throws Exception {
String sql = "";
//统一判断年度
year = formulaContext.getYear() + year;
if(getSql){
year = formulaContext.getYear() + year;
if (getSql) {
tableName = tableName.toLowerCase();
sql = "select * from " + tableName + " where 1=1 and " + filter + filterValue;
return sql + " and project_id = '" + formulaContext.getProjectId() + "'";
}else{
return sql + " and project_id = '" + formulaContext.getProjectId() + "'";
} else {
sql = "select sum(" + getField + ") as " + getField + " from " + tableName + " where 1=1 and " + filter + filterValue;
}
String _p = insertZero(formulaContext.getPeriod() - Math.abs(period));
......@@ -210,7 +210,7 @@ public class FormulaAgent {
}
if (bool)
sql += " and period = " + year;
sql += " and project_id = '" + formulaContext.getProjectId() + "'";
sql += " and project_id = '" + formulaContext.getProjectId() + "'";
return sql;
}
......@@ -237,8 +237,16 @@ public class FormulaAgent {
public BigDecimal getTableDataByName(String tableName, String getField, String filter, String filterValue, Integer period, Integer year, FormulaContext formulaContext) {
Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext));
Map<String, Object> stringObjectMap = new HashMap<>();
try {
stringObjectMap = jdbcTemplate.queryForMap(buildSql(TableRule.map.get(tableName), getField, filter, filterValue, period, year, formulaContext));
if (stringObjectMap.get(getField) != null) {
return new BigDecimal(stringObjectMap.get(getField).toString());
}
} catch (Exception e) {
e.printStackTrace();
return new BigDecimal(0);
}
/* for (int i = 0, j = stringObjectMap.size(); i < j; i++) {
if (i == 1) {
if(stringObjectMap.get(i).get(StringUtil.underline2Camel(getField)) == null){
......@@ -256,28 +264,26 @@ public class FormulaAgent {
}
}
*/
if(stringObjectMap.get(getField) != null ){
return new BigDecimal(stringObjectMap.get(getField).toString());
}
return new BigDecimal(0);
}
/**
* 获取期末余额
* @author zhikai.z.wei
*
* @param subjectType
* @param subjectCode
* @param year
* @param period
* @param formulaContext
* @return
* @author zhikai.z.wei
*/
public BigDecimal getQMYE(Integer subjectType, String subjectCode, Integer year, Integer period, FormulaContext formulaContext){
public BigDecimal getQMYE(Integer subjectType, String subjectCode, Integer year, Integer period, FormulaContext formulaContext) {
Project project = projectMapper.selectByPrimaryKey(formulaContext.getProjectId());
CitTbamExample citTbamExample = new CitTbamExample();
citTbamExample.createCriteria().andAccountCodeEqualTo(subjectCode).andPeriodEqualTo(year+ project.getYear());
citTbamExample.createCriteria().andAccountCodeEqualTo(subjectCode).andPeriodEqualTo(year + project.getYear());
List<CitTbam> citTbams = citTbamMapper.selectByExample(citTbamExample);
if(citTbams == null || citTbams.isEmpty()){
if (citTbams == null || citTbams.isEmpty()) {
return new BigDecimal(0.0);
}
return citTbams.get(0).getEndingBalance();
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
......@@ -61,21 +62,6 @@ public class BB extends FunctionBase implements FreeRefFunction {
BigDecimal cellValue = BigDecimal.ZERO;
try {
List<CellTemplatePerGroupDto> cellTemplateDataList;
if (curPeriod.getCurYear() != formulaContext.getYear()) {
Project project = agent.getFixedProject(formulaContext.getProjectId(), curPeriod.getCurYear());
MyAsserts.assertNotNull(project, Exceptions.PROJECT_NOT_FOUND);
cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
project.getId(), bo.getReportCode(), bo.getRowIndex() - 1, bo.getColumnIndex() - 1, curPeriod.getCurPeriod());
} else {
cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
formulaContext.getProjectId(), bo.getReportCode(), bo.getRowIndex() - 1, bo.getColumnIndex() - 1, curPeriod.getCurPeriod());
}
MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.BB_CELL_TEMP_NULL);
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
nullCellDto.fixedWithGroup(cellTemplateData);
// todo: fix datasource name by templateList(neo)
if (bo.getPeriod().intValue() == 99) {
dataSource.clear();
BigDecimal returnEval = defaultBigDecimal;
......@@ -83,7 +69,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
return defaultBigDecimal;
}
//如果是当年取到当期截至,往年取12期
for (int p = 1; p < (curPeriod.getCurYear()==formulaContext.getYear()?formulaContext.getPeriod():12); p++) {
for (int p = 1; p <= (curPeriod.getCurYear()==formulaContext.getYear()?formulaContext.getPeriod():12); p++) {
try {
returnEval = returnEval.add(bb(new BBParasBo(bo, p, curPeriod.getCurYear()), ec, dataSource, bo));
} catch (Exception e) {
......@@ -92,33 +78,45 @@ public class BB extends FunctionBase implements FreeRefFunction {
}
}
}
return returnEval;
}
List<CellTemplatePerGroupDto> cellTemplateDataList;
if (curPeriod.getCurYear() != formulaContext.getYear()) {
Project project = agent.getFixedProject(formulaContext.getProjectId(), curPeriod.getCurYear());
// MyAsserts.assertNotNull(project, Exceptions.PROJECT_NOT_FOUND);
if(project == null){
return cellValue;
}
cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
project.getId(), bo.getReportCode(), bo.getRowIndex() - 1, bo.getColumnIndex() - 1, curPeriod.getCurPeriod());
} else {
cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
formulaContext.getProjectId(), bo.getReportCode(), bo.getRowIndex() - 1, bo.getColumnIndex() - 1, curPeriod.getCurPeriod());
}
// MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.BB_CELL_TEMP_NULL);
if(CollectionUtils.isEmpty(cellTemplateDataList)){
return cellValue;
}
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
nullCellDto.fixedWithGroup(cellTemplateData);
//当年当期
if (bo.getPeriod().intValue() == 0 && bo.getYear().intValue() == 0) {
int index = ec.getWorkbook().getSheetIndex(bo.getReportCode());
cellValue = getCellValue(index, ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1,
Long.parseLong(cellTemplateData.getCellTemplateId()));
nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
nullCellDto.setAmount(cellValue);
return cellValue;
}
PeriodCellData cellData = null;
String projectId = agent.getPastProjectId(curPeriod.getCurYear(),
formulaContext.getOrganizationId());
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_EMPTY);
cellData = agent.getCellData(cellTemplateData.getReportTemplateId(),
cellTemplateData.getCellTemplateId(), curPeriod.getCurPeriod(), formulaContext.getProjectId());
List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()),
formulaContext.getProjectId(), bo.getPeriod());
nullCellDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData);
if (cellData.getData() == null && !dss.isEmpty()) {
cellValue = dss.get(0).getAmount();
} else if (cellData.getData() != null && dss.isEmpty()) {
......@@ -128,14 +126,12 @@ public class BB extends FunctionBase implements FreeRefFunction {
cellValue = dss.get(0).getAmount().add(new BigDecimal(cellData.getData()).setScale(4,
BigDecimal.ROUND_HALF_DOWN));
} else throw Exceptions.BB_CELL_DATA_NULL;
nullCellDto.setAmount(cellValue);
if (rootBo != null) {
rootBo.putPeriodCellTempate(curPeriod.getCurPeriod(), Long.parseLong(cellTemplateData.getCellTemplateId()));
} else {
bo.putPeriodCellTempate(curPeriod.getCurPeriod(), Long.parseLong(cellTemplateData.getCellTemplateId()));
}
LOGGER.debug("cell static value ");
return cellValue;
} catch (Exception e) {
......
......@@ -251,9 +251,11 @@ public class FunctionBase {
return bigDecimal;
}
} catch (Exception e) {
if (!dss.isEmpty())
return dss.get(0).getAmount();
e.printStackTrace();
if (!dss.isEmpty()){
return dss.get(0).getAmount();}
else {return new BigDecimal(0);}
}
}else{
try {
......@@ -264,9 +266,10 @@ public class FunctionBase {
return bigDecimal;
}
} catch (Exception e) {
if (!dss.isEmpty())
return dss.get(0).getAmount();
e.printStackTrace();
if (!dss.isEmpty()){
return dss.get(0).getAmount();}
else {return new BigDecimal(0);}
}
}
......
......@@ -61,16 +61,17 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
parameterCheck(args, ec);
BigDecimal cellValue = BigDecimal.ZERO;
List<Object> dataSource = new ArrayList<>();
Map map = new HashMap<String, String>();
ReportCellTableSUMIFDataSourceDto reportCellTableSUMIFDataSourceDto = new ReportCellTableSUMIFDataSourceDto();
reportCellTableSUMIFDataSourceDto.insertData(ec, formulaContext);
BigDecimal cellValue = BigDecimal.ZERO;
String filter = null;
String filterValue = null;
dataSource.add(reportCellTableSUMIFDataSourceDto);
try {
parameterCheck(args, ec);
Map map = new HashMap<String, String>();
ReportCellTableSUMIFDataSourceDto reportCellTableSUMIFDataSourceDto = new ReportCellTableSUMIFDataSourceDto();
reportCellTableSUMIFDataSourceDto.insertData(ec, formulaContext);
dataSource.add(reportCellTableSUMIFDataSourceDto);
tableName = resolverString(args, ec, 0);
getField = resolverString(args, ec, 1);
filter= resolverString(args, ec, 2);
......@@ -95,13 +96,9 @@ public class RSUMIF extends FunctionBase implements FreeRefFunction {
cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), ec.getColumnIndex(), ec.getRowIndex(),
formulaContext.getProjectId(), selectShow(tableName), FormulaAgent._buildSql(getField,tableName,filter,filterValue,period,formulaContext,year, boo, true));
} catch (Exception e) {
e.printStackTrace();
}
try {
saveFormulaBlock(formulaContext.getPeriod(), ec,
new RSUMIFParasBo().getExpression(args, ec), cellValue, dataSourceId, formulaContext.getProjectId());
} catch (EvaluationException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
......
......@@ -40,7 +40,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="invoice_record" domainObjectName="InvoiceRecord">
<table tableName="ebit_cell_data" domainObjectName="EbitCellData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......
package pwc.taxtech.atms.dpo;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import java.util.Date;
import java.util.List;
public class ReportDto {
private String id;
......@@ -14,6 +17,15 @@ public class ReportDto {
private String updater;
private Date updateTime;
private Integer reportType;
private List<EbitCellData> cellDataList;
public List<EbitCellData> getCellDataList() {
return cellDataList;
}
public void setCellDataList(List<EbitCellData> cellDataList) {
this.cellDataList = cellDataList;
}
public Integer getReportType() {
return reportType;
......
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.EbitCellData;
import pwc.taxtech.atms.vat.entity.EbitCellDataExample;
@Mapper
public interface EbitCellDataMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
long countByExample(EbitCellDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int deleteByExample(EbitCellDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int insert(EbitCellData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int insertSelective(EbitCellData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
List<EbitCellData> selectByExampleWithRowbounds(EbitCellDataExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
List<EbitCellData> selectByExample(EbitCellDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
EbitCellData selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") EbitCellData record, @Param("example") EbitCellDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int updateByExample(@Param("record") EbitCellData record, @Param("example") EbitCellDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(EbitCellData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_cell_data
*
* @mbg.generated
*/
int updateByPrimaryKey(EbitCellData record);
}
\ No newline at end of file
......@@ -107,7 +107,7 @@ public interface ProfitLossStatementFinalMapper extends MyVatMapper {
*/
int updateByPrimaryKey(ProfitLossStatement record);
List<ProfitLossStatement> selectByCondition(@Param("plCondition") ProfitLossStatementCondition condition);
List<ProfitLossStatement> selectByCondition(@Param("plCondition") ProfitLossStatementExample condition);
int insertBatch(List<ProfitLossStatement> pls);
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
......@@ -18,7 +19,17 @@ public class PeriodReport implements Serializable {
*
* @mbg.generated
*/
private Long id;
private List<EbitCellData> cellDataList;
public List<EbitCellData> getCellDataList() {
return cellDataList;
}
public void setCellDataList(List<EbitCellData> cellDataList) {
this.cellDataList = cellDataList;
}
/**
*
......
......@@ -1696,6 +1696,7 @@ var analysisModule = angular.module('app.analysis', ['ui.grid', 'ui.router','ui.
}
},
resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.analysis),
deepStateRedirect: false,
sticky: true
});
......
......@@ -6,7 +6,7 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<base href="/" />
<base href="/"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" http-equiv="X-UA-Compatible" content="chrome=1; IE=11; IE=10; IE=9; IE=EDGE">
<title>Apex+ ATMS</title>
......@@ -16,7 +16,7 @@
}
body {
font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";
font-family: "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
}
a.back-to-top {
......@@ -50,14 +50,14 @@
<!--@Styles.Render("~/bundles/framework.less")-->
<!--@Styles.Render("~/bundles/taxDocumentManage.less")-->
<link href="Content/bundle_content.css" rel="stylesheet" type="text/css" />
<link href="bundles/appresources.css" rel="stylesheet" type="text/css" />
<link href="bundles/appresources.less" rel="stylesheet" type="text/css" />
<link href="bundles/common.css" rel="stylesheet" type="text/css" />
<link href="bundles/common.less" rel="stylesheet" type="text/css" />
<link href="bundles/less/framework.less" rel="stylesheet" type="text/css" />
<link href="bundles/less/taxDocumentManage.less" rel="stylesheet" type="text/css" />
<link href="bundles/less/cit.less" rel="stylesheet" type="text/css" />
<link href="Content/bundle_content.css" rel="stylesheet" type="text/css"/>
<link href="bundles/appresources.css" rel="stylesheet" type="text/css"/>
<link href="bundles/appresources.less" rel="stylesheet" type="text/css"/>
<link href="bundles/common.css" rel="stylesheet" type="text/css"/>
<link href="bundles/common.less" rel="stylesheet" type="text/css"/>
<link href="bundles/less/framework.less" rel="stylesheet" type="text/css"/>
<link href="bundles/less/taxDocumentManage.less" rel="stylesheet" type="text/css"/>
<link href="bundles/less/cit.less" rel="stylesheet" type="text/css"/>
</head>
<body ng-controller="AppController">
<!--@Html.AntiForgeryToken()-->
......@@ -65,7 +65,7 @@
<app-nav></app-nav>
<div class="page-wrapper" style="position:relative;overflow-x:hidden;overflow-y:auto;margin-top:55px">
<div class="main-contents" ui-view></div>
<div class="data-import-contents" style="display: none" ui-view="importContent"></div>
<div class="data-import-contents" ui-view="importContent"></div><!--style="display: none"-->
</div>
<div class="clear"></div>
<atms-busy-indicator></atms-busy-indicator>
......@@ -120,49 +120,54 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.10.1/xlsx.full.min.js"></script>
<!--<script type="text/javascript" src="bundles/hubs.js">-->
<script type="text/javascript">
GC.Spread.Sheets.LicenseKey = constant.regesterInformation.userKey;
window.location.href = '/#/#/organizationViewInfrastructure/organizationBusinessUnitView';
var arrayCookie = document.cookie.split(';');
var user_name = '';
arrayCookie.forEach(function (item) {
if (item.indexOf('AtmsApiToken') > -1) {
user_name = item;
}
});
// <!--if (JSON.parse(user_name.split('=')[1]).user_name.toLowerCase() === 'simon') {-->
// <!--window.location.href = '/#/overview/assetsManage';-->
// <!--}-->
// <!--else {-->
window.location.href = '/#/overview/vat';
// <!--}-->
// create the back to top button
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
var amountScrolled = 300;
$(window).scroll(function () {
if ($(window).scrollTop() > amountScrolled) {
$('a.back-to-top').fadeIn('slow');
} else {
$('a.back-to-top').fadeOut('slow');
}
});
$('a.back-to-top, a.simple-back-to-top').click(function () {
$('html, body').animate({
scrollTop: 0
}, 700);
return false;
});
window.onload = function () {
$("#overview").click();
//$('#overview').trigger("click");
//$('.nav-element-left a').removeClass('active');
//$('#overview').addClass('active');
};
</script>
GC.Spread.Sheets.LicenseKey = constant.regesterInformation.userKey;
window.location.href = '/#/#/organizationViewInfrastructure/organizationBusinessUnitView';
var arrayCookie = document.cookie.split(';');
var user_name = '';
arrayCookie.forEach(function (item) {
if (item.indexOf('AtmsApiToken') > -1) {
user_name = item;
}
});
//
<!--if (JSON.parse(user_name.split('=')[1]).user_name.toLowerCase() === 'simon') {-->
//
<!--window.location.href = '/#/overview/assetsManage';-->
//
<!--}-->
//
<!--else {-->
window.location.href = '/#/overview/vat';
//
<!--}-->
// create the back to top button
$('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
var amountScrolled = 300;
$(window).scroll(function () {
if ($(window).scrollTop() > amountScrolled) {
$('a.back-to-top').fadeIn('slow');
} else {
$('a.back-to-top').fadeOut('slow');
}
});
$('a.back-to-top, a.simple-back-to-top').click(function () {
$('html, body').animate({
scrollTop: 0
}, 700);
return false;
});
window.onload = function () {
$("#overview").click();
//$('#overview').trigger("click");
//$('.nav-element-left a').removeClass('active');
//$('#overview').addClass('active');
};
</script>
</body>
</html>
......@@ -2288,6 +2288,9 @@
"DriverType": "司机类型",
"FileExportSuccess": "文件下载成功!",
"FileExportFailed": "文件下载失败!",
"singleExport": "单体导出",
"manyExport":"批量导出",
"saveAndRefresh" : "保存并刷新",
"uploadProfileTable": "上传利润表",
"~MustBeEndOneApp": "我必须是最后一个!"
}
\ No newline at end of file
......@@ -145,7 +145,9 @@
if ($scope.curServiceTypeId === enums.serviceType.VAT) {
$scope.detailReportTypeList = angular.copy(defaultReportTypeOpt);
var ds = _.filter(citReportTypeList, function (item) { return item.value == 1 || item.value == 3 || item.value == 4 });
var ds = _.filter(citReportTypeList, function (item) {
return item.value == 1 || item.value == 3 || item.value == 4
});
$scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({
data: ds
});
......@@ -314,7 +316,7 @@
($scope.editReportFormulaForm.formula && !_.isEmpty($scope.editReportFormulaForm.formula.$error) ||
$scope.editReportFormulaForm.voucher && !_.isEmpty($scope.editReportFormulaForm.voucher.$error) ||
$scope.editReportFormulaForm.invoice && !_.isEmpty($scope.editReportFormulaForm.invoice.$error) ||
$scope.editReportFormulaForm.model && !_.isEmpty($scope.editReportFormulaForm.model.$error) ||
// $scope.editReportFormulaForm.model && !_.isEmpty($scope.editReportFormulaForm.model.$error) ||
$scope.editReportFormulaForm.validation && !_.isEmpty($scope.editReportFormulaForm.validation.$error))
};
......@@ -577,10 +579,10 @@
_spread = spread;
var activeSheet;
if(constant.regesterInformation.active){
if (constant.regesterInformation.active) {
activeSheet = _spread.getActiveSheet();
}
else{
else {
activeSheet = _spread.getSheet(1);
}
//设置整个sheet不可编辑
......@@ -764,8 +766,8 @@
var row = startRow + i;
var col = startCol + j;
if (_.every(exceptedCells, function (c) {
return c.rowIndex !== row || c.columnIndex !== col;
})) {
return c.rowIndex !== row || c.columnIndex !== col;
})) {
validPosition.push({rowIndex: row, columnIndex: col});
}
}
......@@ -862,10 +864,10 @@
$scope.selectedTab = 1;
}
else if (editModel.hasModel) {
$scope.selectedTab = 2;
$scope.selectedTab = 3;
}
else if (editModel.hasValidation) {
$scope.selectedTab = 3;
$scope.selectedTab = 2;
}
else { // all options are not configured
$scope.selectedTab = 0;
......@@ -1098,8 +1100,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// Find the operators and make sure they are not duplicated
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
return m.length > 1;
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1279,8 +1281,8 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
// Find the operators and make sure they are not duplicated
var operatorMatches = ngModelValue.match(notDuplicateOperatorExp);
if (_.any(operatorMatches, function (m) {
return m.length > 1;
})) {
return m.length > 1;
})) {
ngModel.$setValidity('operatorDuplicateValidator', false);
return false;
}
......@@ -1354,7 +1356,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
};
/*********************** End Formula Editor ***********************************/
//模板另存为
//模板另存为
var saveTemplateGroup = function () {
var groupName = $scope.groupName;
if (groupName === '' || groupName === undefined) {
......@@ -1732,9 +1734,9 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
if (!newValue) {
$scope.selectedModel = [];
$scope.editModel.modelIDs = [];
$scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', true);
// $scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', true);
} else if ($scope.editModel.modelIDs.length === 0) {
$scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', false);
// $scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', false);
}
});
......@@ -1764,9 +1766,9 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope.$watch('selectedModel.length', function (newValue, oldValue) {
if (newValue !== 0 || !$scope.editModel.hasModel) {
$scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', true);
// $scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', true);
} else {
$scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', false);
// $scope.editReportFormulaForm.model.$setValidity('modelNotSelectValidator', false);
}
if (newValue !== oldValue) {
......@@ -1972,7 +1974,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
serviceTypeId = $scope.curServiceTypeId;
}
$scope.templateModel = {
reportTypeList:$scope.detailReportTypeList,
reportTypeList: $scope.detailReportTypeList,
templateGroupID: $scope.curTemplateGroup.id,
serviceTypeID: serviceTypeId,
payTaxType: serviceTypeId === enums.serviceType.CIT || serviceTypeId === enums.serviceType.Others ? '' : $scope.payTaxType.value,
......@@ -2183,9 +2185,9 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
var tabs = [
{id: 0, text: $translate.instant('AutoCalculateTab')},
{id: 1, text: $translate.instant('ManualInputTab')}
{id: 1, text: $translate.instant('ManualInputTab')},
// {id: 2, text: $translate.instant('ModelTab')},
// {id: 2, text: $translate.instant('ValidationTab')}
{id: 2, text: $translate.instant('ValidationTab')}
];
$scope.tabOptions = {
dataSource: tabs,
......
......@@ -198,7 +198,7 @@
<input type="checkbox" ng-model="editModel.hasKeyIn" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ManualInput' | translate}}
</label>
</div>
<div class="form-group model-group" ng-show="selectedTab === 2">
<div class="form-group model-group" ng-show="selectedTab === 3">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" name="model" ng-model="editModel.hasModel" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'LinkModel' | translate}}
</label>
......@@ -212,7 +212,7 @@
</button>
</div>
</div>
<div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 2" ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2,
<div class="dx-viewport grid-container last-grid" ng-show="selectedTab === 3" ng-class="{ 'row1': selectedModel.length <= 1, 'row2': selectedModel.length === 2,
'row3': selectedModel.length === 3,
'row4': selectedModel.length === 4,
'row5': selectedModel.length === 5,
......@@ -220,7 +220,7 @@
}">
<div id="modelGrid" dx-data-grid="modelGridOptions"></div>
</div>
<div class="form-group validation-group" ng-show="selectedTab === 3">
<div class="form-group validation-group" ng-show="selectedTab === 2">
<label class="checkbox-inline bold" ng-class="{ 'disabled': !hasEditPermission || !ToggleSaveAs }">
<input type="checkbox" ng-model="editModel.hasValidation" ng-disabled="!hasEditPermission || !ToggleSaveAs">{{'ValidationConfig' | translate}}
</label>
......@@ -245,11 +245,11 @@
translator-blur="timerHideTranslatorForValidation();"></formula-translator>
</div>
<div class="form-group validation-instructions" ng-show="selectedTab === 3">
<div class="form-group validation-instructions" ng-show="selectedTab === 2">
<label class="bold">{{'ValidationInstructions' | translate}}:</label>
<textarea class="form-control" ng-model="editModel.validationDescription" ng-readonly="!hasEditPermission || !ToggleSaveAs"></textarea>
</div>
<div ng-show="selectedTab === 3 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;">
<div ng-show="selectedTab === 2 && hasEditPermission && ToggleSaveAs" class="flex-row-start-center" style="margin: 15px 0 15px -15px;">
<span>{{'IsInputNecessary' | translate}}:</span>
<div class="btn-group switch-group" data-toggle="buttons">
<label class="btn btn-primary" ng-class="{'active':editModel.hasFormula}" ng-click="editModel.hasFormula=true;">
......
......@@ -37,7 +37,7 @@
scope.refreshGrids = function () {
$("#voucherGrid").dxDataGrid("instance").refresh();
$("#modelGrid").dxDataGrid("instance").refresh();
//$("#modelGrid").dxDataGrid("instance").refresh();
};
scope.toggleSaveAs = function () {
......
<div class="vat-report-view">
<!--Report SpreadJS-->
<div class="row" style=" height: 71px; background: #ccc;">
<div class="col-sm-7" style=" margin-top: 20px;">
<div class="col-sm-6">
<span class="text-bold" translate="SelectedOrganization" style=" top: -11px; position: relative;">:</span>
<div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'orgList' }" class="dx-item-content dx-list-item-content"
title="{{itemObj.name}}-{{itemObj.name}}">
{{itemObj.code}}-{{itemObj.name}}
</div>
</div>
</div>
<div class="col-sm-6" class="dateClass">
<span class="text-bold" translate="InvoiceQJ">:</span>
<div style=" display: inline-block;">
<input type="text" id="ebitDatepacker" class="datepicker" style="width:120px;height: 34px;"
readonly="readonly"/>
<i class="fa fa-calendar vat-subheader red-color" style="width:20px;"></i>
</div>
</div>
</div>
<div class="col-sm-5" class="bar-export" style=" margin-top: 20px;width: 39%; float: right;">
<span ng-click="uploadProfileTable()" ngf-select ngf-change="upload($files)" ngf-multiple="true"
ngf-validate="{size: {min:'10KB', max:'20MB'}}"><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="singleExport();"><i
class="fa fa-upload"></i>&nbsp;{{'singleExport' | translate}}</span>
<span ng-click="manyExport()"><i
class="fa fa-cloud-upload"></i>&nbsp;{{'manyExport' | translate}}</span>
</div>
</div>
<div class='report-container' id="reportContainer">
<input type="file" id="fileDemo" style="display: none" class="input">
<table-report-sheet report-source="reportData" spread='spread' template-id='templateId'
relation="relation">
</table-report-sheet>
</div>
</div>
\ No newline at end of file
analysisModule.directive('tbEbitForm', ['$log', 'enums',
function ($log, enums) {
'use strict';
$log.debug('tbEbitForm.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/analysis/table/tb-ebit-form.html' + '?_=' + Math.random(),
scope: {
},
controller: 'tableReportSheetController',
link: function ($scope, $ele, $attr) {
}
};
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
@color-red:#e20;
@color-gray:#939598-#222;
.bar-export{
span{
cursor: pointer;
}
}
.dxLeft{
width: 40%;
}
.dateClass{
position: relative;
left: -190px;
}
.vat-report-view {
height: calc(~"100% - 20px");
min-height: 500px;
margin-left: 0px;
margin-top: 0px;
.report-container {
border: @thin-border solid @color-border;
//height: calc(~"100% - 36px");
margin: 0;
width: 100%;
white-space: normal;
display: inline-block;
margin-top: -9px;
}
.row {
margin-left: 0px;
margin-bottom:10px;
&>span {
float: right;
margin-right: 15px;
cursor: pointer;
}
}
#addCertificatePop {
.modal-dialog {
width: 700px;
.add-certificate-pop-body {
height: 240px;
#add-certificate-grid {
height: 210px;
}
}
.modal-footer {
.template-1-button {
background-color: @color-red;
color: white;
margin-right:30px;
}
.template-2-button {
background-color: @color-gray;
color: white;
margin-right: 30px;
}
}
}
}
}
.model-report-approve-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
.model-report-remarks-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
......@@ -10,8 +10,6 @@
class="fa fa-floppy-o"></i>&nbsp;{{'上传手工数据'}}
</span>
<span ng-if="!isBSPL" ng-click="openExportPop('upload');"><i class="fa fa-upload"></i>&nbsp;{{'UploadExcel' | translate}}</span>
<!--<span ng-if="!isBSPL" ng-click="saveReportCache();"><i-->
<!--class="fa fa-floppy-o"></i>&nbsp;{{'Save' | translate}}</span>-->
</div>
......@@ -97,10 +95,6 @@
</script>
</div>
<!-- File Vouchers Upload Popup -->
<div class="modal fade" id="showVoucherUploadPortal" tabindex="-1" role="dialog" aria-labelledby="myModal"
data-backdrop="static" data-keyboard="false">
......
......@@ -52,7 +52,7 @@
if (!Number.prototype.formatAmount) {
Number.prototype.formatAmount = function (decPlaces, type) {
if(type){
return Number(decPlaces.toString().toFixed(2));
return Number(decPlaces.toFixed(2));
}
decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces;
var n = this.toFixed(decPlaces);
......
......@@ -14,16 +14,16 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
//}
};
var getPeriodTemplateJson = function (templateId,period,projectId) {
//return $http.get('/template/getTemplateJson?templateID=' + templateID, apiConfig.create());
//var url = '/template/getTemplateJson?templateID=' + templateID;
//var result = httpCacheService.get(url);
// if (result.finishedCache) {
// return result;
// } else {
return getJsonFromExcelForPeriod(templateId,period,projectId);
//}
};
var getPeriodTemplateJsonByOrg = function (templateId,period,orgId) {
return getJsonFromExcelForPeriod(templateId,period,orgId);
};
var getPeriodTemplateJsonByInit = function (templateId,period,orgId) {
return getJsonFromExcelForPeriod(templateId,period,orgId , true);
};
var getCookie = function (cname) {
var name = cname + "=";
......@@ -115,10 +115,49 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
};
var getJsonFromExcelForPeriod = function (templateID,period,projectId) {
var getJsonFromExcelForPeriod = function (templateID,period,projectId, init) {
var deferred = $q.defer();
var promise = deferred.promise;
var url = null;
if(!init){
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&projectId="+projectId;
}else{
url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID;
}
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
var apiToken = apiTokenObj.access_token;
var tokenType = apiTokenObj.token_type;
xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () {
// 请求完成
if (this.status === 200) {
// 返回200
var blob = this.response;
var excelIo = new GC.Spread.Excel.IO();
excelIo.open(blob, function (json) {
deferred.resolve(json);
}, function (e) {
// console.error(e.errorMessage);
//alert(e.errorMessage);
deferred.reject(e.errorMessage);
}, {});
}
};
// 发送ajax请求
xhr.send();
return promise;
};
var getJsonFromExcelForPeriodOrg = function (templateID,period,orgId) {
var deferred = $q.defer();
var promise = deferred.promise;
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJson?templateId=' + templateID+"&period="+period+"&projectId="+projectId;
var url = loginContext.apiHost + constant.webapi.prefix + '/template/getPeriodTemplateJsonOrg?templateId=' + templateID+"&period="+period+"&orgId="+orgId;
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
......@@ -169,6 +208,8 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
setRowColName: setRowColName,
getTemplateJson: getTemplateJson,
getPeriodTemplateJson:getPeriodTemplateJson,
getPeriodTemplateJsonByOrg :getPeriodTemplateJsonByOrg,
getPeriodTemplateJsonByInit : getPeriodTemplateJsonByInit,
downloadTemplate: function (fileType) {
return $http.get('/template/file/downloadTemplate?fileType=' + fileType , apiConfig.create({ responseType: 'arraybuffer' }));
},
......
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