feat: task-job主表crud基础

This commit is contained in:
2026-07-14 14:09:48 +08:00
parent d225cb8025
commit 9953367281
41 changed files with 4773 additions and 133 deletions

View File

@@ -0,0 +1,23 @@
package cn.code.nl.module.task.enums;
import cn.code.nl.framework.common.enums.RpcConstants;
/**
* API 相关的枚举
*
* @author 芋道源码
*/
public class ApiConstants {
/**
* 服务名
*
* 注意,需要保证和 spring.application.name 保持一致
*/
public static final String NAME = "task-server";
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/task";
public static final String VERSION = "1.0.0";
}

View File

@@ -0,0 +1,12 @@
package cn.code.nl.module.task.enums;
import cn.code.nl.framework.common.exception.ErrorCode;
/**
*
* @Author: liyongde
* @Date: 2026/7/14 13:03
*/
public interface ErrorCodeConstants {
ErrorCode TRANSPORT_TASK_NOT_EXISTS = new ErrorCode(1, "搬运任务不存在");
}

View File

@@ -25,15 +25,16 @@ public class TaskServerApplication {
String port = env.getProperty("server.port");
String hostAddress = InetAddress.getLocalHost().getHostAddress();
log.info("\n-------------------------华创Task服务启动成功------------------------------\n\t" +
"服务名称: '{}' is running! 访问网址:\n\t" +
"本地 localhost: \thttp://localhost:{}\n\t" +
"本机服务 IP: \thttp://{}:{}\n\t" +
String startupMsg = String.format("\n-------------------------华创Task服务启动成功------------------------------\n\t" +
"服务名称: '%s' is running! 访问网址:\n\t" +
"本地 localhost: \thttp://localhost:%s\n\t" +
"本机服务 IP: \thttp://%s:%s\n\t" +
"----------------------------------------------------------",
applicationName,
port,
hostAddress,
port
);
System.out.println(startupMsg);
}
}

View File

@@ -0,0 +1,6 @@
/**
* api实现类
* @Author: liyongde
* @Date: 2026/7/13 13:55
*/
package cn.code.nl.module.task.api;

View File

