Commit 8234757b authored by frank.xa.zhang's avatar frank.xa.zhang

change to periodXXX table

parent 698f9c26
...@@ -21,6 +21,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -21,6 +21,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static FormulaAdminMapper formulaAdminMapper; public static FormulaAdminMapper formulaAdminMapper;
public static ReportMapper reportMapper; public static ReportMapper reportMapper;
public static CellDataMapper cellDataMapper; public static CellDataMapper cellDataMapper;
public static PeriodCellDataMapper periodCellDataMapper;
public static DistributedIdService distributedIdService; public static DistributedIdService distributedIdService;
public static PeriodFormulaBlockMapper formulaBlockMapper; public static PeriodFormulaBlockMapper formulaBlockMapper;
public static PeriodCellTemplateMapper periodCellTemplateMapper; public static PeriodCellTemplateMapper periodCellTemplateMapper;
...@@ -31,10 +32,13 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -31,10 +32,13 @@ public class SpringContextUtil implements ApplicationContextAware {
public static ProjectDao projectDao; public static ProjectDao projectDao;
public static BalanceMapper balanceMapper; public static BalanceMapper balanceMapper;
public static DataSourceMapper dataSourceMapper; public static DataSourceMapper dataSourceMapper;
public static PeriodDataSourceMapper periodDataSourceMapper;
public static DataSourceDetailMapper dataSourceDetailMapper; public static DataSourceDetailMapper dataSourceDetailMapper;
public static PeriodDataSourceDetailMapper periodDataSourceDetailMapper;
public static PeriodFormulaBlockMapper periodFormulaBlockMapper; public static PeriodFormulaBlockMapper periodFormulaBlockMapper;
public static VatEnterpriseAccountDao vatEnterpriseAccountDao; public static VatEnterpriseAccountDao vatEnterpriseAccountDao;
public static VatEnterpriseAccountMapper vatEnterpriseAccountMapper; public static VatEnterpriseAccountMapper vatEnterpriseAccountMapper;
public static PeriodEnterpriseAccountMapper periodEnterpriseAccountMapper;
public static BalanceStdManualMapper balanceStdManualMapper; public static BalanceStdManualMapper balanceStdManualMapper;
public static OutputVatInvoiceMapper outputVATInvoiceMapper; public static OutputVatInvoiceMapper outputVATInvoiceMapper;
public static PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper; public static PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper;
...@@ -43,6 +47,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -43,6 +47,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static AssetsListMapper assetsListMapper; public static AssetsListMapper assetsListMapper;
public static ProjectMapper projectMapper; public static ProjectMapper projectMapper;
public static CellDataSourceMapper cellDataSourceMapper; public static CellDataSourceMapper cellDataSourceMapper;
public static PeriodCellDataSourceMapper periodCellDataSourceMapper;
public static OrganizationMapper organizationMapper; public static OrganizationMapper organizationMapper;
/** /**
...@@ -62,6 +67,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -62,6 +67,7 @@ public class SpringContextUtil implements ApplicationContextAware {
formulaAdminMapper = webApplicationContext.getBean(FormulaAdminMapper.class); formulaAdminMapper = webApplicationContext.getBean(FormulaAdminMapper.class);
reportMapper = webApplicationContext.getBean(ReportMapper.class); reportMapper = webApplicationContext.getBean(ReportMapper.class);
cellDataMapper = webApplicationContext.getBean(CellDataMapper.class); cellDataMapper = webApplicationContext.getBean(CellDataMapper.class);
periodCellDataMapper = webApplicationContext.getBean(PeriodCellDataMapper.class);
distributedIdService = webApplicationContext.getBean(DistributedIdService.class); distributedIdService = webApplicationContext.getBean(DistributedIdService.class);
formulaBlockMapper = webApplicationContext.getBean(PeriodFormulaBlockMapper.class); formulaBlockMapper = webApplicationContext.getBean(PeriodFormulaBlockMapper.class);
periodCellTemplateMapper = webApplicationContext.getBean(PeriodCellTemplateMapper.class); periodCellTemplateMapper = webApplicationContext.getBean(PeriodCellTemplateMapper.class);
...@@ -72,10 +78,13 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -72,10 +78,13 @@ public class SpringContextUtil implements ApplicationContextAware {
projectDao = webApplicationContext.getBean(ProjectDao.class); projectDao = webApplicationContext.getBean(ProjectDao.class);
balanceMapper = webApplicationContext.getBean(BalanceMapper.class); balanceMapper = webApplicationContext.getBean(BalanceMapper.class);
dataSourceMapper = webApplicationContext.getBean(DataSourceMapper.class); dataSourceMapper = webApplicationContext.getBean(DataSourceMapper.class);
periodDataSourceMapper = webApplicationContext.getBean(PeriodDataSourceMapper.class);
dataSourceDetailMapper = webApplicationContext.getBean(DataSourceDetailMapper.class); dataSourceDetailMapper = webApplicationContext.getBean(DataSourceDetailMapper.class);
periodDataSourceDetailMapper = webApplicationContext.getBean(PeriodDataSourceDetailMapper.class);
periodFormulaBlockMapper = webApplicationContext.getBean(PeriodFormulaBlockMapper.class); periodFormulaBlockMapper = webApplicationContext.getBean(PeriodFormulaBlockMapper.class);
vatEnterpriseAccountDao = webApplicationContext.getBean(VatEnterpriseAccountDao.class); vatEnterpriseAccountDao = webApplicationContext.getBean(VatEnterpriseAccountDao.class);
vatEnterpriseAccountMapper = webApplicationContext.getBean(VatEnterpriseAccountMapper.class); vatEnterpriseAccountMapper = webApplicationContext.getBean(VatEnterpriseAccountMapper.class);
periodEnterpriseAccountMapper = webApplicationContext.getBean(PeriodEnterpriseAccountMapper.class);
balanceStdManualMapper = webApplicationContext.getBean(BalanceStdManualMapper.class); balanceStdManualMapper = webApplicationContext.getBean(BalanceStdManualMapper.class);
outputVATInvoiceMapper = webApplicationContext.getBean(OutputVatInvoiceMapper.class); outputVATInvoiceMapper = webApplicationContext.getBean(OutputVatInvoiceMapper.class);
periodTaxRuleSettingMapper = webApplicationContext.getBean(PeriodTaxRuleSettingMapper.class); periodTaxRuleSettingMapper = webApplicationContext.getBean(PeriodTaxRuleSettingMapper.class);
...@@ -84,6 +93,7 @@ public class SpringContextUtil implements ApplicationContextAware { ...@@ -84,6 +93,7 @@ public class SpringContextUtil implements ApplicationContextAware {
assetsListMapper = webApplicationContext.getBean(AssetsListMapper.class); assetsListMapper = webApplicationContext.getBean(AssetsListMapper.class);
projectMapper = webApplicationContext.getBean(ProjectMapper.class); projectMapper = webApplicationContext.getBean(ProjectMapper.class);
cellDataSourceMapper = webApplicationContext.getBean(CellDataSourceMapper.class); cellDataSourceMapper = webApplicationContext.getBean(CellDataSourceMapper.class);
periodCellDataSourceMapper = webApplicationContext.getBean(PeriodCellDataSourceMapper.class);
organizationMapper = webApplicationContext.getBean(OrganizationMapper.class); organizationMapper = webApplicationContext.getBean(OrganizationMapper.class);
} }
} }
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import org.apache.commons.lang3.StringUtils;
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.RequestMapping; import org.springframework.web.bind.annotation.*;
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.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.vat.entity.CellComment; import pwc.taxtech.atms.vat.entity.CellComment;
import pwc.taxtech.atms.vat.entity.PeriodCellComment; import pwc.taxtech.atms.vat.entity.PeriodCellComment;
...@@ -21,7 +19,11 @@ public class CellCommentController { ...@@ -21,7 +19,11 @@ public class CellCommentController {
CellCommentServiceImpl cellCommentService; CellCommentServiceImpl cellCommentService;
@RequestMapping(value = "List", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "List", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<PeriodCellComment>> getCellComments(@RequestParam("cellDataId") Optional<Long> cellDataId) { public OperationResultDto<List<PeriodCellComment>> getCellComments(@RequestParam("cellDataId") Optional<Long> cellDataId, @RequestHeader("from") String form) {
return cellCommentService.getCellComments(cellDataId); String projectId = StringUtils.EMPTY;
if (StringUtils.isNotBlank(form) && form.split("@").length > 0) {
projectId = form.split("@")[0];
}
return cellCommentService.getCellComments(cellDataId, projectId);
} }
} }
...@@ -6,6 +6,7 @@ import pwc.taxtech.atms.constant.DataSourceName; ...@@ -6,6 +6,7 @@ import pwc.taxtech.atms.constant.DataSourceName;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.vat.entity.CellData; import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.PeriodCellData;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -47,7 +48,7 @@ public class ReportCellDataSourceDto extends DataSourceDto { ...@@ -47,7 +48,7 @@ public class ReportCellDataSourceDto extends DataSourceDto {
} }
public void extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo, public void extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo,
CellData cellData, CellTemplatePerGroupDto cellTemplateData) { PeriodCellData cellData, CellTemplatePerGroupDto cellTemplateData) {
this.name = DataSourceName.ReportDataSource; this.name = DataSourceName.ReportDataSource;
this.year = currentPeriodBo.curYear; this.year = currentPeriodBo.curYear;
this.period = currentPeriodBo.curPeriod; this.period = currentPeriodBo.curPeriod;
......
...@@ -3,6 +3,8 @@ package pwc.taxtech.atms.vat.dao; ...@@ -3,6 +3,8 @@ package pwc.taxtech.atms.vat.dao;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.vat.dao.VatEnterpriseAccountMapper; import pwc.taxtech.atms.vat.dao.VatEnterpriseAccountMapper;
import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccountExample;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount; import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccountExample; import pwc.taxtech.atms.vat.entity.VatEnterpriseAccountExample;
...@@ -11,11 +13,11 @@ import java.util.List; ...@@ -11,11 +13,11 @@ import java.util.List;
@Service @Service
public class VatEnterpriseAccountDao { public class VatEnterpriseAccountDao {
@Autowired @Autowired
VatEnterpriseAccountMapper vatEnterpriseAccountMapper; PeriodEnterpriseAccountMapper periodEnterpriseAccountMapper;
public List<VatEnterpriseAccount> getListByAccountCode(String accountCode) { public List<PeriodEnterpriseAccount> getListByAccountCode(String accountCode) {
VatEnterpriseAccountExample example = new VatEnterpriseAccountExample(); PeriodEnterpriseAccountExample example = new PeriodEnterpriseAccountExample();
example.createCriteria().andAcctCodeEqualTo(accountCode); example.createCriteria().andAcctCodeEqualTo(accountCode);
return vatEnterpriseAccountMapper.selectByExample(example); return periodEnterpriseAccountMapper.selectByExample(example);
} }
} }
...@@ -9,7 +9,7 @@ import java.util.Optional; ...@@ -9,7 +9,7 @@ import java.util.Optional;
@Service @Service
public class CellCommentServiceImpl extends VatAbstractService { public class CellCommentServiceImpl extends VatAbstractService {
public OperationResultDto<List<PeriodCellComment>> getCellComments(Optional<Long> cellDataId) { public OperationResultDto<List<PeriodCellComment>> getCellComments(Optional<Long> cellDataId,String projectId) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
try { try {
if (!cellDataId.isPresent() || cellDataId.get() == 0L) { if (!cellDataId.isPresent() || cellDataId.get() == 0L) {
...@@ -20,6 +20,7 @@ public class CellCommentServiceImpl extends VatAbstractService { ...@@ -20,6 +20,7 @@ public class CellCommentServiceImpl extends VatAbstractService {
PeriodCellCommentExample example = new PeriodCellCommentExample(); PeriodCellCommentExample example = new PeriodCellCommentExample();
example.createCriteria().andCellDataIdEqualTo(cellDataId.get()); example.createCriteria().andCellDataIdEqualTo(cellDataId.get());
example.createCriteria().andProjectIdEqualTo(projectId);
List<PeriodCellComment> cellComments = periodCellCommentMapper.selectByExample(example); List<PeriodCellComment> cellComments = periodCellCommentMapper.selectByExample(example);
resultDto.setResult(true); resultDto.setResult(true);
resultDto.setData(cellComments); resultDto.setData(cellComments);
......
...@@ -11,11 +11,9 @@ import pwc.taxtech.atms.entity.ProjectServiceType; ...@@ -11,11 +11,9 @@ import pwc.taxtech.atms.entity.ProjectServiceType;
import pwc.taxtech.atms.entity.ProjectServiceTypeExample; import pwc.taxtech.atms.entity.ProjectServiceTypeExample;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.dao.CellDataMapper; import pwc.taxtech.atms.vat.dao.CellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper;
import pwc.taxtech.atms.vat.dao.ReportMapper; import pwc.taxtech.atms.vat.dao.ReportMapper;
import pwc.taxtech.atms.vat.entity.CellData; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.entity.CellDataExample;
import pwc.taxtech.atms.vat.entity.Report;
import pwc.taxtech.atms.vat.entity.ReportExample;
import java.util.List; import java.util.List;
...@@ -29,6 +27,8 @@ public class FormulaAgent extends VatAbstractService { ...@@ -29,6 +27,8 @@ public class FormulaAgent extends VatAbstractService {
public ReportMapper reportMapper; public ReportMapper reportMapper;
@Autowired @Autowired
public CellDataMapper cellDataMapper; public CellDataMapper cellDataMapper;
@Autowired
public PeriodCellDataMapper periodCellDataMapper;
public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId) { public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId) {
ProjectServiceTypeExample pst = new ProjectServiceTypeExample(); ProjectServiceTypeExample pst = new ProjectServiceTypeExample();
...@@ -60,10 +60,10 @@ public class FormulaAgent extends VatAbstractService { ...@@ -60,10 +60,10 @@ public class FormulaAgent extends VatAbstractService {
return null; return null;
} }
private CellData getCellDataListByTemplate(String templateId, Long reportId) { private PeriodCellData getCellDataListByTemplate(String templateId, Long reportId) {
CellDataExample dataExample = new CellDataExample(); PeriodCellDataExample dataExample = new PeriodCellDataExample();
dataExample.createCriteria().andCellTemplateIdEqualTo(Long.valueOf(templateId)).andReportIdEqualTo(reportId); dataExample.createCriteria().andCellTemplateIdEqualTo(Long.valueOf(templateId)).andReportIdEqualTo(reportId);
List<CellData> cellDataList = cellDataMapper.selectByExample(dataExample); List<PeriodCellData> cellDataList = periodCellDataMapper.selectByExample(dataExample);
if (cellDataList != null && !cellDataList.isEmpty()) return cellDataList.get(FIRST_OR_DEFAULT); if (cellDataList != null && !cellDataList.isEmpty()) return cellDataList.get(FIRST_OR_DEFAULT);
return null; return null;
...@@ -73,11 +73,11 @@ public class FormulaAgent extends VatAbstractService { ...@@ -73,11 +73,11 @@ public class FormulaAgent extends VatAbstractService {
return adminMp.getPastProjectId(year, orgId); return adminMp.getPastProjectId(year, orgId);
} }
public CellData getCellData(String templateId, String cellId, int periodId) { public PeriodCellData getCellData(String templateId, String cellId, int periodId) {
Report report = getReportByTemplate(templateId, periodId); Report report = getReportByTemplate(templateId, periodId);
MyAsserts.assertNotNull(report, Exceptions.BB_REPORT_NULL); MyAsserts.assertNotNull(report, Exceptions.BB_REPORT_NULL);
CellData cellData = getCellDataListByTemplate(cellId, report.getId()); PeriodCellData cellData = getCellDataListByTemplate(cellId, report.getId());
MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL); MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL);
return cellData; return cellData;
} }
......
...@@ -306,7 +306,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -306,7 +306,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
Cell cell = row.getCell(colNum - 1); Cell cell = row.getCell(colNum - 1);
if (cell != null) { if (cell != null) {
//开始取值然后存放到DataSource //开始取值然后存放到DataSource
DataSource dataSource = new DataSource(); PeriodDataSource dataSource = new PeriodDataSource();
dataSource.setId(distributedIdService.nextId()); dataSource.setId(distributedIdService.nextId());
dataSource.setColumnIndex(colNum - 1); dataSource.setColumnIndex(colNum - 1);
dataSource.setRowIndex(rowNum - 1); dataSource.setRowIndex(rowNum - 1);
...@@ -329,7 +329,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -329,7 +329,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
dataSource.setPeriod(period); dataSource.setPeriod(period);
dataSource.setCellTemplateId(periodCellTemplateConfig.getCellTemplateId()); dataSource.setCellTemplateId(periodCellTemplateConfig.getCellTemplateId());
dataSource.setType(FormulaDataSourceType.Report.getCode()); dataSource.setType(FormulaDataSourceType.Report.getCode());
dataSourceMapper.insertSelective(dataSource); periodDataSourceMapper.insertSelective(dataSource);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource //这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好 //解决办法就是 在存DataSource的时候就先把celldata的数据加好
//然后把celldatasource的数据也加好 //然后把celldatasource的数据也加好
...@@ -344,7 +344,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -344,7 +344,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
.filter(a -> a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId())) .filter(a -> a.getCellTemplateId().equals(periodCellTemplateConfig.getCellTemplateId()))
.findFirst(); .findFirst();
if (tempPeriodCellTemplate.isPresent()) { if (tempPeriodCellTemplate.isPresent()) {
CellData cellData = new CellData(); PeriodCellData cellData = new PeriodCellData();
Long cellDataId = distributedIdService.nextId(); Long cellDataId = distributedIdService.nextId();
cellData.setId(cellDataId); cellData.setId(cellDataId);
cellData.setReportId(reportId); cellData.setReportId(reportId);
...@@ -395,23 +395,23 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -395,23 +395,23 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
cellData.setCreateTime(createTime); cellData.setCreateTime(createTime);
cellData.setUpdateBy("Admin"); cellData.setUpdateBy("Admin");
cellData.setUpdateTime(createTime); cellData.setUpdateTime(createTime);
cellDataMapper.insertSelective(cellData); periodCellDataMapper.insertSelective(cellData);
//after insert celldata, insert the celldatasource for link celldata and datasource //after insert celldata, insert the celldatasource for link celldata and datasource
DataSourceExample dataSourceExample = new DataSourceExample(); PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andPeriodEqualTo(period) dataSourceExample.createCriteria().andPeriodEqualTo(period)
.andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId()); .andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId());
List<DataSource> dataSourceList = SpringContextUtil.dataSourceMapper.selectByExample(dataSourceExample); List<PeriodDataSource> dataSourceList = SpringContextUtil.periodDataSourceMapper.selectByExample(dataSourceExample);
for (int ii = 0; ii < dataSourceList.size(); ii++) { for (int ii = 0; ii < dataSourceList.size(); ii++) {
DataSource dataSource = dataSourceList.get(ii); PeriodDataSource dataSource = dataSourceList.get(ii);
CellDataSource cellDataSource = new CellDataSource(); PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId()); cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId()); cellDataSource.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
cellDataSource.setCellDataId(cellDataId); cellDataSource.setCellDataId(cellDataId);
cellDataSource.setDataSourceId(dataSource.getId()); cellDataSource.setDataSourceId(dataSource.getId());
cellDataSource.setCreateTime(createTime); cellDataSource.setCreateTime(createTime);
cellDataSource.setUpdateTime(createTime); cellDataSource.setUpdateTime(createTime);
SpringContextUtil.cellDataSourceMapper.insertSelective(cellDataSource); SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
} }
} }
} }
...@@ -587,7 +587,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -587,7 +587,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
}); });
if (!parameter.isEmpty()) { if (!parameter.isEmpty()) {
List<PCTEntity> pctResults = cellDataMapper.queryByPCTs(parameter); List<PCTEntity> pctResults = periodCellDataMapper.queryByPCTs(parameter);
Map<PCTEntity, BigDecimal> pctCache = new HashMap<>(); Map<PCTEntity, BigDecimal> pctCache = new HashMap<>();
pctResults.forEach(m -> { pctResults.forEach(m -> {
BigDecimal data = null; BigDecimal data = null;
......
...@@ -44,6 +44,8 @@ import java.util.regex.Matcher; ...@@ -44,6 +44,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.periodEnterpriseAccountMapper;
@Component @Component
public class ReportServiceImpl extends VatAbstractService implements ReportService { public class ReportServiceImpl extends VatAbstractService implements ReportService {
@Override @Override
...@@ -155,7 +157,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -155,7 +157,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// dataSourceMapper.clearDataSourceWithPeriod(period); // dataSourceMapper.clearDataSourceWithPeriod(period);
// dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIds, period); // dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIds, period);
// dataSourceMapper.clearReportWithPeriod(period); // dataSourceMapper.clearReportWithPeriod(period);
dataSourceMapper.clearDataWithPeriod(strExceptTemplateIds, period); periodDataSourceMapper.clearDataWithPeriod(strExceptTemplateIds, period);
// 根据templategroupid 把 template 插入到 periodTemplate // 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId); example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
...@@ -434,10 +436,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -434,10 +436,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
templateIds.add(report.getTemplateId()); templateIds.add(report.getTemplateId());
List<CellCalcInfoDto> cellCfgList = reportGenerator.getCellCalcInfo(templateIds, report.getPeriod()); List<CellCalcInfoDto> cellCfgList = reportGenerator.getCellCalcInfo(templateIds, report.getPeriod());
CellDataExample cellDataExample = new CellDataExample(); PeriodCellDataExample cellDataExample = new PeriodCellDataExample();
cellDataExample.createCriteria().andReportIdEqualTo(reportId); cellDataExample.createCriteria().andReportIdEqualTo(reportId);
List<CellData> currentCellDataList = cellDataMapper.selectByExample(cellDataExample); List<PeriodCellData> currentCellDataList = periodCellDataMapper.selectByExample(cellDataExample);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample(); PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andPeriodEqualTo(report.getPeriod()).andReportIdEqualTo(reportId); periodFormulaBlockExample.createCriteria().andPeriodEqualTo(report.getPeriod()).andReportIdEqualTo(reportId);
...@@ -451,7 +453,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -451,7 +453,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// TODO: Check模型回填数据源是否会有多对多的情况出现,如有需distinct // TODO: Check模型回填数据源是否会有多对多的情况出现,如有需distinct
//公式计算数据源 20180711 完成 //公式计算数据源 20180711 完成
List<DataSourceExtendDto> manualDataSourceList = dataSourceMapper.getFormulaDataSource(reportId); List<DataSourceExtendDto> manualDataSourceList = periodDataSourceMapper.getFormulaDataSource(reportId);
//loop the datasource to add datasource detail information //loop the datasource to add datasource detail information
for (DataSourceExtendDto dseo : manualDataSourceList) { for (DataSourceExtendDto dseo : manualDataSourceList) {
//只处理有明细数据的DataSource //只处理有明细数据的DataSource
...@@ -465,9 +467,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -465,9 +467,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} else if (dseo.getType().equals(FormulaDataSourceType.Report.getCode())) { } else if (dseo.getType().equals(FormulaDataSourceType.Report.getCode())) {
List<String> itemValues = new ArrayList<>(); List<String> itemValues = new ArrayList<>();
//todo: get the datasource detail to add the items property //todo: get the datasource detail to add the items property
DataSourceDetailExample dataSourceDetailExample = new DataSourceDetailExample(); PeriodDataSourceDetailExample dataSourceDetailExample = new PeriodDataSourceDetailExample();
dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(dseo.getId()); dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(dseo.getId());
List<DataSourceDetail> dataSourceDetailList = SpringContextUtil.dataSourceDetailMapper.selectByExample(dataSourceDetailExample); List<PeriodDataSourceDetail> dataSourceDetailList = SpringContextUtil.periodDataSourceDetailMapper.selectByExample(dataSourceDetailExample);
dataSourceDetailList.forEach(a -> { dataSourceDetailList.forEach(a -> {
if (StringUtils.isNotBlank(a.getItemValue())) { if (StringUtils.isNotBlank(a.getItemValue())) {
itemValues.add(a.getItemValue()); itemValues.add(a.getItemValue());
...@@ -538,7 +540,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -538,7 +540,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataDto.setDataType(a.getDataType()); cellDataDto.setDataType(a.getDataType());
cellDataDto.setReportId(reportId.toString()); cellDataDto.setReportId(reportId.toString());
cellDataDto.setIsReadOnly(a.getIsReadOnly()); cellDataDto.setIsReadOnly(a.getIsReadOnly());
Optional<CellData> celldata = currentCellDataList.stream() Optional<PeriodCellData> celldata = currentCellDataList.stream()
.filter(x -> x.getCellTemplateId().toString().equals(a.getCellTemplateId())).findFirst(); .filter(x -> x.getCellTemplateId().toString().equals(a.getCellTemplateId())).findFirst();
celldata.ifPresent(cellData -> cellDataDto.setCellId(cellData.getId().toString())); celldata.ifPresent(cellData -> cellDataDto.setCellId(cellData.getId().toString()));
cellDataDto.setFormula(a.getFormula()); cellDataDto.setFormula(a.getFormula());
...@@ -659,10 +661,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -659,10 +661,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
public OperationResultDto<List<VatEnterpriseAccount>> getStdAccountByIndustry(String industryId) { public OperationResultDto<List<VatEnterpriseAccount>> getStdAccountByIndustry(String industryId) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
try { try {
VatEnterpriseAccountExample example = new VatEnterpriseAccountExample(); PeriodEnterpriseAccountExample example = new PeriodEnterpriseAccountExample();
example.createCriteria().andIsActiveEqualTo(true); example.createCriteria().andIsActiveEqualTo(true);
vatEnterpriseAccountMapper.selectByExample(example); periodEnterpriseAccountMapper.selectByExample(example);
List<VatEnterpriseAccount> vatEnterpriseAccounts = vatEnterpriseAccountMapper.selectByExample(example); List<PeriodEnterpriseAccount> vatEnterpriseAccounts = periodEnterpriseAccountMapper.selectByExample(example);
if (vatEnterpriseAccounts == null) { if (vatEnterpriseAccounts == null) {
resultDto.setResult(false); resultDto.setResult(false);
resultDto.setResultMsg("there is no data"); resultDto.setResultMsg("there is no data");
...@@ -693,11 +695,11 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -693,11 +695,11 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return resultDto; return resultDto;
} }
VatEnterpriseAccountExample example = new VatEnterpriseAccountExample(); PeriodEnterpriseAccountExample example = new PeriodEnterpriseAccountExample();
example.createCriteria().andAcctCodeIn(Arrays.asList(periodCellTemplateConfig.getAccountCodes().split(","))); example.createCriteria().andAcctCodeIn(Arrays.asList(periodCellTemplateConfig.getAccountCodes().split(",")));
List<VatEnterpriseAccount> vatEnterpriseAccounts = vatEnterpriseAccountMapper.selectByExample(example); List<PeriodEnterpriseAccount> vatEnterpriseAccounts = periodEnterpriseAccountMapper.selectByExample(example);
List<VatEnterpriseAccountResultDto> vatEnterpriseAccountResultDtos = new ArrayList<>(); List<VatEnterpriseAccountResultDto> vatEnterpriseAccountResultDtos = new ArrayList<>();
for (VatEnterpriseAccount vatEnterpriseAccount : vatEnterpriseAccounts) { for (PeriodEnterpriseAccount vatEnterpriseAccount : vatEnterpriseAccounts) {
VatEnterpriseAccountResultDto vatEnterpriseAccountResultDto = new VatEnterpriseAccountResultDto(); VatEnterpriseAccountResultDto vatEnterpriseAccountResultDto = new VatEnterpriseAccountResultDto();
vatEnterpriseAccountResultDto.setPeriodCellTemplateConfigId(periodCellTemplateConfig.getCellTemplateConfigId()); vatEnterpriseAccountResultDto.setPeriodCellTemplateConfigId(periodCellTemplateConfig.getCellTemplateConfigId());
vatEnterpriseAccountResultDto.setAcctCode(vatEnterpriseAccount.getAcctCode()); vatEnterpriseAccountResultDto.setAcctCode(vatEnterpriseAccount.getAcctCode());
...@@ -723,7 +725,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -723,7 +725,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
try { try {
if (data.getCellId() == null) { if (data.getCellId() == null) {
//todo: insert celldata for manual datasource //todo: insert celldata for manual datasource
CellData cellData = new CellData(); PeriodCellData cellData = new PeriodCellData();
cellData.setId(distributedIdService.nextId()); cellData.setId(distributedIdService.nextId());
cellData.setReportId(data.getReportId()); cellData.setReportId(data.getReportId());
cellData.setCellTemplateId(Long.parseLong(data.getCellTemplateId())); cellData.setCellTemplateId(Long.parseLong(data.getCellTemplateId()));
...@@ -733,24 +735,24 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -733,24 +735,24 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellData.setCreateTime(new Date()); cellData.setCreateTime(new Date());
cellData.setUpdateBy("admin"); cellData.setUpdateBy("admin");
cellData.setUpdateTime(new Date()); cellData.setUpdateTime(new Date());
cellDataMapper.insertSelective(cellData); periodCellDataMapper.insertSelective(cellData);
data.setCellId(cellData.getId()); data.setCellId(cellData.getId());
} else { } else {
CellData cellData = cellDataMapper.selectByPrimaryKey(data.getCellId()); PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if (cellData.getData() != data.getAmount().toString()) { if (cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString()); cellData.setData(data.getAmount().toString());
cellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} }
} }
List<DataSourceExtendDto> dataSourceExtendDtos = dataSourceMapper.getManualDataSource(data.getCellId()); List<DataSourceExtendDto> dataSourceExtendDtos = periodDataSourceMapper.getManualDataSource(data.getCellId());
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample(); PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
periodCellTemplateExample.createCriteria().andCellTemplateIdEqualTo(Long.parseLong(data.getCellTemplateId())).andPeriodEqualTo(data.getPeriod()); periodCellTemplateExample.createCriteria().andCellTemplateIdEqualTo(Long.parseLong(data.getCellTemplateId())).andPeriodEqualTo(data.getPeriod());
Optional<PeriodCellTemplate> periodCellTemplate = periodCellTemplateMapper.selectByExample(periodCellTemplateExample).stream().findFirst(); Optional<PeriodCellTemplate> periodCellTemplate = periodCellTemplateMapper.selectByExample(periodCellTemplateExample).stream().findFirst();
BigDecimal originalAmount = new BigDecimal("0"); BigDecimal originalAmount = new BigDecimal("0");
DataSource dataSourceModel = null; PeriodDataSource dataSourceModel = null;
if (dataSourceExtendDtos.size() > 0) { if (dataSourceExtendDtos.size() > 0) {
dataSourceModel = dataSourceExtendDtos.get(0).getDataSource(); dataSourceModel = dataSourceExtendDtos.get(0).getDataSource();
updateCellValueForDataSourceChange(dataSourceModel, data.getAmount()); updateCellValueForDataSourceChange(dataSourceModel, data.getAmount());
...@@ -760,9 +762,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -760,9 +762,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceModel.setAmount(data.getAmount()); dataSourceModel.setAmount(data.getAmount());
dataSourceModel.setUpdateBy("Admin"); dataSourceModel.setUpdateBy("Admin");
dataSourceModel.setUpdateTime(new Date()); dataSourceModel.setUpdateTime(new Date());
dataSourceMapper.updateByPrimaryKeySelective(dataSourceModel); periodDataSourceMapper.updateByPrimaryKeySelective(dataSourceModel);
} else { } else {
dataSourceModel = new DataSource(); dataSourceModel = new PeriodDataSource();
Long cellDataSourceId = distributedIdService.nextId(); Long cellDataSourceId = distributedIdService.nextId();
dataSourceModel.setId(cellDataSourceId); dataSourceModel.setId(cellDataSourceId);
dataSourceModel.setType(FormulaDataSourceType.KeyInSource.getCode()); dataSourceModel.setType(FormulaDataSourceType.KeyInSource.getCode());
...@@ -780,7 +782,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -780,7 +782,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceModel.setUpdateBy("admin"); dataSourceModel.setUpdateBy("admin");
dataSourceModel.setPeriod(data.getPeriod()); dataSourceModel.setPeriod(data.getPeriod());
CellDataSource cellDataSource = new CellDataSource(); PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId()); cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellDataId(data.getCellId()); cellDataSource.setCellDataId(data.getCellId());
cellDataSource.setDataSourceId(cellDataSourceId); cellDataSource.setDataSourceId(cellDataSourceId);
...@@ -788,9 +790,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -788,9 +790,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataSource.setCreateTime(new Date()); cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date()); cellDataSource.setUpdateTime(new Date());
updateCellValueForDataSourceChange(cellDataSource.getCellDataId(), new BigDecimal("0"), data.getAmount()); updateCellValueForDataSourceChange(cellDataSource.getCellDataId(), new BigDecimal("0"), data.getAmount());
dataSourceMapper.insertSelective(dataSourceModel); periodDataSourceMapper.insertSelective(dataSourceModel);
cellDataSourceMapper.insertSelective(cellDataSource); periodCellDataSourceMapper.insertSelective(cellDataSource);
dataSourceExtendDtos = dataSourceMapper.getManualDataSource(data.getCellId()); dataSourceExtendDtos = periodDataSourceMapper.getManualDataSource(data.getCellId());
} }
//todo: update the reference cell's data, such as if formula is ND(1)+A2, //todo: update the reference cell's data, such as if formula is ND(1)+A2,
...@@ -811,23 +813,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -811,23 +813,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
Optional<Report> report = reportMapper.selectByExample(reportExample).stream().findFirst(); Optional<Report> report = reportMapper.selectByExample(reportExample).stream().findFirst();
if (report.isPresent()) { if (report.isPresent()) {
Long reportId = report.get().getId(); Long reportId = report.get().getId();
CellDataExample cellDataExample = new CellDataExample(); PeriodCellDataExample cellDataExample = new PeriodCellDataExample();
cellDataExample.createCriteria().andReportIdEqualTo(reportId); cellDataExample.createCriteria().andReportIdEqualTo(reportId);
List<CellData> cellDataList = cellDataMapper.selectByExample(cellDataExample); List<PeriodCellData> cellDataList = periodCellDataMapper.selectByExample(cellDataExample);
for (CellData cellData : cellDataList) { for (PeriodCellData cellData : cellDataList) {
if (cellData.getId() != data.getCellId() && cellData.getFormulaExp().contains(cellName)) { if (cellData.getId() != data.getCellId() && cellData.getFormulaExp().contains(cellName)) {
CellDataSourceExample cellDataSourceExample = new CellDataSourceExample(); PeriodCellDataSourceExample cellDataSourceExample = new PeriodCellDataSourceExample();
cellDataSourceExample.createCriteria().andCellDataIdEqualTo(cellData.getId()).andCellTemplateIdEqualTo(cellData.getCellTemplateId()); cellDataSourceExample.createCriteria().andCellDataIdEqualTo(cellData.getId()).andCellTemplateIdEqualTo(cellData.getCellTemplateId());
List<CellDataSource> cellDataSourceList = cellDataSourceMapper.selectByExample(cellDataSourceExample); List<PeriodCellDataSource> cellDataSourceList = periodCellDataSourceMapper.selectByExample(cellDataSourceExample);
for (CellDataSource cellDataSource : cellDataSourceList) { for (PeriodCellDataSource cellDataSource : cellDataSourceList) {
Long dataSourceId = cellDataSource.getDataSourceId(); Long dataSourceId = cellDataSource.getDataSourceId();
DataSource dataSource = dataSourceMapper.selectByPrimaryKey(dataSourceId); PeriodDataSource dataSource = periodDataSourceMapper.selectByPrimaryKey(dataSourceId);
if (dataSource.getDescription().equals(cellName)) { if (dataSource.getDescription().equals(cellName)) {
BigDecimal changeValue = data.getAmount().subtract(dataSource.getAmount()); BigDecimal changeValue = data.getAmount().subtract(dataSource.getAmount());
dataSource.setAmount(data.getAmount()); dataSource.setAmount(data.getAmount());
dataSource.setUpdateBy("admin"); dataSource.setUpdateBy("admin");
dataSource.setUpdateTime(new Date()); dataSource.setUpdateTime(new Date());
dataSourceMapper.updateByPrimaryKeySelective(dataSource); periodDataSourceMapper.updateByPrimaryKeySelective(dataSource);
if (!cellData.getData().equals("#VALUE!")) { if (!cellData.getData().equals("#VALUE!")) {
cellData.setData(new BigDecimal(cellData.getData()).add(changeValue).toString()); cellData.setData(new BigDecimal(cellData.getData()).add(changeValue).toString());
} else { } else {
...@@ -835,7 +837,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -835,7 +837,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} }
//cellData.setFormulaExp(cellData.getData()); //cellData.setFormulaExp(cellData.getData());
cellData.setUpdateTime(new Date()); cellData.setUpdateTime(new Date());
cellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} }
} }
} }
...@@ -857,14 +859,14 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -857,14 +859,14 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
public OperationResultDto<String> addDataSource(DataSourceDto datasourceDto) { public OperationResultDto<String> addDataSource(DataSourceDto datasourceDto) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
try { try {
CellData cellData = cellDataMapper.selectByPrimaryKey(Long.parseLong(datasourceDto.getCellDataId() != null ? datasourceDto.getCellDataId() : "0")); PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(Long.parseLong(datasourceDto.getCellDataId() != null ? datasourceDto.getCellDataId() : "0"));
if (cellData == null) { if (cellData == null) {
operationResultDto.setResult(false); operationResultDto.setResult(false);
operationResultDto.setResultMsg("NoCellData"); operationResultDto.setResultMsg("NoCellData");
return operationResultDto; return operationResultDto;
} }
DataSource dataSource = new DataSource(); PeriodDataSource dataSource = new PeriodDataSource();
CommonUtils.copyProperties(datasourceDto, dataSource); CommonUtils.copyProperties(datasourceDto, dataSource);
dataSource.setType(datasourceDto.getDataSourceType()); dataSource.setType(datasourceDto.getDataSourceType());
if (dataSource.getId() == null || dataSource.getId() == 0L) { if (dataSource.getId() == null || dataSource.getId() == 0L) {
...@@ -876,9 +878,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -876,9 +878,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSource.setCreateBy(datasourceDto.getCreator()); dataSource.setCreateBy(datasourceDto.getCreator());
} }
dataSource.setCreateTime(new Date()); dataSource.setCreateTime(new Date());
dataSourceMapper.insertSelective(dataSource); periodDataSourceMapper.insertSelective(dataSource);
CellDataSource cellDataSource = new CellDataSource(); PeriodCellDataSource cellDataSource = new PeriodCellDataSource();
cellDataSource.setId(distributedIdService.nextId()); cellDataSource.setId(distributedIdService.nextId());
cellDataSource.setCellDataId(cellData.getId()); cellDataSource.setCellDataId(cellData.getId());
cellDataSource.setCellTemplateId(cellData.getCellTemplateId()); cellDataSource.setCellTemplateId(cellData.getCellTemplateId());
...@@ -887,7 +889,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -887,7 +889,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataSource.setCreateTime(new Date()); cellDataSource.setCreateTime(new Date());
cellDataSource.setUpdateTime(new Date()); cellDataSource.setUpdateTime(new Date());
cellDataSourceMapper.insertSelective(cellDataSource); periodCellDataSourceMapper.insertSelective(cellDataSource);
operationResultDto.setData(dataSource.getId().toString()); operationResultDto.setData(dataSource.getId().toString());
operationResultDto.setResult(true); operationResultDto.setResult(true);
...@@ -952,19 +954,19 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -952,19 +954,19 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return operationResultDto; return operationResultDto;
} }
DataSource datasourceEntity = dataSourceMapper.selectByPrimaryKey(Long.parseLong(dataSource.getId())); PeriodDataSource datasourceEntity = periodDataSourceMapper.selectByPrimaryKey(Long.parseLong(dataSource.getId()));
if (datasourceEntity == null) { if (datasourceEntity == null) {
operationResultDto.setResultMsg("DatasourceInvalid"); operationResultDto.setResultMsg("DatasourceInvalid");
operationResultDto.setResult(false); operationResultDto.setResult(false);
return operationResultDto; return operationResultDto;
} }
updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount()); updateCellValueForDataSourceChange(datasourceEntity, dataSource.getAmount());
dataSourceMapper.updateByPrimaryKeySelective(datasourceEntity); periodDataSourceMapper.updateByPrimaryKeySelective(datasourceEntity);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater); //todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
List<DataSourceDetail> dataSourceItems = new ArrayList<>(); List<PeriodDataSourceDetail> dataSourceItems = new ArrayList<>();
dataSource.getItems().forEach(a -> { dataSource.getItems().forEach(a -> {
DataSourceDetail dataSourceDetail = new DataSourceDetail(); PeriodDataSourceDetail dataSourceDetail = new PeriodDataSourceDetail();
dataSourceDetail.setId(distributedIdService.nextId()); dataSourceDetail.setId(distributedIdService.nextId());
dataSourceDetail.setDataSourceId(Long.parseLong(dataSource.getId())); dataSourceDetail.setDataSourceId(Long.parseLong(dataSource.getId()));
dataSourceDetail.setDataSourceType(dataSource.getDataSourceType()); dataSourceDetail.setDataSourceType(dataSource.getDataSourceType());
...@@ -972,16 +974,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -972,16 +974,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceItems.add(dataSourceDetail); dataSourceItems.add(dataSourceDetail);
}); });
DataSourceDetailExample example = new DataSourceDetailExample(); PeriodDataSourceDetailExample example = new PeriodDataSourceDetailExample();
example.createCriteria().andDataSourceIdEqualTo(Long.parseLong(dataSource.getId())); example.createCriteria().andDataSourceIdEqualTo(Long.parseLong(dataSource.getId()));
List<DataSourceDetail> dataSourceDetailList = dataSourceDetailMapper.selectByExample(example); List<PeriodDataSourceDetail> dataSourceDetailList = periodDataSourceDetailMapper.selectByExample(example);
//todo: TBC tomorrow //todo: TBC tomorrow
dataSourceDetailList.forEach(a -> { dataSourceDetailList.forEach(a -> {
dataSourceDetailMapper.deleteByPrimaryKey(a.getId()); periodDataSourceDetailMapper.deleteByPrimaryKey(a.getId());
}); });
dataSourceItems.forEach(a -> { dataSourceItems.forEach(a -> {
dataSourceDetailMapper.insertSelective(a); periodDataSourceDetailMapper.insertSelective(a);
}); });
operationResultDto.setResult(true); operationResultDto.setResult(true);
...@@ -995,15 +997,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -995,15 +997,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
@Override @Override
public OperationResultDto<String> getDataSourceDetailList(Long datasSourceId) { public OperationResultDto<String> getDataSourceDetailList(Long datasSourceId) {
OperationResultDto<String> operationResultDto = new OperationResultDto<>(); OperationResultDto<String> operationResultDto = new OperationResultDto<>();
DataSource dataSource = dataSourceMapper.selectByPrimaryKey(datasSourceId); PeriodDataSource dataSource = periodDataSourceMapper.selectByPrimaryKey(datasSourceId);
String itemStrValue = StringUtils.EMPTY; String itemStrValue = StringUtils.EMPTY;
if (dataSource.getType().equals(FormulaDataSourceType.InputInvoice.getCode())) { if (dataSource.getType().equals(FormulaDataSourceType.InputInvoice.getCode())) {
DataSourceDetailExample dataSourceDetailExample = new DataSourceDetailExample(); PeriodDataSourceDetailExample dataSourceDetailExample = new PeriodDataSourceDetailExample();
dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(datasSourceId).andDataSourceTypeEqualTo(CellDataSourceType.InputInvoice.getCode()); dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(datasSourceId).andDataSourceTypeEqualTo(CellDataSourceType.InputInvoice.getCode());
List<DataSourceDetail> dataSourceDetails = dataSourceDetailMapper.selectByExample(dataSourceDetailExample); List<PeriodDataSourceDetail> dataSourceDetails = periodDataSourceDetailMapper.selectByExample(dataSourceDetailExample);
List<InputVATInvoiceItemExtendDto> inputVATInvoiceItemExtendDtos = new ArrayList<>(); List<InputVATInvoiceItemExtendDto> inputVATInvoiceItemExtendDtos = new ArrayList<>();
for (DataSourceDetail dataSourceDetail : dataSourceDetails) { for (PeriodDataSourceDetail dataSourceDetail : dataSourceDetails) {
if (StringUtils.isNotBlank(dataSourceDetail.getItemValue())) { if (StringUtils.isNotBlank(dataSourceDetail.getItemValue())) {
InputVATInvoiceItemExtendDto inputVATInvoiceItemExtendDto = inputVATInvoiceMapper.selectInvoiceExtendDto(dataSourceDetail.getItemValue()); InputVATInvoiceItemExtendDto inputVATInvoiceItemExtendDto = inputVATInvoiceMapper.selectInvoiceExtendDto(dataSourceDetail.getItemValue());
inputVATInvoiceItemExtendDtos.add(inputVATInvoiceItemExtendDto); inputVATInvoiceItemExtendDtos.add(inputVATInvoiceItemExtendDto);
...@@ -1024,7 +1026,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -1024,7 +1026,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
BigDecimal bValue = originalAmount != null ? originalAmount : new BigDecimal("0"); BigDecimal bValue = originalAmount != null ? originalAmount : new BigDecimal("0");
BigDecimal amountChange = aValue.subtract(bValue); BigDecimal amountChange = aValue.subtract(bValue);
CellData cellData = cellDataMapper.selectByPrimaryKey(cellDataId); PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(cellDataId);
BigDecimal cellVal = new BigDecimal("0"); BigDecimal cellVal = new BigDecimal("0");
try { try {
if (cellData != null) { if (cellData != null) {
...@@ -1040,7 +1042,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -1040,7 +1042,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} }
} }
private void updateCellValueForDataSourceChange(DataSource dataSourceEntity, BigDecimal amount) { private void updateCellValueForDataSourceChange(PeriodDataSource dataSourceEntity, BigDecimal amount) {
BigDecimal originalAmount = dataSourceEntity.getAmount(); BigDecimal originalAmount = dataSourceEntity.getAmount();
dataSourceEntity.setAmount(amount); dataSourceEntity.setAmount(amount);
BigDecimal aValue = dataSourceEntity.getAmount() != null ? dataSourceEntity.getAmount() : new BigDecimal("0"); BigDecimal aValue = dataSourceEntity.getAmount() != null ? dataSourceEntity.getAmount() : new BigDecimal("0");
...@@ -1048,7 +1050,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -1048,7 +1050,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
BigDecimal amountChange = aValue.subtract(bValue); BigDecimal amountChange = aValue.subtract(bValue);
DataSourceCellDataDto dataSourceCellDataDto = DataSourceCellDataDto dataSourceCellDataDto =
dataSourceMapper.getManualDataSource2(dataSourceEntity.getId()); periodDataSourceMapper.getManualDataSource2(dataSourceEntity.getId());
BigDecimal cellVal = new BigDecimal("0"); BigDecimal cellVal = new BigDecimal("0");
if (dataSourceCellDataDto != null && dataSourceCellDataDto.getCellData().getData() != null) { if (dataSourceCellDataDto != null && dataSourceCellDataDto.getCellData().getData() != null) {
if (dataSourceCellDataDto.getCellDataSource().getOperationType().equals(EnumOperationType.Sub)) { if (dataSourceCellDataDto.getCellDataSource().getOperationType().equals(EnumOperationType.Sub)) {
......
...@@ -20,6 +20,8 @@ public class VatAbstractService { ...@@ -20,6 +20,8 @@ public class VatAbstractService {
@Autowired @Autowired
public VatEnterpriseAccountMapper vatEnterpriseAccountMapper; public VatEnterpriseAccountMapper vatEnterpriseAccountMapper;
@Autowired @Autowired
public PeriodEnterpriseAccountMapper periodEnterpriseAccountMapper;
@Autowired
public VatStandardAccountMapper vatStandardAccountMapper; public VatStandardAccountMapper vatStandardAccountMapper;
@Autowired @Autowired
public InputVatInvoiceMapper inputVATInvoiceMapper; public InputVatInvoiceMapper inputVATInvoiceMapper;
...@@ -48,8 +50,12 @@ public class VatAbstractService { ...@@ -48,8 +50,12 @@ public class VatAbstractService {
@Autowired @Autowired
public DataSourceMapper dataSourceMapper; public DataSourceMapper dataSourceMapper;
@Autowired @Autowired
public PeriodDataSourceMapper periodDataSourceMapper;
@Autowired
public DataSourceDetailMapper dataSourceDetailMapper; public DataSourceDetailMapper dataSourceDetailMapper;
@Autowired @Autowired
public PeriodDataSourceDetailMapper periodDataSourceDetailMapper;
@Autowired
public TemplateGroupMapper templateGroupMapper; public TemplateGroupMapper templateGroupMapper;
@Autowired @Autowired
public DistributedIdService distributedIdService; public DistributedIdService distributedIdService;
...@@ -76,6 +82,8 @@ public class VatAbstractService { ...@@ -76,6 +82,8 @@ public class VatAbstractService {
@Autowired @Autowired
public CellDataMapper cellDataMapper; public CellDataMapper cellDataMapper;
@Autowired @Autowired
public PeriodCellDataMapper periodCellDataMapper;
@Autowired
public ModifiedReportCellMapper modifiedReportCellMapper; public ModifiedReportCellMapper modifiedReportCellMapper;
@Autowired @Autowired
public PeriodCellCommentMapper periodCellCommentMapper; public PeriodCellCommentMapper periodCellCommentMapper;
...@@ -85,5 +93,6 @@ public class VatAbstractService { ...@@ -85,5 +93,6 @@ public class VatAbstractService {
public FtpService ftpService; public FtpService ftpService;
@Autowired @Autowired
public CellDataSourceMapper cellDataSourceMapper; public CellDataSourceMapper cellDataSourceMapper;
@Autowired
public PeriodCellDataSourceMapper periodCellDataSourceMapper;
} }
...@@ -18,6 +18,7 @@ import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto; ...@@ -18,6 +18,7 @@ import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException; import pwc.taxtech.atms.exception.FormulaException;
import pwc.taxtech.atms.vat.entity.CellData; import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.PeriodCellData;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -107,7 +108,7 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -107,7 +108,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
} }
// bo.disCount(); // bo.disCount();
CellData cellData = null; PeriodCellData cellData = null;
String projectId = agent.getPastProjectId(curPeriod.getCurYear(), String projectId = agent.getPastProjectId(curPeriod.getCurYear(),
formulaContext.getOrganizationId()); formulaContext.getOrganizationId());
......
...@@ -8,10 +8,7 @@ import pwc.taxtech.atms.common.util.SpringContextUtil; ...@@ -8,10 +8,7 @@ import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto; import pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto;
import pwc.taxtech.atms.vat.entity.Balance; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.entity.BalanceStdManual;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.VatStandardAccount;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -94,7 +91,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -94,7 +91,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
List<Object> formulaDataSourceDtoList = new ArrayList<>(); List<Object> formulaDataSourceDtoList = new ArrayList<>();
if (balanceStdManual != null) { if (balanceStdManual != null) {
List<VatEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil List<VatEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil
.vatEnterpriseAccountMapper .periodEnterpriseAccountMapper
.getListWithAccountCode(accountCode); .getListWithAccountCode(accountCode);
if (period == 99) { if (period == 99) {
val = new BigDecimal(((balanceStdManual.getYearDebitNet() != null ? balanceStdManual.getYearDebitNet() : 0).doubleValue() val = new BigDecimal(((balanceStdManual.getYearDebitNet() != null ? balanceStdManual.getYearDebitNet() : 0).doubleValue()
...@@ -140,7 +137,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -140,7 +137,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
} else { } else {
//企业账套 //企业账套
List<VatEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil List<PeriodEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil
.vatEnterpriseAccountDao .vatEnterpriseAccountDao
.getListByAccountCode(accountCode); .getListByAccountCode(accountCode);
......
...@@ -10,9 +10,7 @@ import org.slf4j.LoggerFactory; ...@@ -10,9 +10,7 @@ import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.vat.entity.DataSource; import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.entity.DataSourceDetail;
import pwc.taxtech.atms.vat.entity.PeriodFormulaBlock;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent; import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import javax.tools.JavaCompiler; import javax.tools.JavaCompiler;
...@@ -111,7 +109,7 @@ public class FunctionBase { ...@@ -111,7 +109,7 @@ public class FunctionBase {
Long periodCellTemplateId = SpringContextUtil.periodCellTemplateMapper.getCellTemplateIdWithMap(map); Long periodCellTemplateId = SpringContextUtil.periodCellTemplateMapper.getCellTemplateIdWithMap(map);
Date creatime = new Date(); Date creatime = new Date();
DataSource dataSource = new DataSource(); PeriodDataSource dataSource = new PeriodDataSource();
Long dataSourceId = SpringContextUtil.distributedIdService.nextId(); Long dataSourceId = SpringContextUtil.distributedIdService.nextId();
dataSource.setId(dataSourceId); dataSource.setId(dataSourceId);
dataSource.setType(FormulaDataSourceType.Report.getCode()); dataSource.setType(FormulaDataSourceType.Report.getCode());
...@@ -128,24 +126,24 @@ public class FunctionBase { ...@@ -128,24 +126,24 @@ public class FunctionBase {
dataSource.setColumnName(""); dataSource.setColumnName("");
dataSource.setCellTemplateId(periodCellTemplateId); dataSource.setCellTemplateId(periodCellTemplateId);
dataSource.setPeriod(period); dataSource.setPeriod(period);
SpringContextUtil.dataSourceMapper.insertSelective(dataSource); SpringContextUtil.periodDataSourceMapper.insertSelective(dataSource);
for (Object obj : dataSourceList) { for (Object obj : dataSourceList) {
if (obj.getClass()==java.util.ArrayList.class) { if (obj.getClass()==java.util.ArrayList.class) {
for (Object obj2 : (ArrayList<Object>)obj) { for (Object obj2 : (ArrayList<Object>)obj) {
DataSourceDetail dataSourceDetail = new DataSourceDetail(); PeriodDataSourceDetail dataSourceDetail = new PeriodDataSourceDetail();
dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId()); dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId());
dataSourceDetail.setDataSourceId(dataSourceId); dataSourceDetail.setDataSourceId(dataSourceId);
dataSourceDetail.setDataSourceType(formulaDataSourceDetailType.getCode()); dataSourceDetail.setDataSourceType(formulaDataSourceDetailType.getCode());
dataSourceDetail.setItemValue(JSON.toJSONString(obj2)); dataSourceDetail.setItemValue(JSON.toJSONString(obj2));
SpringContextUtil.dataSourceDetailMapper.insertSelective(dataSourceDetail); SpringContextUtil.periodDataSourceDetailMapper.insertSelective(dataSourceDetail);
} }
} else { } else {
DataSourceDetail dataSourceDetail = new DataSourceDetail(); PeriodDataSourceDetail dataSourceDetail = new PeriodDataSourceDetail();
dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId()); dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId());
dataSourceDetail.setDataSourceId(dataSourceId); dataSourceDetail.setDataSourceId(dataSourceId);
dataSourceDetail.setDataSourceType(formulaDataSourceDetailType.getCode()); dataSourceDetail.setDataSourceType(formulaDataSourceDetailType.getCode());
dataSourceDetail.setItemValue(JSON.toJSONString(obj)); dataSourceDetail.setItemValue(JSON.toJSONString(obj));
SpringContextUtil.dataSourceDetailMapper.insertSelective(dataSourceDetail); SpringContextUtil.periodDataSourceDetailMapper.insertSelective(dataSourceDetail);
} }
} }
return dataSourceId; return dataSourceId;
......
package pwc.taxtech.atms.vat.dao; package pwc.taxtech.atms.vat.dao;
import java.util.List; import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.PCTEntity;
import pwc.taxtech.atms.vat.entity.PeriodCellData; import pwc.taxtech.atms.vat.entity.PeriodCellData;
import pwc.taxtech.atms.vat.entity.PeriodCellDataExample; import pwc.taxtech.atms.vat.entity.PeriodCellDataExample;
...@@ -105,4 +109,20 @@ public interface PeriodCellDataMapper extends MyVatMapper { ...@@ -105,4 +109,20 @@ public interface PeriodCellDataMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(PeriodCellData record); int updateByPrimaryKey(PeriodCellData record);
@Select("<script>" +
"SELECT " +
" R.PERIOD, C.CELL_TEMPLATE_ID AS CELLTEMPLATEID, DATA " +
"FROM " +
" PERIOD_CELL_DATA C, " +
" PERIOD_REPORT R " +
"WHERE " +
" C.REPORT_ID = R.ID AND " +
" " +
" <foreach item=\"item\" index=\"index\" collection=\"list\"" +
" open=\"(\" separator=\"OR\" close=\")\">" +
" ( R.PERIOD=#{item.period} AND C.CELL_TEMPLATE_ID=#{item.cellTemplateId} )" +
" </foreach>" +
"</script>")
List<PCTEntity> queryByPCTs(@Param("list") Set<PCTEntity> parameter);
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.entity.PeriodDataSource; import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import pwc.taxtech.atms.vat.entity.PeriodDataSourceExample; import pwc.taxtech.atms.vat.entity.PeriodDataSourceExample;
...@@ -105,4 +107,34 @@ public interface PeriodDataSourceMapper extends MyVatMapper { ...@@ -105,4 +107,34 @@ public interface PeriodDataSourceMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(PeriodDataSource record); int updateByPrimaryKey(PeriodDataSource record);
void clearFormulaBlockWithPeriod(@Param("period") Integer period);
void clearTaxRuleSettingWithPeriod(@Param("period") Integer period);
void clearCellTemplateWithPeriod(@Param("period") Integer period, @Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearCellTemplateConfigWithPeriod(@Param("period") Integer period, @Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearTemplateWithPeriod(@Param("period") Integer period, @Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearTaxPayerReportWithPeriod(@Param("period") Integer period);
void clearDataSourceWithPeriod(@Param("period") Integer period);
void clearDataSourceDetailWithPeriod(@Param("period") Integer period);
void clearCellDataSourceDataWithPeriod(@Param("period") Integer period);
void clearCellDataWithPeriod(@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs, @Param("period") Integer period);
void clearReportWithPeriod(Integer period);
void clearDataWithPeriod(@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs, @Param("period") Integer period);
List<DataSourceExtendDto> getFormulaDataSource(Long reportID);
List<DataSourceExtendDto> getManualDataSource(Long cellDataID);
DataSourceCellDataDto getManualDataSource2(Long dataSourceID);
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount; import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccountExample; import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccountExample;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
@Mapper @Mapper
public interface PeriodEnterpriseAccountMapper extends MyVatMapper { public interface PeriodEnterpriseAccountMapper extends MyVatMapper {
...@@ -105,4 +106,7 @@ public interface PeriodEnterpriseAccountMapper extends MyVatMapper { ...@@ -105,4 +106,7 @@ public interface PeriodEnterpriseAccountMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(PeriodEnterpriseAccount record); int updateByPrimaryKey(PeriodEnterpriseAccount record);
List<VatEnterpriseAccount> getListWithAccountCode(@Param("accountCode") String accountCode);
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.dpo; ...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.dpo;
import pwc.taxtech.atms.CommonUtils; import pwc.taxtech.atms.CommonUtils;
import pwc.taxtech.atms.vat.entity.DataSource; import pwc.taxtech.atms.vat.entity.DataSource;
import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import java.util.List; import java.util.List;
...@@ -10,12 +11,12 @@ public class DataSourceExtendDto extends DataSource { ...@@ -10,12 +11,12 @@ public class DataSourceExtendDto extends DataSource {
private Long cellTemplateId; private Long cellTemplateId;
private Long cellDataId; private Long cellDataId;
private List<String> items; private List<String> items;
private DataSource dataSource; private PeriodDataSource dataSource;
private Long reportTemplateId; private Long reportTemplateId;
private Integer dataSourceType; private Integer dataSourceType;
public DataSource getDataSource() { public PeriodDataSource getDataSource() {
this.dataSource = new DataSource(); this.dataSource = new PeriodDataSource();
CommonUtils.copyProperties(this, dataSource); CommonUtils.copyProperties(this, dataSource);
return this.dataSource; return this.dataSource;
} }
...@@ -52,7 +53,7 @@ public class DataSourceExtendDto extends DataSource { ...@@ -52,7 +53,7 @@ public class DataSourceExtendDto extends DataSource {
this.items = items; this.items = items;
} }
public void setDataSource(DataSource dataSource) { public void setDataSource(PeriodDataSource dataSource) {
this.dataSource = dataSource; this.dataSource = dataSource;
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper">
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper">
<delete id="clearFormulaBlockWithPeriod">
DELETE FROM
PERIOD_FORMULA_BLOCK
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearTaxRuleSettingWithPeriod">
DELETE FROM
PERIOD_TAX_RULE_SETTING
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearCellTemplateWithPeriod">
DELETE FROM
PERIOD_CELL_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete id="clearCellTemplateConfigWithPeriod">
DELETE FROM
PERIOD_CELL_TEMPLATE_CONFIG
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete id="clearTemplateWithPeriod">
DELETE FROM
PERIOD_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
AND TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete id="clearTaxPayerReportWithPeriod">
DELETE FROM
PERIOD_TAX_PAYER_REPORT_RULE
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearDataSourceWithPeriod">
DELETE
D FROM
DATA_SOURCE D
WHERE
D.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearDataSourceDetailWithPeriod">
DELETE
D FROM
DATA_SOURCE_DETAIL D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearCellDataSourceDataWithPeriod">
DELETE
D FROM
CELL_DATA_SOURCE D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearCellDataWithPeriod">
DELETE
C FROM
CELL_DATA C
JOIN
REPORT R
ON
C.REPORT_ID=R.ID
WHERE
R.PERIOD = #{period,jdbcType=INTEGER} ;
<!--&amp;lt;if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"&amp;gt;-->
<!--WHERE report_id not in (${exceptReportTemplateIDs});-->
<!--&amp;lt;/if&amp;gt;-->
</delete>
<delete id="clearReportWithPeriod">
DELETE FROM
REPORT
WHERE
period= #{period,jdbcType=INTEGER} ;
</delete>
<delete id="clearDataWithPeriod">
DELETE FROM
PERIOD_FORMULA_BLOCK
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE FROM
PERIOD_TAX_RULE_SETTING
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE FROM
PERIOD_CELL_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_CELL_TEMPLATE_CONFIG
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_TAX_PAYER_REPORT_RULE
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE
D FROM
DATA_SOURCE_DETAIL D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE
D FROM
CELL_DATA_SOURCE D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE
D FROM
DATA_SOURCE D
WHERE
D.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE
C FROM
CELL_DATA C
JOIN
REPORT R
ON
C.REPORT_ID=R.ID
WHERE
R.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE FROM
REPORT
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<resultMap id="DataSourceExtendDtoMap" type="pwc.taxtech.atms.vat.dpo.DataSourceExtendDto">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="TYPE" jdbcType="INTEGER" property="type"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="AMOUNT" jdbcType="DECIMAL" property="amount"/>
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
<result column="KEY_VALUE_DATA_ID" jdbcType="VARCHAR" property="keyValueDataId"/>
<result column="CREATE_BY" jdbcType="VARCHAR" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="UPDATE_BY" jdbcType="VARCHAR" property="updateBy"/>
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="ROW_NAME" jdbcType="VARCHAR" property="rowName"/>
<result column="COLUMN_NAME" jdbcType="VARCHAR" property="columnName"/>
<result column="ROW_INDEX" jdbcType="INTEGER" property="rowIndex"/>
<result column="REMAP_BATCH_ID" jdbcType="VARCHAR" property="remapBatchId"/>
<result column="COLUMN_INDEX" jdbcType="INTEGER" property="columnIndex"/>
<result column="OPERATION_TYPE" jdbcType="INTEGER" property="operationType"/>
<result column="CELL_TEMPLATE_ID" jdbcType="BIGINT" property="cellTemplateId"/>
<result column="CELL_DATA_ID" jdbcType="BIGINT" property="cellDataId"/>
<result column="REPORT_TEMPLATE_ID" jdbcType="BIGINT" property="reportTemplateId"/>
</resultMap>
<select id="getFormulaDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap">
SELECT
DS.*,
CDS.OPERATION_TYPE AS OPERATION_TYPE,
CD.CELL_TEMPLATE_ID AS CELL_TEMPLATE_ID,
CD.ID AS CELL_DATA_ID,
RPT.TEMPLATE_ID AS REPORT_TEMPLATE_ID
FROM
DATA_SOURCE DS
JOIN
CELL_DATA_SOURCE CDS
ON
DS.ID = CDS.DATA_SOURCE_ID
JOIN
CELL_DATA CD
ON
CDS.CELL_DATA_ID = CD.ID
JOIN
REPORT RPT
ON
CD.REPORT_ID= RPT.ID
WHERE
CD.REPORT_ID = #{reportID,jdbcType=BIGINT}
<!--AND <![CDATA[ ds.type <> 1]]>-->
</select>
<select id="getManualDataSource" parameterType="java.lang.Long" resultMap="DataSourceExtendDtoMap">
SELECT
CDS.CELL_DATA_ID,
DS.ID,
DS.T_Y_P_E,
DS.NAME,
DS.AMOUNT,
DS.DESCRIPTION,
DS.KEY_VALUE_DATA_ID,
DS.CREATE_BY,
DS.CREATE_TIME,
DS.UPDATE_BY,
DS.UPDATE_TIME,
DS.ROW_NAME,
DS.COLUMN_NAME,
DS.ROW_INDEX,
DS.REMAP_BATCH_ID,
DS.COLUMN_INDEX,
DS.CELL_TEMPLATE_ID,
DS.PERIOD
FROM
CELL_DATA_SOURCE CDS
JOIN
DATA_SOURCE DS
ON
CDS.DATA_SOURCE_ID = DS.ID
WHERE
DS.TYPE = 10
AND CDS.CELL_DATA_ID = #{cellDataID,jdbcType=BIGINT}
</select>
<resultMap id="dataSourceCellDataDto" type="pwc.taxtech.atms.dto.vatdto.DataSourceCellDataDto">
<id column="ID" jdbcType="BIGINT" property="id"/>
<association property="cellData" javaType="pwc.taxtech.atms.vat.entity.CellData">
<id column="CELL_DATA_ID" jdbcType="BIGINT" property="id"/>
<result column="CELL_DATA_DATA" property="data" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="CELL_DATA_TEMPLATE_ID" property="cellTemplateId" javaType="java.lang.Long" jdbcType="BIGINT"/>
<result column="CELL_DATA_REPORT_ID" property="reportId" javaType="java.lang.Long" jdbcType="BIGINT"/>
</association>
<association property="cellDataSource" javaType="pwc.taxtech.atms.vat.entity.CellDataSource">
<id column="CELL_DATA_SOURCE_ID" jdbcType="BIGINT" property="id"/>
<result column="CELL_DATA_SOURCE_OPERATION_TYPE" property="operationType" javaType="java.lang.Integer" jdbcType="INTEGER"/>
</association>
</resultMap>
<select id="getManualDataSource2" parameterType="java.lang.Long" resultMap="dataSourceCellDataDto">
SELECT
CELL_DATA_SOURCE.ID AS ID,
CELLDATA.ID AS CELL_DATA_ID,
CELLDATA.DATA AS CELL_DATA_DATA,
CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID,
CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID,
CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID,
CELLDATASOURCE.OPERATION_TYPE AS CELL_DATA_SOURCE_OPERATION_TYPE
FROM
CELL_DATA CELLDATA
JOIN
CELL_DATA_SOURCE CELLDATASOURCE
ON
CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID
WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} LIMIT 1
</select>
<!--DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE FROM period_cell_template WHERE period=#{period,jdbcType=INTEGER} and report_template_id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_cell_template_config WHERE period=#{period,jdbcType=INTEGER} and report_template_id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER} and id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER};-->
<!--&amp;amp;lt;/delete&amp;amp;gt;-->
</mapper>
\ No newline at end of file
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