Commit cf13aecd authored by frank.xa.zhang's avatar frank.xa.zhang

fixed shareholder structure -- frank

parent 063c97f5
......@@ -10,10 +10,7 @@ import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.navtree.NavTreeDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.organization.dpo.OrgShareholderTreeDataDto;
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.dpo.*;
import pwc.taxtech.atms.organization.entity.OrganizationDirector;
import pwc.taxtech.atms.organization.entity.OrganizationShareholder;
import pwc.taxtech.atms.service.impl.OrganizationHKServiceImpl;
......@@ -187,4 +184,16 @@ public class OrganizationHKController {
return organizationHKService.getOrgTreeData(orgId);
}
@RequestMapping(value="getOrgsListInfo",method = RequestMethod.GET)
public @ResponseBody OperationResultDto<List<OrgInfoDto>> getOrgsListInfo(){
logger.info("GET /api/v1/orgHK/getOrgsListInfo");
return organizationHKService.getOrgsListInfo();
}
@RequestMapping(value = "deleteShareholder",method = RequestMethod.DELETE)
public @ResponseBody OperationResultDto deleteShareholder(@RequestParam("id")Long id){
logger.info("GET /api/v1/orgHK/deleteShareholder");
return organizationHKService.deleteShareholder(id);
}
}
......@@ -97,9 +97,15 @@ public class OrganizationHKServiceImpl {
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);
OrganizationHKExample organizationHKExample =new OrganizationHKExample();
organizationHKExample.createCriteria().andIsActiveEqualTo(true);
List<OrganizationHK> organizationHKS = organizationHKMapper.selectByExample(organizationHKExample);
OrganizationShareholderExample organizationShareholderExample = new OrganizationShareholderExample();
organizationShareholderExample.createCriteria().andIsDeleteEqualTo(false);
List<OrganizationShareholder> organizationShareholders = organizationShareholderMapper.selectByExample(organizationShareholderExample);
OrganizationDirectorExample organizationDirectorExample = new OrganizationDirectorExample();
organizationDirectorExample.createCriteria().andIsDeleteEqualTo(false);
List<OrganizationDirector> organizationDirectors = organizationDirectorMapper.selectByExample(organizationDirectorExample);
List<OrganizationAttachment> organizationAttachments = organizationAttachmentMapper.selectByExample(null);
organizationHKS.forEach(a -> {
OrganizationHKDto organizationHKDto = organizationHKTMapper.toOrganizationHKDto(a);
......@@ -504,28 +510,24 @@ public class OrganizationHKServiceImpl {
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());
}
OrganizationShareholder organizationShareholder = organizationShareholderTMapper.toOrganizationShareholder(a);
Date now = new Date();
if (organizationShareholder.getId() != null) {
organizationShareholderMapper.deleteByPrimaryKey(organizationShareholder.getId());
organizationShareholder.setUpdateTime(now);
organizationShareholderMapper.updateByPrimaryKeySelective(organizationShareholder);
} else {
organizationShareholder.setId(distributedIdService.nextId());
organizationShareholder.setUpdateTime(now);
organizationShareholder.setCreateTime(now);
organizationShareholderMapper.insertSelective(organizationShareholder);
}
organizationShareholder.setId(distributedIdService.nextId());
Date now = new Date();
organizationShareholder.setUpdateTime(now);
organizationShareholder.setCreateTime(now);
organizationShareholderMapper.insertSelective(organizationShareholder);
});
OrganizationShareholderExample organizationShareholderExample = new OrganizationShareholderExample();
organizationShareholderExample.createCriteria().andEntityIdEqualTo(Long.valueOf(organizationShareholderDtos.get(0).getEntityId())).andIsDeleteEqualTo(false);
List<OrganizationShareholder> organizationShareholders = organizationShareholderMapper.selectByExample(organizationShareholderExample);
List<OrganizationShareholderDto> organizationShareholderDtoList = organizationShareholders.stream().map(organizationShareholderTMapper::toOrgShareholder).collect(Collectors.toList());
resultDto.setResult(true);
resultDto.setData(organizationShareholderDtoList);
return resultDto;
}
......@@ -657,7 +659,7 @@ public class OrganizationHKServiceImpl {
orgShareholderTreeDataDto.setId(i);
orgShareholderTreeDataDto.setName(shareholderDto.getEntityName());
orgShareholderTreeDataDto.setPercent(shareholderDto.getVotingPercentage());
orgShareholderTreeDataDto.setPid(shareholderDtos.size() + 1);
// orgShareholderTreeDataDto.setPid(shareholderDtos.size() + 1);
orgShareholderTreeDataDto.setSpids(Collections.emptyList());
orgShareholderTreeDataDtos.add(orgShareholderTreeDataDto);
if (i > 1) {
......@@ -670,7 +672,7 @@ public class OrganizationHKServiceImpl {
treeDataDto.setId(i);
treeDataDto.setName(organizationHK.getName());
treeDataDto.setPercent("");
if(i>1) {
if (i > 1) {
treeDataDto.setPid(1);
treeDataDto.setSpids(parentIds);
}
......@@ -692,4 +694,25 @@ public class OrganizationHKServiceImpl {
resultDto.setData(orgShareholderTreeDataDtos);
return resultDto;
}
public OperationResultDto<List<OrgInfoDto>> getOrgsListInfo() {
OperationResultDto<List<OrgInfoDto>> resultDto = new OperationResultDto<>();
OrganizationHKExample organizationHKExample = new OrganizationHKExample();
organizationHKExample.createCriteria().andIsActiveEqualTo(true);
List<OrganizationHK> organizationHKS = organizationHKMapper.selectByExample(organizationHKExample);
List<OrgInfoDto> orgInfoDtos = organizationHKS.stream().map(organizationHKTMapper::toOrgInfoDto).collect(Collectors.toList());
resultDto.setResult(true);
resultDto.setData(orgInfoDtos);
return resultDto;
}
public OperationResultDto deleteShareholder(Long id) {
OperationResultDto resultDto =new OperationResultDto();
OrganizationShareholder organizationShareholder = organizationShareholderMapper.selectByPrimaryKey(id);
organizationShareholder.setIsDelete(true);
organizationShareholder.setUpdateTime(new Date());
organizationShareholderMapper.updateByPrimaryKeySelective(organizationShareholder);
resultDto.setResult(true);
return resultDto;
}
}
......@@ -41,24 +41,24 @@
<property name="rootInterface" value="pwc.taxtech.atms.MyMapper"/>
</javaClientGenerator>
<table tableName="organization" domainObjectName="OrganizationHK">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="organization" domainObjectName="OrganizationHK">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--</table>-->
<table tableName="organization_attachment" domainObjectName="OrganizationAttachment">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="organization_attachment" domainObjectName="OrganizationAttachment">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--</table>-->
<table tableName="organization_shareholder" domainObjectName="OrganizationShareholder">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="organization_director" domainObjectName="OrganizationDirector">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="organization_director" domainObjectName="OrganizationDirector">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--</table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
......@@ -11,9 +11,9 @@ import java.util.List;
@Mapper
public interface OrganizationShareholderExtMapper extends MyMapper {
@Select("select a.id, a.investment_entity_id as entityId,b.name,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.investment_entity_id=b.id where entity_id=#{id}")
@Select("select a.id, a.investment_entity_id as entityId,b.name as entityName,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.investment_entity_id=b.id where entity_id=#{id} and a.is_delete=0")
List<ShareholderDto> selectShareholder(Long entityId);
@Select("select a.id, a.entity_id as entityId,b.name,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.entity_id=b.id where investment_entity_id=#{id}")
@Select("select a.id, a.entity_id as entityId,b.name as entityName,a.voting_percentage as votingPercentage from organization_shareholder a left join organization b on a.entity_id=b.id where investment_entity_id=#{id} and a.is_delete=0")
List<SubsidaryDto> selectSubsidary(Long entityId);
}
package pwc.taxtech.atms.organization.dpo;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OrgInfoDto {
String id;
String name;
}
......@@ -13,8 +13,8 @@ public class OrganizationShareholderDto {
String id;
String entityId;
String investmentEntityId;
String ownershipForm;
String commonPreferred;
String classOfShares;
Integer ownershipForm;
Integer commonPreferred;
Integer classOfShares;
String votingPercentage;
}
package pwc.taxtech.atms.organization.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
......@@ -55,7 +56,7 @@ public class OrganizationShareholder extends BaseEntity implements Serializable
*
* @mbg.generated
*/
private Boolean commonPreferred;
private Byte commonPreferred;
/**
*
......@@ -218,7 +219,7 @@ public class OrganizationShareholder extends BaseEntity implements Serializable
*
* @mbg.generated
*/
public Boolean getCommonPreferred() {
public Byte getCommonPreferred() {
return commonPreferred;
}
......@@ -230,7 +231,7 @@ public class OrganizationShareholder extends BaseEntity implements Serializable
*
* @mbg.generated
*/
public void setCommonPreferred(Boolean commonPreferred) {
public void setCommonPreferred(Byte commonPreferred) {
this.commonPreferred = commonPreferred;
}
......
......@@ -445,52 +445,52 @@ public class OrganizationShareholderExample {
return (Criteria) this;
}
public Criteria andCommonPreferredEqualTo(Boolean value) {
public Criteria andCommonPreferredEqualTo(Byte value) {
addCriterion("common_preferred =", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredNotEqualTo(Boolean value) {
public Criteria andCommonPreferredNotEqualTo(Byte value) {
addCriterion("common_preferred <>", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredGreaterThan(Boolean value) {
public Criteria andCommonPreferredGreaterThan(Byte value) {
addCriterion("common_preferred >", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredGreaterThanOrEqualTo(Boolean value) {
public Criteria andCommonPreferredGreaterThanOrEqualTo(Byte value) {
addCriterion("common_preferred >=", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredLessThan(Boolean value) {
public Criteria andCommonPreferredLessThan(Byte value) {
addCriterion("common_preferred <", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredLessThanOrEqualTo(Boolean value) {
public Criteria andCommonPreferredLessThanOrEqualTo(Byte value) {
addCriterion("common_preferred <=", value, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredIn(List<Boolean> values) {
public Criteria andCommonPreferredIn(List<Byte> values) {
addCriterion("common_preferred in", values, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredNotIn(List<Boolean> values) {
public Criteria andCommonPreferredNotIn(List<Byte> values) {
addCriterion("common_preferred not in", values, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredBetween(Boolean value1, Boolean value2) {
public Criteria andCommonPreferredBetween(Byte value1, Byte value2) {
addCriterion("common_preferred between", value1, value2, "commonPreferred");
return (Criteria) this;
}
public Criteria andCommonPreferredNotBetween(Boolean value1, Boolean value2) {
public Criteria andCommonPreferredNotBetween(Byte value1, Byte value2) {
addCriterion("common_preferred not between", value1, value2, "commonPreferred");
return (Criteria) this;
}
......
......@@ -3,6 +3,7 @@ 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.OrgInfoDto;
import pwc.taxtech.atms.organization.dpo.OrganizationHKDto;
import pwc.taxtech.atms.organization.entity.OrganizationHK;
......@@ -14,4 +15,6 @@ public interface OrganizationHKTMapper {
@Mapping(source = "updateTime", target = "updateTime" ,dateFormat = "yyyy/MM/dd")
@Mapping(source = "dateOfIncorporation", target = "dateOfIncorporation" ,dateFormat = "yyyy/MM/dd")
OrganizationHKDto toOrganizationHKDto(OrganizationHK organizationHK);
OrgInfoDto toOrgInfoDto(OrganizationHK organizationHK);
}
......@@ -18,4 +18,6 @@ public interface OrganizationShareholderTMapper {
@Mapping(source = "votingPercentage", target = "percentage")
OrgSubsidaryDto toOrgSubsidaryDto(SubsidaryDto subsidaryDto);
OrganizationShareholder toOrganizationShareholder(OrganizationShareholderDto organizationShareholderDto);
}
......@@ -10,7 +10,7 @@
<result column="entity_id" jdbcType="BIGINT" property="entityId" />
<result column="investment_entity_id" jdbcType="BIGINT" property="investmentEntityId" />
<result column="ownership_form" jdbcType="TINYINT" property="ownershipForm" />
<result column="common_preferred" jdbcType="BIT" property="commonPreferred" />
<result column="common_preferred" jdbcType="TINYINT" property="commonPreferred" />
<result column="class_of_shares" jdbcType="TINYINT" property="classOfShares" />
<result column="voting_percentage" jdbcType="VARCHAR" property="votingPercentage" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
......@@ -147,7 +147,7 @@
voting_percentage, is_delete, create_time,
update_time)
values (#{id,jdbcType=BIGINT}, #{entityId,jdbcType=BIGINT}, #{investmentEntityId,jdbcType=BIGINT},
#{ownershipForm,jdbcType=TINYINT}, #{commonPreferred,jdbcType=BIT}, #{classOfShares,jdbcType=TINYINT},
#{ownershipForm,jdbcType=TINYINT}, #{commonPreferred,jdbcType=TINYINT}, #{classOfShares,jdbcType=TINYINT},
#{votingPercentage,jdbcType=VARCHAR}, #{isDelete,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
......@@ -203,7 +203,7 @@
#{ownershipForm,jdbcType=TINYINT},
</if>
<if test="commonPreferred != null">
#{commonPreferred,jdbcType=BIT},
#{commonPreferred,jdbcType=TINYINT},
</if>
<if test="classOfShares != null">
#{classOfShares,jdbcType=TINYINT},
......@@ -252,7 +252,7 @@
ownership_form = #{record.ownershipForm,jdbcType=TINYINT},
</if>
<if test="record.commonPreferred != null">
common_preferred = #{record.commonPreferred,jdbcType=BIT},
common_preferred = #{record.commonPreferred,jdbcType=TINYINT},
</if>
<if test="record.classOfShares != null">
class_of_shares = #{record.classOfShares,jdbcType=TINYINT},
......@@ -284,7 +284,7 @@
entity_id = #{record.entityId,jdbcType=BIGINT},
investment_entity_id = #{record.investmentEntityId,jdbcType=BIGINT},
ownership_form = #{record.ownershipForm,jdbcType=TINYINT},
common_preferred = #{record.commonPreferred,jdbcType=BIT},
common_preferred = #{record.commonPreferred,jdbcType=TINYINT},
class_of_shares = #{record.classOfShares,jdbcType=TINYINT},
voting_percentage = #{record.votingPercentage,jdbcType=VARCHAR},
is_delete = #{record.isDelete,jdbcType=BIT},
......@@ -311,7 +311,7 @@
ownership_form = #{ownershipForm,jdbcType=TINYINT},
</if>
<if test="commonPreferred != null">
common_preferred = #{commonPreferred,jdbcType=BIT},
common_preferred = #{commonPreferred,jdbcType=TINYINT},
</if>
<if test="classOfShares != null">
class_of_shares = #{classOfShares,jdbcType=TINYINT},
......@@ -340,7 +340,7 @@
set entity_id = #{entityId,jdbcType=BIGINT},
investment_entity_id = #{investmentEntityId,jdbcType=BIGINT},
ownership_form = #{ownershipForm,jdbcType=TINYINT},
common_preferred = #{commonPreferred,jdbcType=BIT},
common_preferred = #{commonPreferred,jdbcType=TINYINT},
class_of_shares = #{classOfShares,jdbcType=TINYINT},
voting_percentage = #{votingPercentage,jdbcType=VARCHAR},
is_delete = #{isDelete,jdbcType=BIT},
......
......@@ -641,6 +641,7 @@
$scope.showOrgs = false;
console.log(org);
$scope.selectCompany = org;
$scope.selectedOrgID = org.id;
$scope.shareholderDatasource = org.shareholders;
$scope.directorDatasource = org.directors;
$scope.attachmentDatasource = org.attachments;
......@@ -819,9 +820,9 @@
caption: $translate.instant('operation'),
cellTemplate: function (container, options) {
try {
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "editDirector2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">modify</i>edit</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "editDirector2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">edit</i>edit</button>&nbsp;&nbsp;')
.appendTo(container);
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "deleteDirector2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "deleteDirector2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
.appendTo(container);
} catch (e) {
$log.error(e);
......@@ -865,6 +866,12 @@
}
};
orgHKService.getOrgsListInfo().success(function (res) {
if (res && res.result) {
$scope.investmentEntityList = res.data;
}
});
$scope.equityGridOptions = {
bindingOptions: {
dataSource: 'shareholderDatasource'
......@@ -882,49 +889,77 @@
keyExpr: "id",
columns: [
{
dataField: "investmentEntity",
dataField: "investmentEntityId",
allowHeaderFiltering: false,
caption: $translate.instant('investmentEntity'),
calculateDisplayValue: function (data) {
// var importType1 = _.find(constant.importTypeList, function (item) {
// return item.value == data.importType;
// });
// if (importType1) {
// return importType1.name;
// } else {
// return '未知';
// }
var importType1 = _.find($scope.investmentEntityList, function (item) {
return item.id === data.investmentEntityId;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "ownershipForm",
allowHeaderFiltering: false,
caption: $translate.instant('ownershipForm'),
calculateDisplayValue: function (data) {
var importType1 = _.find(constant.organizationHK.OwnershipForm, function (item) {
return item.id === data.ownershipForm;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "commonOrPreferred",
dataField: "commonPreferred",
allowHeaderFiltering: false,
caption: $translate.instant('commonOrPreferred'),
calculateDisplayValue: function (data) {
// var importType1 = _.find(constant.importTypeList, function (item) {
// return item.value == data.importType;
// });
// if (importType1) {
// return importType1.name;
// } else {
// return '未知';
// }
var importType1 = _.find(constant.organizationHK.commonOrPreferredType, function (item) {
return item.id === data.commonPreferred;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "classOfShares",
allowHeaderFiltering: false,
caption: $translate.instant('classOfShares'),
calculateDisplayValue: function (data) {
var importType1 = _.find(constant.organizationHK.classOfSharesType, function (item) {
return item.id === data.classOfShares;
});
if (importType1) {
return importType1.name;
} else {
return '未知';
}
}
},
{
dataField: "votingPercentage",
allowHeaderFiltering: false,
caption: $translate.instant('votingPercentage'),
calculateDisplayValue: function (data) {
if (data.votingPercentage) {
return data.votingPercentage + "%";
}
else {
return "0%";
}
}
},
{
dataField: "id",
......@@ -932,9 +967,9 @@
caption: $translate.instant('operation'),
cellTemplate: function (container, options) {
try {
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "editShareholder2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">modify</i>edit</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "editShareholder2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">edit</i>edit</button>&nbsp;&nbsp;&nbsp;&nbsp;')
.appendTo(container);
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "deleteShareholder2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "deleteShareholder2(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
.appendTo(container);
} catch (e) {
$log.error(e);
......@@ -983,38 +1018,48 @@
};
$scope.saveShareholder2 = function (shareholderEntity) {
var shareholder = _.filter($scope.shareholderDatasource, function (item) {
return item.id === shareholderEntity.id;
//todo: validate the value for saving
var findResult = _.find($scope.shareholderDatasource, function (item) {
return item.investmentEntityId === shareholderEntity.investmentEntityId;
});
if (shareholder && shareholder.length > 0) {
$scope.shareholderDatasource = _.without($scope.shareholderDatasource, shareholder[0]);
if (findResult || shareholderEntity.investmentEntityId === $scope.selectCompany.id) {
return "duplicated shareholder added, please change to another one.";
} else {
shareholderEntity.entityId = $scope.selectCompany.id;
var shareholders = [];
shareholders.concat($scope.shareholderDatasource);
shareholders.push(shareholderEntity);
// $scope.shareholderDatasource.push(shareholderEntity);
orgHKService.updateShareholders(shareholders).success(function (res) {
if (res && res.result) {
$scope.shareholderDatasource = res.data;
}
});
}
$scope.shareholderDatasource.push(shareholderEntity);
orgHKService.updateShareholders($scope.shareholderDatasource);
};
window.editShareholder2 = function (id) {
console.log("editShareholder " + id);
var shareholder = _.filter($scope.shareholderDatasource, function (item) {
return item.id === id;
var shareholder = _.find($scope.shareholderDatasource, function (item) {
return item.id !== null && item.id.toString() === id;
});
if (shareholder && shareholder.length > 0) {
$scope.gModel.editShareholderModel = shareholder[0];
if (shareholder) {
$scope.gModel.editShareholderModel = shareholder;
$scope.isShowShareholderModal2 = true;
}
};
window.deleteShareholder2 = function (id) {
console.log("deleteShareholder " + id);
var shareholder = _.filter($scope.shareholderDatasource, function (item) {
var shareholder = _.find($scope.shareholderDatasource, function (item) {
return item.id === id;
});
if (shareholder && shareholder.length > 0) {
$scope.shareholderDatasource = _.without($scope.shareholderDatasource, shareholder[0]);
if (shareholder) {
$scope.shareholderDatasource = _.without($scope.shareholderDatasource, shareholder);
}
orgHKService.deleteShareholder(id);
};
$scope.closeDirector2 = function () {
......@@ -1022,12 +1067,12 @@
};
$scope.saveDirector2 = function (directorEntity) {
var director = _.filter($scope.directorDatasource, function (item) {
var director = _.find($scope.directorDatasource, function (item) {
return item.id === directorEntity.id;
});
if (director && director.length > 0) {
$scope.directorDatasource = _.without($scope.directorDatasource, director[0]);
if (director) {
$scope.directorDatasource = _.without($scope.directorDatasource, director);
}
$scope.directorDatasource.push(directorEntity);
orgHKService.updateDirectors($scope.directorDatasource);
......@@ -1035,23 +1080,23 @@
window.editDirector2 = function (id) {
console.log("editDirector " + id);
var director = _.filter($scope.directorDatasource, function (item) {
var director = _.find($scope.directorDatasource, function (item) {
return item.id === id;
});
if (director && director.length > 0) {
$scope.gModel.editDirectorModel = director[0];
if (director) {
$scope.gModel.editDirectorModel = director;
$scope.isShowDirectorModal2 = true;
}
};
window.deleteDirector2 = function (id) {
console.log("deleteDirector " + id);
var director = _.filter($scope.directorDatasource, function (item) {
var director = _.find($scope.directorDatasource, function (item) {
return item.id === id;
});
if (director && director.length > 0) {
$scope.directorDatasource = _.without($scope.directorDatasource, director[0]);
if (director > 0) {
$scope.directorDatasource = _.without($scope.directorDatasource, director);
}
};
......@@ -1083,9 +1128,9 @@
caption: $translate.instant('operation'),
cellTemplate: function (container, options) {
try {
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "downloadDocument(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">edit</i>download</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "downloadDocument(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">edit</i>download</button>&nbsp;&nbsp;')
.appendTo(container);
$('<button type="button" class="btn btn-in-grid" style="margin-top: -11px;" onclick = "deleteDocument(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
$('<button type="button" class="btn btn-in-grid" style="margin-top: 0px;" onclick = "deleteDocument(\'' + options.data.id + '\')"><i class="material-icons middle" style="vertical-align: text-bottom">delete</i>delete</button>&nbsp;&nbsp;')
.appendTo(container);
} catch (e) {
$log.error(e);
......@@ -1457,7 +1502,7 @@
initialized = true;
}
if (middleNode.id > 0) {
if (middleNode && middleNode.id > 0) {
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);
......@@ -1473,18 +1518,20 @@
// $("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) {
if (middleNode && middleNode.id > 2) {
var count = 0;
for (var i = middleNode.id; i > 1; i--) {
var nodeSelector = "svg>g[second-link-id=[" + middleNode.id + "][" + i + "]";
var value = 440 + 220 * count;
$(nodeSelector).attr("d", "M210,180 L210,160 L" + value + ",160 L" + value + ",102");
for (var i = middleNode.id-1; i > 1; i--) {
var nodeSelector = "svg>g[second-link-id='[" + middleNode.id + "][" + i + "]']>path";
var value = 320 + 220 * count;
$(nodeSelector).attr("d", "M100,180 L100,160 L" + value + ",160 L" + value + ",102");
count++;
}
}
// $("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) {
......@@ -1524,7 +1571,7 @@
}
} else {
middleNode = _.find(res.data, function (node) {
return node.spids.length > 0;
return node.spids && node.spids.length > 0;
});
}
initOrgTree(res.data);
......
commonModule.controller('editOrganizationShareholderModalController', ['$scope', '$log', 'ackUibModal', '$translate', function ($scope, $log, ackUibModal, $translate) {
commonModule.controller('editOrganizationShareholderModalController', ['$scope', '$log', 'ackUibModal', '$translate', 'orgHKService', 'SweetAlert', function ($scope, $log, ackUibModal, $translate, orgHKService, SweetAlert) {
'use strict';
//模态框管理
$scope.modalManage = {
......@@ -15,43 +15,39 @@ commonModule.controller('editOrganizationShareholderModalController', ['$scope',
},
close: function () {
$scope.onClose();
$scope.editModelS = {};
$scope.modalInstance.close();
},
cancel: function () {
$scope.onClose();
$scope.editModelS = {};
$scope.modalInstance.cancel();
},
save: function () {
var dxResult = DevExpress.validationEngine.validateGroup($('#shareholderControlForm').dxValidationGroup("instance")).isValid;
if (dxResult) {
if (!$scope.editModelS.id) {
if (!$scope.editModelS.id && $scope.parentPage !== ".system-manage") {
$scope.editModelS.id = PWC.newGuid();
}
$scope.onSave({shareholderEntity: $scope.editModelS});
$scope.editModelS = {};
$scope.modalManage.shareholderModal.close();
var result = $scope.onSave({shareholderEntity: $scope.editModelS});
if (result) {
SweetAlert.warning(result);
}
else {
$scope.editModelS = {};
$scope.modalManage.shareholderModal.close();
}
}
}
}
};
var initParams = function () {
$scope.ownershipFormTypeList = constant.organizationHK.OwnershipForm;
$scope.commonOrPreferredTypeList = ['Commmon', 'Preferred'];
$scope.classOfSharesTypeList = ['A', 'B'];
$scope.dropdownDatasource = {
investmentEntityTypeList: [],
ownershipFormTypeList: constant.organizationHK.OwnershipForm,
commonOrPreferredTypeList: [{id: 1, name: 'Commmon'}, {id: 2, name: 'Preferred'}],
classOfSharesTypeList: [{id: 1, name: 'A'}, {id: 2, name: 'B'}]
};
$scope.textboxOption = {
investmentEntityOption: {
bindingOptions: {
dataSource: 'dropdownDatasource.ownershipFormTypeList',
value: 'editModelS.investmentEntity'
dataSource: 'dropdownDatasource.investmentEntityList',
value: 'editModelS.investmentEntityId'
},
onSelectionChanged: function (args) {
// $scope.editModelS.investmentEntity = args.selectedItem.id;
......@@ -83,7 +79,7 @@ commonModule.controller('editOrganizationShareholderModalController', ['$scope',
commonOrPreferredOption: {
bindingOptions: {
dataSource: 'dropdownDatasource.commonOrPreferredTypeList',
value: 'editModelS.commonOrPreferred'
value: 'editModelS.commonPreferred'
},
onSelectionChanged: function (args) {
// $scope.editModelS.commonOrPreferred = args.selectedItem.id;
......@@ -191,7 +187,20 @@ commonModule.controller('editOrganizationShareholderModalController', ['$scope',
(function initialize() {
$log.debug('editOrganizationShareholderModalController.ctor()...');
$scope.editModelS = {};
initParams();
//todo:get the entity list id and name @ here
$scope.dropdownDatasource = {
// investmentEntityTypeList: [],
ownershipFormTypeList: constant.organizationHK.OwnershipForm,
commonOrPreferredTypeList: [{id: "1", name: 'Commmon'}, {id: "2", name: 'Preferred'}],
classOfSharesTypeList: [{id: "1", name: 'A'}, {id: "2", name: 'B'}]
};
orgHKService.getOrgsListInfo().success(function (res) {
if (res && res.result) {
$scope.dropdownDatasource.investmentEntityList = res.data;
}
initParams();
});
init();
thisModuleService.initWatches();
thisModuleService.initEvents();
......
......@@ -1721,6 +1721,14 @@ constant.organizationHK = {
executiveType: [
{id: 1, name: "Y"},
{id: 2, name: "N"}
],
commonOrPreferredType: [
{id: 1, name: "Commmon"},
{id: 2, name: "Preferred"}
],
classOfSharesType: [
{id: 1, name: "A"},
{id: 2, name: "B"}
]
};
......
......@@ -61,6 +61,12 @@ webservices.factory('orgHKService', ['$http', 'apiConfig', function ($http, apiC
},
getOrgList: function (type) {
return $http.get('/org/display?useType=' + type, apiConfig.create());
},
getOrgsListInfo:function () {
return $http.get('/orgHK/getOrgsListInfo', apiConfig.create());
},
deleteShareholder:function (id) {
return $http.delete('/orgHK/deleteShareholder?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