This commit is contained in:
shuo.wang
2025-03-01 17:16:53 +08:00
parent 3124174b5f
commit ef12033705
9 changed files with 44 additions and 33 deletions

View File

@@ -23,12 +23,10 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -221,5 +219,4 @@ public class LineInfoDAO {
List<LineInfoDO> lineMobile = lineInfoMapper.getByLineIds(lineIds); List<LineInfoDO> lineMobile = lineInfoMapper.getByLineIds(lineIds);
return lineMobile.stream().filter(o->StringUtils.isNotBlank(o.getMobile())).collect(Collectors.toMap(LineInfoDO::getId, LineInfoDO::getUsername, (k1, k2)-> k1)); return lineMobile.stream().filter(o->StringUtils.isNotBlank(o.getMobile())).collect(Collectors.toMap(LineInfoDO::getId, LineInfoDO::getUsername, (k1, k2)-> k1));
} }
} }

View File

@@ -213,10 +213,10 @@ public class ShopInfoDAO {
return shopInfoMapper.batchUpdate(list); return shopInfoMapper.batchUpdate(list);
} }
public List<ShopInfoDO> selectInvestmentByLines(List<Long> lineIds) { public List<ShopInfoDO> selectByLines(List<Long> lineIds,List<Long> regionIds) {
if (CollectionUtils.isEmpty(lineIds)) { if (CollectionUtils.isEmpty(lineIds)) {
return new ArrayList<>(); return new ArrayList<>();
} }
return shopInfoMapper.selectInvestmentByList(lineIds); return shopInfoMapper.selectByLines(lineIds,regionIds);
} }
} }

View File

@@ -118,5 +118,5 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
Boolean batchUpdate(List<ShopInfoDO> list); Boolean batchUpdate(List<ShopInfoDO> list);
List<ShopInfoDO> selectInvestmentByList (@Param("list") List<Long> list); List<ShopInfoDO> selectByLines (@Param("list") List<Long> list,@Param("regionIds") List<Long> regionIds);
} }

View File

@@ -462,13 +462,14 @@
<select id="partnerList" resultMap="BaseResultMap"> <select id="partnerList" resultMap="BaseResultMap">
select * from xfsg_line_info a select distinct a.id from xfsg_line_info a
join xfsg_shop_info c on a.id = c.line_id
<if test="wantShopAreaName != null"> <if test="wantShopAreaName != null">
left join xfsg_open_area_info b on a.want_shop_area_id = b.id left join xfsg_open_area_info b on a.want_shop_area_id = b.id
</if> </if>
where a.deleted = 0 and a.line_status = 1 and a.join_status in (1,2) where a.deleted = 0 and a.line_status = 1 and a.join_status in (1,2)
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and a.investment_manager = #{userId} and (a.investment_manager = #{userId} or c.investment_manager = #{userId} )
</if> </if>
<if test="request.joinStatus != null"> <if test="request.joinStatus != null">
and a.join_status = #{request.joinStatus} and a.join_status = #{request.joinStatus}
@@ -481,21 +482,33 @@
</if> </if>
<if test="request.queryUserId!=null and request.queryUserId!=''"> <if test="request.queryUserId!=null and request.queryUserId!=''">
<if test="request.queryType != null and request.queryType == 1 "> <if test="request.queryType != null and request.queryType == 1 ">
and a.investment_manager = #{request.queryUserId} and( a.investment_manager = #{request.queryUserId} or c.investment_manager = #{request.queryUserId})
</if> </if>
<if test="request.queryType != null and request.queryType == 2 "> <if test="request.queryType != null and request.queryType == 2 ">
and a.development_manager = #{request.queryUserId} and( a.development_manager = #{request.queryUserId} or c.development_manager = #{request.queryUserId})
</if> </if>
</if> </if>
<if test="request.regionIds !=null and request.regionIds.size>0"> <if test="request.regionIds !=null and request.regionIds.size>0">
<foreach collection="request.regionIds" item="regionId" open="and a.region_id in (" close=")" separator=","> and (
<foreach collection="request.regionIds" item="regionId" open=" a.region_id in (" close=")" separator=",">
#{regionId} #{regionId}
</foreach> </foreach>
or
<foreach collection="request.regionIds" item="regionId" open=" c.region_id in (" close=")" separator=",">
#{regionId}
</foreach>
)
</if> </if>
<if test="regionIds !=null and regionIds.size>0"> <if test="regionIds !=null and regionIds.size>0">
<foreach collection="regionIds" item="regionId" open="and a.region_id in (" close=")" separator=","> and (
<foreach collection="regionIds" item="regionId" open=" a.region_id in (" close=")" separator=",">
#{regionId} #{regionId}
</foreach> </foreach>
or
<foreach collection="regionIds" item="regionId" open=" c.region_id in (" close=")" separator=",">
#{regionId}
</foreach>
)
</if> </if>
order by a.id desc order by a.id desc
</select> </select>

