|
@@ -1,6 +1,7 @@
|
|
|
package com.warewms.hailiang.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -25,13 +26,13 @@ import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
-* @author AD
|
|
|
-* @description 针对表【retroactive_history(生产历史追溯表)】的数据库操作Service实现
|
|
|
-* @createDate 2023-08-22 14:02:21
|
|
|
-*/
|
|
|
+ * @author AD
|
|
|
+ * @description 针对表【retroactive_history(生产历史追溯表)】的数据库操作Service实现
|
|
|
+ * @createDate 2023-08-22 14:02:21
|
|
|
+ */
|
|
|
@Service
|
|
|
public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistoryMapper, RetroactiveHistory>
|
|
|
- implements RetroactiveHistoryService{
|
|
|
+ implements RetroactiveHistoryService {
|
|
|
|
|
|
@Autowired
|
|
|
RetroactiveHistoryMapper retroactiveHistoryMapper;
|
|
@@ -44,13 +45,13 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo<RetroactiveHistory> getListByPage(RetroactiveHistory retroactiveHistory, PageDomain pageDomain) {
|
|
|
- return TableDataInfo.build(retroactiveHistoryMapper.selectPage(pageDomain.build(),new LambdaQueryWrapper<RetroactiveHistory>()
|
|
|
- .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()),RetroactiveHistory::getRetroactiveId,retroactiveHistory.getRetroactiveId())
|
|
|
- .like(StringUtils.isNotEmpty(retroactiveHistory.getProductionLine()),RetroactiveHistory::getProductionLine,retroactiveHistory.getProductionLine())
|
|
|
- .like(StringUtils.isNotEmpty(retroactiveHistory.getBatchNo()),RetroactiveHistory::getBatchNo,retroactiveHistory.getBatchNo())
|
|
|
- .like(StringUtils.isNotEmpty(retroactiveHistory.getLotNo()),RetroactiveHistory::getLotNo,retroactiveHistory.getLotNo())
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()),RetroactiveHistory::getStatus,retroactiveHistory.getStatus())
|
|
|
- .eq(RetroactiveHistory::getDelFlag,"0")
|
|
|
+ return TableDataInfo.build(retroactiveHistoryMapper.selectPage(pageDomain.build(), new LambdaQueryWrapper<RetroactiveHistory>()
|
|
|
+ .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()), RetroactiveHistory::getRetroactiveId, retroactiveHistory.getRetroactiveId())
|
|
|
+ .like(StringUtils.isNotEmpty(retroactiveHistory.getProductionLine()), RetroactiveHistory::getProductionLine, retroactiveHistory.getProductionLine())
|
|
|
+ .like(StringUtils.isNotEmpty(retroactiveHistory.getBatchNo()), RetroactiveHistory::getBatchNo, retroactiveHistory.getBatchNo())
|
|
|
+ .like(StringUtils.isNotEmpty(retroactiveHistory.getLotNo()), RetroactiveHistory::getLotNo, retroactiveHistory.getLotNo())
|
|
|
+ .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
|
|
|
+ .eq(RetroactiveHistory::getDelFlag, "0")
|
|
|
.orderByDesc(RetroactiveHistory::getCreateTime)
|
|
|
|
|
|
));
|
|
@@ -72,13 +73,16 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
|
|
|
.eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
|
|
|
.orderByAsc(RetroactiveHistory::getCreateTime)).stream().collect(Collectors.groupingBy(RetroactiveHistory::getStatus));
|
|
|
|
|
|
- for (RetroactiveHistory history : collect.get("5")) {
|
|
|
- for (Device device : deviceService.getList()) {
|
|
|
- if (device.getDeviceId().equals(history.getDeviceId())){
|
|
|
- history.setDeviceId(device.getAbbreviation());
|
|
|
+ if (ObjectUtil.isNotNull(collect.get("5"))) {
|
|
|
+ for (RetroactiveHistory history : collect.get("5")) {
|
|
|
+ for (Device device : deviceService.getList()) {
|
|
|
+ if (device.getDeviceId().equals(history.getDeviceId())) {
|
|
|
+ history.setDeviceId(device.getAbbreviation());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return collect;
|
|
|
}
|
|
|
|
|
@@ -86,31 +90,31 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
|
|
|
public List<RetroactiveHistoryDTO> export(RetroactiveHistory retroactiveHistory, String ids) {
|
|
|
LambdaQueryWrapper<RetroactiveHistory> retroactiveHistoryLambdaQueryWrapper = Wrappers.lambdaQuery(RetroactiveHistory.class);
|
|
|
List<String> longs = new ArrayList<>();
|
|
|
- if (StringUtils.isNotEmpty(ids)){
|
|
|
+ if (StringUtils.isNotEmpty(ids)) {
|
|
|
String[] split = ids.split(",");
|
|
|
- if (split.length==1){
|
|
|
+ if (split.length == 1) {
|
|
|
longs.add(ids);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
longs = Arrays.asList(split);
|
|
|
System.out.println(longs);
|
|
|
- retroactiveHistoryLambdaQueryWrapper.in(RetroactiveHistory::getHistoryId,longs)
|
|
|
+ retroactiveHistoryLambdaQueryWrapper.in(RetroactiveHistory::getHistoryId, longs)
|
|
|
.orderByAsc(RetroactiveHistory::getCreateTime);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
retroactiveHistoryLambdaQueryWrapper
|
|
|
- .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()),RetroactiveHistory::getRetroactiveId,retroactiveHistory.getRetroactiveId())
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()),RetroactiveHistory::getStatus,retroactiveHistory.getStatus())
|
|
|
+ .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()), RetroactiveHistory::getRetroactiveId, retroactiveHistory.getRetroactiveId())
|
|
|
+ .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
|
|
|
.orderByAsc(RetroactiveHistory::getCreateTime);
|
|
|
}
|
|
|
- return retroactiveHistoryMapper.selectList(retroactiveHistoryLambdaQueryWrapper).stream().map(itme->{
|
|
|
+ return retroactiveHistoryMapper.selectList(retroactiveHistoryLambdaQueryWrapper).stream().map(itme -> {
|
|
|
RetroactiveHistoryDTO retroactiveHistoryDTO = BeanUtil.copyProperties(itme, RetroactiveHistoryDTO.class);
|
|
|
for (Device device : deviceService.getList()) {
|
|
|
- if(device.getDeviceId().equals(retroactiveHistoryDTO.getDeviceId())){
|
|
|
+ if (device.getDeviceId().equals(retroactiveHistoryDTO.getDeviceId())) {
|
|
|
retroactiveHistoryDTO.setDeviceId(device.getAbbreviation());
|
|
|
}
|
|
|
}
|
|
|
for (SysDictData process : dictTypeService.selectDictDataByType("process")) {
|
|
|
- if (process.getDictValue().equals(retroactiveHistoryDTO.getStatus())){
|
|
|
+ if (process.getDictValue().equals(retroactiveHistoryDTO.getStatus())) {
|
|
|
retroactiveHistoryDTO.setStatus(process.getDictLabel());
|
|
|
}
|
|
|
}
|