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);
}
......@@ -619,7 +619,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll'),
searchPanel: {
......@@ -805,24 +805,44 @@
allowHeaderFiltering: false,
caption: $translate.instant('dateOfAppointment'),
dataType: "date",
format: "yyyy-MM-dd"
format: "yyyy/MM/dd"
},
{
dataField: "dateOfResignation",
allowHeaderFiltering: false,
caption: $translate.instant('dateOfResignation'),
dataType: "date",
format: "yyyy-MM-dd"
format: "yyyy/MM/dd"
},
{
dataField: "executive",
dataField: "isExecutive",
allowHeaderFiltering: false,
caption: $translate.instant('executive'),
calculateDisplayValue: function (data) {
var importType1 = _.find(constant.organizationHK.executiveType, function (item) {
return item.id === data.isExecutive;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "otherRoles",
allowHeaderFiltering: false,
caption: $translate.instant('otherRoles'),
calculateDisplayValue: function (data) {
var importType1 = _.find(constant.organizationHK.OtherRoles, function (item) {
return item.id === data.otherRoles;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "id",
......@@ -857,7 +877,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll'),
searchPanel: {
......@@ -892,7 +912,7 @@
pageSize: constant.page.logPageSize
},
pager: {
showPageSizeSelector: true,
showPageSizeSelector: false,
allowedPageSizes: constant.page.pageSizeArrary,
showInfo: true
},
......@@ -1004,7 +1024,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll'),
searchPanel: {
......@@ -1077,15 +1097,15 @@
};
$scope.saveDirector2 = function (directorEntity) {
var director = _.find($scope.directorDatasource, function (item) {
return item.id === directorEntity.id;
directorEntity.entityId = $scope.selectCompany.id;
var directors = [];
directors.concat($scope.directorDatasource);
directors.push(directorEntity);
orgHKService.updateDirectors(directors).success(function (res) {
if (res && res.result) {
$scope.directorDatasource = res.data;
}
});
if (director) {
$scope.directorDatasource = _.without($scope.directorDatasource, director);
}
$scope.directorDatasource.push(directorEntity);
orgHKService.updateDirectors($scope.directorDatasource);
};
window.editDirector2 = function (id) {
......@@ -1105,9 +1125,10 @@
var director = _.find($scope.directorDatasource, function (item) {
return item.id === id;
});
if (director > 0) {
if (director) {
$scope.directorDatasource = _.without($scope.directorDatasource, director);
}
orgHKService.deleteDirector(id);
};
$scope.attachmentGridOptions = {
......@@ -1165,7 +1186,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll'),
searchPanel: {
......@@ -1243,7 +1264,7 @@
keyExpr: "shareholderName",
columns: [
{
dataField: "shareholderName",
dataField: "entityName",
allowHeaderFiltering: false,
caption: $translate.instant('shareholderName')
},
......@@ -1261,7 +1282,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
......@@ -1275,7 +1296,7 @@
keyExpr: "subsidaryName",
columns: [
{
dataField: "subsidaryName",
dataField: "entityName",
allowHeaderFiltering: false,
caption: $translate.instant('subsidaryName')
},
......@@ -1293,7 +1314,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
......@@ -1325,7 +1346,7 @@
showRowLines: true,
allowColumnReordering: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
// rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll')
};
......@@ -1469,32 +1490,22 @@
$scope.chart = new OrgChart(document.getElementById("tree"), {
template: "myTemplate",
enableSearch: false,
// nodeMenu: {
// add: {text: "Add"},
// edit: {text: "Edit"},
// remove: {text: "Remove"}
// },
menu: {
// pdf: {text: "Export PDF"},
png: {text: "Export PNG"}
// svg: {text: "Export SVG"},
// csv: {text: "Export CSV"}
},
linkBinding: {
link_field_0: "percent"
},
nodeBinding: {
field_0: "name"
// field_1: "title",
// img_0: "img"
},
// nodes: [
// {id: 1, name: "Shareholder1", percent: "100%",spids:[]},
// {id: 1, name: "Shareholder1", percent: "100%", spids: []},
// {id: 2, name: "Shareholder2", percent: "100%"},
// {id: 3, name: "Shareholder3", percent: "100%"},
// {id: 4, pid: 1, spids: [2, 3], name: "Comapny", percent: ""},
// {id: 5, pid: 4, name: "Subsidary1", percent: "100%"},
// // {id: 6, pid: 4, name: "Subsidary2", percent: "100%"}
// {id: 6, pid: 4, name: "Subsidary2", percent: "100%"}
// ],
nodes: nodesCotent,
onExportStart: exportStart,
......@@ -1511,35 +1522,54 @@
//第一次在加载时的元素
initialized = true;
}
// nodesCotentValue = [
// {id: 1, name: "Shareholder1", percent: "100%", spids: []},
// {id: 2, name: "Shareholder2", percent: "100%"},
// {id: 3, name: "Shareholder3", percent: "100%"},
// {id: 4, pid: 1, spids: [2, 3], name: "Comapny", percent: ""},
// {id: 5, pid: 4, name: "Subsidary1", percent: "100%"},
// {id: 6, pid: 4, name: "Subsidary2", percent: "100%"}
// ];
// middleNode = {id: 4, pid: 1, spids: [2, 3], name: "Comapny", percent: "100%"};
if (middleNode && middleNode.id > 0) {
//check if there are more than 1 sub node,need change x coordinate
var subNodes = _.filter(nodesCotentValue, function (item) {
return item.id > middleNode.id;
});
var beforeNodes = _.filter(nodesCotentValue, function (item) {
return item.id < middleNode.id;
});
var haveMoreThanOneNode = false;
if (subNodes.length > 1) {
haveMoreThanOneNode = true;
}
var y = beforeNodes.length > 0 && subNodes.length > 0 ? 346 : 166;
for (var iii = 0; iii < subNodes.length; iii++) {
var value = 80 + 220 * iii;
var nodeSelector = "svg>g[link-id='[" + middleNode.id + "][" + subNodes[iii].id + "]']";
$(nodeSelector + ">g").attr("transform", "matrix(1,0,0,1," + value + "," + y + ") rotate(0)");
$(nodeSelector + ">g>text").text(subNodes[iii].percent + "%");
}
var middleNodeSelector = "svg>g[node-id=" + middleNode.id + "]>rect";
var polygon = makeSVG('polygon', {"points": '100,0 0,100 200,100', style: "fill:#ffff;stroke:#000;stroke-width:1", height: 115, width: 250});
$(middleNodeSelector).css("fill", "transparent").css("stroke-width", 0).after(polygon);
var node = _.find(nodesCotentValue, function (item) {
return item.id === 1;
});
var linkSelector = "svg>g[link-id='[1][" + middleNode.id + "]']";
$(linkSelector + ">g").attr("transform", "matrix(1,0,0,1,80,166) rotate(0)");
// var linkRateG = makeSVG('g', {"transform": "matrix(1,0,0,1,100,166) rotate(0)"});
// $(linkSelector + ">path").after(linkRateG);
var linkXValue = 80;
if (haveMoreThanOneNode) {
linkXValue = linkXValue + 110;
}
$(linkSelector + ">g").attr("transform", "matrix(1,0,0,1," + linkXValue + ",166) rotate(0)");
var linkSelectorG = linkSelector + ">g";
// var linkRateText = makeSVG('text', {"text-anchor": "middle", "fill": "#aeaeae", "width": "290", "x": "0", "y": "0", "style": "font-size:10px"});
// $(linkSelectorG).append(linkRateText);
var linkSelectorGText = linkSelectorG + ">text";
$(linkSelectorGText).text(node.percent + "%");
// var ellipse = makeSVG('ellipse', {"cx": '100', "cy": "50", "rx": "100", "ry": "50", style: "fill:blue;stroke:purple;stroke-width:2", height: 115, width: 250});
// var ellipse1 = makeSVG('ellipse', {"cx": '100', "cy": "50", "rx": "100", "ry": "50", style: "fill:blue;stroke:purple;stroke-width:2", height: 115, width: 250});
// var ellipse2 = makeSVG('ellipse', {"cx": '100', "cy": "50", "rx": "100", "ry": "50", style: "fill:blue;stroke:purple;stroke-width:2", height: 115, width: 250});
// $("svg>g[node-id=4]>rect").after(polygon);
// $("svg>g[node-id=4]>rect").after(ellipse);
// $("svg>g[node-id=5]>rect").after(ellipse1);
// $("svg>g[node-id=6]>rect").after(ellipse2);
// $("svg>g[node-id=5]").attr("transform","matrix(1, 0, 0, 1, 360, 0)");
// $("svg>g[node-id=6]").attr("transform","matrix(1, 0, 0, 1, 590, 0)");
if (middleNode.id > 2) {
var count = 0;
for (var i = 2; i < middleNode.id; i++) {
......@@ -1547,9 +1577,17 @@
return item.id === i;
});
var nodeSelector = "svg>g[second-link-id='[" + middleNode.id + "][" + i + "]']";
var value = 320 + 220 * count;
var value = 0;
var value2 = 0;
if (haveMoreThanOneNode) {
value = 320 + 110 + 220 * count;
value2 = 100 + 110;
} else {
value = 320 + 220 * count;
value2 = 100;
}
$(nodeSelector + ">path").attr("stroke", "#000");
$(nodeSelector + ">path").attr("d", "M100,180 L100,160 L" + value + ",160 L" + value + ",102");
$(nodeSelector + ">path").attr("d", "M" + value2 + ",180 L" + value2 + ",160 L" + value + ",160 L" + value + ",102");
count++;
var val2 = value - 20;
var rateG = makeSVG('g', {"transform": "matrix(1,0,0,1," + val2 + ",128) rotate(0)"});
......@@ -1562,11 +1600,6 @@
}
}
}
// $("svg>g[second-link-id='[4][2]']>path").attr("d", "M210,180 L210,160 L440,160 L440,102");
// $("svg>g[second-link-id='[4][3]']>path").attr("d", "M210,180 L210,160 L660,160 L660,102");
// d: path(" M240 180 L240 160 L680 160 L680 120");
// M100,180 L100,160 L320,160 L320,102
// M100,180 L100,160 L540,160 L540,102
};
var makeSVG = function (tag, attrs) {
......@@ -1599,17 +1632,9 @@
var initOrgChart = function (orgId) {
orgHKService.getOrgTreeData(orgId).success(function (res) {
if (res && res.result) {
if (res.data.length < 3) {
if (res.data.length === 1) {
middleNode = res.data[0];
} else {
middleNode = res.data[1];
}
} else {
middleNode = _.find(res.data, function (node) {
return node.spids && node.spids.length > 0;
});
}
middleNode = _.find(res.data, function (node) {
return node.isMiddleNode;
});
initOrgTree(res.data);
nodesCotentValue = res.data;
}
......@@ -1620,7 +1645,6 @@
$scope.showPage4 = function () {
showPage4 = true;
//todo:get node content @ here
initOrgChart($scope.selectCompany.id);
};
......
......@@ -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