puzhibing
2022-09-12 7da4caa40befd523033b8a1d01246ae468674680
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
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.ReportLossMapper;
import com.stylefeng.guns.modular.system.model.ReportLoss;
import com.stylefeng.guns.modular.system.service.IReportLossService;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
 
@Service
public class ReportLossServiceImpl extends ServiceImpl<ReportLossMapper, ReportLoss> implements IReportLossService {
 
    @Autowired
    private IOrderPrivateCarService orderPrivateCarService;
 
    @Autowired
    private IOrderTaxiService orderTaxiService;
 
    @Autowired
    private IOrderCrossCityService orderCrossCityService;
 
    @Autowired
    private IOrderLogisticsService orderLogisticsService;
 
    @Override
    public void addReportLoss(Integer orderType, Integer orderId, String remark, String image) throws Exception {
        ReportLoss reportLoss = new ReportLoss();
        reportLoss.setImage(image);
        reportLoss.setInsertTime(new Date());
        reportLoss.setOrderId(orderId);
        reportLoss.setOrderType(orderType);
        reportLoss.setRemark(remark);
        reportLoss.setState(1);
        reportLoss.setStatus(1);
        switch (orderType){
            case 1:
                OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
                reportLoss.setUserId(orderPrivateCar.getUserId());
                break;
            case 2:
                OrderTaxi orderTaxi = orderTaxiService.selectById(orderId);
                reportLoss.setUserId(orderTaxi.getUserId());
                break;
            case 3:
                OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId);
                reportLoss.setUserId(orderCrossCity.getUserId());
                break;
            case 4:
                OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
                reportLoss.setUserId(orderLogistics.getUserId());
                break;
            case 5:
                OrderLogistics orderLogistics1 = orderLogisticsService.selectById(orderId);
                reportLoss.setUserId(orderLogistics1.getUserId());
                break;
        }
        this.insert(reportLoss);
    }
}