Commit 30a6d8cd authored by frank.xa.zhang's avatar frank.xa.zhang

fixed shareholder structure -- frank

parent 943fbc69
......@@ -196,4 +196,10 @@ public class OrganizationHKController {
return organizationHKService.deleteShareholder(id);
}
@RequestMapping(value = "deleteDirector",method =RequestMethod.DELETE)
public @ResponseBody OperationResultDto deleteDirector(@RequestParam("id")Long id){
logger.info("GET /api/v1/orgHK/deleteDirector");
return organizationHKService.deleteDirector(id);
}
}
......@@ -97,7 +97,7 @@ public class OrganizationHKServiceImpl {
public List<OrganizationHKDto> getOrgInfo() {
List<OrganizationHKDto> organizationHKDtos = new ArrayList<>();
OrganizationHKExample organizationHKExample =new OrganizationHKExample();
OrganizationHKExample organizationHKExample = new OrganizationHKExample();
organizationHKExample.createCriteria().andIsActiveEqualTo(true);
List<OrganizationHK> organizationHKS = organizationHKMapper.selectByExample(organizationHKExample);
OrganizationShareholderExample organizationShareholderExample = new OrganizationShareholderExample();
......@@ -304,7 +304,7 @@ public class OrganizationHKServiceImpl {
public OrganizationHKDto getSingleOrgByOrgId(Long orgId) {
OrganizationHK organizationHK = organizationHKMapper.selectByPrimaryKey(orgId);
OrganizationHKDto result =organizationHKTMapper.toOrganizationHKDto(organizationHK);
OrganizationHKDto result = organizationHKTMapper.toOrganizationHKDto(organizationHK);
Assert.notNull(result, "result is null");
result.setLevel(result.getLevel() == null ? 0 : result.getLevel());
result.setParentName("");
......@@ -482,27 +482,24 @@ public class OrganizationHKServiceImpl {
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()));
}
OrganizationDirector organizationDirector = organizationDirectorTMapper.toOrganizationDirector(a);
Date now = new Date();
if (organizationDirector.getId() != null) {
organizationDirectorMapper.deleteByPrimaryKey(organizationDirector.getId());
organizationDirector.setUpdateTime(now);
organizationDirectorMapper.updateByPrimaryKeySelective(organizationDirector);
} else {
organizationDirector.setId(distributedIdService.nextId());
organizationDirector.setCreateTime(now);
organizationDirector.setUpdateTime(now);
organizationDirectorMapper.insertSelective(organizationDirector);
}
Date now = new Date();
organizationDirector.setId(distributedIdService.nextId());
organizationDirector.setCreateTime(now);
organizationDirector.setUpdateTime(now);
organizationDirectorMapper.insertSelective(organizationDirector);
});
OrganizationDirectorExample organizationDirectorExample = new OrganizationDirectorExample();
organizationDirectorExample.createCriteria().andEntityIdEqualTo(Long.valueOf(organizationDirectorDtos.get(0).getEntityId())).andIsDeleteEqualTo(false);
List<OrganizationDirector> organizationDirectors = organizationDirectorMapper.selectByExample(organizationDirectorExample);
List<OrganizationDirectorDto> organizationDirectorDtoList = organizationDirectors.stream().map(organizationDirectorTMapper::toOrganizationDirectorDto).collect(Collectors.toList());
resultDto.setResult(true);
resultDto.setData(organizationDirectorDtoList);
return resultDto;
}
......@@ -660,6 +657,7 @@ public class OrganizationHKServiceImpl {
orgShareholderTreeDataDto.setPercent(shareholderDto.getVotingPercentage());
// orgShareholderTreeDataDto.setPid(shareholderDtos.size() + 1);
orgShareholderTreeDataDto.setSpids(Collections.emptyList());
orgShareholderTreeDataDto.setIsMiddleNode(false);
orgShareholderTreeDataDtos.add(orgShareholderTreeDataDto);
if (i > 1) {
parentIds.add(i);
......@@ -668,6 +666,7 @@ public class OrganizationHKServiceImpl {
}
//todo: add organization node
OrgShareholderTreeDataDto treeDataDto = new OrgShareholderTreeDataDto();
int middleNodeId = i;
treeDataDto.setId(i);
treeDataDto.setName(organizationHK.getName());
treeDataDto.setPercent("");
......@@ -676,16 +675,19 @@ public class OrganizationHKServiceImpl {
treeDataDto.setSpids(parentIds);
}
i++;
treeDataDto.setIsMiddleNode(true);
orgShareholderTreeDataDtos.add(treeDataDto);
//todo: add subsidary nodes
for (SubsidaryDto subsidaryDto : subsidaryDtos) {
OrgShareholderTreeDataDto orgShareholderTreeDataDto = new OrgShareholderTreeDataDto();
orgShareholderTreeDataDto.setId(i);
orgShareholderTreeDataDto.setName(subsidaryDto.getEntityName());
orgShareholderTreeDataDto.setPercent(subsidaryDto.getVotingPercentage());
orgShareholderTreeDataDto.setPid(0);
orgShareholderTreeDataDto.setPid(middleNodeId);
orgShareholderTreeDataDto.setSpids(Collections.emptyList());
orgShareholderTreeDataDto.setIsMiddleNode(false);
orgShareholderTreeDataDtos.add(orgShareholderTreeDataDto);
i++;
}
......@@ -706,7 +708,7 @@ public class OrganizationHKServiceImpl {
}
public OperationResultDto deleteShareholder(Long id) {
OperationResultDto resultDto =new OperationResultDto();
OperationResultDto resultDto = new OperationResultDto();
OrganizationShareholder organizationShareholder = organizationShareholderMapper.selectByPrimaryKey(id);
organizationShareholder.setIsDelete(true);
organizationShareholder.setUpdateTime(new Date());
......@@ -714,4 +716,14 @@ public class OrganizationHKServiceImpl {
resultDto.setResult(true);
return resultDto;
}
public OperationResultDto deleteDirector(Long id) {
OperationResultDto resultDto = new OperationResultDto();
OrganizationDirector organizationDirector = organizationDirectorMapper.selectByPrimaryKey(id);
organizationDirector.setIsDelete(true);
organizationDirector.setUpdateTime(new Date());
organizationDirectorMapper.updateByPrimaryKeySelective(organizationDirector);
resultDto.setResult(true);
return resultDto;
}
}
......@@ -15,4 +15,5 @@ public class OrgShareholderTreeDataDto {
String percent;
Integer pid;
List<Integer> spids;
Boolean isMiddleNode;
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ public class OrganizationDirectorDto {
String residency;
String dateOfAppointment;
String dateOfResignation;
String isExecutive;
String otherRoles;
Integer isExecutive;
Integer otherRoles;
String isDelete;
}
package pwc.taxtech.atms.organization.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import pwc.taxtech.atms.organization.dpo.OrgDirectorDto;
import pwc.taxtech.atms.organization.dpo.OrganizationDirectorDto;
......@@ -10,7 +11,13 @@ import pwc.taxtech.atms.organization.entity.OrganizationDirector;
public interface OrganizationDirectorTMapper {
OrganizationDirectorTMapper ORGANIZATION_DIRECTOR_T_MAPPER = Mappers.getMapper(OrganizationDirectorTMapper.class);
@Mapping(source = "dateOfAppointment", target = "dateOfAppointment", dateFormat = "yyyy/MM/dd")
@Mapping(source = "dateOfResignation", target = "dateOfResignation", dateFormat = "yyyy/MM/dd")
OrganizationDirectorDto toOrganizationDirectorDto(OrganizationDirector organizationDirector);
OrgDirectorDto toOrgDirectorDto(OrganizationDirector organizationDirector);
@Mapping(source = "dateOfAppointment", target = "dateOfAppointment", dateFormat = "yyyy/MM/dd")
@Mapping(source = "dateOfResignation", target = "dateOfResignation", dateFormat = "yyyy/MM/dd")
OrganizationDirector toOrganizationDirector(OrganizationDirectorDto organizationDirectorDto);
}
......@@ -16,16 +16,18 @@ commonModule.controller('editOrganizationDirectorModalController', ['$scope', '$
},
close: function () {
$scope.onClose();
$scope.editModelD = {};
$scope.modalInstance.close();
},
cancel: function () {
$scope.onClose();
$scope.editModelD = {};
$scope.modalInstance.cancel();
},
save: function () {
var dxResult = DevExpress.validationEngine.validateGroup($('#directorControlForm').dxValidationGroup("instance")).isValid;
if (dxResult) {
if (!$scope.editModelD.id) {
if (!$scope.editModelD.id && $scope.parentPage !== ".system-manage") {
$scope.editModelD.id = PWC.newGuid();
}
$scope.onSave({directorEntity: $scope.editModelD});
......@@ -84,7 +86,7 @@ commonModule.controller('editOrganizationDirectorModalController', ['$scope', '$
executiveOption: {
bindingOptions: {
dataSource: 'dropdownDatasource.executiveTypeList',
value: 'editModelD.executive'
value: 'editModelD.isExecutive'
},
onSelectionChanged: function (args) {
// $scope.editModel.executive = args.selectedItem.id;
......
......@@ -62,11 +62,14 @@ webservices.factory('orgHKService', ['$http', 'apiConfig', function ($http, apiC
getOrgList: function (type) {
return $http.get('/org/display?useType=' + type, apiConfig.create());
},
getOrgsListInfo:function () {
getOrgsListInfo: function () {
return $http.get('/orgHK/getOrgsListInfo', apiConfig.create());
},
deleteShareholder:function (id) {
return $http.delete('/orgHK/deleteShareholder?id='+id,apiConfig.create());
deleteShareholder: function (id) {
return $http.delete('/orgHK/deleteShareholder?id=' + id, apiConfig.create());
},
deleteDirector: function (id) {
return $http.delete('/orgHK/deleteDirector?id=' + id, 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