Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
潘荣晟
2026-01-14 15:50:26 +08:00
10 changed files with 123 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ public class MaterialHasPropertiesDeptController {
public CommonResult<MaterialHasPropertiesBatchSaveRespVO> batchSave(@Valid @RequestBody MaterialHasPropertiesBatchSaveReqVO reqVO) {
Long deptId = reqVO.getDeptId();
if (deptId == null) {
throw new ServiceException(401, "部门ID不能为空");
throw new ServiceException(500, "部门ID不能为空");
}
MaterialHasPropertiesBatchSaveRespVO resp = materialHasPropertiesService.batchSave(reqVO, deptId);
return success(resp);

View File

@@ -97,7 +97,7 @@ public class MaterialPropertiesDeptController {
public CommonResult<MaterialPropertiesRespVO> getMaterialProperties(@RequestParam("id") Long id) {
MaterialPropertiesRespVO materialProperties = materialPropertiesService.getMaterialProperties(id);
if (materialProperties.getDeptId() == null) {
throw new ServiceException(401, "没有权限");
throw new ServiceException(500, "没有权限");
}
return success(materialProperties);
}
@@ -107,7 +107,7 @@ public class MaterialPropertiesDeptController {
@PreAuthorize("@ss.hasPermission('base:material-properties-dept:query')")
public CommonResult<PageResult<MaterialPropertiesRespVO>> getMaterialPropertiesPage(@Valid MaterialPropertiesPageReqVO pageReqVO) {
if (pageReqVO.getDeptId() == null) {
throw new ServiceException(401, "部门ID不能为空");
throw new ServiceException(500, "部门ID不能为空");
}
PageResult<MaterialPropertiesRespVO> pageResult = materialPropertiesService.getMaterialPropertiesPage(pageReqVO);
return success(pageResult);
@@ -118,7 +118,7 @@ public class MaterialPropertiesDeptController {
@PreAuthorize("@ss.hasPermission('base:material-properties-dept:query')")
public CommonResult<PageResult<MaterialPropertiesSimpleRespVO>> getMaterialPropertiesSimplePage(@Valid MaterialPropertiesSimplePageReqVO pageReqVO) {
if (pageReqVO.getDeptId() == null) {
throw new ServiceException(401, "部门ID不能为空");
throw new ServiceException(500, "部门ID不能为空");
}
return success(materialPropertiesService.getMaterialPropertiesSimplePage(pageReqVO));
}
@@ -130,7 +130,7 @@ public class MaterialPropertiesDeptController {
public void exportMaterialPropertiesExcel(@Valid MaterialPropertiesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
if (pageReqVO.getDeptId() == null) {
throw new ServiceException(401, "部门ID不能为空");
throw new ServiceException(500, "部门ID不能为空");
}
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialPropertiesRespVO> list = materialPropertiesService.getMaterialPropertiesPage(pageReqVO).getList();

View File

@@ -0,0 +1,60 @@
package com.zt.plat.module.base.job;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zt.plat.framework.tenant.core.job.TenantJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* 测试定时任务
*
* @author base
*/
@Component
@Slf4j
public class TestJob {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
/**
* 简单测试任务
*/
@XxlJob("testSimpleJob")
@TenantJob
public void testSimpleJob() {
String currentTime = LocalDateTime.now().format(FORMATTER);
log.info("[testSimpleJob][开始执行] 当前时间: {}", currentTime);
try {
// 模拟业务处理
Thread.sleep(2000);
log.info("[testSimpleJob][执行成功] 任务已完成");
} catch (Exception e) {
log.error("[testSimpleJob][执行失败] 错误信息: {}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
/**
* 带参数的测试任务
*/
@XxlJob("testParamJob")
@TenantJob
public void testParamJob() {
String currentTime = LocalDateTime.now().format(FORMATTER);
log.info("[testParamJob][开始执行] 当前时间: {}", currentTime);
try {
// 模拟带参数的业务处理
log.info("[testParamJob][处理中] 正在处理业务逻辑...");
Thread.sleep(1000);
log.info("[testParamJob][执行成功] 任务已完成");
} catch (Exception e) {
log.error("[testParamJob][执行失败] 错误信息: {}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
}

View File

@@ -114,8 +114,14 @@ public class MaterialHasPropertiesServiceImpl implements MaterialHasPropertiesSe
return resp;
}
// 全量替换:先删除该物料的已有属性
materialHasPropertiesMapper.delete(new LambdaQueryWrapperX<MaterialHasPropertiesDO>()
.eq(MaterialHasPropertiesDO::getInfomationId, infoId));
LambdaQueryWrapperX<MaterialHasPropertiesDO> delQuery = new LambdaQueryWrapperX<>();
delQuery.eq(MaterialHasPropertiesDO::getInfomationId, infoId);
if (deptId == null) {
delQuery.isNull(MaterialHasPropertiesDO::getDeptId);
} else {
delQuery.eq(MaterialHasPropertiesDO::getDeptId, deptId);
}
materialHasPropertiesMapper.delete(delQuery);
List<MaterialHasPropertiesBatchItemReqVO> properties = batchReqVO.getProperties();
if (CollUtil.isEmpty(properties)) {