Commit 7243be85 authored by neo's avatar neo

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

parents f33200a9 0c150a0e
......@@ -15,10 +15,22 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.UpateNameParam;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.CellTemplate;
import pwc.taxtech.atms.entity.CellTemplateExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.entity.TemplateExample;
import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.entity.TemplateGroupExample;
import pwc.taxtech.atms.service.TemplateService;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
......@@ -234,32 +246,32 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
@Override
public OperationResultDto<List<TemplateByGroupDto>> getByGroupId(Long templateGroupId, String projectId) {
OperationResultDto result = new OperationResultDto();
Long bspl = getBSPLTemplateGroup(projectId);
// Long bspl = getVatTemplateGroup(projectId);
TemplateExample example = new TemplateExample();
List<Long> ids = new ArrayList<>();
ids.add(templateGroupId);
if(!bspl.equals(null)) {
ids.add(bspl);
}
// if(!bspl.equals(null)) {
// ids.add(bspl);
// }
example.createCriteria().andTemplateGroupIdIn(ids);
example.setOrderByClause(" order_index");
example.setOrderByClause("order_index");
List<Template> templates = templateMapper.selectByExample(example);
List<TemplateByGroupDto> wrappList = new ArrayList<>();
if (bspl != null) {
TemplateByGroupDto bsplGroup = new TemplateByGroupDto();
bsplGroup.setId(bspl);
bsplGroup.setName(TemplateGroupType.FinancialReturn.name());
List<TemplateDto> templateDtos = new ArrayList<>();
templates.stream().filter(x -> x.getTemplateGroupId().equals(bspl)).collect(Collectors.toList()).forEach(a -> {
TemplateDto templateDto = new TemplateDto();
CommonUtils.copyProperties(a, templateDto);
templateDtos.add(templateDto);
});
bsplGroup.setChildren(templateDtos);
bsplGroup.setOrderIndex(1);
wrappList.add(bsplGroup);
}
// if (bspl != null) {
// TemplateByGroupDto bsplGroup = new TemplateByGroupDto();
// bsplGroup.setId(bspl);
// bsplGroup.setName(TemplateGroupType.FinancialReturn.name());
// List<TemplateDto> templateDtos = new ArrayList<>();
//
// templates.stream().filter(x -> x.getTemplateGroupId().equals(bspl)).collect(Collectors.toList()).forEach(a -> {
// TemplateDto templateDto = new TemplateDto();
// CommonUtils.copyProperties(a, templateDto);
// templateDtos.add(templateDto);
// });
// bsplGroup.setChildren(templateDtos);
// bsplGroup.setOrderIndex(1);
// wrappList.add(bsplGroup);
// }
if (templateGroupId != null) {
TemplateByGroupDto taxReturnGroup = new TemplateByGroupDto();
......@@ -276,7 +288,7 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
wrappList.add(taxReturnGroup);
}
if (bspl != null || templateGroupId != null) {
if (templateGroupId != null) {
result.setResult(true);
result.setData(wrappList);
} else {
......@@ -285,7 +297,7 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
return result;
}
private Long getBSPLTemplateGroup(String projectId) {
private Long getVatTemplateGroup(String projectId) {
ProjectExample example = new ProjectExample();
example.createCriteria().andIdEqualTo(projectId);
List<Project> projects = projectMapper.selectByExample(example);
......@@ -295,10 +307,12 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
}
List<TemplateGroup> allTemplateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
Optional<TemplateGroup> bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().equals(industryId) && a.getGroupType().equals(TemplateGroupType.FinancialReturn.getCode())).findFirst();
Optional<TemplateGroup> bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().equals(industryId)
&& a.getGroupType().equals(TemplateGroupType.TaxReturn.getCode())).findFirst();
if (!bsplTemplateGroup.isPresent()) {
bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().contains(industryId.get()) && a.getGroupType().equals(TemplateGroupType.FinancialReturn.getCode())).findFirst();
bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().contains(industryId.get())
&& a.getGroupType().equals(TemplateGroupType.TaxReturn.getCode())).findFirst();
}
if (!bsplTemplateGroup.isPresent()) {
......
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