|
@ -1,9 +1,12 @@ |
|
|
package org.dromara.sample.manage.service.impl; |
|
|
package org.dromara.sample.manage.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
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.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
import org.dromara.common.core.constant.DeviceQrtzConstants; |
|
|
import org.dromara.common.core.utils.MapstructUtils; |
|
|
import org.dromara.common.core.utils.MapstructUtils; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
@ -21,6 +24,8 @@ import org.dromara.sample.manage.service.IDeviceQrtzDateService; |
|
|
import org.dromara.sample.manage.service.IDeviceQrtzFileService; |
|
|
import org.dromara.sample.manage.service.IDeviceQrtzFileService; |
|
|
import org.dromara.sample.manage.service.IDeviceQrtzService; |
|
|
import org.dromara.sample.manage.service.IDeviceQrtzService; |
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
|
|
|
import org.dromara.sample.wayline.mapper.IWaylineFileMapper; |
|
|
|
|
|
import org.dromara.sample.wayline.model.entity.WaylineFileEntity; |
|
|
import org.dromara.system.api.model.LoginUser; |
|
|
import org.dromara.system.api.model.LoginUser; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -46,6 +51,8 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
private IDeviceQrtzFileMapper deviceQrtzFileMapper; |
|
|
private IDeviceQrtzFileMapper deviceQrtzFileMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IDeviceQrtzDateService deviceQrtzDateService; |
|
|
private IDeviceQrtzDateService deviceQrtzDateService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IWaylineFileMapper waylineFileMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public TableDataInfo<DeviceQrtzEntity> listManageDeviceQrtz(Page page, DeviceQrtzDTO deviceQrtzDTO) { |
|
|
public TableDataInfo<DeviceQrtzEntity> listManageDeviceQrtz(Page page, DeviceQrtzDTO deviceQrtzDTO) { |
|
@ -124,6 +131,14 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
return deviceQrtzMapper.updateById(entity)>0; |
|
|
return deviceQrtzMapper.updateById(entity)>0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Boolean update(Long id, Integer status) { |
|
|
|
|
|
DeviceQrtzEntity entity = new DeviceQrtzEntity(); |
|
|
|
|
|
entity.setId(id); |
|
|
|
|
|
entity.setStatus(status); |
|
|
|
|
|
return deviceQrtzMapper.updateById(entity)>0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean add( DeviceQrtzDTO deviceQrtzDTO) { |
|
|
public Boolean add( DeviceQrtzDTO deviceQrtzDTO) { |
|
|
|
|
|
|
|
@ -152,4 +167,73 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
} |
|
|
} |
|
|
return deviceQrtzMapper.deleteBatchIds(ids)>0; |
|
|
return deviceQrtzMapper.deleteBatchIds(ids)>0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Boolean fileRemove(Long id) { |
|
|
|
|
|
return deviceQrtzFileMapper.deleteById(id)>0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Boolean addFileList(DeviceQrtzFileDTO deviceQrtzFileDTO) { |
|
|
|
|
|
int sort=1; |
|
|
|
|
|
List<DeviceQrtzFileEntity> selectList = deviceQrtzFileMapper.selectList(new QueryWrapper<DeviceQrtzFileEntity>() |
|
|
|
|
|
.eq("qrtz_id", deviceQrtzFileDTO.getQrtzId()).eq("exec_date",deviceQrtzFileDTO.getExecDate()) |
|
|
|
|
|
.orderByDesc("sort")); |
|
|
|
|
|
if(!CollectionUtils.isEmpty(selectList)){ |
|
|
|
|
|
Integer number =selectList.get(0).getSort(); |
|
|
|
|
|
if(ObjectUtil.isNotEmpty(number)){ |
|
|
|
|
|
sort=number+1; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
for (String waylineId : deviceQrtzFileDTO.getWaylineIdStr().split(",")) { |
|
|
|
|
|
DeviceQrtzFileEntity entity = new DeviceQrtzFileEntity(); |
|
|
|
|
|
QueryWrapper<WaylineFileEntity> queryWrapper = new QueryWrapper<WaylineFileEntity>().eq("wayline_id", waylineId); |
|
|
|
|
|
WaylineFileEntity fileEntity = waylineFileMapper.selectOne(queryWrapper); |
|
|
|
|
|
entity.setQrtzId(deviceQrtzFileDTO.getQrtzId()); |
|
|
|
|
|
entity.setWaylineId(waylineId); |
|
|
|
|
|
entity.setWaylineName(fileEntity.getName()); |
|
|
|
|
|
try { |
|
|
|
|
|
entity.setSort(sort); |
|
|
|
|
|
entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1); |
|
|
|
|
|
entity.setExecDate(deviceQrtzFileDTO.getExecDate()); |
|
|
|
|
|
|
|
|
|
|
|
sort=sort+1; |
|
|
|
|
|
deviceQrtzFileMapper.insert(entity); |
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
throw new RuntimeException("航线{"+fileEntity.getName()+"}已报错,需要重新添加,报错信息:"+e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Boolean copy(Long qrtzId, String starDate, String endDate) { |
|
|
|
|
|
List<DeviceQrtzFileEntity> selectList = deviceQrtzFileMapper.selectList(new QueryWrapper<DeviceQrtzFileEntity>() |
|
|
|
|
|
.eq("qrtz_id", qrtzId).eq("exec_date",starDate)); |
|
|
|
|
|
if(!selectList.isEmpty()){ |
|
|
|
|
|
List<DeviceQrtzFileEntity> entityList = selectList.stream().map(e -> { |
|
|
|
|
|
DeviceQrtzFileEntity entity = new DeviceQrtzFileEntity(); |
|
|
|
|
|
entity.setQrtzId(e.getQrtzId()); |
|
|
|
|
|
entity.setWaylineId(e.getWaylineId()); |
|
|
|
|
|
entity.setWaylineName(e.getWaylineName()); |
|
|
|
|
|
entity.setSort(e.getSort()); |
|
|
|
|
|
entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1); |
|
|
|
|
|
entity.setExecDate(Convert.toDate(endDate)); |
|
|
|
|
|
return entity; |
|
|
|
|
|
}).toList(); |
|
|
|
|
|
return deviceQrtzFileMapper.insert(entityList).size()>0; |
|
|
|
|
|
}else { |
|
|
|
|
|
throw new RuntimeException("未获取到需要复制的航线"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Boolean fileSort(Long id, Integer sort) { |
|
|
|
|
|
DeviceQrtzFileEntity entity = new DeviceQrtzFileEntity(); |
|
|
|
|
|
entity.setSort(sort); |
|
|
|
|
|
entity.setId(id); |
|
|
|
|
|
return deviceQrtzFileMapper.updateById(entity)>0; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|