mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-09 04:20:08 +08:00
update 占桩订单列表页实现分页
This commit is contained in:
@@ -4,12 +4,14 @@ import com.alibaba.fastjson2.JSON;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.jsowell.common.annotation.Anonymous;
|
import com.jsowell.common.annotation.Anonymous;
|
||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.response.RestApiResponse;
|
import com.jsowell.common.response.RestApiResponse;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
||||||
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||||
import com.jsowell.pile.service.IPileBillingTemplateService;
|
import com.jsowell.pile.service.IPileBillingTemplateService;
|
||||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||||
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;
|
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;
|
||||||
@@ -64,18 +66,19 @@ public class OccupyOrderController extends BaseController {
|
|||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getOccupyOrderInfo")
|
@PostMapping("/getOccupyOrderInfo")
|
||||||
public RestApiResponse<?> getOccupyOrderInfo(HttpServletRequest request) {
|
public RestApiResponse<?> getOccupyOrderInfo(HttpServletRequest request, @RequestBody QueryOccupyOrderDTO dto) {
|
||||||
// 获取memberId
|
// 获取memberId
|
||||||
String memberId = getMemberIdByAuthorization(request);
|
String memberId = getMemberIdByAuthorization(request);
|
||||||
if (StringUtils.isEmpty(memberId)) {
|
if (StringUtils.isEmpty(memberId)) {
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
||||||
}
|
}
|
||||||
logger.info("查询占桩订单列表页 memberId:{}", memberId);
|
logger.info("查询占桩订单列表页 params:{}", JSON.toJSONString(dto));
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
|
dto.setMemberId(memberId);
|
||||||
try {
|
try {
|
||||||
List<OrderPileOccupyVO> orderInfoList = orderPileOccupyService.getOccupyOrderInfo(memberId);
|
PageResponse pageInfo = orderPileOccupyService.getOccupyOrderInfo(dto);
|
||||||
response = new RestApiResponse<>(orderInfoList);
|
response = new RestApiResponse<>(pageInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("查询占桩订单列表页 error, ", e);
|
logger.error("查询占桩订单列表页 error, ", e);
|
||||||
response = new RestApiResponse<>(e);
|
response = new RestApiResponse<>(e);
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ public class GroundLockDataUploadHandler extends AbstractHandler{
|
|||||||
orderInfo.setStatus(OccupyOrderStatusEnum.OCCUPIED.getCode());
|
orderInfo.setStatus(OccupyOrderStatusEnum.OCCUPIED.getCode());
|
||||||
orderInfo.setStartTime(DateUtils.getNowDate());
|
orderInfo.setStartTime(DateUtils.getNowDate());
|
||||||
// 修改数据库
|
// 修改数据库
|
||||||
|
log.info("降锁成功,修改订单状态");
|
||||||
orderPileOccupyService.updateByPrimaryKeySelective(orderInfo);
|
orderPileOccupyService.updateByPrimaryKeySelective(orderInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import lombok.*;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
public class QueryOccupyOrderDTO {
|
public class QueryOccupyOrderDTO {
|
||||||
|
private Integer pageNum;
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
// 充电桩编号
|
// 充电桩编号
|
||||||
private String pileSn;
|
private String pileSn;
|
||||||
|
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ public interface OrderPileOccupyMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询占桩订单列表
|
* 查询占桩订单列表
|
||||||
* @param memberId
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderPileOccupyVO> getOccupyOrderInfo(String memberId);
|
List<OrderPileOccupyVO> getOccupyOrderInfo(QueryOccupyOrderDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据桩号和枪号 查询占桩状态的占桩订单
|
* 根据桩号和枪号 查询占桩状态的占桩订单
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.service;
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
import com.jsowell.pile.dto.PayOrderDTO;
|
import com.jsowell.pile.dto.PayOrderDTO;
|
||||||
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
||||||
@@ -61,10 +62,10 @@ public interface OrderPileOccupyService{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询占桩订单列表
|
* 查询占桩订单列表
|
||||||
* @param memberId
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderPileOccupyVO> getOccupyOrderInfo(String memberId);
|
PageResponse getOccupyOrderInfo(QueryOccupyOrderDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据桩编号、枪口号查询最近一条占桩订单
|
* 根据桩编号、枪口号查询最近一条占桩订单
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.jsowell.pile.service.impl;
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.jsowell.adapay.service.AdapayService;
|
import com.jsowell.adapay.service.AdapayService;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.core.page.PageResponse;
|
||||||
import com.jsowell.common.enums.DelFlagEnum;
|
import com.jsowell.common.enums.DelFlagEnum;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.uniapp.OccupyOrderPayStatusEnum;
|
import com.jsowell.common.enums.uniapp.OccupyOrderPayStatusEnum;
|
||||||
@@ -23,6 +25,7 @@ import com.jsowell.pile.vo.base.PileInfoVO;
|
|||||||
import com.jsowell.pile.vo.uniapp.MemberVO;
|
import com.jsowell.pile.vo.uniapp.MemberVO;
|
||||||
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;
|
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;
|
||||||
import com.jsowell.pile.vo.uniapp.OrderPileOccupyVO;
|
import com.jsowell.pile.vo.uniapp.OrderPileOccupyVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||||
import com.jsowell.pile.vo.web.OrderListVO;
|
import com.jsowell.pile.vo.web.OrderListVO;
|
||||||
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
|
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
|
||||||
@@ -162,7 +165,7 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
|||||||
String occupyCode = "OP" + IdUtils.getOrderCode();
|
String occupyCode = "OP" + IdUtils.getOrderCode();
|
||||||
orderPileOccupy.setOccupyCode(occupyCode);
|
orderPileOccupy.setOccupyCode(occupyCode);
|
||||||
orderPileOccupy.setMemberId(memberId);
|
orderPileOccupy.setMemberId(memberId);
|
||||||
orderPileOccupy.setStatus(OccupyOrderStatusEnum.DRAFT_ORDER.getCode()); // 占桩中
|
orderPileOccupy.setStatus(OccupyOrderStatusEnum.DRAFT_ORDER.getCode()); // 草稿单
|
||||||
orderPileOccupy.setPayStatus(Constants.ZERO); // 未支付
|
orderPileOccupy.setPayStatus(Constants.ZERO); // 未支付
|
||||||
orderPileOccupy.setPileSn(pileSn);
|
orderPileOccupy.setPileSn(pileSn);
|
||||||
PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
|
PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
|
||||||
@@ -296,21 +299,33 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
|||||||
/**
|
/**
|
||||||
* 查询占桩订单列表
|
* 查询占桩订单列表
|
||||||
*
|
*
|
||||||
* @param memberId
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<OrderPileOccupyVO> getOccupyOrderInfo(String memberId) {
|
public PageResponse getOccupyOrderInfo(QueryOccupyOrderDTO dto) {
|
||||||
|
int pageNum = dto.getPageNum() == 0 ? 1 : dto.getPageNum();
|
||||||
|
int pageSize = dto.getPageSize() == 0 ? 10 : dto.getPageSize();
|
||||||
// 分页
|
// 分页
|
||||||
PageUtils.startPage();
|
PageUtils.startPage(pageNum, pageSize);
|
||||||
List<OrderPileOccupyVO> list = orderPileOccupyMapper.getOccupyOrderInfo(memberId);
|
List<OrderPileOccupyVO> list = orderPileOccupyMapper.getOccupyOrderInfo(dto);
|
||||||
for (OrderPileOccupyVO orderPileOccupyVO : list) {
|
PageInfo<OrderPileOccupyVO> pageInfo = new PageInfo<>(list);
|
||||||
|
|
||||||
|
for (OrderPileOccupyVO orderPileOccupyVO : pageInfo.getList()) {
|
||||||
// 订单状态
|
// 订单状态
|
||||||
orderPileOccupyVO.setStatus(OccupyOrderStatusEnum.getValueByCode(orderPileOccupyVO.getStatus()));
|
orderPileOccupyVO.setStatus(OccupyOrderStatusEnum.getValueByCode(orderPileOccupyVO.getStatus()));
|
||||||
// 支付状态
|
// 支付状态
|
||||||
orderPileOccupyVO.setPayStatus(OccupyOrderPayStatusEnum.getValueByCode(orderPileOccupyVO.getPayStatus()));
|
orderPileOccupyVO.setPayStatus(OccupyOrderPayStatusEnum.getValueByCode(orderPileOccupyVO.getPayStatus()));
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
|
PageResponse pageResponse = PageResponse.builder()
|
||||||
|
.pageSize(pageSize)
|
||||||
|
.pageNum(pageNum)
|
||||||
|
.list(pageInfo.getList())
|
||||||
|
.pages(pageInfo.getPages())
|
||||||
|
.total(pageInfo.getTotal())
|
||||||
|
.build();
|
||||||
|
return pageResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -827,22 +827,7 @@
|
|||||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOccupyOrderInfo" resultType="com.jsowell.pile.vo.uniapp.OrderPileOccupyVO">
|
|
||||||
select
|
|
||||||
t1.occupy_code as occupyCode,
|
|
||||||
t1.status,
|
|
||||||
t1.station_id as stationId,
|
|
||||||
t2.station_name as stationName,
|
|
||||||
t1.start_time as startTime,
|
|
||||||
t1.end_time as endTime,
|
|
||||||
t1.pay_status as payStatus,
|
|
||||||
t1.order_amount as orderAmount
|
|
||||||
from
|
|
||||||
order_pile_occupy t1
|
|
||||||
left join pile_station_info t2 on t1.station_id = t2.id
|
|
||||||
where
|
|
||||||
member_id = #{memberId,jdbcType=VARCHAR}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="queryOccupiedOrder" resultMap="BaseResultMap">
|
<select id="queryOccupiedOrder" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@@ -886,4 +871,21 @@
|
|||||||
WHERE
|
WHERE
|
||||||
t1.occupy_code = #{occupyCode,jdbcType=VARCHAR}
|
t1.occupy_code = #{occupyCode,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getOccupyOrderInfo" resultType="com.jsowell.pile.vo.uniapp.OrderPileOccupyVO">
|
||||||
|
select
|
||||||
|
t1.occupy_code as occupyCode,
|
||||||
|
t1.status,
|
||||||
|
t1.station_id as stationId,
|
||||||
|
t2.station_name as stationName,
|
||||||
|
t1.start_time as startTime,
|
||||||
|
t1.end_time as endTime,
|
||||||
|
t1.pay_status as payStatus,
|
||||||
|
t1.order_amount as orderAmount
|
||||||
|
from
|
||||||
|
order_pile_occupy t1
|
||||||
|
left join pile_station_info t2 on t1.station_id = t2.id
|
||||||
|
where
|
||||||
|
t1.member_id = #{memberId,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user