Commit 486c2277 authored by frank.xa.zhang's avatar frank.xa.zhang

add modified function for org and director and shareholder -- frank

parent d1ff2b67
......@@ -6,9 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.navtree.NavTreeDto;
import pwc.taxtech.atms.organization.dpo.OrganizationDirectorDto;
import pwc.taxtech.atms.organization.dpo.OrganizationHKDto;
import pwc.taxtech.atms.organization.dpo.OrganizationShareholderDto;
import pwc.taxtech.atms.organization.entity.OrganizationDirector;
import pwc.taxtech.atms.organization.entity.OrganizationHK;
import pwc.taxtech.atms.organization.entity.OrganizationShareholder;
import pwc.taxtech.atms.service.impl.OrganizationHKServiceImpl;
......@@ -25,7 +26,7 @@ public class OrganizationHKController {
@RequestMapping(value = "getOrgInfoList", method = RequestMethod.GET)
public @ResponseBody
List<OrganizationHK> getOrgInfoList() {
List<OrganizationHKDto> getOrgInfoList() {
logger.info("GET /api/v1/orgHK/getOrgInfoList");
return organizationHKService.getOrgInfo();
}
......@@ -99,4 +100,16 @@ public class OrganizationHKController {
logger.info("PUT /api/v1/orgHK/updateShareholder");
return organizationHKService.updateShareholder(organizationShareholder);
}
@RequestMapping(value = "updateDirectors" ,method=RequestMethod.POST)
public @ResponseBody OperationResultDto<Object> updateDirectors(@RequestBody List<OrganizationDirectorDto> organizationDirectorDtos){
logger.info("POST /api/v1/orgHK/updateDirectors");
return organizationHKService.updateDirectors(organizationDirectorDtos);
}
@RequestMapping(value = "updateShareholders" ,method=RequestMethod.POST)
public @ResponseBody OperationResultDto<Object> updateShareholders(@RequestBody List<OrganizationShareholderDto> organizationShareholderDtos){
logger.info("POST /api/v1/orgHK/updateShareholders");
return organizationHKService.updateShareholders(organizationShareholderDtos);
}
}
......@@ -20,14 +20,16 @@ import pwc.taxtech.atms.entity.ServiceType;
import pwc.taxtech.atms.organization.dao.OrganizationDirectorMapper;
import pwc.taxtech.atms.organization.dao.OrganizationHKMapper;
import pwc.taxtech.atms.organization.dao.OrganizationShareholderMapper;
import pwc.taxtech.atms.organization.dpo.OrganizationDirectorDto;
import pwc.taxtech.atms.organization.dpo.OrganizationHKDto;
import pwc.taxtech.atms.organization.entity.OrganizationDirector;
import pwc.taxtech.atms.organization.entity.OrganizationHK;
import pwc.taxtech.atms.organization.entity.OrganizationHKExample;
import pwc.taxtech.atms.organization.entity.OrganizationShareholder;
import pwc.taxtech.atms.organization.dpo.OrganizationShareholderDto;
import pwc.taxtech.atms.organization.entity.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.CommonConstants.SystemError;
......@@ -58,8 +60,20 @@ public class OrganizationHKServiceImpl {
@Autowired
private BeanUtil beanUtil;
public List<OrganizationHK> getOrgInfo() {
return organizationHKMapper.selectByExample(null);
public List<OrganizationHKDto> getOrgInfo() {
List<OrganizationHKDto> organizationHKDtos = new ArrayList<>();
List<OrganizationHK> organizationHKS = organizationHKMapper.selectByExample(null);
List<OrganizationShareholder> organizationShareholders = organizationShareholderMapper.selectByExample(null);
List<OrganizationDirector> organizationDirectors = organizationDirectorMapper.selectByExample(null);
organizationHKS.forEach(a -> {
OrganizationHKDto organizationHKDto = CommonUtils.copyProperties(a, new OrganizationHKDto());
List<OrganizationShareholderDto> tempShareholders = organizationShareholders.stream().filter(b -> b.getEntityId().equals(a.getId())).map(b -> CommonUtils.copyProperties(b, new OrganizationShareholderDto())).collect(Collectors.toList());
List<OrganizationDirectorDto> tempDirectors = organizationDirectors.stream().filter(c -> c.getEntityId().equals(a.getId())).map(c -> CommonUtils.copyProperties(c, new OrganizationDirectorDto())).collect(Collectors.toList());
organizationHKDto.setShareholders(tempShareholders);
organizationHKDto.setDirectors(tempDirectors);
organizationHKDtos.add(organizationHKDto);
});
return organizationHKDtos;
}
public OperationResultDto enableOrgs(Long orgId) {
......@@ -128,7 +142,7 @@ public class OrganizationHKServiceImpl {
orgOriginal = CommonUtils.copyProperties(org, orgOriginal);
// code唯一验证
beanUtil.copyProperties(orgDto, org);
CommonUtils.copyProperties(orgDto, org);
org.setUpdateTime(new Date());
OrganizationHK orgUpdate = org;
organizationHKMapper.updateByPrimaryKeySelective(org);
......@@ -238,14 +252,22 @@ public class OrganizationHKServiceImpl {
Assert.notNull(result,
"result is null");
result.setLevel(result.getLevel() == null ? 0 : result.getLevel());
if (result.getParentId() == 0) {
// if (result.getParentId() == 0) {
result.setParentName("");
} else {
OrganizationHK tParent = organizationHKMapper.selectByExample(null).stream()
.filter(sa -> Objects.equals(sa.getId(), result.getParentId())).findFirst().orElse(null);
Assert.notNull(tParent, "tParent is null");
result.setParentName(tParent.getName());
}
// } else {
// OrganizationHK tParent = organizationHKMapper.selectByExample(null).stream()
// .filter(sa -> Objects.equals(sa.getId(), result.getParentId())).findFirst().orElse(null);
// Assert.notNull(tParent, "tParent is null");
// result.setParentName(tParent.getName());
// }
OrganizationShareholderExample shareholderExample = new OrganizationShareholderExample();
shareholderExample.createCriteria().andEntityIdEqualTo(orgId);
List<OrganizationShareholderDto> organizationShareholderDtos = organizationShareholderMapper.selectByExample(shareholderExample).stream().map(a -> CommonUtils.copyProperties(a, new OrganizationShareholderDto())).collect(Collectors.toList());
OrganizationDirectorExample directorExample = new OrganizationDirectorExample();
directorExample.createCriteria().andEntityIdEqualTo(orgId);
List<OrganizationDirectorDto> organizationDirectorDtos = organizationDirectorMapper.selectByExample(directorExample).stream().map(a -> CommonUtils.copyProperties(a, new OrganizationDirectorDto())).collect(Collectors.toList());
result.setDirectors(organizationDirectorDtos);
result.setShareholders(organizationShareholderDtos);
return result;
}
......@@ -264,7 +286,7 @@ public class OrganizationHKServiceImpl {
org.setUpdateTime(now);
if (orgDto.getDirectors() != null && orgDto.getDirectors().size() > 0) {
orgDto.getDirectors().forEach(a -> {
OrganizationDirector organizationDirector = beanUtil.copyProperties(a, new OrganizationDirector());
OrganizationDirector organizationDirector = CommonUtils.copyProperties(a, new OrganizationDirector());
organizationDirector.setUpdateTime(now);
organizationDirector.setCreateTime(now);
organizationDirector.setEntityId(org.getId());
......@@ -274,7 +296,7 @@ public class OrganizationHKServiceImpl {
}
if (orgDto.getShareholders() != null && orgDto.getShareholders().size() > 0) {
orgDto.getShareholders().forEach(a -> {
OrganizationShareholder organizationShareholder = beanUtil.copyProperties(a, new OrganizationShareholder());
OrganizationShareholder organizationShareholder = CommonUtils.copyProperties(a, new OrganizationShareholder());
organizationShareholder.setId(distributedIdService.nextId());
organizationShareholder.setInvestmentEntityId(0L);
organizationShareholder.setEntityId(org.getId());
......@@ -392,4 +414,59 @@ public class OrganizationHKServiceImpl {
OrganizationDirector organizationDirector = organizationDirectorMapper.selectByPrimaryKey(organizationDirectorId);
return organizationDirector != null;
}
public OperationResultDto<Object> updateDirectors(List<OrganizationDirectorDto> organizationDirectorDtos) {
OperationResultDto<Object> resultDto = new OperationResultDto<>();
organizationDirectorDtos.forEach(a -> {
OrganizationDirector organizationDirector;
try {
organizationDirector = CommonUtils.copyProperties(a, new OrganizationDirector());
} catch (Exception ex) {
organizationDirector = new OrganizationDirector();
organizationDirector.setDirectorName(a.getDirectorName());
organizationDirector.setDateOfAppointment(new Date(a.getDateOfAppointment()));
organizationDirector.setDateOfResignation(new Date(a.getDateOfResignation()));
organizationDirector.setResidency(a.getResidency());
organizationDirector.setEntityId(Long.valueOf(a.getEntityId()));
}
if (organizationDirector.getId() != null) {
organizationDirectorMapper.deleteByPrimaryKey(organizationDirector.getId());
}
Date now = new Date();
organizationDirector.setId(distributedIdService.nextId());
organizationDirector.setCreateTime(now);
organizationDirector.setUpdateTime(now);
organizationDirectorMapper.insertSelective(organizationDirector);
});
resultDto.setResult(true);
return resultDto;
}
public OperationResultDto<Object> updateShareholders(List<OrganizationShareholderDto> organizationShareholderDtos) {
OperationResultDto<Object> resultDto = new OperationResultDto<>();
organizationShareholderDtos.forEach(a -> {
OrganizationShareholder organizationShareholder;
try {
organizationShareholder = CommonUtils.copyProperties(a, new OrganizationShareholder());
} catch (Exception ex) {
organizationShareholder = new OrganizationShareholder();
organizationShareholder.setEntityId(Long.valueOf(a.getEntityId()));
// organizationShareholder.setClassOfShares(Byte.valueOf(a.getClassOfShares()));
// organizationShareholder.setInvestmentEntityId(Long.valueOf(a.getInvestmentEntityId()));
// organizationShareholder.setCommonPreferred(Boolean.valueOf(a.getCommonPreferred()));
// organizationShareholder.setOwnershipForm(Byte.valueOf(a.getOwnershipForm()));
organizationShareholder.setVotingPercentage(a.getVotingPercentage());
}
if (organizationShareholder.getId() != null) {
organizationShareholderMapper.deleteByPrimaryKey(organizationShareholder.getId());
}
organizationShareholder.setId(distributedIdService.nextId());
Date now = new Date();
organizationShareholder.setUpdateTime(now);
organizationShareholder.setCreateTime(now);
organizationShareholderMapper.insertSelective(organizationShareholder);
});
resultDto.setResult(true);
return resultDto;
}
}
......@@ -106,7 +106,7 @@
{{'ChartInfo' | translate}}
</md-nav-item>
</md-nav-bar>
<div class="ext-content">
<div class="ext-content" style="height:535px;margin-top: 10px">
<div ng-show="currentNavItem==='page1'" class="org-basic-data-table">
<div class="basic-org-info-wrapper">
<div class="right-option">
......@@ -326,8 +326,8 @@
</div>
<!--Direcotr information-->
<div class="label-director">
<label class="basic-label" style="font-weight: bold;font-size: large;">{{'DirectorInfo' | translate}}</label>
<div class="label-director" style="height: 54px;">
<label class="basic-label" style="font-weight: bold;font-size: large;margin-top: 33px">{{'DirectorInfo' | translate}}</label>
</div>
<div class="right-option">
<button type="button" class="btn btn-in-grid" style="width: 117px;"
......@@ -385,10 +385,9 @@
</div>
<operate-log is-show="isShowLog"></operate-log>
<edit-organization-modal is-show="showEditModal" parent-page=".system-manage" operate-type="orgOperateType" is-update="isOrgUpdate"
selected-organization="selectedOrg" dimension-id="showAttributeDimensionID"></edit-organization-modal>
<!--<edit-organization-shareholder-modal is-show-s="isShowShareholderModal2" parent-page=".system-manage" edit-model=""></edit-organization-shareholder-modal>-->
<!--<edit-organization-director-modal is-show-d="isShowDirectorModal2" parent-page=".system-manage" edit-model=""></edit-organization-director-modal>-->
<edit-organization-modal is-show="showEditModal" parent-page=".system-manage" operate-type="orgOperateType" is-update="isOrgUpdate" selected-organization="selectedOrg"></edit-organization-modal>
<edit-organization-shareholder-modal is-show-s="isShowShareholderModal2" parent-page=".system-manage" edit-model-s="gModel.editShareholderModel" on-close="closeSharehoder2()" on-save="saveShareholder2(shareholderEntity)"></edit-organization-shareholder-modal>
<edit-organization-director-modal is-show-d="isShowDirectorModal2" parent-page=".system-manage" edit-model-d="gModel.editDirectorModel" on-close="closeDirector2()" on-save="saveDirector2(directorEntity)"></edit-organization-director-modal>
<!--<edit-equity-modal operate-type="equityEditOperateType" is-update="isEquityUpdate"-->
<!--selected-organization="selectedOrg"></edit-equity-modal>-->
<!--<edit-equity-change-modal operate-type="equityChangeOperateType" is-update="isEquityChange"-->
......
......@@ -178,8 +178,10 @@ commonModule.controller('editOrganizationDirectorModalController', ['$scope', '$
initWatches: function () {
$scope.$watch('isShowD', function (newValue) {
if (newValue) {
if($scope.$parent.$parent.gModel) {
console.log($scope.$parent.$parent.gModel.editDirectorModel);
$scope.editModelD= $scope.$parent.$parent.gModel.editDirectorModel;
$scope.editModelD = $scope.$parent.$parent.gModel.editDirectorModel;
}
$scope.modalManage.directorModal.open();
}
});
......
......@@ -163,12 +163,12 @@
refreshOrg();
$scope.isShowBasic = false;
$scope.orgControlForm.$setPristine();
// $scope.orgControlForm.$setPristine();
if (!orgId) {
orgId = $scope.selectCompany.id;
}
$("#selectedOrgName-error").hide();
// $("#selectedOrgName-error").hide();
$scope.isAdd = false;
$scope.orgHasAccountMapping = false;
orgHKService.getSingleOrg(orgId).success(function (orgData) {
......@@ -288,9 +288,9 @@
// add
newOrg();
} else if (newValue == constant.Operation.Edit) {
if ($scope.selectedOrganization) {
loadOrg($scope.selectedOrganization.id);
}
// if ($scope.selectedOrganization) {
// loadOrg($scope.selectedOrganization.id);
// }
}
}
});
......@@ -362,7 +362,7 @@
bindingOptions: {
dataSource: 'shareholderDatasource'
},
height:150,
height: 150,
showBorders: true,
paging: {
pageSize: constant.page.logPageSize
......@@ -476,7 +476,7 @@
bindingOptions: {
dataSource: 'directorDatasource'
},
height:160,
height: 160,
showBorders: true,
paging: {
pageSize: constant.page.logPageSize
......@@ -596,7 +596,7 @@
value: 'editOrgModel.legalForm'
},
onSelectionChanged: function (args) {
$scope.editOrgModel.legalForm = args.selectedItem.id;
// $scope.editOrgModel.legalForm = args.selectedItem.id;
},
itemTemplate: function (itemData, itemIndex, itemElement) {
var span = $('<span title="' + itemData.name + '">').text(itemData.name);
......@@ -647,7 +647,7 @@
value: 'editOrgModel.entityLevel'
},
onSelectionChanged: function (args) {
$scope.editOrgModel.entityLevel = args.selectedItem.id;
// $scope.editOrgModel.entityLevel = args.selectedItem.id;
},
itemTemplate: function (itemData, itemIndex, itemElement) {
var span = $('<span title="' + itemData.name + '">').text(itemData.name);
......@@ -663,7 +663,7 @@
value: 'editOrgModel.jurisdictionOfFormation'
},
onSelectionChanged: function (args) {
$scope.editOrgModel.jurisdictionOfFormation = args.selectedItem.id;
// $scope.editOrgModel.jurisdictionOfFormation = args.selectedItem.id;
},
itemTemplate: function (itemData, itemIndex, itemElement) {
var span = $('<span title="' + itemData.name + '">').text(itemData.name);
......@@ -693,7 +693,7 @@
value: 'editOrgModel.ownershipFormType'
},
onSelectionChanged: function (args) {
$scope.editOrgModel.ownershipFormType = args.selectedItem.id;
// $scope.editOrgModel.ownershipFormType = args.selectedItem.id;
},
itemTemplate: function (itemData, itemIndex, itemElement) {
var span = $('<span title="' + itemData.name + '">').text(itemData.name);
......@@ -926,11 +926,17 @@
$scope.$watch('isShow', function (newValue, oldValue) {
if (newValue) {
$scope.modalManage.editOrgModal.open();
if ($scope.isAdd) {
$scope.editOrgModel = {};
$scope.selectCompany = {};
$scope.directorDatasource = [];
$scope.shareholderDatasource = [];
}
else {
$scope.editOrgModel = $scope.selectedOrganization;
$scope.selectCompany = $scope.selectedOrganization;
}
}
});
(function initialize() {
......@@ -940,4 +946,5 @@
initParams();
})();
}
]);
])
;
......@@ -175,10 +175,13 @@ commonModule.controller('editOrganizationShareholderModalController', ['$scope',
},
initWatches: function () {
$scope.$watch('isShowS', function (newValue, oldValue) {
$scope.$watch('isShowS', function (newValue) {
if (newValue) {
if ($scope.$parent.$parent.gModel) {
console.log($scope.$parent.$parent.gModel.editShareholderModel);
$scope.editModelS= $scope.$parent.$parent.gModel.editShareholderModel;
$scope.editModelS = $scope.$parent.$parent.gModel.editShareholderModel;
}
$scope.modalManage.shareholderModal.open();
}
});
......@@ -187,7 +190,7 @@ commonModule.controller('editOrganizationShareholderModalController', ['$scope',
(function initialize() {
$log.debug('editOrganizationShareholderModalController.ctor()...');
$scope.editModelS={};
$scope.editModelS = {};
initParams();
init();
thisModuleService.initWatches();
......
......@@ -34,6 +34,12 @@ webservices.factory('orgHKService', ['$http', 'apiConfig', function ($http, apiC
},
updateShareholder: function (orgShareholder) {
return $http.put('/orgHK/updateShareholder', orgShareholder, apiConfig.create());
},
updateDirectors: function (orgDirectors) {
return $http.post('/orgHK/updateDirectors', orgDirectors, apiConfig.create());
},
updateShareholders: function (orgShareholders) {
return $http.post('/orgHK/updateShareholders', orgShareholders, apiConfig.create());
}
}
}]);
\ No newline at end of file
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