| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderAddressSnapshot; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.utils.FileUtil; |
| | | 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; |
| | | |
| | | @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 |
| | | public List<OrderOperationLog> getByOrderNum(String orderNum) { |
| | | return orderOperationLogMapper.getByOrderNum(orderNum); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Order order, OrderAddressSnapshot addressSnapshot) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("order", order); |
| | | map.put("address", addressSnapshot); |
| | | String username = SecurityUtils.getCurrentUsername(); |
| | | Timestamp time = new Timestamp(System.currentTimeMillis()); |
| | | OrderOperationLog resources = new OrderOperationLog(); |
| | | resources.setOrderNum(order.getOrderNum()); |
| | | resources.setUsername(username); |
| | | resources.setUserType(ConstantsKey.BUYER); |
| | | resources.setOperation(OrderStatusEnum.ZERO.getKey()); |
| | | resources.setOperationDescribe(OrderStatusEnum.ZERO.getValue()); |
| | | resources.setRemark(username + ":" + time + ">" + OrderStatusEnum.ZERO.getValue() + ":" + order.getOrderNum()); |
| | | resources.setSnapshotData(JSON.toJSONString(map)); |
| | | resources.setOperationTime(time); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(OrderOperationLog resources) { |
| | | OrderOperationLog orderOperationLog = getById(resources.getLogId()); |
| | | orderOperationLog.copy(resources); |