Commit cd32138b authored by sherlock's avatar sherlock

dffs org filter

parent f74c5e27
...@@ -14,10 +14,7 @@ import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; ...@@ -14,10 +14,7 @@ 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.dpo.CellTemplatePerGroupDto; import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto; import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.entity.AccountMapping; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.AccountMappingExample;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrg;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.GlBalance; import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample; import pwc.taxtech.atms.vat.entity.GlBalanceExample;
...@@ -70,7 +67,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -70,7 +67,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
double result = 0; double result = 0;
for(AccountMapping a : accountMappings){ for(AccountMapping a : accountMappings){
result += count(a.getEnterpriseAccountCode(), dataSource, period, year); result += count(a.getEnterpriseAccountCode(), dataSource, period, year, orgId);
} }
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto, FormulaDataSourceDetailType.FormulaDataSourceDto,
...@@ -80,7 +77,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -80,7 +77,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return new NumberEval(result); return new NumberEval(result);
} else if(type == 1){ } else if(type == 1){
double result = count(code, dataSource, period, year); double result = count(code, dataSource, period, year, orgId);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto, FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId()); new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
...@@ -95,10 +92,17 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -95,10 +92,17 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return year + "-" + (period > 9 ? period : ("0" + period)); return year + "-" + (period > 9 ? period : ("0" + period));
} }
private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year){ private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year, String orgId){
Organization organization = SpringContextUtil.organizationMapper.selectByPrimaryKey(orgId);
GlBalanceExample glBalanceExample = new GlBalanceExample(); GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code).andPeriodNameEqualTo(periodName(period, year)); GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code)
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code).andPeriodNameEqualTo(periodName(period, year)); .andPeriodNameEqualTo(periodName(period, year));
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code)
.andPeriodNameEqualTo(periodName(period, year));
if(organization != null){
c1.andSegment1EqualTo(organization.getClientCode());
c2.andSegment1EqualTo(organization.getClientCode());
}
glBalanceExample.or(c2); glBalanceExample.or(c2);
List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample); List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample);
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
......
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