Commit 903a9c68 authored by neo's avatar neo

[DEV] fixed upate taxpay rule settint

parent 5da74e7d
...@@ -2402,6 +2402,13 @@ public class OrganizationServiceImpl { ...@@ -2402,6 +2402,13 @@ public class OrganizationServiceImpl {
newRule.setTaxPayerType(newTaxPayerType); // Use tax payer type related to template group newRule.setTaxPayerType(newTaxPayerType); // Use tax payer type related to template group
newRule.setCreateTime(now); newRule.setCreateTime(now);
newRule.setUpdateTime(now); newRule.setUpdateTime(now);
TaxPayerReportRuleExample exam = new TaxPayerReportRuleExample();
exam.createCriteria().andOrganizationIdEqualTo(orgDto.getId()).andTemplateGroupIdEqualTo(vatSetting.getTemplateGroupId());
List<TaxPayerReportRule> rules = taxPayerReportRuleMapper.selectByExample(exam);
if (!rules.isEmpty()) {
newRule.setId(rules.get(0).getId());
taxPayerReportRuleMapper.updateByPrimaryKeySelective(newRule);
} else
taxPayerReportRuleMapper.insertSelective(newRule); taxPayerReportRuleMapper.insertSelective(newRule);
} else { } else {
activeRule.setTemplateGroupId(vatSetting.getTemplateGroupId()); activeRule.setTemplateGroupId(vatSetting.getTemplateGroupId());
...@@ -2417,6 +2424,14 @@ public class OrganizationServiceImpl { ...@@ -2417,6 +2424,14 @@ public class OrganizationServiceImpl {
newRule.setTaxPayerType(newTaxPayerType); // Use tax payer type related to template group newRule.setTaxPayerType(newTaxPayerType); // Use tax payer type related to template group
newRule.setCreateTime(now); newRule.setCreateTime(now);
newRule.setUpdateTime(now); newRule.setUpdateTime(now);
TaxPayerReportRuleExample exam = new TaxPayerReportRuleExample();
exam.createCriteria().andOrganizationIdEqualTo(orgDto.getId()).andTemplateGroupIdEqualTo(vatSetting.getTemplateGroupId());
List<TaxPayerReportRule> rules = taxPayerReportRuleMapper.selectByExample(exam);
if (!rules.isEmpty()) {
newRule.setId(rules.get(0).getId());
taxPayerReportRuleMapper.updateByPrimaryKeySelective(newRule);
} else
taxPayerReportRuleMapper.insertSelective(newRule); taxPayerReportRuleMapper.insertSelective(newRule);
} }
} else if (activeRule != null) { // If no setting, remove non-default rule } else if (activeRule != null) { // If no setting, remove non-default rule
......
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