7ed953e819025e9e0567ed18ce0f1aeb99f13406.svn-base 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cn.com.goldenwater.dcproj.controller.sso;
  2. import cn.com.goldenwater.dcproj.service.BisInspAllRlationPersService;
  3. import com.dcxx.framework.watermanagesdk.DingSdk;
  4. import com.dcxx.framework.watermanagesdk.utils.JsonHelper;
  5. import io.swagger.annotations.Api;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.context.annotation.ComponentScan;
  8. import org.springframework.web.bind.annotation.*;
  9. import java.util.Map;
  10. /**
  11. * @author hanxi
  12. * @date 2020-07-09
  13. */
  14. @Api(value = "钉钉用户单点登录", tags = "单点登录")
  15. @RestController
  16. @RequestMapping("/ding")
  17. @ComponentScan(basePackages =
  18. {"com.dcxx.framework.watermanagesdk.config"})
  19. public class DingController{
  20. @Autowired
  21. private BisInspAllRlationPersService bisInspAllRlationPersService;
  22. /**
  23. * @param
  24. * @return java.lang.String
  25. * @Author MJ
  26. * @Description 验证水管平台的票据信息,返回验证得到的用户信息
  27. * @Date 2019/8/8 10:54
  28. **/
  29. @RequestMapping("/validateTicket")
  30. public String validateDingTicket(@RequestParam(value = "ticket", required = false) String ticket) throws Exception {
  31. DingSdk dingSdk = new DingSdk();
  32. //TODO 以下参数请做对应修改
  33. //TODO 钉钉鉴权颁发的票据
  34. ticket = "ding_ticket_test";
  35. //TODO 钉钉微应用ID
  36. long agentId = 272787838L;
  37. Map<String, Object> dingUserMap = dingSdk.validateDingTicket(ticket, agentId);
  38. return JsonHelper.object2Json(dingUserMap);
  39. }
  40. }