package com.oying.modules.sh.service.impl;
|
|
import com.oying.modules.sh.domain.Order;
|
import com.oying.modules.sh.domain.request.GeneratorOrder;
|
import com.oying.modules.sh.domain.request.SubmitOrder;
|
import com.oying.utils.FileUtil;
|
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.OrderService;
|
import com.oying.modules.sh.domain.dto.OrderQueryCriteria;
|
import com.oying.modules.sh.mapper.OrderMapper;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
import com.oying.utils.PageUtil;
|
|
import java.util.*;
|
import java.io.IOException;
|
import javax.servlet.http.HttpServletResponse;
|
|
import com.oying.utils.PageResult;
|
|
/**
|
* @description 服务实现
|
* @author lixin
|
* @date 2025-06-11
|
**/
|
@Service
|
@RequiredArgsConstructor
|
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
|
private final OrderMapper orderMapper;
|
|
@Override
|
public PageResult<Order> queryAll(OrderQueryCriteria criteria, Page<Object> page){
|
return PageUtil.toPage(orderMapper.findAll(criteria, page));
|
}
|
|
@Override
|
public List<Order> queryAll(OrderQueryCriteria criteria){
|
return orderMapper.findAll(criteria);
|
}
|
|
@Override
|
public Order submitOrder(SubmitOrder submit) {
|
return null;
|
}
|
|
@Override
|
public Map<String, Object> generatorOrder(GeneratorOrder generator) {
|
return Collections.emptyMap();
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void create(Order resources) {
|
orderMapper.insert(resources);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void update(Order resources) {
|
Order order = getById(resources.getOrderId());
|
order.copy(resources);
|
orderMapper.updateById(order);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void deleteAll(List<Long> ids) {
|
orderMapper.deleteBatchIds(ids);
|
}
|
|
@Override
|
public void download(List<Order> all, HttpServletResponse response) throws IOException {
|
List<Map<String, Object>> list = new ArrayList<>();
|
for (Order order : all) {
|
Map<String, Object> map = new LinkedHashMap<>();
|
map.put("订单号", order.getOrderNum());
|
map.put("用户id", order.getUserId());
|
map.put("门店ID", order.getStoreId());
|
map.put("描述", order.getOrderDescribe());
|
map.put("原金额", order.getOriginalPrice());
|
map.put("折扣价", order.getPaidPrice());
|
map.put("实付金额", order.getActuallyPayPrice());
|
map.put("支付状态", order.getPayState());
|
map.put("消息", order.getPayMessage());
|
map.put("支付类型", order.getPayType());
|
map.put("支付时间", order.getPayTime());
|
map.put("订单失效时间RFC3339", order.getExpireTime());
|
map.put("openid", order.getOpenid());
|
map.put("APPID", order.getAppId());
|
map.put("时间戳", order.getTimestamp());
|
map.put(" nonceStr", order.getNonceStr());
|
map.put(" packageVal", order.getPackageVal());
|
map.put(" signType", order.getSignType());
|
map.put("签名", order.getPaySign());
|
map.put("创建人", order.getCreateBy());
|
map.put("创建时间", order.getCreateTime());
|
map.put("修改者", order.getUpdateBy());
|
map.put("修改时间", order.getUpdateTime());
|
list.add(map);
|
}
|
FileUtil.downloadExcel(list, response);
|
}
|
}
|