提交 906dab4d 编写于 作者: peijun.zhao's avatar peijun.zhao

根据医生id返回微信用户信息

上级 54465333
流水线 #30192 已失败 于阶段
in 0 second
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.common.req.AccountInfoReq;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.account.account.server.service.AccountInfoService;
import com.pica.cloud.account.account.server.service.WechatService;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.service.starter.interceptor.EnabledLoginValidate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
......@@ -18,11 +21,14 @@ import java.util.List;
@Api(description = "账号信息")
@RestController
@RequestMapping("/info")
public class AccountInfoController {
public class AccountInfoController extends AccountBaseController {
@Autowired
private AccountInfoService accountInfoService;
@Autowired
private WechatService wechatService;
@ApiOperation("获取用户数量")
@PostMapping("/count")
public PicaResponse<Integer> getCount(@RequestBody AccountInfoReq req) {
......@@ -43,4 +49,12 @@ public class AccountInfoController {
return PicaResponse.toResponse(accountInfoService.getDoctorIds(req));
}
@ApiOperation("获取医生wechat信息")
@GetMapping("/wechat")
@EnabledLoginValidate
public PicaResponse<AccountWeChatInfoEntity> getWechatInfo(@RequestHeader String token) {
return PicaResponse.toResponse(wechatService.getAccountWechatInfo(fetchPicaUser()));
}
}
......@@ -112,5 +112,6 @@ public interface DoctorMapper {
*/
Integer updateDoctorModifyRecord();
String getUnionIdByDoctorId(@Param("doctorId") Integer doctorId);
}
\ No newline at end of file
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.foundation.utils.entity.PicaUser;
public interface WechatService {
AccountWeChatInfoEntity getAccountWechatInfo(PicaUser user);
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import com.pica.cloud.account.account.server.mapper.AccountWeChatInfoMapper;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.account.account.server.service.WechatService;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class WechatServiceImpl implements WechatService {
@Autowired
private DoctorMapper doctorMapper;
@Autowired
private AccountWeChatInfoMapper weChatInfoMapper;
@Override
public AccountWeChatInfoEntity getAccountWechatInfo(PicaUser user) {
String unionId = doctorMapper.getUnionIdByDoctorId(user.getId());
if(StringUtil.isEmpty(unionId)){
return null;
}else {
return weChatInfoMapper.selectByUnionId(unionId);
}
}
}
......@@ -1063,5 +1063,13 @@
</foreach>
</update>
<select id="getUnionIdByDoctorId" resultType="java.lang.String" parameterType="java.lang.Integer">
select u.union_id from p_doctor d
join account_info a on d.acct_id = a.id
join account_union u on a.id = u.acct_id
where d.id = #{doctorId} and u.union_type = 1
and d.delete_flag = 1 and a.delete_flag = 1 and u.delete_flag = 1
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册