| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.message.common.MesTypeEnum; |
| | | import com.oying.modules.message.common.MsgStatusEnum; |
| | | import com.oying.modules.message.service.MesMsgRecordService; |
| | | import com.oying.modules.sh.domain.OrderOperationLog; |
| | | import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria; |
| | | import com.oying.modules.sh.domain.vo.OrderResponse; |
| | | import com.oying.modules.sh.mapper.OrderMapper; |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import com.oying.modules.sh.service.OrderOperationLogService; |
| | | 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.service.OrderOperationLogService; |
| | | import com.oying.modules.sh.domain.dto.OrderOperationLogQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderOperationLogMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author lixin |
| | |
| | | |
| | | private final OrderOperationLogMapper orderOperationLogMapper; |
| | | private final OrderMapper orderMapper; |
| | | private final MesMsgRecordService mesMsgRecordService; |
| | | |
| | | @Override |
| | | public PageResult<OrderOperationLog> queryAll(OrderOperationLogQueryCriteria criteria, Page<Object> page) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderOperationLog> getByOrderNum(String orderNum) { |
| | | return orderOperationLogMapper.getByOrderNum(orderNum); |
| | | public List<OrderOperationLog> getByOrderNum(String orderNum, String type) { |
| | | return orderOperationLogMapper.getByOrderNum(orderNum, type); |
| | | } |
| | | |
| | | @Override |
| | |
| | | log1.setUsername(username); |
| | | log1.setUserType(userType); |
| | | log1.setOperation(OrderStatusEnum.ONE.getKey()); |
| | | log1.setOperationType(OrderStatusEnum.ONE.getCode()); |
| | | log1.setOperationDescribe(OrderStatusEnum.ONE.getValue()); |
| | | log1.setRemark(username + ":" + time + ">" + OrderStatusEnum.ONE.getValue() + ":" + response.getOrder().getOrderNum()); |
| | | Map<String, Object> map1 = new LinkedHashMap<>(); |
| | |
| | | orderOperationLogMapper.insert(log1); |
| | | response.getOrder().setOrderStatus(OrderStatusEnum.TWO.getKey()); |
| | | response.getOrder().setOrderStatusDescribe(OrderStatusEnum.TWO.getValue()); |
| | | case FOUR: |
| | | case THREE: |
| | | userType = ConstantsKey.MERCHANT; |
| | | break; |
| | | case THREE: |
| | | case FOUR: |
| | | orderMapper.updateRider(response.getOrder().getOrderNum(), SecurityUtils.getCurrentUserId(), SecurityUtils.getCurrentUsername(), cardName); |
| | | case FIVE: |
| | | case SIX: |
| | |
| | | log2.setUsername(username); |
| | | log2.setUserType(userType); |
| | | log2.setOperation(statusEnum.getKey()); |
| | | log2.setOperationType(statusEnum.getCode()); |
| | | log2.setOperationDescribe(statusEnum.getValue()); |
| | | log2.setRemark(username + ":" + time + ">" + statusEnum.getValue() + ":" + response.getOrder().getOrderNum()); |
| | | Map<String, Object> map2 = new LinkedHashMap<>(); |
| | |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | statusEnum = OrderStatusEnum.EIGHT; |
| | | break; |
| | | case TEN: |
| | | case TWELVE: |
| | | userType = ConstantsKey.BUYER; |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | break; |
| | | case FIFTEEN: |
| | | userType = ConstantsKey.BUYER; |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), OrderStatusEnum.EIGHT.getKey(), OrderStatusEnum.EIGHT.getValue()); |
| | | break; |
| | | case ELEVEN: |
| | | userType = ConstantsKey.MERCHANT; |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), OrderStatusEnum.EIGHT.getKey(), OrderStatusEnum.EIGHT.getValue()); |
| | | break; |
| | | case THIRTEEN: |
| | | case FOURTEEN: |
| | | userType = ConstantsKey.MERCHANT; |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | break; |
| | | default: |
| | | throw new BadRequestException("状态错误"); |
| | | } |
| | | if (username == null) { |
| | | username = SecurityUtils.getCurrentUsername(); |
| | |
| | | resources.setUsername(username); |
| | | resources.setUserType(userType); |
| | | resources.setOperation(statusEnum.getKey()); |
| | | resources.setOperationType(statusEnum.getCode()); |
| | | resources.setOperationDescribe(statusEnum.getValue()); |
| | | resources.setRemark(username + ":" + time + ">" + statusEnum.getValue() + ":" + response.getOrder().getOrderNum()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | |
| | | resources.setSnapshotData(JSON.toJSONString(map)); |
| | | resources.setOperationTime(time); |
| | | orderOperationLogMapper.insert(resources); |
| | | mesMsgRecordService.insertOrderMsg(response.getOrder(), MsgStatusEnum.MERCHANT_ACCEPTED, MesTypeEnum.ORDER); |
| | | orderMapper.updateOrderStatus(response.getOrder().getOrderNum(), statusEnum.getKey(), statusEnum.getValue()); |
| | | } |
| | | |