Commit 83809a27 by 墨竹

feat:是否有店长权限接口

parent 09d2d96b
......@@ -272,4 +272,11 @@ public interface StaffApiService {
*/
StoreRoleDTO getCountHaoBanStoreIdsByClerkId(String clerkId, String wxEnterpriseId);
/**
* 是否店长权限 true 是
* @param clerkId
* @return
*/
boolean isManager(String clerkId);
}
......@@ -138,8 +138,8 @@ public class StaffApiServiceImpl implements StaffApiService {
if (CollectionUtils.isEmpty(staffDTOList)) {
return new Page<>();
}
Set<String> staffIdList = staffDTOList.stream().map(dto->dto.getStaffId()).collect(Collectors.toSet()) ;
List<String> relationIdList = this.staffClerkRelationService.listRelationsStaffId(staffIdList) ;
Set<String> staffIdList = staffDTOList.stream().map(dto -> dto.getStaffId()).collect(Collectors.toSet());
List<String> relationIdList = this.staffClerkRelationService.listRelationsStaffId(staffIdList);
staffDTOList.forEach(one -> {
one.setRelationFlag(relationIdList.contains(one.getStaffId()) ? 1 : 0);
});
......@@ -163,14 +163,14 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId) {
ServiceResponse res = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) {
logger.info("企业不存在:{}:{}", wxEnterpriseId, wxUserId);
res.setMessage("企业不存在");
res.setCode(2);
return res;
}
String dkCorpid = qwDTO.getDkCorpid() ;
String dkCorpid = qwDTO.getDkCorpid();
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
logger.info("没有配置secret:{}", JSONObject.toJSONString(qwDTO));
......@@ -179,18 +179,18 @@ public class StaffApiServiceImpl implements StaffApiService {
return res;
}
UserDTO user = null;
if(qwDTO.getWxSecurityType()==4) {
if (qwDTO.getWxSecurityType() == 4) {
user = qywxUserApiService.getWorkWxUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId);
logger.info("成员详情(第三方)={}",JSON.toJSONString(user)) ;
logger.info("成员详情(第三方)={}", JSON.toJSONString(user));
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), user.getOpen_userid());
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
logger.info("成员详情(代开)={}", JSON.toJSONString(user));
if (user != null && userSelf != null) {
user.setName(userSelf.getName());
user.setPosition(userSelf.getPosition());
}
} else {
user = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), wxUserId);
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
logger.info("成员详情(代开)={}", JSON.toJSONString(user));
}
if (null == user) {
logger.info("企业微信用户不存在:{}:{}", wxEnterpriseId, wxUserId);
......@@ -207,7 +207,7 @@ public class StaffApiServiceImpl implements StaffApiService {
nationCode = arr[0];
phoneNumber = arr[1];
}
String openUserid = getOpenUserid(wxUserId, dkCorpid , qwDTO);
String openUserid = getOpenUserid(wxUserId, dkCorpid, qwDTO);
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(wxUserId, openUserid, wxEnterpriseId);
if (staff != null) {
staffService.delOtherStaffByWxUserId(staff.getWxUserId(), staff.getStaffId(), wxEnterpriseId);
......@@ -263,25 +263,25 @@ public class StaffApiServiceImpl implements StaffApiService {
* @param corpid
* @return
*/
private String getOpenUserid(String userId, String corpid , WxEnterpriseQwDTO qwDTO) {
if(qwDTO.getWxSecurityType()==2) {
return userId ;
private String getOpenUserid(String userId, String corpid, WxEnterpriseQwDTO qwDTO) {
if (qwDTO.getWxSecurityType() == 2) {
return userId;
}
List<QywxNewUseridDTO> list = null ;
if(qwDTO.getWxSecurityType()==4) {
List<QywxNewUseridDTO> list = null;
if (qwDTO.getWxSecurityType() == 4) {
list = qywxUserApiService.useridToOpenuserid(qwDTO.getThirdCorpid(), config.getWxSuiteid(), Collections.singletonList(userId));
}else {
} else {
// 绝色这类商户在2个服务商,在2023516要切换调
Object o = RedisUtil.getCache("bgrjswxEnterpriseId") ;
if(null != o && o.toString().contains(qwDTO.getWxEnterpriseId())) {
Object o = RedisUtil.getCache("bgrjswxEnterpriseId");
if (null != o && o.toString().contains(qwDTO.getWxEnterpriseId())) {
logger.info("绝色同步通讯录");
list = qywxUserApiService.useridToOpenuserid(qwDTO.getThirdCorpid(), config.getWxSuiteid(), Collections.singletonList(userId));
}else {
SecretSettingDTO set = this.secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal()) ;
list = qywxUserApiService.getSelfUseridToOpenuserid(qwDTO.getDkCorpid(), set.getSecretVal() , Collections.singletonList(userId));
} else {
SecretSettingDTO set = this.secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
list = qywxUserApiService.getSelfUseridToOpenuserid(qwDTO.getDkCorpid(), set.getSecretVal(), Collections.singletonList(userId));
}
}
logger.info("明文userId转密文={},{}",userId , JSON.toJSONString(list));
logger.info("明文userId转密文={},{}", userId, JSON.toJSONString(list));
if (CollectionUtils.isEmpty(list)) {
return "";
}
......@@ -428,7 +428,7 @@ public class StaffApiServiceImpl implements StaffApiService {
user.setAlias(EmojiFilterUtil.removeAllEmoji(user.getAlias()));
tab.setNickName((user.getAlias()));
}
if(StringUtils.isNotBlank(tab.getPhoneNumber())){
if (StringUtils.isNotBlank(tab.getPhoneNumber())) {
tab.setNationCode("86");
}
tab.setSex(user.getGender() == null ? 1 : Integer.parseInt(user.getGender()));
......@@ -496,7 +496,7 @@ public class StaffApiServiceImpl implements StaffApiService {
} else {
//该员工部门没做改变(只更新手机号即可)
TabHaobanStaffDepartmentRelated related = map.get(addId);
if(StringUtils.isNotBlank(related.getPhoneNumber())) {
if (StringUtils.isNotBlank(related.getPhoneNumber())) {
if (!related.getPhoneNumber().equals(staff.getPhoneNumber())) {
related.setPhoneNumber(staff.getPhoneNumber());
related.setNationCode(staff.getNationCode());
......@@ -645,15 +645,15 @@ public class StaffApiServiceImpl implements StaffApiService {
resp.setResult((String) url);
return resp;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId()) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId());
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
logger.info("没有配置secret:{}", qwDTO.getWxEnterpriseId());
return null;
}
String wxUserId = relationDTO.getQwUserId() ;
if(qwDTO.needOpenUserIdDk()) {
wxUserId = relationDTO.getOpenUserId() ;
String wxUserId = relationDTO.getQwUserId();
if (qwDTO.needOpenUserIdDk()) {
wxUserId = relationDTO.getOpenUserId();
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
if (user != null) {
......@@ -798,7 +798,7 @@ public class StaffApiServiceImpl implements StaffApiService {
logger.info("没有配置secret:wxEnterpriseId:{}", wxEnterpriseId);
return null;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
logger.info("企业不存在:wxEnterpriseId:{}", wxEnterpriseId);
return null;
......@@ -824,8 +824,8 @@ public class StaffApiServiceImpl implements StaffApiService {
//获取微信信息
String wxUserId = staff.getWxUserId();
if(qwDTO.needOpenUserIdDk()) {
wxUserId = staff.getWxOpenUseId() ;
if (qwDTO.needOpenUserIdDk()) {
wxUserId = staff.getWxOpenUseId();
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
if (null == user) {
......@@ -980,7 +980,6 @@ public class StaffApiServiceImpl implements StaffApiService {
/**
* 获取门店筛选器门店ids
*/
private List<String> getStoreWidgetIdStoreIds(String storeWidgetId, String enterpriseId) {
// 门店id列表
......@@ -991,4 +990,16 @@ public class StaffApiServiceImpl implements StaffApiService {
logger.info("门店筛选器查询结果数量:{}", storeIdList.size());
return storeIdList;
}
@Override
public boolean isManager(String clerkId) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO != null) {
Integer clerkType = clerkDTO.getClerkType();
if (clerkType == 1 || clerkType == 2) {
return true;
}
}
return false;
}
}
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