Commit 3f550fd8 authored by kevin's avatar kevin

fix

parent ddc6e98b
......@@ -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
......@@ -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
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());
}
......
......@@ -1961,7 +1961,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);
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
}
/**
*
......
......@@ -1679,6 +1679,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
<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);
......
......@@ -43,23 +43,29 @@
// citGetTemplate: function (projectId, period?)
updateConfig: function (projectId, ifDeleteManualDataSource, period, generator, isMergeManualDataSource) {
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator+ '&mergeManual='+isMergeManualDataSource, {}, apiConfig.createVat({ignoreLoadingBar: true}));
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator + '&mergeManual=' + isMergeManualDataSource, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generate: function (projectId, templateId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generate/' + projectId + '/' + templateId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generateAll: function (projectId, isMergeManualDataSource, period, generator) {
return $http.post('/Report/generateByTotal/' + projectId + '/' + isMergeManualDataSource + '/' + period + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
return $http.post('/Report/generateByTotal/' + projectId + '/' + isMergeManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
getRunningJob: function (projectId, period) {
return $http.get('/Report/getRunningJob/' + projectId+'/'+period, apiConfig.createVat());
},
return $http.get('/Report/getRunningJob/' + projectId + '/' + period, apiConfig.createVat());
},
getJobStatus: function (projectId, period, jobId) {
return $http.get('/Report/getJobStatus/' + projectId+'/'+period+'/'+jobId, apiConfig.createVat({ignoreLoadingBar: true}));
},
return $http.get('/Report/getJobStatus/' + projectId + '/' + period + '/' + jobId, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
},
getReportEbitData: function (reportId, orgId, period) {
return $http.get('/Report/reportEbitData?reportId=' + reportId + '&orgId=' + orgId, +'&period=' + period, apiConfig.createVat());
} ,
saveAndRefresh: function (orgId, period, specialConsiderations, ebitRate) {
return $http.get('/Report/specialConsiderations?=' + orgId + '&period=' + period + "&specialConsiderations=" + specialConsiderations + "&ebitRate=" + ebitRate, apiConfig.createVat());
},
calculateKeyValue: function (projectId, period) {
return $http.post('/Report/calculateKeyValue/' + projectId + '/' + period, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
......@@ -95,7 +101,7 @@
vatOperationLogService.addOperationLog(logInfo);
data.dataSourceType = enums.cellDataSourceType.KeyIn;
return $q.when(data);
},function (data) {
}, function (data) {
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
......@@ -163,7 +169,7 @@
return $http.post('/Report/citGenerate/byTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + 0
// 暂时将生成预缴表的period设置为0,等待完成新的预缴表生成逻辑 + period
+ '/' + enums.reportType.prepay
+ '?generator=' + generator, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
+ '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
citGenerateByType: function (projectId, ifDeleteManualDataSource, reportType, generator) {
var paramStr = '';
......@@ -171,7 +177,7 @@
paramStr = '/' + reportType;
}
return $http.post('/Report/citGenerate/byTotal/' + projectId + '/' + ifDeleteManualDataSource + '/0' + paramStr + '?generator=' + generator, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
return $http.post('/Report/citGenerate/byTotal/' + projectId + '/' + ifDeleteManualDataSource + '/0' + paramStr + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
citGetTemplate: function (projectId, period) {
if (!_.isNumber(period)) {
......@@ -192,7 +198,7 @@
reportTypeParam = '/' + reportType;
}
return $http.post('/Report/citCalculateKeyValue/' + projectId + '/0' + reportTypeParam, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
return $http.post('/Report/citCalculateKeyValue/' + projectId + '/0' + reportTypeParam, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportByTemplateId: function (templateId, period) {
if (!_.isNumber(period)) {
......@@ -200,20 +206,33 @@
}
return $http.get('/Report/report/' + templateId + '/' + period, apiConfig.createVat());
},
getReportByTemplateIdEbit: function (templateId, period, orgId) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/getReportByTemplateEbit/' + templateId + '/' + period + '/' + orgId, apiConfig.createVat());
},
getDataSourceDetailList: function (dataSourceId) {
return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat());
},
hasManualDataSource: function (projectId, period) {
return $http.get('/Report/hasManualDataSource/' + projectId+ '/' +period, apiConfig.createVat());
return $http.get('/Report/hasManualDataSource/' + projectId + '/' + period, apiConfig.createVat());
},
loadAttachList: function (activeSheet) {
return $http.post('/Report/loadAttachList', activeSheet, apiConfig.createVat());
},
loadAttachList : function(activeSheet){
return $http.post('/Report/loadAttachList' , activeSheet, apiConfig.createVat());
deleteAttach: function (id) {
var config = {isBusyRequest: true};
return $http.get('/Report/deleteAttach?id=' + id, apiConfig.create(config));
},
deleteAttach : function(id){
var config = { isBusyRequest: true };
return $http.get('/Report/deleteAttach?id=' + id, apiConfig.create(config));
}
getOrgLists: function () {
return $http.get('/Report/getOrgLists', apiConfig.createVat());
},
saveEbitModule: function () {
}
};
......
......@@ -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