Commit ae5e44b9 authored by fangxinjiang's avatar fangxinjiang

项目信息新增服务团队权限同步

parent 3c34c8b7
...@@ -488,4 +488,12 @@ public class TSettleDomain extends BaseEntity { ...@@ -488,4 +488,12 @@ public class TSettleDomain extends BaseEntity {
@ExcelIgnore @ExcelIgnore
private String bpoFlag; private String bpoFlag;
/**
* EKP的服务团队 : 存
*/
@Schema(description = "EKP的服务团队", name = "serviceTeam")
@ExcelIgnore
@TableField(exist = false)
private String serviceTeam;
} }
...@@ -7,7 +7,7 @@ public class EmployeeContractConstants { ...@@ -7,7 +7,7 @@ public class EmployeeContractConstants {
public static final String NOT_CREATE_USER = "不是创建人,无法删除"; public static final String NOT_CREATE_USER = "不是创建人,无法删除";
public static final String NOT_AUDIT_STATUS = "不是待提交或审核不通过,无法删除"; public static final String NOT_AUDIT_STATUS = "不是待提交,无法删除";
public static final String NOT_AUDIT = "未审核通过,无法更新"; public static final String NOT_AUDIT = "未审核通过,无法更新";
public static final String INVALID = "作废、终止,无法更新"; public static final String INVALID = "作废、终止,无法更新";
......
...@@ -553,8 +553,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -553,8 +553,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
errorVo.setMainName(contractInfo.getApplyNo()); errorVo.setMainName(contractInfo.getApplyNo());
if (!user.getId().equals(contractInfo.getCreateBy())) { if (!user.getId().equals(contractInfo.getCreateBy())) {
errorVo.setErrorInfo(EmployeeContractConstants.NOT_CREATE_USER); errorVo.setErrorInfo(EmployeeContractConstants.NOT_CREATE_USER);
} else if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT } else if (contractInfo.getAuditStatus() != CommonConstants.ZERO_INT) {
&& contractInfo.getAuditStatus() != CommonConstants.dingleDigitIntArray[3]) {
errorVo.setErrorInfo(EmployeeContractConstants.NOT_AUDIT_STATUS); errorVo.setErrorInfo(EmployeeContractConstants.NOT_AUDIT_STATUS);
} else { } else {
errorVo.setResult(CommonConstants.ONE_INT); errorVo.setResult(CommonConstants.ONE_INT);
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson; import com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain; import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
...@@ -38,6 +40,7 @@ import lombok.RequiredArgsConstructor; ...@@ -38,6 +40,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -141,6 +144,15 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -141,6 +144,15 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
} }
} }
} }
// 处理服务团队数据权限 2022-09-19 fxj
if (Common.isNotNull(tSettleDomain.getServiceTeam())){
R<AllUserNaVo> res = upmsDaprUtils.getUserIdsByUserNames(tSettleDomain.getServiceTeam());
if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserIds())){
// 先清理缓存
this.removeSettleCache(null,res.getData().getUserIds());
saveForEkp(res.getData().getUserIds(),tSettleDomain.getId());
}
}
tSettleDomainInfo = baseMapper.selectById(tSettleDomain.getId()); tSettleDomainInfo = baseMapper.selectById(tSettleDomain.getId());
if (Common.isNotNull(tSettleDomainInfo)) { if (Common.isNotNull(tSettleDomainInfo)) {
baseMapper.updateById(tSettleDomain); baseMapper.updateById(tSettleDomain);
...@@ -163,4 +175,36 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -163,4 +175,36 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
} }
return setMap; return setMap;
} }
/**
* @Author fxj
* @Description 更新EKP对应MVP 项目权限,已有权限不做删除处理
* @Date 17:17 2022/9/19
* @Param
* @return
**/
public boolean saveForEkp(List<String> userIds, String domainId){
// 1. 先清除现有的这些认的项目权限
permissonMapper.delete(Wrappers.<TCutsomerDataPermisson>query().lambda()
.in(TCutsomerDataPermisson::getBePermissonUser,userIds)
.eq(TCutsomerDataPermisson::getSettleDomainId,domainId));
// 2.新增新的项目人员权限
TCutsomerDataPermisson pm;
if (Common.isNotNull(userIds)){
for (String uId:userIds){
pm = new TCutsomerDataPermisson();
pm.setIsCustomerService(CommonConstants.ZERO_STRING);
pm.setIsOwner(CommonConstants.ONE_STRING);
pm.setPermissonSrc("EKP服务团队");
pm.setPermissonLevel(CommonConstants.ONE_INT);
pm.setBePermissonUser(uId);
pm.setBePermissionTime(LocalDateTime.now());
pm.setSettleDomainId(domainId);
pm.setPermissionUser(CommonConstants.ONE_STRING);
pm.setType(CommonConstants.TWO_STRING);
permissonMapper.insert(pm);
}
}
return true;
}
} }
package com.yifu.cloud.plus.v1.yifu.common.dapr.util; package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
...@@ -51,4 +52,19 @@ public class UpmsDaprUtils { ...@@ -51,4 +52,19 @@ public class UpmsDaprUtils {
} }
return allUserVoR; return allUserVoR;
} }
/**
* @Author fxj
* @Description 获取指定用户名对应用户IDs
* @Date 17:57 2022/8/16
* @Param
* @return
**/
public R<AllUserNaVo> getUserIdsByUserNames(String usernames) {
R<AllUserNaVo> allUserVoR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/getUserIdsByUserNames", usernames, AllUserNaVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(allUserVoR)){
return R.failed("获取指定用户名对应用户IDs失败!");
}
return allUserVoR;
}
} }
...@@ -4,6 +4,7 @@ import lombok.Data; ...@@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
/** /**
* @Author fxj * @Author fxj
...@@ -13,5 +14,16 @@ import java.util.HashMap; ...@@ -13,5 +14,16 @@ import java.util.HashMap;
*/ */
@Data @Data
public class AllUserNaVo implements Serializable { public class AllUserNaVo implements Serializable {
/**
* @Author fxj
* @Description key 用户ID value 用户名称
* @Date 17:05 2022/9/19
**/
private HashMap<String,String> userNames; private HashMap<String,String> userNames;
/**
* @Author fxj
* @Description 用户IDS
* @Date 17:05 2022/9/19
**/
private List<String> userIds;
} }
...@@ -45,6 +45,7 @@ import org.springframework.validation.BindingResult; ...@@ -45,6 +45,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -294,7 +295,32 @@ public class UserController { ...@@ -294,7 +295,32 @@ public class UserController {
} }
return naVo; return naVo;
} }
/**
* @Author fxj
* @Description 获取所有用户-- 指定用户名
* @Date 18:20 2022/8/16
* @Param
* @return
**/
@Inner
@PostMapping(value = {"/inner/getUserIdsByUserNames"})
public AllUserNaVo getUserIdsByUserNames(@RequestBody String usernames) {
AllUserNaVo naVo = new AllUserNaVo();
if (Common.isEmpty(usernames)){
return naVo;
}
List<SysUser> sysUsers = userService.list(Wrappers.<SysUser>query().lambda()
.in(SysUser::getUsername,Common.getList(usernames)));
if (Common.isNotEmpty(sysUsers)){
List<String> userIds = new ArrayList<>();
for (SysUser u:sysUsers){
userIds.add(u.getUserId());
}
naVo.setUserIds(userIds);
}
return naVo;
}
/** /**
* @Author hgw * @Author hgw
* @Description 获取部门下的用户id * @Description 获取部门下的用户id
......
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