puzhibing
2023-12-01 dae4651a80ac06f432a2ff448a199afb6dc0d2b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.OrderCancelMapper;
import com.stylefeng.guns.modular.system.model.OrderCancel;
import com.stylefeng.guns.modular.system.service.IOrderCancelService;
import com.stylefeng.guns.modular.system.util.DateUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
 
 
@Service
@Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class OrderCancelServiceImpl extends ServiceImpl<OrderCancelMapper, OrderCancel> implements IOrderCancelService {
 
    @Resource
    private OrderCancelMapper orderCancelMapper;
 
 
 
    /**
     * 添加数据
     * @param orderId
     * @param orderType
     * @param reason
     * @param remark
     * @param payType
     * @param money
     * @param state
     * @throws Exception
     */
    @Override
    public Integer saveData(Integer orderId, Integer orderType, String reason, String remark, Integer payType,
                            Double money, Integer state, Integer userType, Integer uid) throws Exception {
        OrderCancel orderCancel = new OrderCancel();
        orderCancel.setOrderId(orderId);
        orderCancel.setOrderType(orderType);
        orderCancel.setReason(reason);
        orderCancel.setRemark(remark);
        orderCancel.setPayType(payType);
        orderCancel.setMoney(money);
        orderCancel.setState(state);
        orderCancel.setInsertTime(new Date());
        orderCancel.setUserType(userType);
        orderCancel.setUserId(uid);
        this.insert(orderCancel);
        return orderCancel.getId();
    }
 
 
    /**
     * 获取取消数据
     * @param orderId
     * @param orderType
     * @param money
     * @param payType
     * @param state
     * @return
     * @throws Exception
     */
    @Override
    public OrderCancel query(Integer orderId, Integer orderType, Double money, Integer payType, Integer state) throws Exception {
        return orderCancelMapper.query(orderId, orderType, money, payType, state);
    }
 
 
    /**
     * 获取用户取消记录
     * @param uid
     * @param isPay
     * @return
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> queryCancel(Integer language, Integer uid, Integer isPay) throws Exception {
        List<Map<String, Object>> list = orderCancelMapper.queryCancel(uid, isPay);
        for (Map<String, Object> map : list) {
            String time = map.get("time").toString();
            map.put("time", DateUtil.conversionFormat(language, time));
        }
        return list;
    }
}