Commit 57042132 by jinxin

获取敏感信息接口开发

parent d0f39e56
...@@ -185,6 +185,13 @@ public interface StaffApiService { ...@@ -185,6 +185,13 @@ public interface StaffApiService {
int updateOpenIdByStaffId(String staffId, String openId); int updateOpenIdByStaffId(String staffId, String openId);
/** /**
* 根据员工id获取二维码
* @param staffId
* @return
*/
int getQrCodeByStaffId(String staffId);
/**
* 更新二维码通过员工id * 更新二维码通过员工id
* *
* @param staffId 员工id * @param staffId 员工id
......
...@@ -69,6 +69,13 @@ public interface StaffMapper { ...@@ -69,6 +69,13 @@ public interface StaffMapper {
int updateOpenIdByStaffId(@Param("staffId") String staffId, @Param("openId") String openId); int updateOpenIdByStaffId(@Param("staffId") String staffId, @Param("openId") String openId);
/** /**
* 根据员工id获取二维码
* @param staffId
* @return
*/
String getQrCodeByStaffId(@Param("staffId") String staffId);
/**
* 更新二维码通过员工id * 更新二维码通过员工id
* *
* @param staffId 员工id * @param staffId 员工id
......
...@@ -742,6 +742,14 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -742,6 +742,14 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
@Override @Override
public int getQrCodeByStaffId(String staffId) {
String qrCode = staffMapper.getQrCodeByStaffId(staffId);
if(StringUtils.isNotBlank(qrCode))
return 1;
return 0;
}
@Override
public int updateQrCodeByStaffId(String staffId, String qrCode) { public int updateQrCodeByStaffId(String staffId, String qrCode) {
return staffMapper.updateQrCodeByStaffId(staffId, qrCode); return staffMapper.updateQrCodeByStaffId(staffId, qrCode);
} }
......
...@@ -435,6 +435,10 @@ ...@@ -435,6 +435,10 @@
and wx_user_id = #{wxUserId} and wx_user_id = #{wxUserId}
</update> </update>
<select id="getQrCodeByStaffId" resultType="string">
select qr_code from tab_haoban_staff where staff_id = #{staffId} and status_flag = 1
</select>
<update id="updateOpenIdByStaffId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff"> <update id="updateOpenIdByStaffId" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff">
update tab_haoban_staff update tab_haoban_staff
set wx_open_id = #{openId}, set wx_open_id = #{openId},
......
...@@ -45,6 +45,9 @@ public class ServiceTest { ...@@ -45,6 +45,9 @@ public class ServiceTest {
@Autowired @Autowired
private Config config; private Config config;
@Autowired
private StaffApiService staffApiService;
@Test @Test
public void test() { public void test() {
...@@ -69,4 +72,9 @@ public class ServiceTest { ...@@ -69,4 +72,9 @@ public class ServiceTest {
String autoActiveStatus = qywxUserApiService.getAutoActiveStatus("wp59NLDQAAJL6DsM6YwOGqJlhCBykkeA", config.getCorpid()); String autoActiveStatus = qywxUserApiService.getAutoActiveStatus("wp59NLDQAAJL6DsM6YwOGqJlhCBykkeA", config.getCorpid());
System.out.println(autoActiveStatus); System.out.println(autoActiveStatus);
} }
@Test
public void test5(){
int qrCodeByStaffId = staffApiService.getQrCodeByStaffId("00af1fe7e75644a7accdcb84e126e50c");
System.out.println("111111111111111111111111111111111"+qrCodeByStaffId);
}
} }
...@@ -15,6 +15,9 @@ import java.util.stream.Collectors; ...@@ -15,6 +15,9 @@ import java.util.stream.Collectors;
import javax.validation.Valid; import javax.validation.Valid;
import com.gic.wechat.api.dto.qywx.fee.UserSensitiveInfoDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -155,6 +158,10 @@ public class WxStaffController extends WebBaseController { ...@@ -155,6 +158,10 @@ public class WxStaffController extends WebBaseController {
private HaobanRoleApiService haobanRoleApiService; private HaobanRoleApiService haobanRoleApiService;
@Autowired @Autowired
private PowerService powerService ; private PowerService powerService ;
@Autowired
private QywxCorpApiService qywxCorpApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
//选择成员列表 //选择成员列表
@RequestMapping("/staff-list") @RequestMapping("/staff-list")
...@@ -1786,4 +1793,42 @@ public class WxStaffController extends WebBaseController { ...@@ -1786,4 +1793,42 @@ public class WxStaffController extends WebBaseController {
retPage.setResult(resultList); retPage.setResult(resultList);
return RestResponse.successResult(retPage); return RestResponse.successResult(retPage);
} }
/**
* 获取构造网页授权链接url
* @return
*/
@RequestMapping("get-third-auth-url")
public HaobanResponse getAuthUrl() {
String suiteId = config.getSuiteId();
logger.info("通讯录应用ID:{}", suiteId);
String redictUrl = config.getHost() + "third-callback";
String authorizationUrl = qywxCorpApiService.getAuthorizationUrl(suiteId,redictUrl,"snsapi_privateinfo");
return resultResponse(HaoBanErrCode.ERR_1, authorizationUrl);
}
/**
* 更新成员的qr_code
* @param code
*/
@RequestMapping("third-callback")
public void getAuthUrl(String code) {
logger.info("获取第三方应用用户敏感信息企微回调的code:{}", code);
String suiteId = config.getSuiteId();
ServiceResponse<UserSensitiveInfoDTO> dto = qywxUserApiService.getUserSensitiveInfoDTOByCode(code, suiteId);
UserSensitiveInfoDTO result = dto.getResult();
//更新staff的qr_code
if(null!=result){
logger.info("成员的user_id:{},qr_code:{}", result.getUserid(),result.getQr_code());
staffApiService.updateQrCodeByStaffId(result.getUserid(), result.getQr_code());
}
}
/**
* 判断成员是否授权获取敏感信息
*/
@RequestMapping("get-sensitive-status")
public HaobanResponse getSensitiveStatus(String staffId){
int qrCodeByStaffId = staffApiService.getQrCodeByStaffId(staffId);
return resultResponse(HaoBanErrCode.ERR_1, qrCodeByStaffId);
}
} }
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