| | |
| | | @ApiModelProperty(value = "微信openId") |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "éé unionId") |
| | | private String ddUnionId; |
| | | |
| | | @NotBlank(message = "å¯ç ä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "å¯ç ") |
| | | private String password; |
| | |
| | | @ApiModelProperty(value = "微信openId") |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "éé unionId") |
| | | private String ddUnionId; |
| | | |
| | | @NotBlank(message = "å¯ç ä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "å¯ç ") |
| | | private String password; |
| | |
| | | private String code; |
| | | @ApiModelProperty(value = "openid") |
| | | private String openid; |
| | | @ApiModelProperty(value = "éé unionId") |
| | | private String ddUnionId; |
| | | @ApiModelProperty(value = "ç¨æ·ç±»åï¼0=叿ºï¼1=访客ï¼2=å
é¨åå·¥") |
| | | private Integer userType; |
| | | } |
| | |
| | | private String openidHkInfo; |
| | | @ApiModelProperty(value = "微信openidæ¨é海康æ¶é´", example = "1", hidden = true) |
| | | private Date openidHkDate; |
| | | @ApiModelProperty(value = "éé unionId", example = "1", hidden = true) |
| | | private String ddUnionId; |
| | | |
| | | //2024å¹´12æ6æ¥11:00:30 ç±»å 0叿ºäººå 1æ®é访客 2å
é¨äººå 3tms管æ§äººå |
| | | @ApiModelProperty(value = "ç±»å 0叿ºäººå 1æ®é访客 2å
é¨äººå 3tms管æ§äººå", example = "0") |
| | |
| | | } |
| | | } |
| | | try { |
| | | LoginUserInfo user = dealLoginByPwdNewBiz(dto.getUsername(),dto.getPassword(),null,dto.getOpenid(),request); |
| | | LoginUserInfo user = dealLoginByPwdNewBiz(dto.getUsername(),dto.getPassword(),null,dto.getOpenid(),dto.getDdUnionId(),request); |
| | | systemLoginLogService.create(loginLog); |
| | | return user; |
| | | }catch (BusinessException e){ |
| | |
| | | throw e; |
| | | } |
| | | } |
| | | LoginUserInfo user = dealLoginByPwdNewBiz(dto.getUsername(),dto.getPassword(),null,dto.getOpenid(),request); |
| | | LoginUserInfo user = dealLoginByPwdNewBiz(dto.getUsername(),dto.getPassword(),null,dto.getOpenid(),dto.getDdUnionId(),request); |
| | | systemLoginLogService.create(loginLog); |
| | | return user; |
| | | } |
| | |
| | | isCaptcheValide(dto.getPhone(),dto.getCode());//æ£æ¥éªè¯ç |
| | | SystemLoginLog loginLog = getInitLoginlog(dto.getPhone(),request); |
| | | try{ |
| | | LoginUserInfo userInfo = dealLoginByPwdNewBiz(null,null,dto.getPhone(),dto.getOpenid(), request ); |
| | | LoginUserInfo userInfo = dealLoginByPwdNewBiz(null,null,dto.getPhone(),dto.getOpenid(),dto.getDdUnionId(), request ); |
| | | systemLoginLogService.create(loginLog); |
| | | return userInfo; |
| | | }catch (BusinessException e){ |
| | |
| | | throw e; |
| | | } |
| | | } |
| | | private LoginUserInfo dealLoginByPwdNewBiz(String username,String pwd, String phone, String openid, ServerHttpRequest request) { |
| | | private LoginUserInfo dealLoginByPwdNewBiz(String username,String pwd, String phone, String openid, String ddUnionId, ServerHttpRequest request) { |
| | | // æ ¹æ®ç¨æ·åæ¥è¯¢ç¨æ·å¯¹è±¡ |
| | | SystemUser queryDto = new SystemUser(); |
| | | queryDto.setMobile(phone); |
| | |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | } |
| | | } |
| | | dealOpenIdBiz(user,openid); |
| | | if(StringUtils.isNotBlank(openid)){ |
| | | dealOpenIdBiz(user,openid); |
| | | } |
| | | if(StringUtils.isNotBlank(ddUnionId)){ |
| | | dealDDUnionIdBiz(user,ddUnionId); |
| | | } |
| | | Company company = new Company(); |
| | | if(Objects.nonNull(user.getCompanyId())){ |
| | | company = companyMapper.selectById(user.getCompanyId()); |
| | |
| | | .eq(SystemUser::getId,user.getId())); |
| | | } |
| | | } |
| | | |
| | | private void dealDDUnionIdBiz(SystemUser user, String ddUnionId) { |
| | | if(StringUtils.isNotBlank(ddUnionId)){ |
| | | //妿openIdä¸ä¸ºç©º,ç»å®è¯¥ç¨æ·openid |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda() |
| | | .set(SystemUser::getDdUnionId,null) |
| | | .set(SystemUser::getOpenidHkStatus,Constants.ZERO) |
| | | .ne(SystemUser::getType,Constants.memberType.gkuser) |
| | | .eq(SystemUser::getDdUnionId,ddUnionId) |
| | | ); |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda() |
| | | .set(SystemUser::getDdUnionId,ddUnionId) |
| | | .set(SystemUser::getOpenidHkStatus,Constants.ZERO) |
| | | .set(SystemUser::getOpenidHkDate,null) |
| | | .set(SystemUser::getOpenidHkInfo,null) |
| | | .eq(SystemUser::getId,user.getId())); |
| | | } |
| | | } |
| | | private void dealOpenIdBizForGk(SystemUser user, String openid) { |
| | | if(StringUtils.isNotBlank(openid)){ |
| | | //妿openIdä¸ä¸ºç©º,ç»å®è¯¥ç¨æ·openid |
| | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.dao.web.response.DDAuthorizeVO; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | |
| | | import com.doumee.service.business.MemberService; |
| | | import com.doumee.service.business.VisitReasonService; |
| | | import com.doumee.service.business.VisitsService; |
| | | import com.taobao.api.ApiException; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | return ApiResponse.success("æ¥è¯¢æå",wxAuthorizeVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "éé微信ææ", notes = "访客微信ææè·åopenId") |
| | | @GetMapping("/ddAuthorize") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "ææç ", required = true), |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "source", value = "æ¥æº:0=叿ºï¼1=访客ï¼2=å
é¨åå·¥", required = true) |
| | | }) |
| | | public ApiResponse<DDAuthorizeVO> ddAuthorize(@RequestParam String code, @RequestParam Integer source) throws ApiException { |
| | | DDAuthorizeVO ddAuthorizeVO = memberService.ddAuthorize(code,source); |
| | | return ApiResponse.success("æ¥è¯¢æå",ddAuthorizeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢è¢«è®¿é®äººä¿¡æ¯", notes = "æ¥è¯¢è¢«è®¿é®äººä¿¡æ¯") |
| | | @PostMapping("/getVisitedMember") |
| | | public ApiResponse<List<MemberVO>> getVisitedMember(@Valid @RequestBody CheckVisitedDTO checkVisitedDTO) { |
| | |
| | | visits.setSourceType(Constants.ZERO); |
| | | return ApiResponse.success("æ¥è¯¢æå", visitsService.createFk(visits,false,Constants.ZERO)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æ¥è®¿äºç±", notes = "æ¥è®¿äºç±") |
| | | @PostMapping("/visitReason") |
| | | public ApiResponse<List<VisitReason>> visitReason() { |
| | |
| | | } |
| | | |
| | | |
| | | public OapiV2UserGetuserinfoResponse.UserGetByCodeResponse getDDUserByCode(String code) throws ApiException { |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/getuserinfo"); |
| | | OapiV2UserGetuserinfoRequest req = new OapiV2UserGetuserinfoRequest(); |
| | | req.setCode(code); |
| | | OapiV2UserGetuserinfoResponse rsp = client.execute(req, getToken()); |
| | | if(rsp.getErrcode().equals(Constants.DD_ERR_CODE)){ |
| | | return rsp.getResult(); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),rsp.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å
¨é忥 é¨é¨ä¿¡æ¯ |
| | | * æ¥å£ææ¡£å°å https://open.dingtalk.com/document/orgapp/obtain-the-department-list-v2 |
| | |
| | | } |
| | | } |
| | | |
| | | public void workInfoOANotice(Long agentId,String userIds,OapiMessageCorpconversationAsyncsendV2Request.Msg msg)throws ApiException { |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"); |
| | | OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request(); |
| | | request.setAgentId(agentId); |
| | | request.setUseridList(userIds); |
| | | request.setToAllUser(false); |
| | | // OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg(); |
| | | // msg.setMsgtype("oa"); |
| | | // OapiMessageCorpconversationAsyncsendV2Request.OA oa = new OapiMessageCorpconversationAsyncsendV2Request.OA(); |
| | | // oa.setMessageUrl(""); |
| | | // OapiMessageCorpconversationAsyncsendV2Request.Head head = new OapiMessageCorpconversationAsyncsendV2Request.Head(); |
| | | // head.setText(""); |
| | | // head.setBgcolor("#279BAA"); |
| | | // |
| | | // oa.setHead(head); |
| | | // |
| | | // OapiMessageCorpconversationAsyncsendV2Request.Body body = new OapiMessageCorpconversationAsyncsendV2Request.Body(); |
| | | // body.setTitle(""); |
| | | // List<OapiMessageCorpconversationAsyncsendV2Request.Form> form = new ArrayList<>(); |
| | | // |
| | | // body.setForm(form); |
| | | // oa.setBody(body); |
| | | // msg.setOa(oa); |
| | | request.setMsg(msg); |
| | | OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(request, getToken()); |
| | | if(rsp.getErrcode().equals(Constants.DD_ERR_CODE)){ |
| | | |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),rsp.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.web.response; |
| | | |
| | | import com.doumee.dao.business.model.Member; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : Rk |
| | | * @create 2023/12/7 11:19 |
| | | */ |
| | | @Data |
| | | public class DDAuthorizeVO { |
| | | |
| | | @ApiModelProperty(value = "ææ unionId ") |
| | | private String unionId; |
| | | |
| | | @ApiModelProperty(value = "ç¨æ·token") |
| | | private String token; |
| | | |
| | | @ApiModelProperty(value = "ç¨æ·ä¿¡æ¯") |
| | | private Member member; |
| | | } |
| | |
| | | package com.doumee.service.business; |
| | | |
| | | import com.doumee.dao.web.response.DDAuthorizeVO; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | |
| | | import com.doumee.dao.web.reqeust.VisitMemberDTO; |
| | | import com.doumee.dao.web.response.MemberVO; |
| | | import com.doumee.dao.web.response.WxAuthorizeVO; |
| | | import com.taobao.api.ApiException; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | WxAuthorizeVO wxAuthorize(String code,Integer source); |
| | | |
| | | DDAuthorizeVO ddAuthorize(String code, Integer source) throws ApiException; |
| | | |
| | | |
| | | List<MemberVO> getVisitedMember(CheckVisitedDTO checkVisitedDTO); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dingtalk.api.response.OapiV2DepartmentGetResponse; |
| | | import com.dingtalk.api.response.OapiV2UserGetResponse; |
| | | import com.dingtalk.api.response.OapiV2UserGetuserinfoResponse; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.DataSyncConfig; |
| | | import com.doumee.core.annotation.excel.ExcelImporter; |
| | |
| | | import com.doumee.core.haikang.model.param.respose.UserAddResponse; |
| | | import com.doumee.core.haikang.model.param.respose.UserDelResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.dao.web.response.DDAuthorizeVO; |
| | | import com.doumee.service.business.third.TmsService; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | |
| | | return wxAuthorizeVO; |
| | | } |
| | | |
| | | /** |
| | | * å¾®ä¿¡ææ å
é¨äººåç»å½ |
| | | * @param wxAuthorizeVO |
| | | * @param openId |
| | | * @param source |
| | | */ |
| | | private void dealSystemUserAuthBiz(WxAuthorizeVO wxAuthorizeVO, String openId, Integer source) { |
| | | SystemUser user = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() |
| | | .eq(SystemUser::getOpenid,openId) |
| | |
| | | wxAuthorizeVO.setToken(token); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ééææè·åå
é¨äººåç»å½ä¿¡æ¯ |
| | | * @param ddAuthorizeVO |
| | | * @param unionId |
| | | * @param source |
| | | */ |
| | | private void dealSystemUserAuthBizByDD(DDAuthorizeVO ddAuthorizeVO, String unionId, Integer source) { |
| | | SystemUser user = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() |
| | | .eq(SystemUser::getDdUnionId,unionId) |
| | | .in(SystemUser::getType,Constants.memberType.internal) |
| | | .eq(SystemUser::getDeleted,Constants.ZERO) |
| | | .last(" limit 1 ")); |
| | | //éè®¿å®¢ç¨æ· è¿è¡å¤ææ¯å¦åå¨ç¨æ· |
| | | if(!Objects.isNull(user)){ |
| | | Member member = memberMapper.selectById(user.getMemberId()); |
| | | if(member == null || member.getIsdeleted() == Constants.ONE){ |
| | | return; |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ç¨æ·å·²å é¤,请è系管çå"); |
| | | } |
| | | if(member.getStatus() != Constants.ZERO){ |
| | | return; |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ç¨æ·å·²ç¦ç¨,请è系管çå"); |
| | | } |
| | | if(StringUtils.isNotBlank(member.getIdcardNo())){ |
| | | member.setIdcardDecode(DESUtil.decrypt(Constants.EDS_PWD, member.getIdcardNo())); |
| | | } |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); |
| | | member.setPrefixUrl(prefixUrl); |
| | | ddAuthorizeVO.setMember(member); |
| | | //叿º ä¸ å
é¨äººå æä¾token |
| | | String token = systemLoginService.loginByUserId(user.getId()); |
| | | ddAuthorizeVO.setToken(token); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void dealDriverUserAuthBiz(WxAuthorizeVO wxAuthorizeVO, String openId, Integer source) { |
| | | SystemUser user = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() |
| | | .eq(SystemUser::getOpenid,openId) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ééææç»å½ |
| | | * @param code |
| | | * @param source |
| | | * @return |
| | | * @throws ApiException |
| | | */ |
| | | @Override |
| | | public DDAuthorizeVO ddAuthorize(String code, Integer source) throws ApiException { |
| | | if(StringUtils.isBlank(code)||Objects.isNull(source)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | OapiV2UserGetuserinfoResponse.UserGetByCodeResponse userGetByCodeResponse = dingTalk.getDDUserByCode(code); |
| | | if(Objects.isNull(userGetByCodeResponse) |
| | | || StringUtils.isBlank(userGetByCodeResponse.getUnionid())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ééææå¤±è´¥"); |
| | | } |
| | | String unionId = userGetByCodeResponse.getUnionid(); |
| | | |
| | | DDAuthorizeVO ddAuthorizeVO = new DDAuthorizeVO(); |
| | | if(StringUtils.isBlank(unionId)){ |
| | | return ddAuthorizeVO; |
| | | } |
| | | ddAuthorizeVO.setUnionId(unionId); |
| | | // if(source==1){ |
| | | // //å¤çæ®é访客人åèªå¨ææé»è¾ |
| | | // dealVisitUserAuthBiz(wxAuthorizeVO,openId,source); |
| | | // }else if(source == 3){ |
| | | // //å¤çtms管æ§äººåèªå¨ææé»è¾ |
| | | // dealGkUserAuthBiz(wxAuthorizeVO,openId,source); |
| | | // }else if(source == 0){ |
| | | // //妿æ¯å¸æºï¼åä»system_useræ¥è¯¢ |
| | | // dealDriverUserAuthBiz(wxAuthorizeVO,openId,source); |
| | | // }else{ |
| | | //妿æ¯å
é¨äººåï¼åä»system_useræ¥è¯¢ |
| | | dealSystemUserAuthBizByDD(ddAuthorizeVO,unionId,source); |
| | | // } |
| | | return ddAuthorizeVO; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | //åå§åè®¿å®¢ä¿¡æ¯ |
| | | initVisitInfo(visits,date); |
| | | |
| | | // if(StringUtils.isNotBlank(visits.getFaceImg())&&(Constants.equalsInteger(visits.getType(),Constants.ZERO)|| Constants.equalsInteger(visits.getType(),Constants.TWO))){ |
| | | // //人è¸è¯å |
| | | // FacePictureCheckRequest param = new FacePictureCheckRequest(); |
| | | // String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode() + |
| | | // systemDictDataBiz.queryByCode(Constants.FTP,Constants.MEMBER_IMG).getCode(); |
| | | // param.setFacePicUrl(prefixUrl + visits.getFaceImg()); |
| | | // BaseResponse<FacePictureCheckResponse> response = HKService.facePictureCheck(param); |
| | | // if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | // } |
| | | // FacePictureCheckResponse facePictureCheckResponse = response.getData(); |
| | | // if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | // } |
| | | // if(!facePictureCheckResponse.getCheckResult()){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), facePictureCheckResponse.getStatusMessage()); |
| | | // } |
| | | // } |
| | | visits.setSendTimeOutNotice(Constants.ZERO); |
| | | visitsMapper.insert(visits); |
| | | |