提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.main.da.passingStationCollection.service.impl; |
A |
2 |
|
|
3 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
4 |
import com.jcdm.common.utils.DateUtils; |
|
5 |
//import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
|
6 |
//import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper; |
|
7 |
//import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
|
8 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
|
9 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
|
10 |
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
|
11 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
|
12 |
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; |
|
13 |
import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper; |
|
14 |
import org.apache.ibatis.session.ExecutorType; |
|
15 |
import org.apache.ibatis.session.SqlSession; |
|
16 |
import org.apache.ibatis.session.SqlSessionFactory; |
|
17 |
import org.springframework.beans.factory.annotation.Autowired; |
|
18 |
import org.springframework.stereotype.Service; |
|
19 |
|
|
20 |
import javax.annotation.Resource; |
|
21 |
import java.time.LocalDate; |
|
22 |
import java.time.LocalDateTime; |
|
23 |
import java.time.format.DateTimeFormatter; |
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
/** |
|
27 |
* 产品过站采集Service业务层处理 |
|
28 |
* |
|
29 |
* @author yyt |
|
30 |
* @date 2023-12-12 |
|
31 |
*/ |
|
32 |
@Service |
|
33 |
public class DaPassingStationCollectionServiceImpl extends ServiceImpl<DaPassingStationCollectionMapper,DaPassingStationCollection> implements IDaPassingStationCollectionService |
|
34 |
{ |
|
35 |
@Autowired |
|
36 |
private DaPassingStationCollectionMapper daPassingStationCollectionMapper; |
|
37 |
|
|
38 |
@Autowired |
|
39 |
private IDaPassingStationCollectionService daPassingStationCollectionService; |
|
40 |
|
|
41 |
@Autowired |
|
42 |
private RmRepairRecordMapper rmRepairRecordMapper; |
|
43 |
|
|
44 |
@Resource |
|
45 |
private SqlSessionFactory sqlSessionFactory; |
|
46 |
|
|
47 |
// @Autowired |
|
48 |
// private BsOrderSchedulingMapper bsOrderSchedulingMapper; |
|
49 |
// |
|
50 |
// @Autowired |
|
51 |
// private IBsOrderSchedulingService bsOrderSchedulingService; |
|
52 |
|
|
53 |
/** |
|
54 |
* 查询产品过站采集 |
|
55 |
* |
|
56 |
* @param id 产品过站采集主键 |
|
57 |
* @return 产品过站采集 |
|
58 |
*/ |
|
59 |
@Override |
|
60 |
public DaPassingStationCollection selectDaPassingStationCollectionById(Long id) |
|
61 |
{ |
|
62 |
return daPassingStationCollectionMapper.selectDaPassingStationCollectionById(id); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 查询产品过站采集列表 |
|
67 |
* |
|
68 |
* @param daPassingStationCollection 产品过站采集 |
|
69 |
* @return 产品过站采集 |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public List<DaPassingStationCollection> selectDaPassingStationCollectionList(DaPassingStationCollection daPassingStationCollection) |
|
73 |
{ |
|
74 |
return daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
|
75 |
} |
|
76 |
|
|
77 |
// /** |
|
78 |
// * 获取首页单日累计量产数据 |
|
79 |
// * @param fieldName bs |
|
80 |
// * @return list |
|
81 |
// */ |
|
82 |
// @Override |
|
83 |
// public Integer getProduceNumToday(String fieldName) { |
|
84 |
// |
|
85 |
// BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
86 |
// bsOrderScheduling.setQueryField(fieldName); |
|
87 |
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
88 |
// LocalDateTime startTime = LocalDate.now().atStartOfDay(); |
|
89 |
// LocalDateTime endTime = LocalDate.now().plusDays(1).atStartOfDay(); |
|
90 |
// String s1 = startTime.format(formatter); |
|
91 |
// String s2 = endTime.format(formatter); |
|
92 |
// bsOrderScheduling.setStartTime(s1); |
|
93 |
// bsOrderScheduling.setEndTime(s2); |
|
94 |
// return bsOrderSchedulingMapper.getProduceNumToday(bsOrderScheduling); |
|
95 |
// } |
|
96 |
|
|
97 |
/** |
|
98 |
* 新增产品过站采集 |
|
99 |
* |
|
100 |
* @param daPassingStationCollection 产品过站采集 |
|
101 |
* @return 结果 |
|
102 |
*/ |
|
103 |
@Override |
|
104 |
public int insertDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection) |
|
105 |
{ |
|
106 |
daPassingStationCollection.setCreateTime(DateUtils.getNowDate()); |
|
107 |
return daPassingStationCollectionMapper.insertDaPassingStationCollection(daPassingStationCollection); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* 修改产品过站采集 |
|
112 |
* |
|
113 |
* @param daPassingStationCollection 产品过站采集 |
|
114 |
* @return 结果 |
|
115 |
*/ |
|
116 |
@Override |
|
117 |
public int updateDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection) |
|
118 |
{ |
|
119 |
daPassingStationCollection.setUpdateTime(DateUtils.getNowDate()); |
|
120 |
return daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollection); |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public int updateDaPassingStationCollectionBySfcCodeAndLocationCode(DaPassingStationCollection daPassingStationCollection) { |
|
125 |
return daPassingStationCollectionMapper.updateDaPassingStationCollectionBySfcCodeAndLocationCode(daPassingStationCollection); |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* 批量删除产品过站采集 |
|
130 |
* |
|
131 |
* @param ids 需要删除的产品过站采集主键 |
|
132 |
* @return 结果 |
|
133 |
*/ |
|
134 |
@Override |
|
135 |
public int deleteDaPassingStationCollectionByIds(Long[] ids) |
|
136 |
{ |
|
137 |
return daPassingStationCollectionMapper.deleteDaPassingStationCollectionByIds(ids); |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* 删除产品过站采集信息 |
|
142 |
* |
|
143 |
* @param id 产品过站采集主键 |
|
144 |
* @return 结果 |
|
145 |
*/ |
|
146 |
@Override |
|
147 |
public int deleteDaPassingStationCollectionById(Long id) |
|
148 |
{ |
|
149 |
return daPassingStationCollectionMapper.deleteDaPassingStationCollectionById(id); |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection) { |
|
154 |
Long[] conditions = daPassingStationCollection.getIds(); |
|
155 |
for (int i = 0; i < conditions.length; i++) { |
|
156 |
DaPassingStationCollection result = daPassingStationCollectionMapper.selectDaPassingStationCollectionById(conditions[i]); |
|
157 |
RmRepairRecord rmRepairRecord = new RmRepairRecord(); |
|
158 |
rmRepairRecord.setBoxCode(result.getSfcCode()); |
|
159 |
rmRepairRecord.setProcessesCode(result.getLocationCode()); |
|
160 |
rmRepairRecord.setOriginalResult(result.getOutRsSign()); |
|
161 |
rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord); |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
@Override |
|
166 |
public int jrmAddPassingStationCollection(DaPassingStationCollection daPassingStationCollection) { |
|
167 |
for (String model : daPassingStationCollection.getSfcCode().split(",")) { |
|
168 |
daPassingStationCollection.setSfcCode(model); |
|
169 |
daPassingStationCollectionService.save(daPassingStationCollection); |
|
170 |
} |
|
171 |
return 1; |
|
172 |
} |
|
173 |
|
|
174 |
@Override |
|
175 |
public void saveBeachDaPassingStationCollection(List<DaPassingStationCollection> list) { |
|
176 |
// ExecutorType.SIMPLE: 这个执行器类型不做特殊的事情。它为每个语句的执行创建一个新的预处理语句。 |
|
177 |
// ExecutorType.REUSE: 这个执行器类型会复用预处理语句。 |
|
178 |
// ExecutorType.BATCH: 这个执行器会批量执行所有更新语句,如果 SELECT 在它们中间执行还会标定它们是 必须的,来保证一个简单并易于理解的行为。 |
|
179 |
|
|
180 |
// 关闭session的自动提交 |
|
181 |
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); |
|
182 |
try { |
|
183 |
DaPassingStationCollectionMapper userMapper = sqlSession.getMapper(DaPassingStationCollectionMapper.class); |
|
184 |
list.stream().forEach(item -> userMapper.insertDaPassingStationCollection(item)); |
|
185 |
// 提交数据 |
|
186 |
sqlSession.commit(); |
|
187 |
sqlSession.rollback(); |
|
188 |
} catch (Exception e) { |
|
189 |
sqlSession.rollback(); |
|
190 |
} finally { |
|
191 |
sqlSession.close(); |
|
192 |
} |
|
193 |
} |
109e2f
|
194 |
|
C |
195 |
@Override |
|
196 |
public void insertBatch(List<DaPassingStationCollection> confList){ |
|
197 |
try{ |
|
198 |
this.saveBatch(confList); |
|
199 |
}catch (Exception e){ |
|
200 |
return; |
|
201 |
} |
|
202 |
|
|
203 |
} |
0ca254
|
204 |
} |