package com.mosty.wzzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mosty.base.model.dto.wzzx.LocationInfo;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.entity.wzzx.TbWzSblswz;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.utils.GeoHashKit;
import com.mosty.base.utils.JtsUtils;
import com.mosty.base.utils.UUIDGenerator;
import com.mosty.wzzx.mapper.TbWzSblswzMapper;
import com.mosty.wzzx.mongodb.TbWzSblswzMongoService;
import com.mosty.wzzx.mongodb.entity.TbWzSblswzMo;
import com.mosty.wzzx.remote.TbBaseAdaptRemoteService;
import com.mosty.wzzx.service.TbWzSblswzService;
import com.mosty.wzzx.service.TbWzSbsswzService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Timestamp;

@Service
public class TbWzSblswzServiceImpl extends ServiceImpl<TbWzSblswzMapper, TbWzSblswz>
        implements TbWzSblswzService {

    @Resource
    private TbWzSblswzMongoService tbWzSblswzMongoService;

    public void saveSblswz(TbWzSbsswz sbsswz) {
        if (ObjectUtils.isNotEmpty(sbsswz)) {
            TbWzSblswz wz = new TbWzSblswz();
            BeanUtils.copyProperties(sbsswz, wz);
            wz.setZb(JtsUtils.getPoint(wz.getJd(), wz.getWd()));
            this.baseMapper.insertEntity(wz);
            TbWzSblswzMo mo = new TbWzSblswzMo();
            BeanUtils.copyProperties(wz, mo);
            this.tbWzSblswzMongoService.save(mo);
        }
    }
}
