Commit 1f74d0af authored by Cheng C Yang's avatar Cheng C Yang

Bug 23451

parent f6a94285
......@@ -34,8 +34,7 @@ public class RevenueConfController extends BaseController {
@PostMapping("add")
public ApiResultDto addConf(@RequestBody RevConfAddDto addDto) {
revenueConfService.addConfig(addDto);
return ApiResultDto.success();
return revenueConfService.addConfig(addDto);
}
@PostMapping("update")
......
......@@ -8,6 +8,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfResult;
......@@ -71,14 +72,28 @@ public class RevenueConfService extends BaseService {
*
* @param addDto RevConfAddDto
*/
public void addConfig(RevConfAddDto addDto) {
public ApiResultDto addConfig(RevConfAddDto addDto) {
RevenueConfigExample revenueConfigExample = new RevenueConfigExample();
revenueConfigExample.createCriteria().andNameEqualTo(addDto.getName());
List<RevenueConfig> list = revenueConfigMapper.selectByExample(revenueConfigExample);
if (list.size() > 0) {
ApiResultDto apiResultDto = ApiResultDto.success();
apiResultDto.setMessage("DuplicateName");
return apiResultDto;
}
if (!CollectionUtils.isEmpty(addDto.getOrgList())) {
addDto.getOrgList().forEach(id -> {
addDto.setId(idService.nextId());
addDto.setOrgId(id);
revenueConfigMapper.insertSelective(parseEntity(addDto));
});
return ApiResultDto.success();
}
return ApiResultDto.fail();
}
/**
......
......@@ -1985,6 +1985,7 @@
"FileExportFailed": "File Export Failed",
"InputAllMandatoryInfo": "Please Input All The Mandatory Information",
"NameShouldUniqueWarn": "Name Should Be Unique",
"~MustBeEndOneApp": "I Must be the End One, please!"
}
\ No newline at end of file
......@@ -2297,6 +2297,8 @@
"uploadProfileTable": "上传利润表",
"InputAllMandatoryInfo": "请输入所有必填信息",
"NameShouldUniqueWarn": "收入类型名称应当唯一",
"~MustBeEndOneApp": "我必须是最后一个!"
}
\ No newline at end of file
......@@ -28,9 +28,9 @@ controller('addExistDimensionModalController', ['$scope', '$log', '$translate',
$scope.$watch('operateType', function (newValue, oldValue) {
if (newValue) {
if (newValue == constant.Operation.Add) {
if (newValue === constant.Operation.Add) {
showModal();
} else if (newValue == constant.Operation.Edit) {
} else if (newValue === constant.Operation.Edit) {
}
}
......
......@@ -178,7 +178,7 @@
$scope.formParam.status === undefined ||
$scope.formParam.startDate === undefined ||
$scope.formParam.endDate === undefined) {
SweetAlert.warning("InputAllMandatoryInfo");
SweetAlert.warning($translate.instant("InputAllMandatoryInfo"));
return;
}
......@@ -186,6 +186,10 @@
$http.post('/revenueConf/update', $scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
if(res.message === "DuplicateName"){
SweetAlert.success($translate.instant('NameShouldUniqueWarn'));
return;
}
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
......@@ -198,6 +202,10 @@
$http.post('/revenueConf/add', $scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
if(res.message === "DuplicateName"){
SweetAlert.success($translate.instant('NameShouldUniqueWarn'));
return;
}
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
......
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