update 运营商仅可查看本运营商下所有站点订单信息

This commit is contained in:
Lemon
2023-07-04 14:49:50 +08:00
parent ba9c16d34c
commit 31e366b49f
11 changed files with 69 additions and 10 deletions

View File

@@ -17,4 +17,10 @@ public class AuthorizedDeptVO {
private List<String> merchantDeptIds; private List<String> merchantDeptIds;
// 有权限的站点 // 有权限的站点
private List<String> stationDeptIds; private List<String> stationDeptIds;
// 部门id
private String deptId;
// 运营商id
private List<String> merchantIds;
} }

View File

@@ -126,6 +126,8 @@ public class SecurityUtils {
log.info("用户id:{}, 获取不到所属部门信息", user.getUserId()); log.info("用户id:{}, 获取不到所属部门信息", user.getUserId());
return null; return null;
} }
String deptId = String.valueOf(dept.getDeptId());
resultVO.setDeptId(deptId);
log.info("用户id:{}, 所属部门信息:{}", user.getUserId(), JSONObject.toJSONString(dept)); log.info("用户id:{}, 所属部门信息:{}", user.getUserId(), JSONObject.toJSONString(dept));
// 登录用户角色 // 登录用户角色
List<SysRole> roles = user.getRoles(); List<SysRole> roles = user.getRoles();
@@ -136,11 +138,11 @@ public class SecurityUtils {
// 父级id是0表明是该账号挂在平台下面是系统管理员 // 父级id是0表明是该账号挂在平台下面是系统管理员
} else if (parentId == 100L) { } else if (parentId == 100L) {
// 父级id是100表明是该账号挂在运营商下面是运营商管理员 // 父级id是100表明是该账号挂在运营商下面是运营商管理员
merchantDeptIds.add(String.valueOf(dept.getDeptId())); merchantDeptIds.add(deptId);
resultVO.setMerchantDeptIds(merchantDeptIds); resultVO.setMerchantDeptIds(merchantDeptIds);
} else { } else {
// 其他情况,表明是站点管理员 // 其他情况,表明是站点管理员
stationDeptIds.add(String.valueOf(dept.getDeptId())); stationDeptIds.add(deptId);
resultVO.setStationDeptIds(stationDeptIds); resultVO.setStationDeptIds(stationDeptIds);
} }
return resultVO; return resultVO;

View File

@@ -61,6 +61,12 @@ public class OrderBasicInfo extends BaseEntity {
@Excel(name = "站点id") @Excel(name = "站点id")
private String stationId; private String stationId;
/**
* 运营商id
*/
@Excel(name = "运营商id")
private String merchantId;
/** /**
* 充电桩sn号 * 充电桩sn号
*/ */

View File

@@ -49,6 +49,11 @@ public class QueryOrderDTO extends BaseEntity {
*/ */
private String stationId; private String stationId;
/**
* 运营商Id
*/
private String merchantId;
/** /**
* 开始时间 * 开始时间
*/ */

View File

@@ -70,4 +70,11 @@ public interface PileMerchantInfoMapper {
public int deletePileMerchantInfoByIds(Long[] ids); public int deletePileMerchantInfoByIds(Long[] ids);
List<String> queryByMerchantDeptIds(@Param("merchantDeptIds") List<String> merchantDeptIds); List<String> queryByMerchantDeptIds(@Param("merchantDeptIds") List<String> merchantDeptIds);
/**
* 根据部门id查询基本信息
* @param deptId
* @return
*/
PileMerchantInfo queryInfoByDeptId(@Param("deptId") String deptId);
} }

View File

@@ -72,5 +72,5 @@ public interface IPileMerchantInfoService {
*/ */
List<String> queryByMerchantDeptIds(List<String> merchantDeptIds); List<String> queryByMerchantDeptIds(List<String> merchantDeptIds);
PileMerchantInfo queryInfoByDeptId(String deptId);
} }

View File