@@ -0,0 +1,104 @@
package cn.code.nl.module.task.controller.admin.transporttask;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.code.nl.framework.common.pojo.PageParam;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.CommonResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import static cn.code.nl.framework.common.pojo.CommonResult.success;
import cn.code.nl.framework.excel.core.util.ExcelUtils;
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.code.nl.module.task.controller.admin.transporttask.vo.*;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import cn.code.nl.module.task.service.transporttask.TransportTaskService;
@Tag(name = "管理后台 - 搬运任务")
@RestController
@RequestMapping("/task/transport-task")
@Validated
public class TransportTaskController {
@Resource
private TransportTaskService transportTaskService;
@PostMapping("/create")
@Operation(summary = "创建搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:create')")
public CommonResult<Long> createTransportTask(@Valid @RequestBody TransportTaskSaveReqVO createReqVO) {
return success(transportTaskService.createTransportTask(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:update')")
public CommonResult<Boolean> updateTransportTask(@Valid @RequestBody TransportTaskSaveReqVO updateReqVO) {
transportTaskService.updateTransportTask(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除搬运任务")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTask(@RequestParam("id") Long id) {
transportTaskService.deleteTransportTask(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除搬运任务")
@PreAuthorize("@ss.hasPermission('task:transport-task:delete')")
public CommonResult<Boolean> deleteTransportTaskList(@RequestParam("ids") List<Long> ids) {
transportTaskService.deleteTransportTaskListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得搬运任务")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<TransportTaskRespVO> getTransportTask(@RequestParam("id") Long id) {
TransportTaskDO transportTask = transportTaskService.getTransportTask(id);
return success(BeanUtils.toBean(transportTask, TransportTaskRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得搬运任务分页")
@PreAuthorize("@ss.hasPermission('task:transport-task:query')")
public CommonResult<PageResult<TransportTaskRespVO>> getTransportTaskPage(@Valid TransportTaskPageReqVO pageReqVO) {
PageResult<TransportTaskDO> pageResult = transportTaskService.getTransportTaskPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, TransportTaskRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出搬运任务 Excel")
@PreAuthorize("@ss.hasPermission('task:transport-task:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportTransportTaskExcel(@Valid TransportTaskPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<TransportTaskDO> list = transportTaskService.getTransportTaskPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "搬运任务.xls", "数据", TransportTaskRespVO.class,
BeanUtils.toBean(list, TransportTaskRespVO.class));
}
}

View File

@@ -0,0 +1,122 @@
package cn.code.nl.module.task.controller.admin.transporttask.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.code.nl.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.code.nl.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 搬运任务分页 Request VO")
@Data
public class TransportTaskPageReqVO extends PageParam {
@Schema(description = "任务编码")
private String taskCode;
@Schema(description = "任务名称", example = "张三")
private String taskName;
@Schema(description = "业务归属服务LMS/WMS用于完成取消事件一级路由")
private String ownerService;
@Schema(description = "业务类型", example = "2")
private String bizType;
@Schema(description = "业务侧标识", example = "31008")
private String bizId;
@Schema(description = "业务回调处理器编码")
private String handleCode;
@Schema(description = "任务类型", example = "2")
private String taskType;
@Schema(description = "任务状态", example = "2")
private String taskStatus;
@Schema(description = "ACS任务类型", example = "1")
private String acsTaskType;
@Schema(description = "AGV系统类型", example = "1")
private String agvSystemType;
@Schema(description = "ACS外部任务号")
private String externalTaskNo;
@Schema(description = "取货点1")
private String pointCode1;
@Schema(description = "放货点1")
private String pointCode2;
@Schema(description = "取货点2")
private String pointCode3;
@Schema(description = "放货点2")
private String pointCode4;
@Schema(description = "载具类型", example = "2")
private String vehicleType;
@Schema(description = "载具数量")
private Long vehicleQty;
@Schema(description = "载具编码")
private String vehicleCode;
@Schema(description = "载具编码2")
private String vehicleCode2;
@Schema(description = "车号")
private String carNo;
@Schema(description = "优先级")
private String priority;
@Schema(description = "生产区域")
private String productArea;
@Schema(description = "是否自动下发")
private String isAutoIssue;
@Schema(description = "任务组标识", example = "21169")
private Long taskGroupId;
@Schema(description = "任务组顺序号")
private Long sortSeq;
@Schema(description = "任务完成类型", example = "1")
private String finishedType;
@Schema(description = "业务回调状态PENDING/SUCCESS/FAILED", example = "2")
private String callbackStatus;
@Schema(description = "业务回调重试次数", example = "2146")
private Integer callbackRetryCount;
@Schema(description = "业务回调失败原因")
private String callbackErrorMsg;
@Schema(description = "生成方式")
private String createMode;
@Schema(description = "创建任务请求参数")
private String requestParam;
@Schema(description = "下发ACS的AcsTaskDto扩展报文")
private String dispatchParam;
@Schema(description = "ACS反馈参数")
private String resultParam;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,162 @@
package cn.code.nl.module.task.controller.admin.transporttask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
import cn.code.nl.framework.excel.core.annotations.DictFormat;
import cn.code.nl.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 搬运任务 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TransportTaskRespVO {
@Schema(description = "任务标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "11528")
@ExcelProperty("任务标识")
private Long taskId;
@Schema(description = "任务编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务编码")
private String taskCode;
@Schema(description = "任务名称", example = "张三")
@ExcelProperty("任务名称")
private String taskName;
@Schema(description = "业务归属服务LMS/WMS用于完成取消事件一级路由", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务归属服务LMS/WMS用于完成取消事件一级路由")
private String ownerService;
@Schema(description = "业务类型", example = "2")
@ExcelProperty("业务类型")
private String bizType;
@Schema(description = "业务侧标识", example = "31008")
@ExcelProperty("业务侧标识")
private String bizId;
@Schema(description = "业务回调处理器编码")
@ExcelProperty("业务回调处理器编码")
private String handleCode;
@Schema(description = "任务类型", example = "2")
@ExcelProperty("任务类型")
private String taskType;
@Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("任务状态")
private String taskStatus;
@Schema(description = "ACS任务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("ACS任务类型")
private String acsTaskType;
@Schema(description = "AGV系统类型", example = "1")
@ExcelProperty("AGV系统类型")
private String agvSystemType;
@Schema(description = "ACS外部任务号")
@ExcelProperty("ACS外部任务号")
private String externalTaskNo;
@Schema(description = "取货点1")
@ExcelProperty("取货点1")
private String pointCode1;
@Schema(description = "放货点1")
@ExcelProperty("放货点1")
private String pointCode2;
@Schema(description = "取货点2")
@ExcelProperty("取货点2")
private String pointCode3;
@Schema(description = "放货点2")
@ExcelProperty("放货点2")
private String pointCode4;
@Schema(description = "载具类型", example = "2")
@ExcelProperty("载具类型")
private String vehicleType;
@Schema(description = "载具数量", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("载具数量")
private Long vehicleQty;
@Schema(description = "载具编码")
@ExcelProperty("载具编码")
private String vehicleCode;
@Schema(description = "载具编码2")
@ExcelProperty("载具编码2")
private String vehicleCode2;
@Schema(description = "车号")
@ExcelProperty("车号")
private String carNo;
@Schema(description = "优先级", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("优先级")
private String priority;
@Schema(description = "生产区域")
@ExcelProperty("生产区域")
private String productArea;
@Schema(description = "是否自动下发", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否自动下发")
private String isAutoIssue;
@Schema(description = "任务组标识", example = "21169")
@ExcelProperty("任务组标识")
private Long taskGroupId;
@Schema(description = "任务组顺序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务组顺序号")
private Long sortSeq;
@Schema(description = "任务完成类型", example = "1")
@ExcelProperty("任务完成类型")
private String finishedType;
@Schema(description = "业务回调状态PENDING/SUCCESS/FAILED", example = "2")
@ExcelProperty("业务回调状态PENDING/SUCCESS/FAILED")
private String callbackStatus;
@Schema(description = "业务回调重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2146")
@ExcelProperty("业务回调重试次数")
private Integer callbackRetryCount;
@Schema(description = "业务回调失败原因")
@ExcelProperty("业务回调失败原因")
private String callbackErrorMsg;
@Schema(description = "生成方式", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "生成方式", converter = DictConvert.class)
@DictFormat("user_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String createMode;
@Schema(description = "创建任务请求参数")
@ExcelProperty("创建任务请求参数")
private String requestParam;
@Schema(description = "下发ACS的AcsTaskDto扩展报文")
@ExcelProperty("下发ACS的AcsTaskDto扩展报文")
private String dispatchParam;
@Schema(description = "ACS反馈参数")
@ExcelProperty("ACS反馈参数")
private String resultParam;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,126 @@
package cn.code.nl.module.task.controller.admin.transporttask.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 搬运任务新增/修改 Request VO")
@Data
public class TransportTaskSaveReqVO {
private Long taskId;
@Schema(description = "任务编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "任务编码不能为空")
private String taskCode;
@Schema(description = "任务名称", example = "张三")
private String taskName;
@Schema(description = "业务归属服务LMS/WMS用于完成取消事件一级路由", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "业务归属服务LMS/WMS用于完成取消事件一级路由不能为空")
private String ownerService;
@Schema(description = "业务类型", example = "2")
private String bizType;
@Schema(description = "业务侧标识", example = "31008")
private String bizId;
@Schema(description = "业务回调处理器编码")
private String handleCode;
@Schema(description = "任务类型", example = "2")
private String taskType;
@Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "任务状态不能为空")
private String taskStatus;
@Schema(description = "ACS任务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "ACS任务类型不能为空")
private String acsTaskType;
@Schema(description = "AGV系统类型", example = "1")
private String agvSystemType;
@Schema(description = "ACS外部任务号")
private String externalTaskNo;
@Schema(description = "取货点1")
private String pointCode1;
@Schema(description = "放货点1")
private String pointCode2;
@Schema(description = "取货点2")
private String pointCode3;
@Schema(description = "放货点2")
private String pointCode4;
@Schema(description = "载具类型", example = "2")
private String vehicleType;
@Schema(description = "载具数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "载具数量不能为空")
private Long vehicleQty;
@Schema(description = "载具编码")
private String vehicleCode;
@Schema(description = "载具编码2")
private String vehicleCode2;
@Schema(description = "车号")
private String carNo;
@Schema(description = "优先级", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "优先级不能为空")
private String priority;
@Schema(description = "生产区域")
private String productArea;
@Schema(description = "是否自动下发", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "是否自动下发不能为空")
private String isAutoIssue;
@Schema(description = "任务组标识", example = "21169")
private Long taskGroupId;
@Schema(description = "任务组顺序号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "任务组顺序号不能为空")
private Long sortSeq;
@Schema(description = "任务完成类型", example = "1")
private String finishedType;
@Schema(description = "业务回调状态PENDING/SUCCESS/FAILED", example = "2")
private String callbackStatus;
@Schema(description = "业务回调重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2146")
@NotNull(message = "业务回调重试次数不能为空")
private Integer callbackRetryCount;
@Schema(description = "业务回调失败原因")
private String callbackErrorMsg;
@Schema(description = "生成方式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "生成方式不能为空")
private String createMode;
@Schema(description = "创建任务请求参数")
private String requestParam;
@Schema(description = "下发ACS的AcsTaskDto扩展报文")
private String dispatchParam;
@Schema(description = "ACS反馈参数")
private String resultParam;
@Schema(description = "备注", example = "你说的对")
private String remark;
}

View File

@@ -0,0 +1,6 @@
/**
* 控制层包
* @Author: liyongde
* @Date: 2026/7/13 13:56
*/
package cn.code.nl.module.task.controller;

View File

@@ -0,0 +1,170 @@
package cn.code.nl.module.task.dal.dataobject.transporttask;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.code.nl.framework.mybatis.core.dataobject.BaseDO;
/**
* 搬运任务 DO
*
* @author 诺力管理员
*/
@TableName("task_transport_job")
@KeySequence("task_transport_job_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TransportTaskDO extends BaseDO {
/**
* 任务标识
*/
@TableId
private Long taskId;
/**
* 任务编码
*/
private String taskCode;
/**
* 任务名称
*/
private String taskName;
/**
* 业务归属服务LMS/WMS用于完成取消事件一级路由
*/
private String ownerService;
/**
* 业务类型
*/
private String bizType;
/**
* 业务侧标识
*/
private String bizId;
/**
* 业务回调处理器编码
*/
private String handleCode;
/**
* 任务类型
*/
private String taskType;
/**
* 任务状态
*/
private String taskStatus;
/**
* ACS任务类型
*/
private String acsTaskType;
/**
* AGV系统类型
*/
private String agvSystemType;
/**
* ACS外部任务号
*/
private String externalTaskNo;
/**
* 取货点1
*/
private String pointCode1;
/**
* 放货点1
*/
private String pointCode2;
/**
* 取货点2
*/
private String pointCode3;
/**
* 放货点2
*/
private String pointCode4;
/**
* 载具类型
*/
private String vehicleType;
/**
* 载具数量
*/
private Long vehicleQty;
/**
* 载具编码
*/
private String vehicleCode;
/**
* 载具编码2
*/
private String vehicleCode2;
/**
* 车号
*/
private String carNo;
/**
* 优先级
*/
private String priority;
/**
* 生产区域
*/
private String productArea;
/**
* 是否自动下发
*/
private String isAutoIssue;
/**
* 任务组标识
*/
private Long taskGroupId;
/**
* 任务组顺序号
*/
private Long sortSeq;
/**
* 任务完成类型
*/
private String finishedType;
/**
* 业务回调状态PENDING/SUCCESS/FAILED
*/
private String callbackStatus;
/**
* 业务回调重试次数
*/
private Integer callbackRetryCount;
/**
* 业务回调失败原因
*/
private String callbackErrorMsg;
/**
* 生成方式
*
* 枚举 {@link TODO user_type 对应的类}
*/
private String createMode;
/**
* 创建任务请求参数
*/
private String requestParam;
/**
* 下发ACS的AcsTaskDto扩展报文
*/
private String dispatchParam;
/**
* ACS反馈参数
*/
private String resultParam;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,60 @@
package cn.code.nl.module.task.dal.mysql.transporttask;
import java.util.*;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import org.apache.ibatis.annotations.Mapper;
import cn.code.nl.module.task.controller.admin.transporttask.vo.*;
/**
* 搬运任务 Mapper
*
* @author 诺力管理员
*/
@Mapper
public interface TransportTaskMapper extends BaseMapperX<TransportTaskDO> {
default PageResult<TransportTaskDO> selectPage(TransportTaskPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<TransportTaskDO>()
.eqIfPresent(TransportTaskDO::getTaskCode, reqVO.getTaskCode())
.likeIfPresent(TransportTaskDO::getTaskName, reqVO.getTaskName())
.eqIfPresent(TransportTaskDO::getOwnerService, reqVO.getOwnerService())
.eqIfPresent(TransportTaskDO::getBizType, reqVO.getBizType())
.eqIfPresent(TransportTaskDO::getBizId, reqVO.getBizId())
.eqIfPresent(TransportTaskDO::getHandleCode, reqVO.getHandleCode())
.eqIfPresent(TransportTaskDO::getTaskType, reqVO.getTaskType())
.eqIfPresent(TransportTaskDO::getTaskStatus, reqVO.getTaskStatus())
.eqIfPresent(TransportTaskDO::getAcsTaskType, reqVO.getAcsTaskType())
.eqIfPresent(TransportTaskDO::getAgvSystemType, reqVO.getAgvSystemType())
.eqIfPresent(TransportTaskDO::getExternalTaskNo, reqVO.getExternalTaskNo())
.eqIfPresent(TransportTaskDO::getPointCode1, reqVO.getPointCode1())
.eqIfPresent(TransportTaskDO::getPointCode2, reqVO.getPointCode2())
.eqIfPresent(TransportTaskDO::getPointCode3, reqVO.getPointCode3())
.eqIfPresent(TransportTaskDO::getPointCode4, reqVO.getPointCode4())
.eqIfPresent(TransportTaskDO::getVehicleType, reqVO.getVehicleType())
.eqIfPresent(TransportTaskDO::getVehicleQty, reqVO.getVehicleQty())
.eqIfPresent(TransportTaskDO::getVehicleCode, reqVO.getVehicleCode())
.eqIfPresent(TransportTaskDO::getVehicleCode2, reqVO.getVehicleCode2())
.eqIfPresent(TransportTaskDO::getCarNo, reqVO.getCarNo())
.eqIfPresent(TransportTaskDO::getPriority, reqVO.getPriority())
.eqIfPresent(TransportTaskDO::getProductArea, reqVO.getProductArea())
.eqIfPresent(TransportTaskDO::getIsAutoIssue, reqVO.getIsAutoIssue())
.eqIfPresent(TransportTaskDO::getTaskGroupId, reqVO.getTaskGroupId())
.eqIfPresent(TransportTaskDO::getSortSeq, reqVO.getSortSeq())
.eqIfPresent(TransportTaskDO::getFinishedType, reqVO.getFinishedType())
.eqIfPresent(TransportTaskDO::getCallbackStatus, reqVO.getCallbackStatus())
.eqIfPresent(TransportTaskDO::getCallbackRetryCount, reqVO.getCallbackRetryCount())
.eqIfPresent(TransportTaskDO::getCallbackErrorMsg, reqVO.getCallbackErrorMsg())
.eqIfPresent(TransportTaskDO::getCreateMode, reqVO.getCreateMode())
.eqIfPresent(TransportTaskDO::getRequestParam, reqVO.getRequestParam())
.eqIfPresent(TransportTaskDO::getDispatchParam, reqVO.getDispatchParam())
.eqIfPresent(TransportTaskDO::getResultParam, reqVO.getResultParam())
.eqIfPresent(TransportTaskDO::getRemark, reqVO.getRemark())
.betweenIfPresent(TransportTaskDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(TransportTaskDO::getTaskId));
}
}

View File

@@ -0,0 +1,6 @@
/**
* 数据库字段层
* @Author: liyongde
* @Date: 2026/7/13 13:58
*/
package cn.code.nl.module.task.dal;

View File

@@ -0,0 +1,6 @@
/**
* 封装framework
* @Author: liyongde
* @Date: 2026/7/13 14:05
*/
package cn.code.nl.module.task.framework;

View File

@@ -0,0 +1,43 @@
package cn.code.nl.module.task.framework.security.config;
import cn.code.nl.framework.security.config.AuthorizeRequestsCustomizer;
import cn.code.nl.module.infra.enums.ApiConstants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
/**
* Infra 模块的 Security 配置
*/
@Configuration(proxyBeanMethods = false, value = "taskSecurityConfiguration")
public class SecurityConfiguration {
@Bean("taskAuthorizeRequestsCustomizer")
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
return new AuthorizeRequestsCustomizer() {
@Override
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
// Swagger 接口文档
registry.requestMatchers("/v3/api-docs/**").permitAll()
.requestMatchers("/webjars/**").permitAll()
.requestMatchers("/swagger-ui").permitAll()
.requestMatchers("/swagger-ui/**").permitAll();
// Spring Boot Actuator 的安全配置
registry.requestMatchers("/actuator").permitAll()
.requestMatchers("/actuator/**").permitAll();
// Druid 监控
registry.requestMatchers("/druid/**").permitAll();
// 文件读取
registry.requestMatchers(buildAdminApi("/task/file/*/get/**")).permitAll();
// TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案
// RPC 服务的安全配置
registry.requestMatchers(ApiConstants.PREFIX + "/**").permitAll();
}
};
}
}

View File

@@ -0,0 +1,4 @@
/**
* 占位
*/
package cn.code.nl.module.task.framework.security.core;

View File

@@ -0,0 +1,28 @@
package cn.code.nl.module.task.job;
import cn.code.nl.framework.tenant.core.job.TenantJob;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;
/**
* 任务相关的定时任务
* @Author: liyongde
* @Date: 2026/7/13 14:01
*/
@Component
public class TaskScheduleJob {
@XxlJob("autoTaskAssignmentJob")
@TenantJob
public void autoTaskAssignmentJob() {
XxlJobHelper.log("自动下发任务开始");
// todo: 具体业务
String msg = "自动下发任务成功";
XxlJobHelper.log(msg);
XxlJobHelper.handleSuccess(msg);
}
}

View File

@@ -0,0 +1,6 @@
/**
* xxljob任务
* @Author: liyongde
* @Date: 2026/7/13 14:00
*/
package cn.code.nl.module.task.job;

View File

@@ -0,0 +1,6 @@
/**
*
* @Author: liyongde
* @Date: 2026/7/14 13:02
*/
package cn.code.nl.module.task.service;

View File

@@ -0,0 +1,62 @@
package cn.code.nl.module.task.service.transporttask;
import java.util.*;
import jakarta.validation.*;
import cn.code.nl.module.task.controller.admin.transporttask.vo.*;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.pojo.PageParam;
/**
* 搬运任务 Service 接口
*
* @author 诺力管理员
*/
public interface TransportTaskService {
/**
* 创建搬运任务
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createTransportTask(@Valid TransportTaskSaveReqVO createReqVO);
/**
* 更新搬运任务
*
* @param updateReqVO 更新信息
*/
void updateTransportTask(@Valid TransportTaskSaveReqVO updateReqVO);
/**
* 删除搬运任务
*
* @param id 编号
*/
void deleteTransportTask(Long id);
/**
* 批量删除搬运任务
*
* @param ids 编号
*/
void deleteTransportTaskListByIds(List<Long> ids);
/**
* 获得搬运任务
*
* @param id 编号
* @return 搬运任务
*/
TransportTaskDO getTransportTask(Long id);
/**
* 获得搬运任务分页
*
* @param pageReqVO 分页查询
* @return 搬运任务分页
*/
PageResult<TransportTaskDO> getTransportTaskPage(TransportTaskPageReqVO pageReqVO);
}

View File

@@ -0,0 +1,80 @@
package cn.code.nl.module.task.service.transporttask;
import cn.code.nl.framework.common.pojo.PageResult;
import cn.code.nl.framework.common.util.object.BeanUtils;
import cn.code.nl.module.task.controller.admin.transporttask.vo.TransportTaskPageReqVO;
import cn.code.nl.module.task.controller.admin.transporttask.vo.TransportTaskSaveReqVO;
import cn.code.nl.module.task.dal.dataobject.transporttask.TransportTaskDO;
import cn.code.nl.module.task.dal.mysql.transporttask.TransportTaskMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.code.nl.module.task.enums.ErrorCodeConstants.*;
/**
* 搬运任务 Service 实现类
*
* @author 诺力管理员
*/
@Service
@Validated
public class TransportTaskServiceImpl implements TransportTaskService {
@Resource
private TransportTaskMapper transportTaskMapper;
@Override
public Long createTransportTask(TransportTaskSaveReqVO createReqVO) {
// 插入
TransportTaskDO transportTask = BeanUtils.toBean(createReqVO, TransportTaskDO.class);
transportTaskMapper.insert(transportTask);
// 返回
return transportTask.getTaskId();
}
@Override
public void updateTransportTask(TransportTaskSaveReqVO updateReqVO) {
// 校验存在
validateTransportTaskExists(updateReqVO.getTaskId());
// 更新
TransportTaskDO updateObj = BeanUtils.toBean(updateReqVO, TransportTaskDO.class);
transportTaskMapper.updateById(updateObj);
}
@Override
public void deleteTransportTask(Long id) {
// 校验存在
validateTransportTaskExists(id);
// 删除
transportTaskMapper.deleteById(id);
}
@Override
public void deleteTransportTaskListByIds(List<Long> ids) {
// 删除
transportTaskMapper.deleteByIds(ids);
}
private void validateTransportTaskExists(Long id) {
if (transportTaskMapper.selectById(id) == null) {
throw exception(TRANSPORT_TASK_NOT_EXISTS);
}
}
@Override
public TransportTaskDO getTransportTask(Long id) {
return transportTaskMapper.selectById(id);
}
@Override
public PageResult<TransportTaskDO> getTransportTaskPage(TransportTaskPageReqVO pageReqVO) {
return transportTaskMapper.selectPage(pageReqVO);
}
}

View File

@@ -3,15 +3,15 @@
spring:
cloud:
nacos:
server-addr: http://192.168.10.29:8848 # Nacos 服务器地址
username: # Nacos 账号
password: # Nacos 密码
discovery: # 【配置中心】配置项
server-addr: 192.168.81.193:8848 # Nacos 服务器地址
username: nacos
password: nacos
discovery: # 【注册中心】配置项
namespace: dev # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
metadata:
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
config: # 【注册中心】配置项
config: # 【配置中心】配置项
namespace: dev # 命名空间。这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
@@ -57,14 +57,14 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://192.168.81.193:3306/huachuang_lms_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: 12356
password: root123
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://192.168.81.193:3306/huachuang_lms_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: 12356
password: root123
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data:
@@ -95,9 +95,9 @@ spring:
xxl:
job:
admin:
addresses: http://192.168.10.29:8080/xxl-job-admin # 调度中心部署跟地址
addresses: http://192.168.10.2:8080/xxl-job-admin # 调度中心部署跟地址
executor:
ip: 192.168.10.29
ip: 192.168.10.2
port: 9992
--- #################### 服务保障相关配置 ####################

View File

@@ -3,7 +3,7 @@
spring:
cloud:
nacos:
server-addr: http://192.168.10.29:8848 # Nacos 服务器地址
server-addr: 192.168.81.193:8848 # Nacos 服务器地址
username: # Nacos 账号
password: # Nacos 密码
discovery: # 【配置中心】配置项
@@ -57,14 +57,14 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://192.168.81.193:3306/huachuang_lms_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: 12356
password: root123
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/huachuang_lms?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://192.168.81.193:3306/huachuang_lms_dev?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
username: root
password: 12356
password: root123
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data:
@@ -95,9 +95,9 @@ spring:
xxl:
job:
admin:
addresses: http://192.168.10.29:8080/xxl-job-admin # 调度中心部署跟地址
addresses: http://192.168.10.2:8080/xxl-job-admin # 调度中心部署跟地址
executor:
ip: 192.168.10.29
ip: 192.168.10.2
port: 9992
--- #################### 服务保障相关配置 ####################