| | |
| | | import cn.flightfeather.supervision.domain.entity.UserInfoWx |
| | | import cn.flightfeather.supervision.domain.entity.Userinfo |
| | | import cn.flightfeather.supervision.domain.mapper.* |
| | | import cn.flightfeather.supervision.domain.repository.UserInfoRep |
| | | import cn.flightfeather.supervision.lightshare.service.WxUserService |
| | | import cn.flightfeather.supervision.lightshare.vo.AccessToken |
| | | import cn.flightfeather.supervision.lightshare.vo.AccessTokenPW |
| | | import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX |
| | | import cn.flightfeather.supervision.lightshare.vo.BaseResponse |
| | | import cn.flightfeather.supervision.bgtask.sysnotice.SysNoticeManager |
| | | import com.alibaba.fastjson.JSON |
| | | import com.alibaba.fastjson.JSONArray |
| | | import com.alibaba.fastjson.JSONObject |
| | |
| | | val userMapMapper: UserMapMapper, |
| | | val baseInfoMapper: BaseInfoMapper, |
| | | private val msgSubscribeWxMapper: MsgSubscribeWxMapper, |
| | | private val logMsgSubscribeWxMapper: LogMsgSubscribeWxMapper |
| | | private val logMsgSubscribeWxMapper: LogMsgSubscribeWxMapper, |
| | | private val sysNoticeManager: SysNoticeManager, |
| | | private val userInfoRep: UserInfoRep |
| | | ): WxUserService { |
| | | |
| | | private val LOGGER = LoggerFactory.getLogger(WxUserServiceImpl::class.java) |
| | |
| | | } |
| | | } else { |
| | | if (user.uiGuid != null) { |
| | | userInfoRep.loginLog(user.uiGuid) |
| | | val userinfo = userinfoMapper.selectByPrimaryKey(user.uiGuid) |
| | | BaseResponse(true, "微信用户登录成功", data = userinfo) |
| | | } else { |
| | |
| | | val result = AccessToken() |
| | | //1.1 微信id为空,直接登录; 微信id不为空,绑定至账号 |
| | | if (!accessTokenPW.code.isNullOrBlank()) { |
| | | val baseInfo = baseInfoMapper.selectByPrimaryKey(user[0].guid) |
| | | val baseInfo = baseInfoMapper.selectByPrimaryKey(user[0]?.guid) |
| | | WXHttpService.code2Session(accessTokenPW.code!!)?.let { |
| | | val openid = it.first |
| | | val unionid = it.second |
| | |
| | | result.openId = openid |
| | | return@let if (userWx == null || userWx.uiOpenId == null) { |
| | | val newUserWx = UserInfoWx().apply { |
| | | uiGuid = user[0].guid |
| | | uiGuid = user[0]?.guid |
| | | ciGuid = baseInfo?.ciGuid |
| | | uiOpenId = openid |
| | | uiNickName = accessTokenPW.nickName |
| | |
| | | uiUnionid = unionid |
| | | } |
| | | userInfoWxMapper.insert(newUserWx) |
| | | } else if (userWx.uiGuid != user[0].guid) { |
| | | userWx.uiGuid = user[0].guid |
| | | } else if (userWx.uiGuid != user[0]?.guid) { |
| | | userWx.uiGuid = user[0]?.guid |
| | | userWx.ciGuid = baseInfo?.ciGuid |
| | | userInfoWxMapper.updateByPrimaryKey(userWx) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | val u = user[0] |
| | | u?.uiLoginTime = Date() |
| | | userinfoMapper.updateByPrimaryKeySelective(u) |
| | | userInfoRep.loginLog(u?.guid) |
| | | return result.apply { |
| | | userId = user[0].guid |
| | | userId = user[0]?.guid |
| | | val sUser = userMapMapper.selectByPrimaryKey(userId) |
| | | sUserId = sUser?.svUserId |
| | | success = true |
| | |
| | | AccessToken() |
| | | } else { |
| | | val user = userinfoMapper.selectByPrimaryKey(userWx.uiGuid) |
| | | user?.uiLoginTime = Date() |
| | | userinfoMapper.updateByPrimaryKeySelective(user) |
| | | userInfoRep.loginLog(user?.guid) |
| | | AccessToken().apply { |
| | | if (user?.guid == null) { |
| | | success = false |