| | |
| | | package cn.flightfeather.supervision.lightshare.service.Impl |
| | | |
| | | import cn.flightfeather.supervision.common.net.WXHttpService |
| | | import cn.flightfeather.supervision.domain.entity.BaseInfo |
| | | import cn.flightfeather.supervision.domain.entity.Company |
| | | import cn.flightfeather.supervision.domain.entity.UserInfoWx |
| | | import cn.flightfeather.supervision.domain.entity.Userinfo |
| | | import cn.flightfeather.supervision.domain.enumeration.SceneType |
| | | import cn.flightfeather.supervision.domain.enumeration.UserType |
| | | import cn.flightfeather.supervision.domain.mapper.* |
| | | import cn.flightfeather.supervision.infrastructure.utils.FileUtil |
| | | import cn.flightfeather.supervision.infrastructure.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.lightshare.service.UserinfoService |
| | | import cn.flightfeather.supervision.lightshare.vo.* |
| | | import com.alibaba.fastjson.JSONObject |
| | | import com.github.pagehelper.PageHelper |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Service |
| | |
| | | val restaurantBaseInfoMapper: RestaurantBaseInfoMapper, |
| | | val vehicleBaseInfoMapper: VehicleBaseInfoMapper, |
| | | val userMapMapper: UserMapMapper, |
| | | val personalInfoMapper: PersonalInfoMapper, |
| | | val userInfoWxMapper: UserInfoWxMapper |
| | | ) : UserinfoService { |
| | | |
| | | //根据userinfo条件查询 |
| | |
| | | } |
| | | } |
| | | |
| | | override fun findOne(id: String): Userinfo{ |
| | | override fun findOne(id: String): Userinfo { |
| | | val userInfo = userinfoMapper.selectByPrimaryKey(id) |
| | | userMapMapper.selectByPrimaryKey(id)?.let { |
| | | userInfo?.extension3 = it.svUserId |
| | |
| | | } |
| | | } |
| | | |
| | | override fun changePassword(userId: String, oldPassword: String, newPassword: String): Int { |
| | | override fun changePassword(userId: String, oldPassword: String, newPassword: String): BaseResponse<String> { |
| | | if (newPassword.trim() == "") return BaseResponse(false, "新密码不能为空") |
| | | if (oldPassword == newPassword) return BaseResponse(false, "新密码不能和原密码相同") |
| | | |
| | | val userInfo = findOne(userId) |
| | | return if (oldPassword != userInfo.password) { |
| | | 0 |
| | | BaseResponse(false, "原密码错误") |
| | | } else { |
| | | val newUserInfo = Userinfo().apply { |
| | | guid = userInfo.guid |
| | | password = newPassword |
| | | remark = "pwChanged" |
| | | } |
| | | update(newUserInfo) |
| | | BaseResponse(true, "密码修改成功") |
| | | } |
| | | } |
| | | |
| | |
| | | return result |
| | | } |
| | | |
| | | override fun getBaseInfo(userId: String): UserBaseInfo { |
| | | override fun getBaseInfo(userId: String, wxUserId: String?): UserBaseInfo { |
| | | val userInfo = userinfoMapper.selectByPrimaryKey(userId) ?: return UserBaseInfo(userId) |
| | | val baseInfo = baseInfoMapper.selectByPrimaryKey(userId) ?: return UserBaseInfo(userId) |
| | | val baseInfo = baseInfoMapper.selectByPrimaryKey(userId) |
| | | val wxUser = if (wxUserId != null) userInfoWxMapper.selectByPrimaryKey(wxUserId) else null |
| | | |
| | | val mapper = when (userInfo.extension2) { |
| | | SceneType.Restaurant.value.toString() -> restaurantBaseInfoMapper |
| | | SceneType.VehicleRepair.value.toString() -> vehicleBaseInfoMapper |
| | | else -> restaurantBaseInfoMapper |
| | | else -> null |
| | | } |
| | | |
| | | val specialInfo = mapper.selectByPrimaryKey(baseInfo.biGuid) |
| | | val companyInfo = companyMapper.selectByPrimaryKey(baseInfo.ciGuid) |
| | | val specialInfo = mapper?.selectByPrimaryKey(baseInfo?.biGuid) |
| | | val companyInfo = companyMapper.selectByPrimaryKey(if (baseInfo?.ciGuid != null) baseInfo.ciGuid else wxUser?.ciGuid) |
| | | val personalInfo = personalInfoMapper.selectByPrimaryKey(wxUser?.piGuid) |
| | | |
| | | return UserBaseInfo(userId, userInfo.realname, baseInfo, companyInfo, specialInfo) |
| | | return UserBaseInfo(userId, userInfo.realname, baseInfo, companyInfo, specialInfo, personalInfo) |
| | | } |
| | | |
| | | override fun search(district: String?, sceneType: Int?, userType: Int?, page: Int, perPage: Int): BaseResponse<List<Userinfo>> { |