update 查询所属运营商,带权限校验

This commit is contained in:
Guoqs
2024-06-13 15:44:46 +08:00
parent fe87fa038c
commit 53d83bf1af
6 changed files with 46 additions and 4 deletions

View File

@@ -108,8 +108,6 @@ public class MemberBasicInfoController extends BaseController {
@GetMapping("/getMerchantListByAuth") @GetMapping("/getMerchantListByAuth")
public RestApiResponse<?> getMerchantListByAuth() { public RestApiResponse<?> getMerchantListByAuth() {
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
// LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail();
// logger.info("获取登录用户信息:{}", JSON.toJSONString(loginUserDetail));
List<MerchantInfoVO> list = UserUtils.getMerchantInfoVOList(); List<MerchantInfoVO> list = UserUtils.getMerchantInfoVOList();
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();

View File

@@ -6,17 +6,22 @@ import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.page.TableDataInfo; import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType; import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.poi.ExcelUtil; import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileMerchantInfo; import com.jsowell.pile.domain.PileMerchantInfo;
import com.jsowell.pile.dto.CreateMerchantDTO; import com.jsowell.pile.dto.CreateMerchantDTO;
import com.jsowell.pile.dto.QueryMerchantInfoDTO; import com.jsowell.pile.dto.QueryMerchantInfoDTO;
import com.jsowell.pile.service.PileMerchantInfoService; import com.jsowell.pile.service.PileMerchantInfoService;
import com.jsowell.pile.util.UserUtils;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**

View File

@@ -25,6 +25,13 @@ public interface PileMerchantInfoMapper {
*/ */
public PileMerchantInfo selectPileMerchantInfoById(Long id); public PileMerchantInfo selectPileMerchantInfoById(Long id);
/**
* 查询运营商列表
* @param merchantIdList
* @return
*/
List<PileMerchantInfo> selectPileMerchantInfoListByIdList(@Param("merchantIdList") List<String> merchantIdList);
/** /**
* 通过appid查询充电桩运营商信息 * 通过appid查询充电桩运营商信息
* @param appId * @param appId
@@ -127,4 +134,5 @@ public interface PileMerchantInfoMapper {
* @return * @return
*/ */
PileMerchantInfoVO queryMerchantInfoByStationId(String stationId); PileMerchantInfoVO queryMerchantInfoByStationId(String stationId);
} }

View File

@@ -36,6 +36,8 @@ public interface PileMerchantInfoService {
List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo); List<PileMerchantInfo> selectPileMerchantInfoList(PileMerchantInfo pileMerchantInfo);
List<PileMerchantInfo> selectPileMerchantInfoListByIdList(List<String> merchantIdList);
/** /**
* 新增充电桩运营商信息 * 新增充电桩运营商信息
* *
@@ -72,11 +74,16 @@ public interface PileMerchantInfoService {
/** /**
* 通过微信小程序appId查询一级运营商merchantId * 通过微信小程序appId查询一级运营商merchantId
* @param appId 微信小程序appId * @param wechatAppId 微信小程序appId
* @return 一级运营商merchantId * @return 一级运营商merchantId
*/ */
String getFirstLevelMerchantIdByWxAppId(String wechatAppId); String getFirstLevelMerchantIdByWxAppId(String wechatAppId);
/**
* 通过支付宝小程序appId查询一级运营商merchantId
* @param alipayAppId 微信小程序appId
* @return 一级运营商merchantId
*/
String getFirstLevelMerchantIdByAliAppId(String alipayAppId); String getFirstLevelMerchantIdByAliAppId(String alipayAppId);
MerchantInfoVO getMerchantInfoVO(String merchantId); MerchantInfoVO getMerchantInfoVO(String merchantId);

View File

@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/** /**
* 充电桩运营商信息Service业务层处理 * 充电桩运营商信息Service业务层处理
@@ -81,7 +82,13 @@ public class PileMerchantInfoServiceImpl implements PileMerchantInfoService {
return Lists.newArrayList(); return Lists.newArrayList();
} }
pileMerchantInfo.setStationDeptIds(authorizedMap.getStationDeptIds()); pileMerchantInfo.setStationDeptIds(authorizedMap.getStationDeptIds());
pileMerchantInfo.setMerchantDeptIds(authorizedMap.getMerchantDeptIds());
// 当前登录用户的运营商权限列表
List<MerchantInfoVO> list = UserUtils.getMerchantInfoVOList();
if (CollectionUtils.isNotEmpty(list)) {
List<String> collect = list.stream().map(MerchantInfoVO::getDeptId).collect(Collectors.toList());
pileMerchantInfo.setMerchantDeptIds(collect);
}
return selectPileMerchantInfoList(pileMerchantInfo); return selectPileMerchantInfoList(pileMerchantInfo);
} }
@@ -104,6 +111,11 @@ public class PileMerchantInfoServiceImpl implements PileMerchantInfoService {
return list; return list;
} }
@Override
public List<PileMerchantInfo> selectPileMerchantInfoListByIdList(List<String> merchantIdList) {
return pileMerchantInfoMapper.selectPileMerchantInfoListByIdList(merchantIdList);
}
/** /**
* 新增充电桩运营商信息 * 新增充电桩运营商信息
* *

View File

@@ -100,6 +100,17 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="selectPileMerchantInfoListByIdList" resultMap="PileMerchantInfoResult">
select
<include refid="Base_Column_List"/>
from pile_merchant_info
where id in
<foreach collection="merchantIdList" item="merchantId" open="(" separator="," close=")">
#{merchantId,jdbcType=VARCHAR}
</foreach>
</select>
<insert id="insertPileMerchantInfo" parameterType="com.jsowell.pile.domain.PileMerchantInfo"> <insert id="insertPileMerchantInfo" parameterType="com.jsowell.pile.domain.PileMerchantInfo">
insert into pile_merchant_info insert into pile_merchant_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -428,4 +439,5 @@
t1.del_flag = '0' t1.del_flag = '0'
AND t1.id = #{stationId,jdbcType=VARCHAR} AND t1.id = #{stationId,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>