Browse Source

提交

pull/1/head
袁强 3 months ago
parent
commit
ebbd514d5d
  1. 18
      dk-common/common-bus/pom.xml
  2. 12
      dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceQrtzController.java
  3. 1
      dk-modules/sample/src/main/java/org/dromara/sample/manage/model/entity/DeviceQrtzEntity.java
  4. 13
      dk-modules/sample/src/main/java/org/dromara/sample/manage/model/entity/DeviceQrtzFileEntity.java
  5. 5
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/IDeviceQrtzService.java
  6. 32
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceQrtzServiceImpl.java

18
dk-common/common-bus/pom.xml

@ -16,20 +16,20 @@
</description> </description>
<dependencies> <dependencies>
<!-- rabbitmq --> <!-- &lt;!&ndash; rabbitmq &ndash;&gt;-->
<dependency> <!-- <dependency>-->
<groupId>org.springframework.cloud</groupId> <!-- <groupId>org.springframework.cloud</groupId>-->
<artifactId>spring-cloud-starter-bus-amqp</artifactId> <!-- <artifactId>spring-cloud-starter-bus-amqp</artifactId>-->
</dependency> <!-- </dependency>-->
<!-- kafka --> <!-- kafka -->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>--> <!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-bus-kafka</artifactId>--> <!-- <artifactId>spring-cloud-starter-bus-kafka</artifactId>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- rocketmq --> <!-- rocketmq -->
<!-- <dependency>--> <dependency>
<!-- <groupId>com.alibaba.cloud</groupId>--> <groupId>com.alibaba.cloud</groupId>
<!-- <artifactId>spring-cloud-starter-bus-rocketmq</artifactId>--> <artifactId>spring-cloud-starter-bus-rocketmq</artifactId>
<!-- </dependency>--> </dependency>
</dependencies> </dependencies>
</project> </project>

12
dk-modules/sample/src/main/java/org/dromara/sample/manage/controller/DeviceQrtzController.java

