|
...
|
...
|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
5
|
5
|
import com.github.pagehelper.PageInfo;
|
|
6
|
6
|
import com.lframework.starter.bpm.dto.FlowTaskDto;
|
|
7
|
7
|
import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
|
|
|
8
|
+import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
8
|
9
|
import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
|
|
9
|
10
|
import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
10
|
11
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
|
...
|
...
|
@@ -20,13 +21,17 @@ import com.lframework.starter.web.core.components.resp.PageResult; |
|
20
|
21
|
import com.lframework.starter.common.utils.StringUtil;
|
|
21
|
22
|
import com.lframework.starter.common.utils.ObjectUtil;
|
|
22
|
23
|
import com.lframework.starter.common.utils.Assert;
|
|
|
24
|
+import com.lframework.xingyun.basedata.entity.Workshop;
|
|
|
25
|
+import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
|
|
23
|
26
|
import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip;
|
|
24
|
27
|
import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
|
|
25
|
28
|
import com.lframework.xingyun.sc.mappers.ProductSampleConfirmationSlipMapper;
|
|
|
29
|
+import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
|
|
26
|
30
|
import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipDetailService;
|
|
27
|
31
|
import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService;
|
|
28
|
32
|
import com.lframework.xingyun.sc.vo.sample.confirm.*;
|
|
29
|
33
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
34
|
+import org.apache.commons.lang3.StringUtils;
|
|
30
|
35
|
import org.springframework.transaction.annotation.Transactional;
|
|
31
|
36
|
import org.springframework.stereotype.Service;
|
|
32
|
37
|
import javax.annotation.Resource;
|
|
...
|
...
|
@@ -35,10 +40,17 @@ import java.util.stream.Collectors; |
|
35
|
40
|
|
|
36
|
41
|
@Service
|
|
37
|
42
|
public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl<ProductSampleConfirmationSlipMapper, ProductSampleConfirmationSlip> implements ProductSampleConfirmationSlipService {
|
|
|
43
|
+ private static final String BPM_FLAG = "CONFIRMATION_SLIP";
|
|
38
|
44
|
@Resource
|
|
39
|
45
|
private ProductSampleConfirmationSlipDetailService productSampleConfirmationSlipDetailService;
|
|
40
|
46
|
@Resource
|
|
41
|
47
|
private FlowTaskWrapperMapper flowTaskWrapperMapper;
|
|
|
48
|
+ @Resource
|
|
|
49
|
+ private WorkshopService workshopService;
|
|
|
50
|
+ @Resource
|
|
|
51
|
+ private PurchaseOrderInfoService purchaseOrderInfoService;
|
|
|
52
|
+ @Resource
|
|
|
53
|
+ private FlowInstanceWrapperService flowInstanceWrapperService;
|
|
42
|
54
|
|
|
43
|
55
|
@Override
|
|
44
|
56
|
public PageResult<ProductSampleConfirmationSlip> query(Integer pageIndex, Integer pageSize, QueryProductSampleConfirmationSlipVo vo) {
|
|
...
|
...
|
@@ -153,6 +165,141 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< |
|
153
|
165
|
productSampleConfirmationSlipDetailService.update(vo1);
|
|
154
|
166
|
}
|
|
155
|
167
|
}
|
|
|
168
|
+ //开启审核
|
|
|
169
|
+ ProductSampleConfirmationSlip result = getBaseMapper().findById(vo.getId());
|
|
|
170
|
+ if (StringUtils.isNotEmpty(result.getWorkshopId())) {
|
|
|
171
|
+ Workshop workshop = workshopService.findById(result.getWorkshopId());
|
|
|
172
|
+ if (workshop != null) {
|
|
|
173
|
+ result.setWorkshopCode(workshop.getCode());
|
|
|
174
|
+ }
|
|
|
175
|
+ }
|
|
|
176
|
+ PurchaseOrderInfo orderInfo = purchaseOrderInfoService.findById(result.getOrderId());
|
|
|
177
|
+ if (orderInfo != null) {
|
|
|
178
|
+ result.setDeptCode(orderInfo.getDeptCode());
|
|
|
179
|
+ }
|
|
|
180
|
+ flowInstanceWrapperService.startInstance(BPM_FLAG, result.getId(), BPM_FLAG, result);
|
|
|
181
|
+ }
|
|
|
182
|
+
|
|
|
183
|
+ @OpLog(type = OtherOpLogType.class, name = "修改产品试样确认单不走审核,ID:{}", params = {"#id"})
|
|
|
184
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
185
|
+ @Override
|
|
|
186
|
+ public void updateNoFlowInstance(UpdateProductSampleConfirmationSlipVo vo) {
|
|
|
187
|
+
|
|
|
188
|
+ ProductSampleConfirmationSlip data = getBaseMapper().selectById(vo.getId());
|
|
|
189
|
+ if (ObjectUtil.isNull(data)) {
|
|
|
190
|
+ throw new DefaultClientException("产品试样确认单不存在!");
|
|
|
191
|
+ }
|
|
|
192
|
+
|
|
|
193
|
+ LambdaUpdateWrapper<ProductSampleConfirmationSlip> updateWrapper = Wrappers.lambdaUpdate(ProductSampleConfirmationSlip.class)
|
|
|
194
|
+ .set(ProductSampleConfirmationSlip::getSampleType, StringUtil.isBlank(vo.getSampleType()) ? null : vo.getSampleType())
|
|
|
195
|
+ .set(ProductSampleConfirmationSlip::getCustomerType, StringUtil.isBlank(vo.getCustomerType()) ? null : vo.getCustomerType())
|
|
|
196
|
+ .set(ProductSampleConfirmationSlip::getOriginalSupplierPeer, StringUtil.isBlank(vo.getOriginalSupplierPeer()) ? null : vo.getOriginalSupplierPeer())
|
|
|
197
|
+ .set(ProductSampleConfirmationSlip::isSampleQuantityRegulation, vo.isSampleQuantityRegulation())
|
|
|
198
|
+ .set(ProductSampleConfirmationSlip::isSpecificationQuantityRegulation, vo.isSpecificationQuantityRegulation())
|
|
|
199
|
+ .set(ProductSampleConfirmationSlip::getSampleFrequency, StringUtil.isBlank(vo.getSampleFrequency()) ? null : vo.getSampleFrequency())
|
|
|
200
|
+ .set(ProductSampleConfirmationSlip::getEarlyNonconformityDescription, StringUtil.isBlank(vo.getEarlyNonconformityDescription()) ? null : vo.getEarlyNonconformityDescription())
|
|
|
201
|
+ .eq(ProductSampleConfirmationSlip::getId, vo.getId());
|
|
|
202
|
+
|
|
|
203
|
+ getBaseMapper().update(updateWrapper);
|
|
|
204
|
+
|
|
|
205
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
|
206
|
+ OpLogUtil.setExtra(vo);
|
|
|
207
|
+ //明细数据
|
|
|
208
|
+ List<UpdateProductSampleConfirmationSlipDetailVo> detailList = vo.getProductSampleConfirmationSlipDetailList();
|
|
|
209
|
+ if (CollectionUtils.isNotEmpty(detailList)) {
|
|
|
210
|
+ for (UpdateProductSampleConfirmationSlipDetailVo vo1 : detailList) {
|
|
|
211
|
+ productSampleConfirmationSlipDetailService.update(vo1);
|
|
|
212
|
+ }
|
|
|
213
|
+ }
|
|
|
214
|
+ }
|
|
|
215
|
+
|
|
|
216
|
+ @OpLog(type = OtherOpLogType.class, name = "修改产品试样确认单审核人及意见,ID:{}", params = {"#id"})
|
|
|
217
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
218
|
+ @Override
|
|
|
219
|
+ public void updateExamine(String id, String userId, String nodeCode, String message, String review) {
|
|
|
220
|
+
|
|
|
221
|
+ ProductSampleConfirmationSlip data = getBaseMapper().findById(id);
|
|
|
222
|
+ if (ObjectUtil.isNull(data)) {
|
|
|
223
|
+ throw new DefaultClientException("产品试样确认单不存在!");
|
|
|
224
|
+ }
|
|
|
225
|
+ LambdaUpdateWrapper<ProductSampleConfirmationSlip> updateWrapper = Wrappers.lambdaUpdate(ProductSampleConfirmationSlip.class);
|
|
|
226
|
+ if (nodeCode.equals("confirmation_slip_1")) {
|
|
|
227
|
+ //办事处内勤
|
|
|
228
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeClerk, StringUtil.isBlank(userId) ? null : userId);
|
|
|
229
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeClerkReview, StringUtil.isBlank(review) ? null : review);
|
|
|
230
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
231
|
+ } else if (nodeCode.equals("confirmation_slip_2")) {
|
|
|
232
|
+ //办事处主管
|
|
|
233
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeSupervisor, StringUtil.isBlank(userId) ? null : userId);
|
|
|
234
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeSupervisorReview, StringUtil.isBlank(review) ? null : review);
|
|
|
235
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeSupervisorOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
236
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
237
|
+ } else if (nodeCode.startsWith("confirmation_slip_3-")) {
|
|
|
238
|
+ //办事处分管
|
|
|
239
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirector, StringUtil.isBlank(userId) ? null : userId);
|
|
|
240
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorReview, StringUtil.isBlank(review) ? null : review);
|
|
|
241
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
242
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
243
|
+ } else if (nodeCode.equals("confirmation_slip_4-")) {
|
|
|
244
|
+ //分厂经营办主管
|
|
|
245
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisor, StringUtil.isBlank(userId) ? null : userId);
|
|
|
246
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorReview, StringUtil.isBlank(review) ? null : review);
|
|
|
247
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
248
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
249
|
+ } else if (nodeCode.equals("confirmation_slip_5-")) {
|
|
|
250
|
+ //分厂品质经理
|
|
|
251
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getQualityManager, StringUtil.isBlank(userId) ? null : userId);
|
|
|
252
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerReview, StringUtil.isBlank(review) ? null : review);
|
|
|
253
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
254
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
255
|
+ } else if (nodeCode.equals("confirmation_slip_6-")) {
|
|
|
256
|
+ //分厂主管
|
|
|
257
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisor, StringUtil.isBlank(userId) ? null : userId);
|
|
|
258
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisorReview, StringUtil.isBlank(review) ? null : review);
|
|
|
259
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisorOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
260
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
261
|
+ } else if (nodeCode.equals("confirmation_slip_7")) {
|
|
|
262
|
+ //营销部主管
|
|
|
263
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDepartmentManager, StringUtil.isBlank(userId) ? null : userId);
|
|
|
264
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDepartmentManagerReview, StringUtil.isBlank(review) ? null : review);
|
|
|
265
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDepartmentManagerOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
266
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
267
|
+ } else if (nodeCode.equals("confirmation_slip_8")) {
|
|
|
268
|
+ //营销中心主管
|
|
|
269
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingCenterSupervisor, StringUtil.isBlank(userId) ? null : userId);
|
|
|
270
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingCenterSupervisorReview, StringUtil.isBlank(review) ? null : review);
|
|
|
271
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getMarketingCenterSupervisorOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
272
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
273
|
+ } else if (nodeCode.equals("confirmation_slip_9")) {
|
|
|
274
|
+ //总经理
|
|
|
275
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getGeneralManager, StringUtil.isBlank(userId) ? null : userId);
|
|
|
276
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getGeneralManagerReview, StringUtil.isBlank(review) ? null : review);
|
|
|
277
|
+ updateWrapper.set(ProductSampleConfirmationSlip::getGeneralManagerOpinion, StringUtil.isBlank(message) ? null : message);
|
|
|
278
|
+ updateWrapper.eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
279
|
+ }
|
|
|
280
|
+ getBaseMapper().update(updateWrapper);
|
|
|
281
|
+
|
|
|
282
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
|
283
|
+ OpLogUtil.setExtra(id);
|
|
|
284
|
+ }
|
|
|
285
|
+
|
|
|
286
|
+ @OpLog(type = OtherOpLogType.class, name = "修改审核状态,ID:{}", params = {"#id"})
|
|
|
287
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
288
|
+ @Override
|
|
|
289
|
+ public void updateStatus(String id, String status) {
|
|
|
290
|
+
|
|
|
291
|
+ ProductSampleConfirmationSlip data = getBaseMapper().selectById(id);
|
|
|
292
|
+ if (ObjectUtil.isNull(data)) {
|
|
|
293
|
+ throw new DefaultClientException("产品试样确认单不存在!");
|
|
|
294
|
+ }
|
|
|
295
|
+
|
|
|
296
|
+ LambdaUpdateWrapper<ProductSampleConfirmationSlip> updateWrapper = Wrappers.lambdaUpdate(ProductSampleConfirmationSlip.class)
|
|
|
297
|
+ .set(ProductSampleConfirmationSlip::getStatus, StringUtil.isBlank(status) ? null : status)
|
|
|
298
|
+ .eq(ProductSampleConfirmationSlip::getId, id);
|
|
|
299
|
+
|
|
|
300
|
+ getBaseMapper().update(updateWrapper);
|
|
|
301
|
+
|
|
|
302
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
156
|
303
|
}
|
|
157
|
304
|
|
|
158
|
305
|
@OpLog(type = OtherOpLogType.class, name = "删除产品试样确认单,ID:{}", params = {"#id"})
|
...
|
...
|
|