| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dingtalk.api.response.OapiV2UserGetuserinfoResponse; |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.annotation.LoginRequired; |
| | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | |
| | | import com.doumee.dao.business.dto.LoginRequestNewParam; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.system.dto.DingLoginDTO; |
| | | import com.doumee.dao.system.model.SystemJob; |
| | | import com.doumee.dao.vo.WebLoginUserVO; |
| | | import com.doumee.service.business.CategoryService; |
| | | import com.doumee.service.business.MemberService; |
| | | import com.sun.deploy.net.HttpUtils; |
| | | import com.taobao.api.ApiException; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private MemberService memberService; |
| | | |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | |
| | | |
| | | @ApiOperation("UK单点登录") |
| | | @GetMapping("/ukLogin") |
| | | public void ukLogin(String tick, Object obj, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | LoginRequestNewParam requestParam = new LoginRequestNewParam(); |
| | | /*// UK_ERROR_URL = "http://u.zhibang.com/sso/web/token/error"; |
| | | // UK_ERROR_URL = "http://u.zhibang.com/sso/web/token/error"; |
| | | String errorUrl =systemDictDataBiz.queryByCode(Constants.ZBOM_PARAM,Constants.ZBOM_UK_ERROR_URL).getCode(); |
| | | try { |
| | | /* try { |
| | | log.error("请求参数TICK最原始===========:" + tick); |
| | | JSONObject urlParams = new JSONObject(); |
| | | log.info("请求参数:" + JSON.toJSONString(urlParams)); |
| | |
| | | response.sendRedirect(requestParam.getRediUrl()+"?token="+token); |
| | | } |
| | | |
| | | @ApiOperation("钉钉登录") |
| | | @PostMapping("/ddLogin") |
| | | public ApiResponse<WebLoginUserVO> ddLogin(@Validated @RequestBody DingLoginDTO dingLoginDTO) throws ApiException { |
| | | WebLoginUserVO loginUserVO = new WebLoginUserVO(); |
| | | OapiV2UserGetuserinfoResponse.UserGetByCodeResponse response = dingTalk.getDDUserByCode(dingLoginDTO); |
| | | if(Objects.nonNull(response)){ |
| | | loginUserVO.setId(response.getUserid()); |
| | | loginUserVO.setRoleType(Constants.DD_USER_TYPE); |
| | | } |
| | | loginUserVO.setToken(jwtTokenUtil.generateToken(loginUserVO)); |
| | | return ApiResponse.success(loginUserVO); |
| | | } |
| | | |
| | | |
| | | private String enCode(String string) { |
| | | // TODO Auto-generated method stub |
| | |
| | | WebLoginUserVO loginUserVO = this.getMemberResponse(); |
| | | pageWrap.getModel().setQueryUserRole(loginUserVO.getRoleType()); |
| | | pageWrap.getModel().setQueryZQCode(loginUserVO.getZhanqu()); |
| | | return ApiResponse.success(memberService.findPage(pageWrap)); |
| | | PageData<Member> pageData = memberService.findPage(pageWrap); |
| | | if(CollectionUtils.isNotEmpty(pageData.getRecords())){ |
| | | String roleConfig = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.ROLE_CONFIG).getCode(); |
| | | if(StringUtils.isBlank(roleConfig)||StringUtils.isBlank(pageWrap.getModel().getQueryUserRole()) |
| | | || ! (roleConfig.contains(pageWrap.getModel().getQueryUserRole()) || pageWrap.getModel().getQueryUserRole().equals(Constants.DD_USER_TYPE) )){ |
| | | pageData.getRecords().forEach(i->{ |
| | | i.setFee(null); |
| | | }); |
| | | } |
| | | } |
| | | return ApiResponse.success(pageData); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |