吴远 3 months ago
parent
commit
176b09cea2
  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>
<dependencies>
<!-- rabbitmq -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<!-- &lt;!&ndash; rabbitmq &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-bus-amqp</artifactId>-->
<!-- </dependency>-->
<!-- kafka -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-bus-kafka</artifactId>-->
<!-- </dependency>-->
<!-- rocketmq -->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-bus-rocketmq</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-bus-rocketmq</artifactId>
</dependency>
</dependencies>
</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")
@Log(title = "自动飞行任务启停", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PostMapping("status")
@GetMapping("status")
public R<Void> status(@Validated@NotNull(message = "任务id不能为空") Long id ,@NotNull(message = "状态不能为空") Integer status) {
return toAjax(deviceQrtzService.update(id,status));
}
@ -133,16 +133,16 @@ public class DeviceQrtzController extends BaseController {
@Log(title = "自动飞行新增航线", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/addFileList")
public R<Void> addFileList(@Validated(AddGroup.class) @RequestBody DeviceQrtzFileDTO deviceQrtzFileDTO) {
return toAjax(deviceQrtzService.addFileList(deviceQrtzFileDTO));
public R<Void> addFileList(@RequestBody Map<String,Object>map) {
return toAjax(deviceQrtzService.addFileList(map));
}
/** 自动飞行-复制航线*/
@SaCheckPermission("devict:qrtz:copy")
@Log(title = "自动飞行新增航线", businessType = BusinessType.INSERT)
@Log(title = "自动飞行复制航线", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/copy")
@GetMapping("/copy")
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));
}
@ -169,7 +169,7 @@ public class DeviceQrtzController extends BaseController {
@SaCheckPermission("devict:qrtz:edit")
@Log(title = "自动飞行编辑航线排序", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PostMapping("/fileSort")
@GetMapping("/fileSort")
public R<Void> fileSort(@Validated@NotNull(message = "主键id不能为空") Long id ,@NotNull(message = "排序") Integer 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
@NoArgsConstructor
@AllArgsConstructor
@JsonNaming() // 设置为驼峰命名风格
public class DeviceQrtzEntity extends BaseEntity {
@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 Long createDept;
/**
* 部门名称 */
private String deptName;
/**
* 用户名称 */
private String nickName;
/**
* 删除 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 deleteIds(Collection<Long> ids);
Boolean fileRemove(Long id);
Boolean addFileList(DeviceQrtzFileDTO deviceQrtzFileDTO);
Boolean addFileList(Map<String,Object>map);
Boolean copy(Long qrtzId ,String starDate,String endDate);
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
public Boolean addFileList(DeviceQrtzFileDTO deviceQrtzFileDTO) {
public Boolean addFileList(Map<String,Object>map) {
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>()
.eq("qrtz_id", deviceQrtzFileDTO.getQrtzId()).eq("exec_date",deviceQrtzFileDTO.getExecDate())
.orderByDesc("sort"));
.eq("qrtz_id", qrtzId).eq("exec_date",execDate).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(",")) {
for (String waylineId : waylineIdStr.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.setQrtzId(qrtzId);
entity.setWaylineId(waylineId);
entity.setWaylineName(fileEntity.getName());
try {
entity.setSort(sort);
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;
deviceQrtzFileMapper.insert(entity);
}catch (Exception e){
@ -220,6 +227,12 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService {
entity.setSort(e.getSort());
entity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_1);
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;
}).toList();
return deviceQrtzFileMapper.insert(entityList).size()>0;
@ -236,4 +249,9 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService {
entity.setId(id);
return deviceQrtzFileMapper.updateById(entity)>0;
}
@Override
public DeviceQrtzFileEntity getDeviceQrtzFileEntity(Long id) {
return null;
}
}

Loading…
Cancel
Save