提交 | 用户 | 时间
|
0cceb6
|
1 |
package com.jcdm.main.rm.repairRecord.service.impl; |
Y |
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
import java.util.stream.Collectors; |
|
6 |
|
|
7 |
import cn.hutool.core.collection.CollUtil; |
|
8 |
import com.jcdm.common.utils.DateUtils; |
|
9 |
import com.jcdm.main.bs.orderScheduling.common.Constants; |
|
10 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
|
11 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
|
12 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
|
13 |
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
|
14 |
import com.jcdm.main.rm.repairData.domain.RmRepairData; |
|
15 |
import com.jcdm.main.rm.repairRecord.vo.RmRepairDataVO; |
|
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
17 |
import org.springframework.stereotype.Service; |
|
18 |
import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper; |
|
19 |
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; |
|
20 |
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService; |
|
21 |
|
|
22 |
import javax.annotation.Resource; |
|
23 |
|
|
24 |
/** |
|
25 |
* 返修记录Service业务层处理 |
|
26 |
* |
|
27 |
* @author Yi |
|
28 |
* @date 2023-12-22 |
|
29 |
*/ |
|
30 |
@Service |
|
31 |
public class RmRepairRecordServiceImpl implements IRmRepairRecordService |
|
32 |
{ |
|
33 |
@Autowired |
|
34 |
private RmRepairRecordMapper rmRepairRecordMapper; |
|
35 |
|
|
36 |
@Resource |
|
37 |
private DaParamCollectionMapper daParamCollectionMapper; |
|
38 |
@Resource |
|
39 |
private DaPassingStationCollectionMapper daPassingStationCollectionMapper; |
|
40 |
|
|
41 |
/** |
|
42 |
* 查询返修记录 |
|
43 |
* |
|
44 |
* @param id 返修记录主键 |
|
45 |
* @return 返修记录 |
|
46 |
*/ |
|
47 |
@Override |
|
48 |
public RmRepairRecord selectRmRepairRecordById(Long id) |
|
49 |
{ |
|
50 |
return rmRepairRecordMapper.selectRmRepairRecordById(id); |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* 查询返修记录列表 |
|
55 |
* |
|
56 |
* @param rmRepairRecord 返修记录 |
|
57 |
* @return 返修记录 |
|
58 |
*/ |
|
59 |
@Override |
|
60 |
public List<RmRepairRecord> selectRmRepairRecordList(RmRepairRecord rmRepairRecord) |
|
61 |
{ |
|
62 |
return rmRepairRecordMapper.selectRmRepairRecordList(rmRepairRecord); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public RmRepairDataVO getRepairReportList(RmRepairRecord rmRepairRecord) { |
|
67 |
RmRepairDataVO vo = new RmRepairDataVO(); |
|
68 |
//主表数据 |
|
69 |
List<RmRepairRecord> mainList = rmRepairRecordMapper.selectRmRepairRecordList(rmRepairRecord); |
|
70 |
vo.setMainList(mainList); |
|
71 |
List<String> engineNoList = mainList.stream().map(RmRepairRecord::getBoxCode).distinct().collect(Collectors.toList()); |
|
72 |
List<DaParamCollection> allChildList = new ArrayList<>(); |
|
73 |
List<DaPassingStationCollection> collect5 = new ArrayList<>(); |
|
74 |
if (CollUtil.isNotEmpty(engineNoList)){ |
|
75 |
allChildList = daParamCollectionMapper.getListBySfcCode(engineNoList); |
|
76 |
collect5 = daPassingStationCollectionMapper.getListBySfcCode(engineNoList); |
|
77 |
} |
|
78 |
if (CollUtil.isNotEmpty(allChildList)){ |
|
79 |
allChildList = allChildList.stream().filter(x -> Constants.IS_REPAIR.equals(x.getRepairFlag())).collect(Collectors.toList()); |
|
80 |
//拿到所有子数据 |
|
81 |
List<DaParamCollection> collect1 = allChildList.stream().filter(x -> Constants.DATA1.equals(x.getType())).collect(Collectors.toList()); |
|
82 |
List<DaParamCollection> collect2 = allChildList.stream().filter(x -> Constants.DATA2.equals(x.getType())).collect(Collectors.toList()); |
|
83 |
List<DaParamCollection> collect3 = allChildList.stream().filter(x -> Constants.DATA3.equals(x.getType())).collect(Collectors.toList()); |
|
84 |
List<DaParamCollection> collect4 = allChildList.stream().filter(x -> Constants.DATA4.equals(x.getType())).collect(Collectors.toList()); |
|
85 |
vo.setList1(collect1); |
|
86 |
vo.setList2(collect2); |
|
87 |
vo.setList3(collect3); |
|
88 |
vo.setList4(collect4); |
|
89 |
} |
|
90 |
collect5 = collect5.stream().filter(x -> Constants.IS_REPAIR.equals(x.getRepairFlag())).collect(Collectors.toList()); |
|
91 |
vo.setList5(collect5); |
|
92 |
return vo; |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* 新增返修记录 |
|
97 |
* |
|
98 |
* @param rmRepairRecord 返修记录 |
|
99 |
* @return 结果 |
|
100 |
*/ |
|
101 |
@Override |
|
102 |
public int insertRmRepairRecord(RmRepairRecord rmRepairRecord) |
|
103 |
{ |
|
104 |
rmRepairRecord.setCreateTime(DateUtils.getNowDate()); |
|
105 |
return rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* 修改返修记录 |
|
110 |
* |
|
111 |
* @param rmRepairRecord 返修记录 |
|
112 |
* @return 结果 |
|
113 |
*/ |
|
114 |
@Override |
|
115 |
public int updateRmRepairRecord(RmRepairRecord rmRepairRecord) |
|
116 |
{ |
|
117 |
rmRepairRecord.setUpdateTime(DateUtils.getNowDate()); |
|
118 |
return rmRepairRecordMapper.updateRmRepairRecord(rmRepairRecord); |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* 批量删除返修记录 |
|
123 |
* |
|
124 |
* @param ids 需要删除的返修记录主键 |
|
125 |
* @return 结果 |
|
126 |
*/ |
|
127 |
@Override |
|
128 |
public int deleteRmRepairRecordByIds(Long[] ids) |
|
129 |
{ |
|
130 |
return rmRepairRecordMapper.deleteRmRepairRecordByIds(ids); |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* 删除返修记录信息 |
|
135 |
* |
|
136 |
* @param id 返修记录主键 |
|
137 |
* @return 结果 |
|
138 |
*/ |
|
139 |
@Override |
|
140 |
public int deleteRmRepairRecordById(Long id) |
|
141 |
{ |
|
142 |
return rmRepairRecordMapper.deleteRmRepairRecordById(id); |
|
143 |
} |
|
144 |
} |