Commit d4ce6f59 authored by neo's avatar neo

[dev] fixed period template project id

parent d244664d
...@@ -2,7 +2,13 @@ package pwc.taxtech.atms.controller; ...@@ -2,7 +2,13 @@ package pwc.taxtech.atms.controller;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.constant.enums.EnumServiceType; import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dpo.ReportDto; import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
...@@ -48,13 +54,13 @@ public class ReportController { ...@@ -48,13 +54,13 @@ public class ReportController {
} }
@RequestMapping(value = "reportData/{reportId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "reportData/{reportId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDataDto> getReportData(@PathVariable Long reportId) { public OperationResultDto<ReportDataDto> getReportData(@PathVariable Long reportId, @RequestHeader String from) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
if (reportId == null || reportId == 0L) { if (reportId == null || reportId == 0L) {
resultDto.setResult(false); resultDto.setResult(false);
return resultDto; return resultDto;
} }
return reportService.getCellData(reportId); return reportService.getCellData(reportId, from);
} }
@RequestMapping(value = "report/{templateId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "report/{templateId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......
...@@ -24,7 +24,7 @@ public interface ReportService { ...@@ -24,7 +24,7 @@ public interface ReportService {
List<CellTemplateReferenceDto> getTemplateReferences(int period); List<CellTemplateReferenceDto> getTemplateReferences(int period);
OperationResultDto<ReportDataDto> getCellData(Long reportId); OperationResultDto<ReportDataDto> getCellData(Long reportId, String porjectId);
OperationResultDto<ReportDto> getReportByTemplate(Long templateId, Integer period); OperationResultDto<ReportDto> getReportByTemplate(Long templateId, Integer period);
......
...@@ -70,7 +70,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -70,7 +70,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andIdIn(templateIds); periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andIdIn(templateIds);
List<PeriodTemplate> periodTemplateList = periodTemplateMapper.selectByExample(periodTemplateExample); List<PeriodTemplate> periodTemplateList = periodTemplateMapper.selectByExample(periodTemplateExample);
List<Long> periodTemplateIdList = periodTemplateList.stream() List<Long> periodTemplateIdList = periodTemplateList.stream()
.map(PeriodTemplate::getTemplateId) .map(PeriodTemplate::getTemplateId)
......
...@@ -367,13 +367,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -367,13 +367,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria() periodTemplateExample.createCriteria()
.andTemplateGroupIdEqualTo(templateGroupId.get()) .andTemplateGroupIdEqualTo(templateGroupId.get())
.andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period) .andPeriodEqualTo(period)
.andIsActiveAssociationEqualTo(true) .andIsActiveAssociationEqualTo(true)
.andReportTypeEqualTo(reportType); .andReportTypeEqualTo(reportType);
templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList()); templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList());
} else { } else {
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andTemplateGroupIdEqualTo(templateGroupId.get()).andPeriodEqualTo(period).andIsActiveAssociationEqualTo(true); periodTemplateExample.createCriteria().andTemplateGroupIdEqualTo(templateGroupId.get())
.andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period).andIsActiveAssociationEqualTo(true);
templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList()); templateIds = periodTemplateMapper.selectByExample(periodTemplateExample).stream().map(PeriodTemplate::getId).collect(Collectors.toList());
} }
...@@ -396,7 +399,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -396,7 +399,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} }
@Override @Override
public OperationResultDto<ReportDataDto> getCellData(Long reportId) { public OperationResultDto<ReportDataDto> getCellData(Long reportId, String projectId) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
ReportDataDto dataDto = new ReportDataDto(); ReportDataDto dataDto = new ReportDataDto();
try { try {
...@@ -408,7 +411,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -408,7 +411,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} }
PeriodTemplateExample example = new PeriodTemplateExample(); PeriodTemplateExample example = new PeriodTemplateExample();
example.createCriteria().andTemplateIdEqualTo(report.getTemplateId()).andPeriodEqualTo(report.getPeriod()); example.createCriteria().andProjectIdEqualTo(projectId).andTemplateIdEqualTo(report.getTemplateId()).andPeriodEqualTo(report.getPeriod());
Optional<PeriodTemplate> reportTemplate = periodTemplateMapper.selectByExample(example).stream().findFirst(); Optional<PeriodTemplate> reportTemplate = periodTemplateMapper.selectByExample(example).stream().findFirst();
if (!reportTemplate.isPresent()) { if (!reportTemplate.isPresent()) {
resultDto.setResult(false); resultDto.setResult(false);
...@@ -425,6 +428,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -425,6 +428,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample(); PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria() periodTemplateExample.createCriteria()
.andProjectIdEqualTo(projectId)
.andTemplateGroupIdEqualTo(reportTemplate.get().getTemplateGroupId()) .andTemplateGroupIdEqualTo(reportTemplate.get().getTemplateGroupId())
.andPeriodEqualTo(report.getPeriod()) .andPeriodEqualTo(report.getPeriod())
.andIsActiveAssociationEqualTo(true); .andIsActiveAssociationEqualTo(true);
......
...@@ -2,12 +2,9 @@ package pwc.taxtech.atms.vat.service.impl.report.functions; ...@@ -2,12 +2,9 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import pwc.taxtech.atms.vat.entity.PeriodTemplateExample;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class FormulaHelper { public class FormulaHelper {
......
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