Commit bf6f17c4 authored by frank.xa.zhang's avatar frank.xa.zhang

fixed issue of rule save failed

parent 0985d834
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -41,7 +42,7 @@ public class RuleEngineeConfigController {
}
@ApiOperation(value = "", notes = "saveTaxRuleSettings")
@RequestMapping(value = "taxRuleSetting/Save", method = RequestMethod.POST)
@RequestMapping(value = "taxRuleSetting/Save", method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void saveTaxRuleSettings(@RequestBody BatchUpdateTaxRuleDto batchUpdateTaxRule) {
logger.debug("RuleEngineeConfigController SaveTaxRuleSettings");
ruleEngineeConfigService.savetaxrulesettings(batchUpdateTaxRule);
......
......@@ -3,22 +3,22 @@ package pwc.taxtech.atms.dto;
import java.util.List;
public class BatchUpdateTaxRuleDto {
private List<TaxRuleSettingOperation> TaxRuleSettingOperations;
private List<TaxPayerReportRuleDtoOperation> TaxPayerReportRuleOperations;
private List<TaxRuleSettingOperation> taxRuleSettingOperations;
private List<TaxPayerReportRuleDtoOperation> taxPayerReportRuleOperations;
public List<TaxRuleSettingOperation> getTaxRuleSettingOperations() {
return TaxRuleSettingOperations;
return this.taxRuleSettingOperations;
}
public void setTaxRuleSettingOperations(List<TaxRuleSettingOperation> taxRuleSettingOperations) {
TaxRuleSettingOperations = taxRuleSettingOperations;
this.taxRuleSettingOperations = taxRuleSettingOperations;
}
public List<TaxPayerReportRuleDtoOperation> getTaxPayerReportRuleOperations() {
return TaxPayerReportRuleOperations;
return this.taxPayerReportRuleOperations;
}
public void setTaxPayerReportRuleOperations(List<TaxPayerReportRuleDtoOperation> taxPayerReportRuleOperations) {
TaxPayerReportRuleOperations = taxPayerReportRuleOperations;
this.taxPayerReportRuleOperations = taxPayerReportRuleOperations;
}
}
......@@ -5,18 +5,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class TaxPayerReportRuleDto {
private Long id;
private String id;
private int isDefault;
private int taxPayerType;
@JsonProperty("templateGroupID")
private Long templateGroupId;
private String templateGroupId;
private List<String> orgs;
private Long editKey;
private Boolean isNotPersistent;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
......@@ -36,11 +37,11 @@ public class TaxPayerReportRuleDto {
this.taxPayerType = taxPayerType;
}
public Long getTemplateGroupId() {
public String getTemplateGroupId() {
return templateGroupId;
}
public void setTemplateGroupId(Long templateGroupId) {
public void setTemplateGroupId(String templateGroupId) {
this.templateGroupId = templateGroupId;
}
......@@ -53,4 +54,19 @@ public class TaxPayerReportRuleDto {
}
public Long getEditKey() {
return editKey;
}
public void setEditKey(Long editKey) {
this.editKey = editKey;
}
public Boolean getNotPersistent() {
return isNotPersistent;
}
public void setNotPersistent(Boolean notPersistent) {
isNotPersistent = notPersistent;
}
}
package pwc.taxtech.atms.dto;
public class TaxPayerReportRuleDtoOperation {
private String Action;
private TaxPayerReportRuleDto TaxPayerReportRule;
private String action;
private TaxPayerReportRuleDto taxPayerReportRule;
public String getAction() {
return Action;
return action;
}
public void setAction(String action) {
Action = action;
this.action = action;
}
public TaxPayerReportRuleDto getTaxPayerReportRule() {
return TaxPayerReportRule;
return this.taxPayerReportRule;
}
public void setTaxPayerReportRule(TaxPayerReportRuleDto taxPayerReportRule) {
TaxPayerReportRule = taxPayerReportRule;
this.taxPayerReportRule = taxPayerReportRule;
}
}
package pwc.taxtech.atms.dto;
public class TaxRuleSettingOperation {
private String Action;
private TaxRuleSettingDto TaxRuleSetting;
private String action;
private TaxRuleSettingDto taxRuleSetting;
public String getAction() {
return Action;
return this.action;
}
public void setAction(String action) {
Action = action;
this.action = action;
}
public TaxRuleSettingDto getTaxRuleSetting() {
return TaxRuleSetting;
return taxRuleSetting;
}
public void setTaxRuleSetting(TaxRuleSettingDto taxPayerReportRule) {
TaxRuleSetting = taxPayerReportRule;
this.taxRuleSetting = taxPayerReportRule;
}
}
......@@ -45,19 +45,18 @@ public class RuleEngineeConfigServiceImpl extends AbstractService {
List<TaxPayerReportRule> filterRules = new ArrayList<>();
for (TaxPayerReportRule rule : rules) {
boolean isAtLeastOrgExisted = false;
if (StringUtils.isNotBlank(rule.getOrganizationId())) {
String[] selectedOrgIds = rule.getOrganizationId().split(",");
boolean isAtLeastOrgExisted = false;
for (String selectedOrgId : selectedOrgIds) {
if (orgIds.contains(selectedOrgId)) {
isAtLeastOrgExisted = true;
}
}
if (isAtLeastOrgExisted || rule.getIsDefault()) {
filterRules.add(rule);
}
}
if (isAtLeastOrgExisted || rule.getIsDefault()) {
filterRules.add(rule);
}
}
......@@ -65,7 +64,9 @@ public class RuleEngineeConfigServiceImpl extends AbstractService {
for (TaxPayerReportRule rule : filterRules) {
TaxPayerReportRuleDto ruleDto = new TaxPayerReportRuleDto();
CommonUtils.copyProperties(rule, ruleDto);
ruleDto.setOrgs(new ArrayList<>(Arrays.asList(rule.getOrganizationId().split(","))));
if(rule.getOrganizationId()!=null) {
ruleDto.setOrgs(new ArrayList<>(Arrays.asList(rule.getOrganizationId().split(","))));
}
dtoList.add(ruleDto);
}
return dtoList;
......@@ -128,16 +129,17 @@ public class RuleEngineeConfigServiceImpl extends AbstractService {
sb.append(s).append(",");
}
String tempStr = sb.toString();
taxPayerReportRule.setOrganizationId(tempStr.substring(0, tempStr.length() - 2));
taxPayerReportRule.setOrganizationId(tempStr.substring(0, tempStr.length() - 1));
taxPayerReportRule.setCreateTime(new Date());
taxPayerReportRule.setUpdateTime(new Date());
SaveOrganizationServiceTemplateGroup(taxPayerReportRule, tprrdo.getAction());
if ("Add".equals(tprrdo.getAction())) {
taxPayerReportRule.setId(distributedIdService.nextId());
taxPayerReportRuleMapper.insert(taxPayerReportRule);
// operationService.addDataAddLog(taxPayerReportRule, OperationModule.RuleEngineConfig, authUserHelper.getCurrentUserId(),
// "AddRuleEngineConfiguration", "纳税类型", "纳税类型添加特殊机构", OperateLogType.OperationLogRuleEngine);
} else if ("Update".equals(tprrdo.getAction())) {
TaxPayerReportRule old = taxPayerReportRuleMapper.selectByPrimaryKey(reportDto.getId());
TaxPayerReportRule old = taxPayerReportRuleMapper.selectByPrimaryKey(Long.parseLong(reportDto.getId()));
TaxPayerReportRule original = new TaxPayerReportRule();
CommonUtils.copyProperties(old, original);
......
......@@ -34,7 +34,7 @@
state = itemState.Modified;
}
if (originalItem.templateGroupID !== updatedItem.templateGroupID) {
if (originalItem.templateGroupId !== updatedItem.templateGroupId) {
state = itemState.Modified;
}
......
......@@ -20,7 +20,7 @@
}))[0];
if($scope.defaultTaxPayerReportMapping){
$scope.defaultTaxPayerReportMapping.templateGroupID = $scope.defaultTaxPayerReportMapping.templateGroupID.toString();
$scope.defaultTaxPayerReportMapping.templateGroupId = $scope.defaultTaxPayerReportMapping.templateGroupId.toString();
}
$scope.taxPayerReportMappingExceptions = taxPayerReportMappings.filter(function (item) {
......@@ -28,11 +28,11 @@
});
$scope.taxPayerReportMappingExceptions.forEach(function (value) {
value.templateGroupID = value.templateGroupID.toString();
value.templateGroupId = value.templateGroupId.toString();
});
taxReportRuleOrginal.forEach(function (value) {
value.templateGroupID = value.templateGroupID.toString();
value.templateGroupId = value.templateGroupId.toString();
});
});
......@@ -111,7 +111,7 @@
$scope.defaultReportTypeOption = {
bindingOptions: {
value: 'defaultTaxPayerReportMapping.templateGroupID',
value: 'defaultTaxPayerReportMapping.templateGroupId',
dataSource: {
deep: true,
dataPath: 'reportTypes'
......
......@@ -29,7 +29,7 @@
});
scope.addException = function () {
var newException = { id: PWC.newGuid(), GroupName: scope.editModel.groupName, name: scope.editModel.name, isNotPersistent: true, taxBase: '', editKey: +new Date() };
var newException = { id: 0, GroupName: scope.editModel.groupName, name: scope.editModel.name, isNotPersistent: true, taxBase: '', editKey: +new Date() };
scope.editModel.taxRuleSettingsExceptions.push(newException);
};
......
......@@ -32,7 +32,7 @@
};
scope.addException = function () {
var newException = { id: PWC.newGuid(),isNotPersistent: true, editKey: +new Date() };
var newException = { id: 0,isNotPersistent: true, editKey: +new Date() };
ruleEngineOp.addTaxPayerReportRuleOperation(newException);
scope.taxPayerExceptions.push(newException);
};
......
......@@ -7007,7 +7007,7 @@ systemConfigurationModule.factory('ruleEngineComparer', ['ruleEngineService', fu
state = itemState.Modified;
}
if (originalItem.templateGroupID !== updatedItem.templateGroupID) {
if (originalItem.templateGroupId !== updatedItem.templateGroupId) {
state = itemState.Modified;
}
......@@ -7268,7 +7268,7 @@ systemConfigurationModule.controller('ruleEngineeConfigController', ['$scope', '
}))[0];
if($scope.defaultTaxPayerReportMapping){
$scope.defaultTaxPayerReportMapping.templateGroupID = $scope.defaultTaxPayerReportMapping.templateGroupID.toString();
$scope.defaultTaxPayerReportMapping.templateGroupId = $scope.defaultTaxPayerReportMapping.templateGroupId.toString();
}
$scope.taxPayerReportMappingExceptions = taxPayerReportMappings.filter(function (item) {
......@@ -7276,11 +7276,11 @@ systemConfigurationModule.controller('ruleEngineeConfigController', ['$scope', '
});
$scope.taxPayerReportMappingExceptions.forEach(function (value) {
value.templateGroupID = value.templateGroupID.toString();
value.templateGroupId = value.templateGroupId.toString();
});
taxReportRuleOrginal.forEach(function (value) {
value.templateGroupID = value.templateGroupID.toString();
value.templateGroupId = value.templateGroupId.toString();
});
});
......@@ -7359,7 +7359,7 @@ systemConfigurationModule.controller('ruleEngineeConfigController', ['$scope', '
$scope.defaultReportTypeOption = {
bindingOptions: {
value: 'defaultTaxPayerReportMapping.templateGroupID',
value: 'defaultTaxPayerReportMapping.templateGroupId',
dataSource: {
deep: true,
dataPath: 'reportTypes'
......@@ -7667,7 +7667,7 @@ systemConfigurationModule.directive('ruleEngineeTable', ['$log','ruleEngineOp','
});
scope.addException = function () {
var newException = { id: PWC.newGuid(), GroupName: scope.editModel.groupName, name: scope.editModel.name, isNotPersistent: true, taxBase: '', editKey: +new Date() };
var newException = { id: 0, GroupName: scope.editModel.groupName, name: scope.editModel.name, isNotPersistent: true, taxBase: '', editKey: +new Date() };
scope.editModel.taxRuleSettingsExceptions.push(newException);
};
......@@ -7725,7 +7725,7 @@ systemConfigurationModule.directive('taxpayerTypeExceptionsTable', ['$log','rule
};
scope.addException = function () {
var newException = { id: PWC.newGuid(),isNotPersistent: true, editKey: +new Date() };
var newException = { id: 0,isNotPersistent: true, editKey: +new Date() };
ruleEngineOp.addTaxPayerReportRuleOperation(newException);
scope.taxPayerExceptions.push(newException);
};
......
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