@@ -176,7 +176,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
} }
dto.setStationDeptIds(authorizedMap.getStationDeptIds()); dto.setStationDeptIds(authorizedMap.getStationDeptIds());
dto.setMerchantDeptIds(authorizedMap.getMerchantDeptIds()); dto.setMerchantDeptIds(authorizedMap.getMerchantDeptIds());
String deptId = authorizedMap.getDeptId();
// 根据部门id查询merchantId
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
if (pileMerchantInfo != null) {
dto.setMerchantId(String.valueOf(pileMerchantInfo.getId()));
}
List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto); List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto);
if (CollectionUtils.isNotEmpty(orderListVOS)) { if (CollectionUtils.isNotEmpty(orderListVOS)) {
for (OrderListVO orderListVO : orderListVOS) { for (OrderListVO orderListVO : orderListVOS) {

View File

@@ -245,4 +245,9 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
public List<String> queryByMerchantDeptIds(List<String> merchantDeptIds) { public List<String> queryByMerchantDeptIds(List<String> merchantDeptIds) {
return pileMerchantInfoMapper.queryByMerchantDeptIds(merchantDeptIds); return pileMerchantInfoMapper.queryByMerchantDeptIds(merchantDeptIds);
} }
@Override
public PileMerchantInfo queryInfoByDeptId(String deptId) {
return pileMerchantInfoMapper.queryInfoByDeptId(deptId);
}
} }

View File

@@ -10,6 +10,7 @@
<result property="orderStatus" column="order_status"/> <result property="orderStatus" column="order_status"/>
<result property="memberId" column="member_id"/> <result property="memberId" column="member_id"/>
<result property="stationId" column="station_id"/> <result property="stationId" column="station_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="pileSn" column="pile_sn"/> <result property="pileSn" column="pile_sn"/>
<result property="connectorCode" column="connector_code"/> <result property="connectorCode" column="connector_code"/>
<result property="pileConnectorCode" column="pile_connector_code"/> <result property="pileConnectorCode" column="pile_connector_code"/>
@@ -91,6 +92,7 @@
order_status, order_status,
member_id, member_id,
station_id, station_id,
merchant_id,
pile_sn, pile_sn,
connector_code, connector_code,
pile_connector_code, pile_connector_code,
@@ -223,13 +225,16 @@
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR} and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</if> </if>
<if test="merchantId != null and merchantId != ''">
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
<!--<if test="merchantDeptIds != null and merchantDeptIds.size() != 0"> <!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
and t3.dept_id in <!-- and t3.dept_id in-->
<foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")"> <!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
#{merchantDeptId} <!-- #{merchantDeptId}-->
</foreach> <!-- </foreach>-->
</if>--> <!-- </if>-->
<if test="stationDeptIds != null and stationDeptIds.size() != 0"> <if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in and t3.dept_id in
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")"> <foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
@@ -305,6 +310,9 @@
<if test="stationId != null"> <if test="stationId != null">
station_id, station_id,
</if> </if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn, pile_sn,
</if> </if>
@@ -403,6 +411,9 @@
<if test="stationId != null"> <if test="stationId != null">
#{stationId}, #{stationId},
</if> </if>
<if test="merchantId != null">
#{merchantId},
</if>
<if test="pileSn != null"> <if test="pileSn != null">
#{pileSn,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR},
</if> </if>
@@ -502,6 +513,9 @@
<if test="stationId != null"> <if test="stationId != null">
station_id = #{stationId}, station_id = #{stationId},
</if> </if>
<if test="merchantId != null">
merchant_id = #{merchantId},
</if>
<if test="pileSn != null"> <if test="pileSn != null">
pile_sn = #{pileSn}, pile_sn = #{pileSn},
</if> </if>

View File

@@ -278,4 +278,12 @@
#{item,jdbcType=VARCHAR} #{item,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </select>
<select id="queryInfoByDeptId" resultMap="PileMerchantInfoResult">
select
<include refid="Base_Column_List"/>
from pile_merchant_info
where
dept_id = #{deptId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>

View File

@@ -349,6 +349,7 @@ export default {
mobileNumber: null, mobileNumber: null,
orderStatus: null, orderStatus: null,
stationId: null, stationId: null,
merchantId: null,
startTime: null, startTime: null,
endTime: null, endTime: null,
}, },