feiyu02
2022-09-23 497475defd5d0ebf90ae6a8e2b080a16d78043ab
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/UserinfoServiceImpl.kt
@@ -1,17 +1,25 @@
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
import org.springframework.web.multipart.MultipartFile
import tk.mybatis.mapper.entity.Example
import java.math.BigDecimal
import java.util.*
import javax.servlet.http.HttpServletResponse
@Service
@@ -21,7 +29,7 @@
    val companyMapper: CompanyMapper,
    val restaurantBaseInfoMapper: RestaurantBaseInfoMapper,
    val vehicleBaseInfoMapper: VehicleBaseInfoMapper,
    val userMapMapper: UserMapMapper
    val userMapMapper: UserMapMapper,
) : UserinfoService {
    //根据userinfo条件查询
@@ -97,6 +105,55 @@
        }
    }
    override fun register2(loginRequestVo: LoginRequestVo): AccessToken {
        val result = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().andEqualTo("realname", loginRequestVo.userName)
        })
        if (result.isNotEmpty()) {
            return AccessToken().apply { success = false }
        } else {
            val userInfo = Userinfo().apply {
                guid = UUIDGenerator.generate16ShortUUID()
                acountname = loginRequestVo.userName
                realname = loginRequestVo.userName
                password = loginRequestVo.password
                usertypeid = 3
                usertype = "企业"
                isenable = true
                extension2 = loginRequestVo.sceneType
            }
            val company = Company().apply {
                ciGuid = UUIDGenerator.generate16ShortUUID()
                ciName = loginRequestVo.department
                ciAddress = loginRequestVo.address
                ciLongitude = BigDecimal.ZERO
                ciLatitude = BigDecimal.ZERO
                ciOrgCode = loginRequestVo.orgCode
                ciBuildDate = Date()
                ciTelephone = loginRequestVo.telephone
            }
            val baseInfo = BaseInfo().apply {
                biGuid = userInfo.guid
                biName = userInfo.realname
                ciGuid = company.ciGuid
                ciName = company.ciName
                biTelephone = loginRequestVo.telephone
                biAddress
                biCreateTime = Date()
                biUpdateTime = Date()
                biExtension1 = userInfo.acountname
            }
            save(userInfo)
            baseInfoMapper.insert(baseInfo)
            companyMapper.insert(company)
            return AccessToken().apply {
                userId = userInfo.guid
                success = true
            }
        }
    }
    override fun getAddressBook(userId: String): List<FriendVo> {
        val resultList = mutableListOf<FriendVo>()
        val userInfo = findOne(userId)