@ -97,7 +97,7 @@ public class DeviceQrtzController extends BaseController {
@SaCheckPermission("devict:qrtz:edit") @SaCheckPermission("devict:qrtz:edit")
@Log(title = "自动飞行任务启停", businessType = BusinessType.UPDATE) @Log(title = "自动飞行任务启停", businessType = BusinessType.UPDATE)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("status") @GetMapping("status")
public R<Void> status(@Validated@NotNull(message = "任务id不能为空") Long id ,@NotNull(message = "状态不能为空") Integer status) { public R<Void> status(@Validated@NotNull(message = "任务id不能为空") Long id ,@NotNull(message = "状态不能为空") Integer status) {
return toAjax(deviceQrtzService.update(id,status)); return toAjax(deviceQrtzService.update(id,status));
} }
@ -133,16 +133,16 @@ public class DeviceQrtzController extends BaseController {
@Log(title = "自动飞行新增航线", businessType = BusinessType.INSERT) @Log(title = "自动飞行新增航线", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/addFileList") @PostMapping("/addFileList")
public R<Void> addFileList(@Validated(AddGroup.class) @RequestBody DeviceQrtzFileDTO deviceQrtzFileDTO) { public R<Void> addFileList(@RequestBody Map<String,Object>map) {
return toAjax(deviceQrtzService.addFileList(deviceQrtzFileDTO)); return toAjax(deviceQrtzService.addFileList(map));
} }
/** 自动飞行-复制航线*/ /** 自动飞行-复制航线*/
@SaCheckPermission("devict:qrtz:copy") @SaCheckPermission("devict:qrtz:copy")
@Log(title = "自动飞行新增航线", businessType = BusinessType.INSERT) @Log(title = "自动飞行复制航线", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/copy") @GetMapping("/copy")
public R<Void> copy(@Validated@NotNull(message = "任务id不能为空") Long qrtzId ,@NotNull(message = "请选择原来的时间") String starDate,@NotNull(message ="请选择新的时间") String endDate) { public R<Void> copy(@Validated@NotNull(message = "任务id不能为空") Long qrtzId ,@NotNull(message = "请选择原来的时间") String starDate,@NotNull(message ="请选择新的时间") String endDate) {
return toAjax(deviceQrtzService.copy(qrtzId,starDate,endDate)); return toAjax(deviceQrtzService.copy(qrtzId,starDate,endDate));
} }
@ -169,7 +169,7 @@ public class DeviceQrtzController extends BaseController {
@SaCheckPermission("devict:qrtz:edit") @SaCheckPermission("devict:qrtz:edit")
@Log(title = "自动飞行编辑航线排序", businessType = BusinessType.UPDATE) @Log(title = "自动飞行编辑航线排序", businessType = BusinessType.UPDATE)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/fileSort") @GetMapping("/fileSort")
public R<Void> fileSort(@Validated@NotNull(message = "主键id不能为空") Long id ,@NotNull(message = "排序") Integer sort) { public R<Void> fileSort(@Validated@NotNull(message = "主键id不能为空") Long id ,@NotNull(message = "排序") Integer sort) {
return toAjax(deviceQrtzService.fileSort(id,sort)); return toAjax(deviceQrtzService.fileSort(id,sort));
} }

1
dk-modules/sample/src/main/java/org/dromara/sample/manage/model/entity/DeviceQrtzEntity.java

@ -28,7 +28,6 @@ import java.util.List;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonNaming() // 设置为驼峰命名风格
public class DeviceQrtzEntity extends BaseEntity { public class DeviceQrtzEntity extends BaseEntity {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)

13
dk-modules/sample/src/main/java/org/dromara/sample/manage/model/entity/DeviceQrtzFileEntity.java

@ -64,7 +64,7 @@ public class DeviceQrtzFileEntity implements Serializable {
*/ */
private String createBy; private Long createBy;
/** /**
* 创建时间 * 创建时间
@ -83,6 +83,17 @@ public class DeviceQrtzFileEntity implements Serializable {
private Date updateTime; private Date updateTime;
private Long createDept;
/**
* 部门名称 */
private String deptName;
/**
* 用户名称 */
private String nickName;
/** /**
* 删除 0 正常 1已删除 * 删除 0 正常 1已删除
*/ */

5
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/IDeviceQrtzService.java

@ -47,8 +47,11 @@ public interface IDeviceQrtzService {
Boolean add( DeviceQrtzDTO deviceQrtzDTO); Boolean add( DeviceQrtzDTO deviceQrtzDTO);
Boolean deleteIds(Collection<Long> ids); Boolean deleteIds(Collection<Long> ids);
Boolean fileRemove(Long id); Boolean fileRemove(Long id);
Boolean addFileList(DeviceQrtzFileDTO deviceQrtzFileDTO); Boolean addFileList(Map<String,Object>map);
Boolean copy(Long qrtzId ,String starDate,String endDate); Boolean copy(Long qrtzId ,String starDate,String endDate);
Boolean fileSort(Long id ,Integer sort); Boolean fileSort(Long id ,Integer sort);
//通知启用飞行任务
DeviceQrtzFileEntity getDeviceQrtzFileEntity(Long id);
} }

32
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceQrtzServiceImpl.java

@ -174,29 +174,36 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService {
} }
@Override @Override
public Boolean addFileList(DeviceQrtzFileDTO deviceQrtzFileDTO) { public Boolean addFileList(Map<String,Object>map) {
int sort=1; int sort=1;
Long qrtzId = Convert.toLong(map.get("qrtzId"));
Date execDate = Convert.toDate(map.get("execDate"));
String waylineIdStr = Convert.toStr(map.get("waylineIdStr"));
List<DeviceQrtzFileEntity> selectList = deviceQrtzFileMapper.selectList(new QueryWrapper<DeviceQrtzFileEntity>() List<DeviceQrtzFileEntity> selectList = deviceQrtzFileMapper.selectList(new QueryWrapper<DeviceQrtzFileEntity>()
.eq("qrtz_id", deviceQrtzFileDTO.getQrtzId()).eq("exec_date",deviceQrtzFileDTO.getExecDate()) .eq("qrtz_id", qrtzId).eq("exec_date",execDate).orderByDesc("sort"));
.orderByDesc("sort"));
if(!CollectionUtils.isEmpty(selectList)){ if(!CollectionUtils.isEmpty(selectList)){
Integer number =selectList.get(0).getSort(); Integer number =selectList.get(0).getSort();
if(ObjectUtil.isNotEmpty(number)){ if(ObjectUtil.isNotEmpty(number)){
sort=number+1; sort=number+1;
} }
} }
for (String waylineId : deviceQrtzFileDTO.getWaylineIdStr().split(",")) { for (String waylineId : waylineIdStr.split(",")) {
DeviceQrtzFileEntity entity = new DeviceQrtzFileEntity(); DeviceQrtzFileEntity entity = new DeviceQrtzFileEntity();
QueryWrapper<WaylineFileEntity> queryWrapper = new QueryWrapper<WaylineFileEntity>().eq("wayline_id", waylineId); QueryWrapper<WaylineFileEntity> queryWrapper = new QueryWrapper<WaylineFileEntity>().eq("wayline_id", waylineId);
WaylineFileEntity fileEntity = waylineFileMapper.selectOne(queryWrapper); WaylineFileEntity fileEntity = waylineFileMapper.selectOne(queryWrapper);
entity.setQrtzId(deviceQrtzFileDTO.getQrtzId()); entity.setQrtzId(qrtzId);
entity.setWaylineId(waylineId); entity.setWaylineId(waylineId);
entity.setWaylineName(fileEntity.getName()); entity.setWaylineName(fileEntity.getName());
try { try {
entity.setSort(sort); entity.setSort(sort);
entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1); entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1);
entity.setExecDate(deviceQrtzFileDTO.getExecDate()); entity.setExecDate(execDate);
LoginUser loginUser = LoginHelper.getLoginUser();
entity.setCreateBy(loginUser.getUserId());
entity.setCreateTime(new Date());
entity.setNickName(loginUser.getNickname());
entity.setCreateDept(loginUser.getDeptId());
entity.setDeptName(loginUser.getDeptName());
sort=sort+1; sort=sort+1;
deviceQrtzFileMapper.insert(entity); deviceQrtzFileMapper.insert(entity);
}catch (Exception e){ }catch (Exception e){
@ -220,6 +227,12 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService {
entity.setSort(e.getSort()); entity.setSort(e.getSort());
entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1); entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1);
entity.setExecDate(Convert.toDate(endDate)); entity.setExecDate(Convert.toDate(endDate));
LoginUser loginUser = LoginHelper.getLoginUser();
entity.setCreateBy(loginUser.getUserId());
entity.setCreateTime(new Date());
entity.setNickName(loginUser.getNickname());
entity.setCreateDept(loginUser.getDeptId());
entity.setDeptName(loginUser.getDeptName());
return entity; return entity;
}).toList(); }).toList();
return deviceQrtzFileMapper.insert(entityList).size()>0; return deviceQrtzFileMapper.insert(entityList).size()>0;
@ -236,4 +249,9 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService {
entity.setId(id); entity.setId(id);
return deviceQrtzFileMapper.updateById(entity)>0; return deviceQrtzFileMapper.updateById(entity)>0;
} }
@Override
public DeviceQrtzFileEntity getDeviceQrtzFileEntity(Long id) {
return null;
}
} }

Loading…
Cancel
Save