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},
......
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