liujie
2023-05-26 786466f6accfe836160342c56cdf3415e09bcb38
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.TGoodsMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.dao.TClaimMapper;
import com.stylefeng.guns.modular.system.service.ITClaimService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.utils.UserInfoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
 
/**
 * <p>
 * 投诉 服务实现类
 * </p>
 *
 * @author stylefeng
 * @since 2023-02-06
 */
@Service
public class TClaimServiceImpl extends ServiceImpl<TClaimMapper, TClaim> implements ITClaimService {
    @Autowired
    private TGoodsMapper goodsMapper;
 
 
    @Override
    public List<TClaimList> getList(Page<TClaimList> tClaimListPage,String time, Integer state, String name) {
        String sTime =null;
        String eTime = null;
        if(ToolUtil.isNotEmpty(time)){
            sTime=time.split(" - ")[0]+" 00:00:01";
            eTime=time.split(" - ")[1]+" 23:59:59";
        }
        Integer companyId = UserInfoUtil.getId();
        return this.baseMapper.getListCompany(tClaimListPage,sTime,eTime,state,name,companyId);
    }
 
    @Override
    public TClaimVo getClaimInfo(Integer id) {
        TClaimVo claimVo = this.baseMapper.getClaimInfo(id);
        Long orderId = claimVo.getOrderId();
        //  根据订单id获取订单详情
        ArrayList<TGoodsClaim> tGoodsClaims = new ArrayList<>();
        List<TGoods> goods = goodsMapper.selectList(new EntityWrapper<TGoods>().eq("order_id", orderId));
        for (TGoods good : goods) {
            TGoodsClaim tGoodsClaim = new TGoodsClaim();
            tGoodsClaim.setContainerNumber(good.getContainerNumber());
            tGoodsClaim.setDanger(good.getDanger());
            tGoodsClaim.setId(good.getId());
            tGoodsClaim.setKg(good.getKg());
            tGoodsClaim.setShippingLine(good.getShippingLine());
            tGoodsClaim.setSize(good.getSize());
            tGoodsClaim.setWeight(good.getWeight());
            claimVo.setBLNO(good.getBillNumber());
            claimVo.setHazmat(good.getDanger());
            claimVo.setOverweight(good.getWeight());
            claimVo.setShippingLine(good.getShippingLine());
            tGoodsClaims.add(tGoodsClaim);
        }
        claimVo.setCargo(tGoodsClaims);
        // 获取订单文件
        claimVo.setFiles(this.baseMapper.getOrderFile(orderId));
 
        return claimVo;
    }
 
    public static void main(String[] args) {
 
 
        // 定义最大容量为10
        final int maxSize = 10;
 
        // 参数boolean accessOrder含义:false-按照插入顺序排序;true-按照访问顺序排序。
        Map<Integer, Integer> map = new LinkedHashMap<Integer, Integer>(0, 0.75f, true) {
            // LinkedHashMap加入新元素时会自动调用该方法,若返回true,则会删除链表尾部的元素
            @Override
            protected boolean removeEldestEntry(Map.Entry<Integer, Integer> eldest) {
                return size() > maxSize;
            }
        };
        // 先往map中加入10个元素(定义的最大容量为10)
        for (int i = 1; i <= 10; i++) {
            map.put(i, i);
        }
 
        // 访问一下第6个元素,看看是否会排到链表的头部
        map.get(6);
        System.out.println("发现第6个元素排到了链表的头部:" + map.toString());
 
        // 再加数据
        map.put(11, 11);
        System.out.println("删除链表尾部的元素,再将新的元素添加至链表头部 :" + map.toString());
    }
}