Commit 077df184 by fudahua

本地缓存

parent 03174eba
......@@ -100,4 +100,11 @@ public interface StaffApiService {
* @return
*/
public boolean activeStaff(String staffId);
/**
* 获取一个staff
* @param wxEnterpriseId
* @return
*/
public StaffDTO getWxStaffOne(String wxEnterpriseId);
}
......@@ -40,4 +40,6 @@ public interface StaffMapper {
List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds")List<String> userIds, @Param("wxEnterpriseId")String wxEnterpriseId);
public int cleanStaff(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("staffIds")List<String> staffIds);
TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId")String wxEnterpriseId);
}
\ No newline at end of file
......@@ -29,9 +29,10 @@ public interface StaffService {
/**
* 清楚微信信息
* @param wxEnterpriseId
* @param wxUserIds
* @return
*/
public int cleanStaff(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("staffIds") List<String> staffIds);
public int cleanStaff(String wxEnterpriseId, List<String> staffIds);
TabHaobanStaff getWxStaffByOne( String wxEnterpriseId);
}
......@@ -87,4 +87,9 @@ public class StaffServiceImpl implements StaffService {
public int cleanStaff(String wxEnterpriseId, List<String> staffIds) {
return mapper.cleanStaff(wxEnterpriseId,staffIds);
}
@Override
public TabHaobanStaff getWxStaffByOne(String wxEnterpriseId) {
return mapper.getWxStaffByOne(wxEnterpriseId);
}
}
......@@ -1465,6 +1465,12 @@ public class StaffApiServiceImpl implements StaffApiService {
return true;
}
@Override
public StaffDTO getWxStaffOne(String wxEnterpriseId) {
TabHaobanStaff wxStaffByOne = staffService.getWxStaffByOne(wxEnterpriseId);
return EntityUtil.changeEntityByJSON(StaffDTO.class,wxStaffByOne);
}
// private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber;
// return mobile;
......
......@@ -353,5 +353,14 @@
#{item}
</foreach>
</update>
<select id="getWxStaffByOne" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id is not null and wx_user_id!=''
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -20,6 +20,7 @@ import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.anno.IgnoreLogin;
......@@ -62,6 +63,9 @@ public class WxEnterpriseController extends WebBaseController{
private Config config;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private StaffApiService staffApiService;
//授权企业列表
......@@ -263,7 +267,7 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10012);
}
contactSecret = contactSecret.trim();
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), contactSecret, login.getStaffDTO().getWxUserId());
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), contactSecret, getWxUserId(wxEnterpriseId,login.getStaffDTO()));
logger.info("【保存联系人key】user={}",JSON.toJSONString(user));
SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_SECRET.getVal(), null);
if (null== secretSetting) {
......@@ -301,7 +305,7 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10012);
}
wxSecretKey = wxSecretKey.trim();
String res = qywxUserApiService.listSelfExternalUserid(wxEnterprise.getCorpid(), wxSecretKey, login.getStaffDTO().getWxUserId());
String res = qywxUserApiService.listSelfExternalUserid(wxEnterprise.getCorpid(), wxSecretKey, getWxUserId(wxEnterpriseId,login.getStaffDTO()));
logger.info("【保存联系人key】res={}",res);
SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CONTACT_CUSTOMER.getVal(), null);
......@@ -351,7 +355,7 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10012);
}
memberSecret = memberSecret.trim();
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), memberSecret, login.getStaffDTO().getWxUserId());
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), memberSecret, getWxUserId(wxEnterpriseId,login.getStaffDTO()));
SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.MEMBER_WAPP.getVal(), enterpriseId);
if (null== secretSetting) {
......@@ -374,6 +378,13 @@ public class WxEnterpriseController extends WebBaseController{
}
}
private String getWxUserId(String wxEnterpriseId,StaffDTO loginStaffDTO) {
if (loginStaffDTO!=null && (!StringUtils.isEmpty(loginStaffDTO.getWxUserId()))) {
return loginStaffDTO.getWxUserId();
}
StaffDTO staffOne = staffApiService.getWxStaffOne(wxEnterpriseId);
return staffOne.getWxUserId();
}
//微信企业绑定接口绑定通讯录key
@IgnoreLogin
......@@ -393,7 +404,8 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_10012);
}
contactSecret = contactSecret.trim();
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), contactSecret, login.getStaffDTO().getWxUserId());
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), contactSecret, getWxUserId(wxEnterpriseId,login.getStaffDTO()));
logger.info("【保存联系人key】user={}",JSON.toJSONString(user));
SecretSettingDTO secretSetting = wxEnterpriseApiService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.HAOBAN_HELP.getVal(), null);
if (null== secretSetting) {
......
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