Compare commits

...

2 Commits

Author SHA1 Message Date
kkk-ops 631211af89 Merge branch 'main' of https://git.ngsk.tech/linweidong/besure_server
# Conflicts:
#	yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/DeviceService.java
#	yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/DeviceServiceImpl.java
1 month ago
kkk-ops 100331b455 commit 1 month ago

@ -61,6 +61,9 @@ public class MoldPageReqVO extends PageParam {
@Schema(description = "id集合导出用")
private String ids;
@Schema(description = "status集合")
private List<Long> statuss;
@Schema(description = "附件地址")
private String fileUrl;

@ -24,7 +24,7 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
default PageResult<MoldDO> selectPage(MoldPageReqVO reqVO) {
LambdaQueryWrapperX<MoldDO> wrapper = new LambdaQueryWrapperX<>();
wrapper
.eqIfPresent(MoldDO::getCode, reqVO.getCode())
.likeIfPresent(MoldDO::getCode, reqVO.getCode())
.likeIfPresent(MoldDO::getName, reqVO.getName())
.eqIfPresent(MoldDO::getUnitId, reqVO.getUnitId())
.eqIfPresent(MoldDO::getMachineId, reqVO.getMachineId())
@ -48,6 +48,9 @@ public interface MoldMapper extends BaseMapperX<MoldDO> {
wrapper.in(MoldDO::getId, idList);
}
if (reqVO.getStatuss() != null && !reqVO.getStatuss().isEmpty()) {
wrapper.in(MoldDO::getStatus, reqVO.getStatuss());
}
return selectPage(reqVO, wrapper);
}

@ -103,4 +103,13 @@ public class MoldController {
List<MoldDO> doList = moldService.getInTransitMoldAllList();
return success(doList);
}
@GetMapping("/getMoldListByStatus")
@Operation(summary = "根据状态获得模具列表")
@Parameter(name = "id", description = "设备id", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold-operate:query')")
public CommonResult<List<MoldDO>> getMoldListByStatus(@RequestParam("status") Long status) {
List<MoldDO> moldDO = moldService.getMoldListByStatus(status);
return success(moldDO);
}
}

@ -87,6 +87,7 @@ public interface MoldBrandService {
* @return
*/
PageResult<MoldRespVO> getMoldPage(MoldPageReqVO pageReqVO);
List<MoldDO> getMoldList();
/**

@ -100,4 +100,6 @@ public interface MoldService {
List<MoldRespVO> buildMoldVOList(List<MoldDO> list);
List<MoldDO> getInTransitMoldAllList();
List<MoldDO> getMoldListByStatus(Long status);
}

@ -129,4 +129,11 @@ public class MoldServiceImpl implements MoldService {
public List<MoldDO> getInTransitMoldAllList() {
return moldMapper.selectList(Wrappers.<MoldDO>lambdaQuery().eq(MoldDO::getStatus,3));
}
@Override
public List<MoldDO> getMoldListByStatus(Long status) {
LambdaQueryWrapperX<MoldDO> queryWrapper = new LambdaQueryWrapperX<MoldDO>()
.eqIfPresent(MoldDO::getStatus, status);
return moldMapper.selectList(queryWrapper);
}
}

@ -58,6 +58,7 @@ public class DeviceController {
// @Resource
// private IMqttservice mqttService;
@PostMapping("/create")
@Operation(summary = "创建物联设备")
@PreAuthorize("@ss.hasPermission('iot:device:create')")
@ -127,6 +128,40 @@ public class DeviceController {
return success(list);
}
@GetMapping("/noUsedlist")
@Operation(summary = "获得未关联设备台账列表")
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
public CommonResult<List<DeviceRespVO>> getDeviceLedgerListByNoUsed() {
DevicePageReqVO pageReqVO = new DevicePageReqVO();
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DeviceRespVO> list = deviceService.getDevicePage(pageReqVO).getList();
List<Long> ids = deviceService.deviceLedgerList();
List<DeviceRespVO> filteredList = list.stream()
.filter(device -> !ids.contains(device.getId()))
.collect(Collectors.toList());
return success(filteredList);
}
@GetMapping("/noUsedlist2")
@Operation(summary = "获得未关联设备台账列表")
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
public CommonResult<List<DeviceRespVO>> getDeviceLedgerList2ByNoUsed(@RequestParam("id") Long id) {
DevicePageReqVO pageReqVO = new DevicePageReqVO();
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DeviceRespVO> list = deviceService.getDevicePage(pageReqVO).getList();
List<Long> ids = deviceService.deviceLedgerList();
List<DeviceRespVO> filteredList = list.stream()
.filter(device -> {
if (id != null && id.equals(device.getId())) {
return true;
}
return !ids.contains(device.getId());
})
.collect(Collectors.toList());
return success(filteredList);
}
@PostMapping("/connect")
@Operation(summary = "连接")
// @PreAuthorize("@ss.hasPermission('iot:device:create')")

@ -100,6 +100,8 @@ public interface DeviceMapper extends BaseMapperX<DeviceDO> {
String lineDeviceLedgerPage(@Param("id") Long id);
List<Long> deviceLedgerList();
List<LineDeviceRespVO> lineDeviceList(@Param("pageReqVO") LineDeviceRequestVO pageReqVO);

@ -140,6 +140,8 @@ public interface DeviceService {
List<DeviceContactModelDO> getDeviceAttributeList(Long deviceId);
List<Long> deviceLedgerList();
void updateDeviceEnabled(@Valid DeviceUpdateEnabledReqVO updateEnabledReqVO) throws MqttException;
DeviceDO getDeviceByMqttTopic(String topic);

@ -672,7 +672,14 @@ public class DeviceServiceImpl implements DeviceService {
if(latestDeviceData != null) {
lineDeviceRespVO.setCollectionTime((String) latestDeviceData.get("timestamp"));
}
lineDeviceRespVO.setLineName(deviceMapper.lineDeviceLedgerPage(record.getId()));
String line = deviceMapper.lineDeviceLedgerPage(record.getId());
if (line != null) {
lineDeviceRespVO.setLineName(line);
lineDeviceRespVO.setLineNode(line);
} else {
lineDeviceRespVO.setLineName("-");
lineDeviceRespVO.setLineNode("-");
}
list.add(lineDeviceRespVO);
}
if (list.isEmpty()) {
@ -1167,4 +1174,10 @@ public class DeviceServiceImpl implements DeviceService {
}
@Override
public List<Long> deviceLedgerList() {
return deviceMapper.deviceLedgerList();
}
}

@ -62,10 +62,19 @@
SELECT mo.workshop
FROM mes_device_ledger mo
WHERE mo.deleted = 0
and dv_id = #{id}
LIMIT 1
and mo.dv_id = #{id}
LIMIT 1
</select>
<select id="deviceLedgerList" resultType="java.lang.Long">
SELECT mo.dv_id
FROM mes_device_ledger mo
WHERE mo.deleted = 0
AND mo.dv_id IS NOT NULL
AND mo.dv_id != 0
</select>
<select id="getDeviceOperationalStatus"
resultType="cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceOperationStatusRespVO">
SELECT

@ -166,7 +166,18 @@ public class DeviceLedgerController {
public CommonResult<List<DeviceLedgerDO>> getDeviceLedgerListByNoUsed() {
List<DeviceLedgerDO> deviceLedgerDOList = deviceLedgerService.getDeviceLedgerList();
deviceLedgerDOList.removeIf(device ->
device.getWorkshop() != null
device.getWorkshop() != null && !device.getWorkshop().trim().isEmpty()
);
return success(deviceLedgerDOList);
}
@GetMapping("/noUsedlist2")
@Operation(summary = "获得未关联设备台账列表")
@PreAuthorize("@ss.hasPermission('mes:device-ledger:query')")
public CommonResult<List<DeviceLedgerDO>> getDeviceLedgerList2ByNoUsed(@RequestParam("id") Long id) {
List<DeviceLedgerDO> deviceLedgerDOList = deviceLedgerService.getDeviceLedgerList();
deviceLedgerDOList.removeIf(device ->
device.getWorkshop() != null && !device.getWorkshop().trim().isEmpty() && !Objects.equals(device.getId(), id)
);
return success(deviceLedgerDOList);
}

@ -56,5 +56,4 @@ public interface MoldOperateService {
List<MoldDO> getLowerMoldList(Long id);
}

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.mes.service.moldoperate;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.common.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.common.dal.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
@ -171,4 +172,5 @@ public class MoldOperateServiceImpl implements MoldOperateService {
return moldDOList;
}
}
Loading…
Cancel
Save