提交 894d7be6 作者: 刘明祎-运维用途

修改查找不到用户的公众号openid空指针问题

上级 e900d627
流水线 #7706 已通过 于阶段
in 2 分 22 秒
......@@ -22,4 +22,6 @@ public interface UserSubInfoDao {
void removeUserSubInfo(String openId);
void updateUserSubInfo(UserSubInfoDO subInfo);
String getUserOpenidByUnionId(String unionId);
}
......@@ -17,6 +17,7 @@ import com.mmc.iuav.user.dao.userpoints.UserPointsDao;
import com.mmc.iuav.user.dao.userpoints.UserPointsDetailsDao;
import com.mmc.iuav.user.entity.CompanyInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserSubInfoDO;
import com.mmc.iuav.user.entity.dronepilot.*;
import com.mmc.iuav.user.entity.userpoints.UserPointsDO;
import com.mmc.iuav.user.entity.userpoints.UserPointsDetails;
......@@ -313,7 +314,7 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
WxMsgVO ws = new WxMsgVO();
String unionId = userAccountDO.getUnionId();
// 查询对应的openId(touser)
String touser = userSubInfoDao.getUserSubInfoByUnionId(unionId).getOpenId();
String touser = userSubInfoDao.getUserOpenidByUnionId(unionId);
JSONObject jsonObject = spellMsg("飞手执照及能力认证","审核通过");
ws.setTouser(touser);
ws.setTemplateId("9qvgBhfW9yoQJY91iMfhrog8y5eZUPSbo9PLvQzS_vk");
......
......@@ -255,8 +255,8 @@ public class WxServiceImpl implements WxService {
try {
accessToken = this.getSubStableAccessToken();
if (StringUtils.isBlank(ws.getTouser())) {
String unionId = userServiceDao.getUserAccountById(ws.getUserAccountId()).getUnionId();
String touser = userSubInfoDao.getUserSubInfoByUnionId(unionId).getOpenId();
String unionId = userServiceDao.getUserAccountById(ws.getUserAccountId()).getUnionId();// 查询对应的openId(touser)
String touser = userSubInfoDao.getUserOpenidByUnionId(unionId);
ws.setTouser(touser);
}
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
......
......@@ -41,6 +41,11 @@
from user_sub_info u
where u.open_id = #{openId} and is_deleted = 0
</select>
<select id="getUserOpenidByUnionId" resultType="java.lang.String">
select usi.open_id
from user_sub_info usi
where usi.union_id = #{unionId} and usi.is_deleted=0
</select>
<insert id="insertUserSubInfo" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.iuav.user.entity.UserSubInfoDO">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论