| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.mapper.OrderMapper; |
| | | import com.oying.utils.*; |
| | | import com.oying.utils.enums.OrderStatusEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author lixin |
| | | * @date 2025-06-11 |
| | | **/ |
| | | * @author lixin |
| | | * @description 服务实现 |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OrderOperationLogServiceImpl extends ServiceImpl<OrderOperationLogMapper, OrderOperationLog> implements OrderOperationLogService { |
| | | |
| | | private final OrderOperationLogMapper orderOperationLogMapper; |
| | | private final OrderMapper orderMapper; |
| | | |
| | | @Override |
| | | public PageResult<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria, Page<Object> page){ |
| | | public PageResult<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria, Page<Object> page) { |
| | | return PageUtil.toPage(orderOperationLogMapper.findAll(criteria, page)); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria){ |
| | | public List<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria) { |
| | | return orderOperationLogMapper.findAll(criteria); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(OrderOperationLog resources) { |
| | | public void create(OrderResponse response, OrderStatusEnum statusEnum, String cardName) { |
| | | String userType = ConstantsKey.BUYER; |
| | | String username = null; |
| | | switch (statusEnum) { |
| | | case ZERO: |
| | | case ONE: |
| | | case EIGHT: |
| | | case NINE: |
| | | userType = ConstantsKey.BUYER; |
| | | break; |
| | | case TWO: |
| | | username = response.getOrder().getUsername(); |
| | | case FOUR: |
| | | userType = ConstantsKey.MERCHANT; |
| | | break; |
| | | case THREE: |
| | | orderMapper.updateRider(response.getOrder().getOrderNum(), SecurityUtils.getCurrentUserId(), SecurityUtils.getCurrentUsername(), cardName); |
| | | case FIVE: |
| | | case SIX: |
| | | case SEVEN: |
| | | userType = ConstantsKey.RIDER; |
| | | break; |
| | | default: |
| | | } |
| | | if (username == null) { |
| | | username = SecurityUtils.getCurrentUsername(); |
| | | } |
| | | Timestamp time = new Timestamp(System.currentTimeMillis()); |
| | | OrderOperationLog resources = new OrderOperationLog(); |
| | | resources.setOrderNum(response.getOrder().getOrderNum()); |
| | | resources.setUsername(username); |
| | | resources.setUserType(userType); |
| | | resources.setOperation(statusEnum.getKey()); |
| | | resources.setOperationDescribe(statusEnum.getValue()); |
| | | resources.setRemark(username + ":" + time + ">" + statusEnum.getValue() + ":" + response.getOrder().getOrderNum()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("order", response.getOrder()); |
| | | map.put("address", response.getAddress()); |
| | | resources.setSnapshotData(JSON.toJSONString(map)); |
| | | resources.setOperationTime(time); |
| | | orderOperationLogMapper.insert(resources); |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | } |
| | | |
| | | @Override |