View File

@@ -346,17 +346,13 @@
select select
<include refid="allColumn"/> <include refid="allColumn"/>
from xfsg_shop_info where line_id = #{lineId} and deleted= '0' from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
and ( 1=1
<if test="userId!=null and userId!=''">
or investment_manager = #{userId}
</if>
<if test="list!=null and list.size>0"> <if test="list!=null and list.size>0">
or region_id in and region_id in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
)
</select> </select>
@@ -389,15 +385,16 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectInvestmentByList" resultType="com.cool.store.entity.ShopInfoDO"> <select id="selectByLines" resultType="com.cool.store.entity.ShopInfoDO">
select line_id as LineId, select *
investment_manager as investmentManager,
development_manager as developmentManager
from xfsg_shop_info from xfsg_shop_info
where line_id in where line_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
<foreach collection="regionIds" item="item" index="index" open="and region_id in (" separator="," close=")">
#{item}
</foreach>
</select> </select>
<update id="batchUpdate" parameterType="list"> <update id="batchUpdate" parameterType="list">

View File

@@ -20,7 +20,7 @@ public interface LineService {
* @param lineId * @param lineId
* @return * @return
*/ */
LineInfoVO getLineInfo(Long lineId); LineInfoVO getLineInfo(Long lineId,String userId);
/** /**

View File

@@ -1,7 +1,6 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants; import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo; import com.cool.store.context.LoginUserInfo;
@@ -12,10 +11,8 @@ import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.IntentAgreementMapper; import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.JoinIntentionMapper; import com.cool.store.mapper.JoinIntentionMapper;
import com.cool.store.mapper.RegionMapper;
import com.cool.store.request.*; import com.cool.store.request.*;
import com.cool.store.service.*; import com.cool.store.service.*;
import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.StringUtil; import com.cool.store.utils.StringUtil;
import com.cool.store.utils.UUIDUtils; import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.DateUtils; import com.cool.store.utils.poi.DateUtils;
@@ -30,7 +27,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @Author suzhuhong * @Author suzhuhong
@@ -86,7 +82,7 @@ public class LineServiceImpl implements LineService {
@Override @Override
public LineInfoVO getLineInfo(Long lineId) { public LineInfoVO getLineInfo(Long lineId,String currentUserId) {
LineInfoVO result = new LineInfoVO(); LineInfoVO result = new LineInfoVO();
// 查询线索信息 // 查询线索信息
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
@@ -100,8 +96,16 @@ public class LineServiceImpl implements LineService {
Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(Arrays.asList(lineInfo.getLineSource())); Map<Integer, String> channelMapByIds = hyPartnerUserChannelDAO.getChannelMapByIds(Arrays.asList(lineInfo.getLineSource()));
result.setLineSourceName(channelMapByIds.get(lineInfo.getLineSource())); result.setLineSourceName(channelMapByIds.get(lineInfo.getLineSource()));
} }
List<Long> regionId = new ArrayList<>();
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectInvestmentByLines(Collections.singletonList(lineInfo.getId())); if (StringUtils.isNotBlank(currentUserId) && !sysRoleService.checkIsAdmin(currentUserId)) {
List<String> list = userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(currentUserId);
if (CollectionUtils.isNotEmpty(list)) {
for (String s : list) {
regionId.add(Long.valueOf(s));
}
}
}
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByLines(Collections.singletonList(lineInfo.getId()),regionId);
Set<String> userIds = new HashSet<>(); Set<String> userIds = new HashSet<>();
//门店的招生和选址人远 //门店的招生和选址人远
Set<String> shopInvestmentMserIds = shopInfoDOS.stream().map(ShopInfoDO::getInvestmentManager).filter(StringUtils::isNotBlank).collect(Collectors.toSet()); Set<String> shopInvestmentMserIds = shopInfoDOS.stream().map(ShopInfoDO::getInvestmentManager).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
@@ -287,7 +291,7 @@ public class LineServiceImpl implements LineService {
List<LineInfoDO> lineInfoDOS = lineInfoDAO.partnerList(partnerRequest, areaName, userId, regionId); List<LineInfoDO> lineInfoDOS = lineInfoDAO.partnerList(partnerRequest, areaName, userId, regionId);
PageInfo page = new PageInfo(lineInfoDOS); PageInfo page = new PageInfo(lineInfoDOS);
List<Long> lineIds = lineInfoDOS.stream().map(LineInfoDO::getId).collect(Collectors.toList()); List<Long> lineIds = lineInfoDOS.stream().map(LineInfoDO::getId).collect(Collectors.toList());
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectInvestmentByLines(lineIds); List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByLines(lineIds,regionId);
Map<Long, Set<String>> investmentManagerIdMapByLineId = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getLineId, Collectors.mapping(ShopInfoDO::getInvestmentManager, Collectors.toSet()))); Map<Long, Set<String>> investmentManagerIdMapByLineId = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getLineId, Collectors.mapping(ShopInfoDO::getInvestmentManager, Collectors.toSet())));
Map<Long, Set<String>> developmentManagerMap = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getLineId, Collectors.mapping(ShopInfoDO::getDevelopmentManager, Collectors.toSet()))); Map<Long, Set<String>> developmentManagerMap = shopInfoDOS.stream().collect(Collectors.groupingBy(ShopInfoDO::getLineId, Collectors.mapping(ShopInfoDO::getDevelopmentManager, Collectors.toSet())));

View File

@@ -48,7 +48,7 @@ public class LineInfoController {
@ApiImplicitParam(name = "lineId", value = "线索id", required = true) @ApiImplicitParam(name = "lineId", value = "线索id", required = true)
}) })
public ResponseResult<LineInfoVO> getLineInfo(@RequestParam("lineId")Long lineId) { public ResponseResult<LineInfoVO> getLineInfo(@RequestParam("lineId")Long lineId) {
return ResponseResult.success(lineService.getLineInfo(lineId)); return ResponseResult.success(lineService.getLineInfo(lineId,CurrentUserHolder.getUserId()));
} }
@ApiOperation("我的线索") @ApiOperation("我的线索")

View File

@@ -46,7 +46,7 @@ public class LineController {
@ApiImplicitParam(name = "lineId", value = "线索id", required = true) @ApiImplicitParam(name = "lineId", value = "线索id", required = true)
}) })
public ResponseResult<LineInfoVO> getLineInfo(@RequestParam("lineId")Long lineId) { public ResponseResult<LineInfoVO> getLineInfo(@RequestParam("lineId")Long lineId) {
return ResponseResult.success(lineService.getLineInfo(lineId)); return ResponseResult.success(lineService.getLineInfo(lineId, null));
} }
@ApiOperation("根据线索id查询大区的支付二维码图片") @ApiOperation("根据线索id查询大区的支付二维码图片")