10 changed files with 223 additions and 347 deletions
-
67src/main/java/com/qyft/ms/app/service/MatrixCraftService.java
-
62src/main/java/com/qyft/ms/app/service/MatrixService.java
-
47src/main/java/com/qyft/ms/app/service/OperationLogService.java
-
23src/main/java/com/qyft/ms/app/service/PositionService.java
-
63src/main/java/com/qyft/ms/app/service/SysSettingsService.java
-
83src/main/java/com/qyft/ms/app/service/impl/MatrixCraftServiceImpl.java
-
66src/main/java/com/qyft/ms/app/service/impl/MatrixServiceImpl.java
-
59src/main/java/com/qyft/ms/app/service/impl/OperationLogServiceImpl.java
-
30src/main/java/com/qyft/ms/app/service/impl/PositionServiceImpl.java
-
70src/main/java/com/qyft/ms/app/service/impl/SysSettingsServiceImpl.java
@ -1,29 +1,76 @@ |
|||||
package com.qyft.ms.app.service; |
package com.qyft.ms.app.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qyft.ms.app.mapper.MatrixCraftMapper; |
||||
|
import com.qyft.ms.app.mapper.MatrixMapper; |
||||
import com.qyft.ms.app.model.dto.MatrixCraftPageDTO; |
import com.qyft.ms.app.model.dto.MatrixCraftPageDTO; |
||||
|
import com.qyft.ms.app.model.entity.Matrix; |
||||
import com.qyft.ms.app.model.entity.MatrixCraft; |
import com.qyft.ms.app.model.entity.MatrixCraft; |
||||
import com.qyft.ms.app.model.vo.MatrixCraftResult; |
import com.qyft.ms.app.model.vo.MatrixCraftResult; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
import java.util.List; |
import java.util.List; |
||||
|
|
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
/** |
/** |
||||
* 日志业务接口 |
|
||||
|
* 基质业务实现类 |
||||
*/ |
*/ |
||||
public interface MatrixCraftService extends IService<MatrixCraft> { |
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class MatrixCraftService extends ServiceImpl<MatrixCraftMapper, MatrixCraft> { |
||||
|
private final MatrixCraftMapper matrixCraftMapper; |
||||
|
private final MatrixMapper matrixMapper; |
||||
|
public Integer add(MatrixCraft dto) { |
||||
|
return matrixCraftMapper.add(dto); |
||||
|
} |
||||
|
|
||||
Integer add(MatrixCraft dto); |
|
||||
|
public MatrixCraft getCraftById(Long id) { |
||||
|
return matrixCraftMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
MatrixCraft getCraftById(Long id); |
|
||||
|
public List<MatrixCraft> getListByMatrixId(Long matrixId) { |
||||
|
return matrixCraftMapper.getListByMatrixId(matrixId); |
||||
|
} |
||||
|
|
||||
List<MatrixCraft> getListByMatrixId(Long matrixId); |
|
||||
|
public Boolean updateMatrixCraft(MatrixCraft matrixCraft) { |
||||
|
return matrixCraftMapper.updateById(matrixCraft) > 0; |
||||
|
} |
||||
|
|
||||
|
public Boolean deleteMatrixCraft(String ids) { |
||||
|
List<Long> idsArr = Arrays.stream(ids.split(",")) |
||||
|
.map(Long::parseLong) |
||||
|
.collect(Collectors.toList()); |
||||
|
return this.removeByIds(idsArr); |
||||
|
} |
||||
|
|
||||
Boolean updateMatrixCraft(MatrixCraft matrixCraft); |
|
||||
|
public IPage<MatrixCraftResult> getAll(MatrixCraftPageDTO dto) { |
||||
|
// 构建分页对象 |
||||
|
Page<MatrixCraftResult> page = new Page<>(dto.getPageNum(), dto.getPageSize()); |
||||
|
ArrayList<MatrixCraftResult> matrixCraftResultList = new ArrayList<>(); |
||||
|
|
||||
Boolean deleteMatrixCraft(String ids); |
|
||||
|
// 查询所有工艺 |
||||
|
List<MatrixCraft> matrixCrafts = matrixCraftMapper.selectList( new LambdaQueryWrapper<MatrixCraft>() |
||||
|
.like(dto.getMatrixCraftName() != null, MatrixCraft::getName, "%"+dto.getMatrixCraftName()+"%") |
||||
|
.eq(dto.getMatrixId() != null, MatrixCraft::getMatrixId, dto.getMatrixId()) |
||||
|
); |
||||
|
for (MatrixCraft matrixCraft : matrixCrafts) { |
||||
|
Long matrixId = matrixCraft.getMatrixId(); |
||||
|
Matrix matrix = matrixMapper.selectOne(new QueryWrapper<Matrix>().eq("id", matrixId)); |
||||
|
MatrixCraftResult matrixCraftResult = new MatrixCraftResult(); |
||||
|
BeanUtils.copyProperties(matrixCraft, matrixCraftResult); |
||||
|
matrixCraftResult.setMatrixName(matrix != null ? matrix.getName() : ""); |
||||
|
|
||||
IPage<MatrixCraftResult> getAll(MatrixCraftPageDTO dto); |
|
||||
|
matrixCraftResultList.add((matrixCraftResult)); |
||||
|
} |
||||
|
page.setRecords(matrixCraftResultList); |
||||
|
return page; |
||||
|
} |
||||
} |
} |
@ -1,16 +1,64 @@ |
|||||
package com.qyft.ms.app.service; |
package com.qyft.ms.app.service; |
||||
|
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qyft.ms.app.mapper.MatrixMapper; |
||||
import com.qyft.ms.app.model.entity.Matrix; |
import com.qyft.ms.app.model.entity.Matrix; |
||||
|
import com.qyft.ms.app.model.entity.MatrixCraft; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
import java.util.List; |
import java.util.List; |
||||
|
|
||||
|
|
||||
/** |
/** |
||||
* 日志业务接口 |
|
||||
|
* 基质业务实现类 |
||||
*/ |
*/ |
||||
public interface MatrixService extends IService<Matrix> { |
|
||||
int addMatrix(Matrix matrix); |
|
||||
boolean updateMatrix(Matrix matrix); |
|
||||
List<String> deleteMatrix(String ids); |
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class MatrixService extends ServiceImpl<MatrixMapper, Matrix> { |
||||
|
|
||||
|
private final MatrixMapper matrixMapper; |
||||
|
private final MatrixCraftService matrixCraftService; |
||||
|
|
||||
|
public int addMatrix(Matrix matrix) { |
||||
|
return matrixMapper.insert(matrix); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public boolean updateMatrix(Matrix matrix) { |
||||
|
return matrixMapper.updateById(matrix) > 0; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public List<String> deleteMatrix(String ids) { |
||||
|
// 不能删除的name集合 |
||||
|
List<String> nameList = new ArrayList<>(); |
||||
|
List<Long> idsArr = Arrays.stream(ids.split(",")) |
||||
|
.map(Long::parseLong) |
||||
|
.toList(); |
||||
|
// 能删除的id集合 |
||||
|
List<Long> removeIdList = new ArrayList<>(); |
||||
|
for (Long id : idsArr) { |
||||
|
|
||||
|
List<MatrixCraft> listByMatrix = matrixCraftService.list(new LambdaQueryWrapper<MatrixCraft>() .eq( MatrixCraft::getMatrixId, id)); |
||||
|
if(listByMatrix.isEmpty()){ |
||||
|
removeIdList.add(id); |
||||
|
}else{ |
||||
|
Matrix matrix = this.getById(id); |
||||
|
nameList.add(matrix.getName()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (removeIdList.isEmpty()) { |
||||
|
// 无可删除项时直接返回不可删除的nameList(可能为空) |
||||
|
return nameList.isEmpty() ? null : nameList; |
||||
|
} |
||||
|
|
||||
|
// 执行删除并返回结果 |
||||
|
boolean result = this.removeByIds(removeIdList); |
||||
|
return result ? nameList : null; |
||||
|
} |
||||
} |
} |
@ -1,22 +1,53 @@ |
|||||
package com.qyft.ms.app.service; |
package com.qyft.ms.app.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qyft.ms.app.mapper.OperationLogMapper; |
||||
import com.qyft.ms.app.model.entity.OperationLog; |
import com.qyft.ms.app.model.entity.OperationLog; |
||||
import com.qyft.ms.system.common.base.BasePageQuery; |
import com.qyft.ms.system.common.base.BasePageQuery; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
/** |
/** |
||||
* 日志业务接口 |
|
||||
|
* 基质业务实现类 |
||||
*/ |
*/ |
||||
public interface OperationLogService extends IService<OperationLog> { |
|
||||
Integer add(OperationLog operationLog); |
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class OperationLogService extends ServiceImpl<OperationLogMapper, OperationLog> { |
||||
|
private final OperationLogMapper operationLogMapper; |
||||
|
public Integer add(OperationLog operationLog) { |
||||
|
return operationLogMapper.insert(operationLog); |
||||
|
} |
||||
|
|
||||
OperationLog getLogById(Integer id); |
|
||||
|
public OperationLog getLogById(Integer id) { |
||||
|
return operationLogMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
Boolean deleteLog(String ids); |
|
||||
|
public Boolean deleteLog(String ids) { |
||||
|
List<Long> idsArr = Arrays.stream(ids.split(",")) |
||||
|
.map(Long::parseLong) |
||||
|
.collect(Collectors.toList()); |
||||
|
return this.removeByIds(idsArr); |
||||
|
} |
||||
|
|
||||
IPage<OperationLog> getAll(BasePageQuery pageQuery); |
|
||||
|
public IPage<OperationLog> getAll(BasePageQuery pageQuery) { |
||||
|
// 构建分页对象 |
||||
|
Page<OperationLog> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); |
||||
|
|
||||
OperationLog getIng(); |
|
||||
|
QueryWrapper<OperationLog> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.in("status", 1); |
||||
|
return operationLogMapper.selectPage(page, queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public OperationLog getIng() { |
||||
|
QueryWrapper<OperationLog> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.in("status", 0); |
||||
|
return operationLogMapper.selectOne(queryWrapper); |
||||
|
} |
||||
} |
} |
@ -1,13 +1,28 @@ |
|||||
package com.qyft.ms.app.service; |
package com.qyft.ms.app.service; |
||||
|
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qyft.ms.app.mapper.PositionMapper; |
||||
import com.qyft.ms.app.model.entity.Position; |
import com.qyft.ms.app.model.entity.Position; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
/** |
/** |
||||
* 日志业务接口 |
|
||||
|
* 基质业务实现类 |
||||
*/ |
*/ |
||||
public interface PositionService extends IService<Position> { |
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class PositionService extends ServiceImpl<PositionMapper, Position> { |
||||
|
|
||||
|
public Boolean delete(String ids) { |
||||
|
List<Long> idsArr = Arrays.stream(ids.split(",")) |
||||
|
.map(Long::parseLong) |
||||
|
.collect(Collectors.toList()); |
||||
|
return this.removeByIds(idsArr); |
||||
|
} |
||||
|
|
||||
|
|
||||
Boolean delete(String ids); |
|
||||
} |
} |
@ -1,26 +1,69 @@ |
|||||
package com.qyft.ms.app.service; |
package com.qyft.ms.app.service; |
||||
|
|
||||
|
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qyft.ms.app.mapper.SysSettingsMapper; |
||||
import com.qyft.ms.app.model.entity.SysSettings; |
import com.qyft.ms.app.model.entity.SysSettings; |
||||
|
import lombok.Getter; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
import java.util.List; |
import java.util.List; |
||||
import java.util.Map; |
import java.util.Map; |
||||
|
|
||||
/** |
/** |
||||
* 系统配置接口层 |
|
||||
|
* 系统配置实现类 |
||||
*/ |
*/ |
||||
public interface SysSettingsService extends IService<SysSettings> { |
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class SysSettingsService extends ServiceImpl<SysSettingsMapper, SysSettings> { |
||||
|
private final SysSettingsMapper sysSettingsMapper; |
||||
|
// 玻片位置 |
||||
|
@Getter |
||||
|
List<SysSettings> slidePositionList; |
||||
|
// 电机速度 |
||||
|
@Getter |
||||
|
List<SysSettings> motorSpeedList; |
||||
|
|
||||
|
@Getter |
||||
|
Map<String, Double> wasteLiquorPosition; |
||||
|
|
||||
List<SysSettings> getSlidePositionList(); |
|
||||
|
// 自检状态 |
||||
|
@Getter |
||||
|
boolean selfCheckStatus = false; |
||||
|
|
||||
void updateWorkStatus(String washing); |
|
||||
|
// 设备状态 |
||||
|
@Getter |
||||
|
String workStatus = "idle"; |
||||
|
|
||||
String getWorkStatus(); |
|
||||
|
// 目标湿度 |
||||
|
@Getter |
||||
|
Double targetHumidity = 0.0; |
||||
|
|
||||
Double getTargetHumidity(); |
|
||||
|
// @PostConstruct |
||||
|
public void init() { |
||||
|
QueryWrapper<SysSettings> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.in("code", "slide_position"); |
||||
|
Long parentId = sysSettingsMapper.selectOne(queryWrapper).getId(); |
||||
|
slidePositionList = sysSettingsMapper.selectList(new QueryWrapper<SysSettings>().eq("parent_id", parentId)); |
||||
|
motorSpeedList = sysSettingsMapper.selectList(new QueryWrapper<SysSettings>().eq("parent_id", new QueryWrapper<SysSettings>().eq("code", "speed"))); |
||||
|
String position = sysSettingsMapper.selectOne(new QueryWrapper<SysSettings>().eq("code", "waste_liquor")).getValue(); |
||||
|
String [] positionList = position.split(","); |
||||
|
wasteLiquorPosition = Map.of( |
||||
|
"x", Double.parseDouble(positionList[0]), |
||||
|
"y", Double.parseDouble(positionList[1]), |
||||
|
"z", Double.parseDouble(positionList[2]) |
||||
|
); |
||||
|
|
||||
void updateTargetHumidity(Double humidity); |
|
||||
|
} |
||||
|
|
||||
Map<String, Double> getWasteLiquorPosition(); |
|
||||
|
public void updateWorkStatus(String status) { |
||||
|
workStatus = status; |
||||
|
} |
||||
|
public void updateTargetHumidity(Double humidity) { |
||||
|
targetHumidity = humidity; |
||||
|
} |
||||
|
public void updateSelfCheckStatus(boolean status) { |
||||
|
selfCheckStatus = status; |
||||
|
} |
||||
} |
} |
@ -1,83 +0,0 @@ |
|||||
package com.qyft.ms.app.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import com.qyft.ms.app.mapper.MatrixCraftMapper; |
|
||||
import com.qyft.ms.app.mapper.MatrixMapper; |
|
||||
import com.qyft.ms.app.model.dto.MatrixCraftPageDTO; |
|
||||
import com.qyft.ms.app.model.entity.Matrix; |
|
||||
import com.qyft.ms.app.model.entity.MatrixCraft; |
|
||||
import com.qyft.ms.app.model.vo.MatrixCraftResult; |
|
||||
import com.qyft.ms.app.service.MatrixCraftService; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.beans.BeanUtils; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.Arrays; |
|
||||
import java.util.List; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
/** |
|
||||
* 基质业务实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class MatrixCraftServiceImpl extends ServiceImpl<MatrixCraftMapper, MatrixCraft> implements MatrixCraftService { |
|
||||
private final MatrixCraftMapper matrixCraftMapper; |
|
||||
private final MatrixMapper matrixMapper; |
|
||||
@Override |
|
||||
public Integer add(MatrixCraft dto) { |
|
||||
return matrixCraftMapper.add(dto); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public MatrixCraft getCraftById(Long id) { |
|
||||
return matrixCraftMapper.selectById(id); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<MatrixCraft> getListByMatrixId(Long matrixId) { |
|
||||
return matrixCraftMapper.getListByMatrixId(matrixId); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public Boolean updateMatrixCraft(MatrixCraft matrixCraft) { |
|
||||
return matrixCraftMapper.updateById(matrixCraft) > 0; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public Boolean deleteMatrixCraft(String ids) { |
|
||||
List<Long> idsArr = Arrays.stream(ids.split(",")) |
|
||||
.map(Long::parseLong) |
|
||||
.collect(Collectors.toList()); |
|
||||
return this.removeByIds(idsArr); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public IPage<MatrixCraftResult> getAll(MatrixCraftPageDTO dto) { |
|
||||
// 构建分页对象 |
|
||||
Page<MatrixCraftResult> page = new Page<>(dto.getPageNum(), dto.getPageSize()); |
|
||||
ArrayList<MatrixCraftResult> matrixCraftResultList = new ArrayList<>(); |
|
||||
|
|
||||
// 查询所有工艺 |
|
||||
List<MatrixCraft> matrixCrafts = matrixCraftMapper.selectList( new LambdaQueryWrapper<MatrixCraft>() |
|
||||
.like(dto.getMatrixCraftName() != null, MatrixCraft::getName, "%"+dto.getMatrixCraftName()+"%") |
|
||||
.eq(dto.getMatrixId() != null, MatrixCraft::getMatrixId, dto.getMatrixId()) |
|
||||
); |
|
||||
for (MatrixCraft matrixCraft : matrixCrafts) { |
|
||||
Long matrixId = matrixCraft.getMatrixId(); |
|
||||
Matrix matrix = matrixMapper.selectOne(new QueryWrapper<Matrix>().eq("id", matrixId)); |
|
||||
MatrixCraftResult matrixCraftResult = new MatrixCraftResult(); |
|
||||
BeanUtils.copyProperties(matrixCraft, matrixCraftResult); |
|
||||
matrixCraftResult.setMatrixName(matrix != null ? matrix.getName() : ""); |
|
||||
|
|
||||
matrixCraftResultList.add((matrixCraftResult)); |
|
||||
} |
|
||||
page.setRecords(matrixCraftResultList); |
|
||||
return page; |
|
||||
} |
|
||||
} |
|
@ -1,66 +0,0 @@ |
|||||
package com.qyft.ms.app.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import com.qyft.ms.app.mapper.MatrixMapper; |
|
||||
import com.qyft.ms.app.model.entity.Matrix; |
|
||||
import com.qyft.ms.app.model.entity.MatrixCraft; |
|
||||
import com.qyft.ms.app.service.MatrixCraftService; |
|
||||
import com.qyft.ms.app.service.MatrixService; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.Arrays; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* 基质业务实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class MatrixServiceImpl extends ServiceImpl<MatrixMapper, Matrix> implements MatrixService { |
|
||||
|
|
||||
private final MatrixMapper matrixMapper; |
|
||||
private final MatrixCraftService matrixCraftService; |
|
||||
@Override |
|
||||
public int addMatrix(Matrix matrix) { |
|
||||
return matrixMapper.insert(matrix); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public boolean updateMatrix(Matrix matrix) { |
|
||||
return matrixMapper.updateById(matrix) > 0; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<String> deleteMatrix(String ids) { |
|
||||
// 不能删除的name集合 |
|
||||
List<String> nameList = new ArrayList<>(); |
|
||||
List<Long> idsArr = Arrays.stream(ids.split(",")) |
|
||||
.map(Long::parseLong) |
|
||||
.toList(); |
|
||||
// 能删除的id集合 |
|
||||
List<Long> removeIdList = new ArrayList<>(); |
|
||||
for (Long id : idsArr) { |
|
||||
|
|
||||
List<MatrixCraft> listByMatrix = matrixCraftService.list(new LambdaQueryWrapper<MatrixCraft>() .eq( MatrixCraft::getMatrixId, id)); |
|
||||
if(listByMatrix.isEmpty()){ |
|
||||
removeIdList.add(id); |
|
||||
}else{ |
|
||||
Matrix matrix = this.getById(id); |
|
||||
nameList.add(matrix.getName()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
if (removeIdList.isEmpty()) { |
|
||||
// 无可删除项时直接返回不可删除的nameList(可能为空) |
|
||||
return nameList.isEmpty() ? null : nameList; |
|
||||
} |
|
||||
|
|
||||
// 执行删除并返回结果 |
|
||||
boolean result = this.removeByIds(removeIdList); |
|
||||
return result ? nameList : null; |
|
||||
} |
|
||||
} |
|
@ -1,59 +0,0 @@ |
|||||
package com.qyft.ms.app.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import com.qyft.ms.app.mapper.OperationLogMapper; |
|
||||
import com.qyft.ms.app.model.entity.OperationLog; |
|
||||
import com.qyft.ms.app.service.OperationLogService; |
|
||||
import com.qyft.ms.system.common.base.BasePageQuery; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.Arrays; |
|
||||
import java.util.List; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
/** |
|
||||
* 基质业务实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements OperationLogService { |
|
||||
private final OperationLogMapper operationLogMapper; |
|
||||
@Override |
|
||||
public Integer add(OperationLog operationLog) { |
|
||||
return operationLogMapper.insert(operationLog); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public OperationLog getLogById(Integer id) { |
|
||||
return operationLogMapper.selectById(id); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public Boolean deleteLog(String ids) { |
|
||||
List<Long> idsArr = Arrays.stream(ids.split(",")) |
|
||||
.map(Long::parseLong) |
|
||||
.collect(Collectors.toList()); |
|
||||
return this.removeByIds(idsArr); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public IPage<OperationLog> getAll(BasePageQuery pageQuery) { |
|
||||
// 构建分页对象 |
|
||||
Page<OperationLog> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()); |
|
||||
|
|
||||
QueryWrapper<OperationLog> queryWrapper = new QueryWrapper<>(); |
|
||||
queryWrapper.in("status", 1); |
|
||||
return operationLogMapper.selectPage(page, queryWrapper); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public OperationLog getIng() { |
|
||||
QueryWrapper<OperationLog> queryWrapper = new QueryWrapper<>(); |
|
||||
queryWrapper.in("status", 0); |
|
||||
return operationLogMapper.selectOne(queryWrapper); |
|
||||
} |
|
||||
} |
|
@ -1,30 +0,0 @@ |
|||||
package com.qyft.ms.app.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import com.qyft.ms.app.mapper.PositionMapper; |
|
||||
import com.qyft.ms.app.model.entity.Position; |
|
||||
import com.qyft.ms.app.service.PositionService; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.Arrays; |
|
||||
import java.util.List; |
|
||||
import java.util.stream.Collectors; |
|
||||
|
|
||||
/** |
|
||||
* 基质业务实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements PositionService { |
|
||||
|
|
||||
@Override |
|
||||
public Boolean delete(String ids) { |
|
||||
List<Long> idsArr = Arrays.stream(ids.split(",")) |
|
||||
.map(Long::parseLong) |
|
||||
.collect(Collectors.toList()); |
|
||||
return this.removeByIds(idsArr); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,70 +0,0 @@ |
|||||
package com.qyft.ms.app.service.impl; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||
import com.qyft.ms.app.mapper.SysSettingsMapper; |
|
||||
import com.qyft.ms.app.model.entity.SysSettings; |
|
||||
import com.qyft.ms.app.service.SysSettingsService; |
|
||||
import lombok.Getter; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
/** |
|
||||
* 系统配置实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class SysSettingsServiceImpl extends ServiceImpl<SysSettingsMapper, SysSettings> implements SysSettingsService { |
|
||||
private final SysSettingsMapper sysSettingsMapper; |
|
||||
// 玻片位置 |
|
||||
@Getter |
|
||||
List<SysSettings> slidePositionList; |
|
||||
// 电机速度 |
|
||||
@Getter |
|
||||
List<SysSettings> motorSpeedList; |
|
||||
|
|
||||
@Getter |
|
||||
Map<String, Double> wasteLiquorPosition; |
|
||||
|
|
||||
// 自检状态 |
|
||||
@Getter |
|
||||
boolean selfCheckStatus = false; |
|
||||
|
|
||||
// 设备状态 |
|
||||
@Getter |
|
||||
String workStatus = "idle"; |
|
||||
|
|
||||
// 目标湿度 |
|
||||
@Getter |
|
||||
Double targetHumidity = 0.0; |
|
||||
|
|
||||
// @PostConstruct |
|
||||
public void init() { |
|
||||
QueryWrapper<SysSettings> queryWrapper = new QueryWrapper<>(); |
|
||||
queryWrapper.in("code", "slide_position"); |
|
||||
Long parentId = sysSettingsMapper.selectOne(queryWrapper).getId(); |
|
||||
slidePositionList = sysSettingsMapper.selectList(new QueryWrapper<SysSettings>().eq("parent_id", parentId)); |
|
||||
motorSpeedList = sysSettingsMapper.selectList(new QueryWrapper<SysSettings>().eq("parent_id", new QueryWrapper<SysSettings>().eq("code", "speed"))); |
|
||||
String position = sysSettingsMapper.selectOne(new QueryWrapper<SysSettings>().eq("code", "waste_liquor")).getValue(); |
|
||||
String [] positionList = position.split(","); |
|
||||
wasteLiquorPosition = Map.of( |
|
||||
"x", Double.parseDouble(positionList[0]), |
|
||||
"y", Double.parseDouble(positionList[1]), |
|
||||
"z", Double.parseDouble(positionList[2]) |
|
||||
); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void updateWorkStatus(String status) { |
|
||||
workStatus = status; |
|
||||
} |
|
||||
public void updateTargetHumidity(Double humidity) { |
|
||||
targetHumidity = humidity; |
|
||||
} |
|
||||
public void updateSelfCheckStatus(boolean status) { |
|
||||
selfCheckStatus = status; |
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue