This commit is contained in:
2023-08-23 11:50:48 +08:00
9 changed files with 63 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.PileMerchantInfo;
@@ -18,8 +19,10 @@ import com.jsowell.pile.dto.QueryMerchantOrderDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileMerchantInfoService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.vo.web.OrderListVO;
import com.jsowell.service.OrderService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -45,6 +48,9 @@ public class OrderBasicInfoController extends BaseController {
@Autowired
private IPileMerchantInfoService pileMerchantInfoService;
@Autowired
private IPileStationInfoService pileStationInfoService;
/**
* 查询订单列表
* 订单列表页,带数据权限校验
@@ -82,10 +88,17 @@ public class OrderBasicInfoController extends BaseController {
return new AjaxResult();
}
String deptId = authorizedMap.getDeptId();
// 根据部门id查询merchantId
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
if (pileMerchantInfo != null) {
dto.setMerchantId(String.valueOf(pileMerchantInfo.getId()));
if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) {
// 为站点管理员
List<String> stationIds = pileStationInfoService.getIdsByDeptId(deptId);
dto.setStationIdList(stationIds);
}else {
// 平台管理员或运营商管理员
// 根据部门id查询merchantId
PileMerchantInfo pileMerchantInfo = pileMerchantInfoService.queryInfoByDeptId(deptId);
if (pileMerchantInfo != null) {
dto.setMerchantId(String.valueOf(pileMerchantInfo.getId()));
}
}
return AjaxResult.success(orderBasicInfoService.getOrderTotalDataV2(dto));
}

View File

@@ -81,4 +81,11 @@ public interface PileStationInfoMapper {
List<String> queryByStationDeptIds(@Param("stationDeptIds") List<String> stationDeptIds);
int updateAmapFlag(@Param("stationId") String stationId, @Param("amapFlag") String amapFlag);
/**
* 通过站点部门id 查询站点id
* @param deptId
* @return
*/
List<String> getIdsByDeptId(String deptId);
}

View File

@@ -98,4 +98,11 @@ public interface IPileStationInfoService {
String selectAdapayMemberId(String stationId);
int updateAmapFlag(String stationId, String amapFlag);
/**
* 通过站点部门id查询站点id
* @param deptId
* @return
*/
List<String> getIdsByDeptId(String deptId);
}

View File

@@ -372,6 +372,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
public OrderTotalDataVO getOrderTotalDataV2(QueryOrderDTO dto) {
// 确定查询的站点
List<String> stationIdList = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(dto.getStationIdList())) {
stationIdList.addAll(dto.getStationIdList());
}
if (StringUtils.isNotBlank(dto.getStationId())) {
stationIdList.add(dto.getStationId());
}

View File

@@ -277,7 +277,14 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
// 查询枪口当前订单
for (PileConnectorInfoVO pileConnectorInfoVO : pileConnectorInfoList) {
String pileConnectorCode = pileConnectorInfoVO.getPileConnectorCode();
pileConnectorInfoVO.setConnectorQrCodeUrl(getPileConnectorQrCodeUrl(pileConnectorCode)); // 枪口号二维码
// 通过stationId查询充电站信息缓存方法
PileStationVO stationInfo = pileStationInfoService.getStationInfo(pileConnectorInfoVO.getStationId());
if (stationInfo != null && StringUtils.isNotBlank(stationInfo.getQrcodePrefix())) {
String connectorQrCodeUrl = stationInfo.getQrcodePrefix() + pileConnectorCode;
pileConnectorInfoVO.setConnectorQrCodeUrl(connectorQrCodeUrl);
}else {
pileConnectorInfoVO.setConnectorQrCodeUrl(getPileConnectorQrCodeUrl(pileConnectorCode)); // 枪口号二维码
}
OrderBasicInfo order = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
if (order != null) {
pileConnectorInfoVO.setOrderCode(order.getOrderCode());

View File

@@ -476,5 +476,15 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
return pileStationInfoMapper.updateAmapFlag(stationId, amapFlag);
}
/**
* 通过站点部门id查询站点id
* @param deptId
* @return
*/
@Override
public List<String> getIdsByDeptId(String deptId) {
return pileStationInfoMapper.getIdsByDeptId(deptId);
}
}

View File

@@ -407,4 +407,13 @@
where
id = #{stationId,jdbcType=VARCHAR}
</update>
<select id="getIdsByDeptId" resultType="java.lang.String">
select
id
from
pile_station_info
where
dept_id = #{deptId,jdbcType=VARCHAR}
</select>
</mapper>

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.lutongyun.common;
package com.jsowell.thirdparty.lutongyunting.common;
import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.jsowell.thirdparty.lutongyun.common;
package com.jsowell.thirdparty.lutongyunting.common;
import lombok.Data;