|
|
@@ -242,13 +242,15 @@ public class StaffService extends BaseService<Staff> {
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
public ResponseResultVO<?> saveStaffRight(StaffVO staffVO) {
|
|
|
+ // 获取当前公司的cpId
|
|
|
+ Integer cpId = authUtils.getStaff().getCpId();
|
|
|
// 转化实体
|
|
|
Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
staffRightService.delete(staffVO.getStaffId());
|
|
|
for (StaffRight staffRight : staffVO.getStaffRightList()) {
|
|
|
staffRight.setStaffId(staff.getStaffId());
|
|
|
staffRight.setRightType(1);
|
|
|
- staffRight.setCpId(staff.getCpId());
|
|
|
+ staffRight.setCpId(cpId);
|
|
|
}
|
|
|
if (staffVO.getStaffRightList()!=null && staffVO.getStaffRightList().size() > 0) {
|
|
|
staffRightService.saveStaffRight(staffVO.getStaffRightList());
|
|
|
@@ -265,11 +267,13 @@ public class StaffService extends BaseService<Staff> {
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
public ResponseResultVO<?> saveStaffPurview(StaffVO staffVO) {
|
|
|
+ // 获取当前公司的cpId
|
|
|
+ Integer cpId = authUtils.getStaff().getCpId();
|
|
|
// 转化实体
|
|
|
Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
for (StaffPurview staffRight : staffVO.getStaffPurviewList()) {
|
|
|
staffRight.setStaffId(staff.getStaffId());
|
|
|
- staffRight.setCpId(staff.getCpId());
|
|
|
+ staffRight.setCpId(cpId);
|
|
|
}
|
|
|
staffPurviewService.saveStaffPurview(staffVO.getStaffPurviewList());
|
|
|
return ResponseResultUtil.success();
|
|
|
@@ -285,6 +289,20 @@ public class StaffService extends BaseService<Staff> {
|
|
|
rollbackFor = {Exception.class}
|
|
|
)
|
|
|
public ResponseResultVO<Boolean> dimission(StaffVO staffVO) {
|
|
|
+ // 将微信的用户的信息 openid current_cp , "joined_cps" 缩减相应的cpid
|
|
|
+ // 更新 被邀请人员的微信用户的cpid 加入公司
|
|
|
+ Map<String, Object> collectQuery = new HashMap<>();
|
|
|
+ // 获取当前公司的cpId
|
|
|
+ Integer cpId = authUtils.getStaff().getCpId();
|
|
|
+ collectQuery.put("cpId", cpId);
|
|
|
+ collectQuery.put("userId", staffVO.getWxUserId());
|
|
|
+ ResponseResultVO<?> resultVO = userFeign.updateClearOpenidFeign(collectQuery);
|
|
|
+ // 如果没有成功返回,状态设置为待审
|
|
|
+ if (resultVO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
|
|
|
+ // 无用户
|
|
|
+ throw new BaseBusinessException(ErrorCodeEnum.STAFF_UPDATE_ERROR.getCode(),
|
|
|
+ ErrorCodeEnum.STAFF_UPDATE_ERROR.getMessage());
|
|
|
+ }
|
|
|
// 转化实体
|
|
|
Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
super.updateByUuid(staff);
|