Commit 0a777559 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

parents 53190c5d 989a748d
......@@ -190,7 +190,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
for (String company : appShareholderDetailDTO.getCompanyList()) {
Integer companyId = Integer.valueOf(company);
//更新股东表 持股状态改为已退股
mapper.updShareHolderIsQuit(appShareholderDetailDTO.getPhone(), companyId);
mapper.updShareHolderIsQuit(appShareholderDetailDTO.getPhone(), companyId, 1);
AppShareholderDetail updAppShareholderDetail = selectById(appShareholderDetailDTO);
//查询股东表,是否为总部股东
Integer oldPositionId = null;
......@@ -216,13 +216,16 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
}
//复股操作
} else if (appShareholderDetailDTO.getChangeState().equals(3)) {
if (appShareholderDetailDTO.getPhone() == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "请输入股东号码");
}
if (appShareholderDetailDTO.getCompanyList() == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "请输入复股公司");
}
for (String company : appShareholderDetailDTO.getCompanyList()) {
Integer companyId = Integer.valueOf(company);
AppShareholderDetail updAppShareholderDetail = selectById(appShareholderDetail);
//查询股东表,是否为总部股东
Integer oldPositionId = mapper.selectShareHolderByUserIdOrPhone(updAppShareholderDetail.getUserId(), updAppShareholderDetail.getPhone());
......@@ -234,18 +237,25 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
userId = userLogin.getId();
//关联查询detail表 获取身份
AppUserDetail appUserDetail = detailBiz.checkeIsAppUser(userId);
CompanyDetail branchCompany = vehicleFeign.getCompanyDetail(companyId).getData();
Integer positionId = branchCompany.getId().equals(1) ? HEADQUARTERS_SHAREHOLDER : BRANCH_HEADQUARTERS_SHAREHOLDER;
if (oldPositionId == null) {
detailBiz.updateUserPositionByUserId(userId, appShareholderDetail.getPositionId());
detailBiz.updateUserPositionByUserId(userId, positionId);
} else {
if (!(appUserDetail.getPositionId().equals(1))) {
detailBiz.updateUserPositionByUserId(userId, appShareholderDetail.getPositionId());
if (oldPositionId > positionId) {
detailBiz.updateUserPositionByUserId(userId, positionId);
} else {
detailBiz.updateUserPositionByUserId(userId, oldPositionId);
}
}
}
}
appShareholderDetail.setIsQuit(SHAREHOLDERDE_IS_TRUE);
//修改
Integer companyId = Integer.valueOf(company);
updateSelectiveById(appShareholderDetail);
mapper.updShareHolderIsQuit(appShareholderDetailDTO.getPhone(), companyId, 0);
//updateSelectiveById(appShareholderDetail);
appShareholderDetailChangeRecordBiz.addAppShareholderDetailChangeRecord(updAppShareholderDetail, updUserId, SHAREHOLDERDE_IS_TRUE);
}
}
......@@ -475,4 +485,5 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
result.put("exist", exist - total);
return result;
}
}
......@@ -24,7 +24,7 @@ public interface AppShareholderDetailMapper extends Mapper<AppShareholderDetail>
@Param("companyId") Integer companyId);
void updShareHolderIsQuit(@Param("phone") String phone, @Param("companyId") Integer companyId);
void updShareHolderIsQuit(@Param("phone") String phone, @Param("companyId") Integer companyId,@Param("isQuit") Integer isQuit);
Integer selectMaxShareHolderByUserIdOrPhone(
@Param("phone") String phone,
......
......@@ -32,8 +32,8 @@
<select id="updShareHolderIsQuit" resultType="com.github.wxiaoqi.security.admin.entity.AppShareholderDetail">
UPDATE `app_shareholder_detail`
SET
<if test="phone!=null">
`is_quit`=#{phone}
<if test="isQuit!=null">
`is_quit`=#{isQuit}
</if>
WHERE
1 = 1
......
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