This commit is contained in:
苏竹红
2023-06-21 15:56:14 +08:00
parent bbf3d47de5
commit 72a3bcc850
8 changed files with 124 additions and 2 deletions

View File

@@ -2,10 +2,13 @@ package com.cool.store.dao;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import com.cool.store.mapper.HyPartnerBaseInfoMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author suzhuhong
@@ -25,6 +28,13 @@ public class HyPartnerBaseInfoDAO {
return hyPartnerBaseInfoMapper.insertSelective(record);
}
public int batchInsert( List<HyPartnerBaseInfoDO> records){
if (CollectionUtils.isEmpty(records)){
return 0;
}
return hyPartnerBaseInfoMapper.batchInsert(records);
}
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
@@ -57,6 +67,13 @@ public class HyPartnerBaseInfoDAO {
return hyPartnerBaseInfoMapper.getByPartnerLineId(partnerLineId);
}
public List<HyPartnerBaseInfoDO> getByPartnerLineIds(List<Long> partnerLineId){
if (CollectionUtils.isEmpty(partnerLineId)){
return new ArrayList<>();
}
return hyPartnerBaseInfoMapper.getByPartnerLineIds(partnerLineId);
}
public Long getLineIdByIdCard(String idCard){
if (StringUtils.isEmpty(idCard)){
return null;

View File

@@ -3,6 +3,8 @@ package com.cool.store.mapper;
import com.cool.store.entity.HyPartnerBaseInfoDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-05-29 03:51
@@ -16,6 +18,8 @@ public interface HyPartnerBaseInfoMapper {
*/
int insertSelective(@Param("record") HyPartnerBaseInfoDO record);
int batchInsert(@Param("records") List<HyPartnerBaseInfoDO> records);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
@@ -38,6 +42,9 @@ public interface HyPartnerBaseInfoMapper {
HyPartnerBaseInfoDO getByPartnerLineId(@Param("partnerLineId") Long partnerLineId);
List<HyPartnerBaseInfoDO> getByPartnerLineIds(@Param("partnerLineId") List<Long> partnerLineIds);
Long getLineIdByIdCard(@Param("idCard") String idCard);
int cleanIdCardInfoByPartnerLineId(@Param("idCard") String idCard,

View File

@@ -27,6 +27,21 @@
id_card_photo_front, id_card_photo_black, live_address, user_portrait, status, latest_log_message,
pass_reason, certify_file, create_time, update_time
</sql>
<insert id="batchInsert">
insert into
hy_partner_base_info
(
partner_id,
partner_line_id
)
values
<foreach collection="records" item="record" separator=",">
(#{record.partnerId},
#{record.partnerLineId}
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_base_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -142,6 +157,9 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_partner_base_info
<set>
@@ -231,6 +249,19 @@
where partner_line_id = #{partnerLineId}
</select>
<select id="getByPartnerLineIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_base_info
<where>
<if test="partnerLineIds !=null and partnerLineIds.size>0">
<foreach collection="partnerLineIds" item="lineId" open="and partner_line_id in (" close=")" separator=",">
#{lineId}
</foreach>
</if>
</where>
</select>
<select id="getLineIdByIdCard" resultType="java.lang.Long">
select
partner_line_id

View File

@@ -36,7 +36,7 @@
</select>
<insert id="batchInsert">
<insert id="batchInsert" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into
hy_partner_line_info
(

View File

@@ -0,0 +1,17 @@
package com.cool.store.service;
/**
* @Author suzhuhong
* @Date 2023/6/21 15:01
* @Version 1.0
*/
public interface GaoDeService {
/**
* 根据经纬度生成图片
* @param latitudeLongitude
* @return
*/
String getGaoDePicture(String latitudeLongitude);
}

View File

@@ -0,0 +1,31 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.service.GaoDeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2023/6/21 15:04
* @Version 1.0
*/
@Service
@Slf4j
public class GaoDeServiceImpl implements GaoDeService {
@Resource
RestTemplate restTemplate;
@Override
public String getGaoDePicture(String latitudeLongitude) {
String url = "https://restapi.amap.com/v3/staticmap?location=120.21201,30.2084&zoom=10&size=750*300&markers=mid,,A:116.481485,39.990464&key=fb6332444cab4eba54655571dfc68f5b&markersStyle=-1";
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
String body = forEntity.getBody();
log.info("--------------{}", JSONObject.toJSON(body));
return body;
}
}

View File

@@ -29,6 +29,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Array;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -57,6 +58,8 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
EnterpriseUserService enterpriseUserService;
@Resource
AliyunService aliyunService;
@Resource
HyPartnerBaseInfoDAO hyPartnerBaseInfoDAO;
@Override
public StageCountVO selectStagePendingCount(String userId) {
@@ -141,6 +144,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
//过滤出已结束的线索 这块线索需要重新生成新的线索
List<HyPartnerLineInfoDO> closeLineList = partnerLineInfoList.stream().filter(x -> x.getCloseTime() != null).collect(Collectors.toList());
List<Long> closeLineIdList = closeLineList.stream().map(HyPartnerLineInfoDO::getId).collect(Collectors.toList());
//已结束的线索 需要重新生成一条新的线索
List<HyPartnerLineInfoDO> list = new ArrayList<>();
closeLineList.stream().forEach(x->{
@@ -153,6 +157,14 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
list.add(hyPartnerLineInfoDO);
});
hyPartnerLineInfoDAO.batchInsert(list);
List<HyPartnerBaseInfoDO> hyPartnerBaseInfoDOS = new ArrayList<>();
list.forEach(x->{
HyPartnerBaseInfoDO newHyPartnerBaseInfoDO = new HyPartnerBaseInfoDO();
newHyPartnerBaseInfoDO.setPartnerId(x.getPartnerId());
newHyPartnerBaseInfoDO.setPartnerLineId(x.getId());
hyPartnerBaseInfoDOS.add(newHyPartnerBaseInfoDO);
});
hyPartnerBaseInfoDAO.batchInsert(hyPartnerBaseInfoDOS);
//将老的线索置为删除状态
hyPartnerLineInfoDAO.batchDeleted(closeLineIdList);
//没有结束的线索直接分配招商经理
@@ -160,7 +172,7 @@ public class HyPartnerLineInfoServiceImpl implements HyPartnerLineInfoService {
List<Long> otherLineIdList = otherLineList.stream().map(HyPartnerLineInfoDO::getId).collect(Collectors.toList());
hyPartnerLineInfoDAO.updateInvestmentManager(userId, otherLineIdList);
return null;
return Boolean.TRUE;
}
@Override

View File

@@ -25,6 +25,7 @@ import com.cool.store.response.ResponseResult;
import com.cool.store.service.AliyunService;
import com.cool.store.service.EnterpriseSyncService;
import com.cool.store.service.EnterpriseUserService;
import com.cool.store.service.GaoDeService;
import com.cool.store.vo.cuser.IdentityCardInfoVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -47,6 +48,8 @@ public class TestController {
@Resource
private EnterpriseUserService enterpriseUserService;
@Resource
GaoDeService gaoDeService;
@Resource
private ISVHttpRequest isvHttpRequest;
@Resource
private HyOpenAreaInfoMapper hyOpenAreaInfoMapper;
@@ -239,4 +242,8 @@ public class TestController {
return ResponseResult.success(enterpriseUserService.getDevelopmentByZoneId(zoneId));
}
@GetMapping("getGaoDePicture")
public ResponseResult getDevelopmentByZoneId(){
return ResponseResult.success(gaoDeService.getGaoDePicture(""));
}
}