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