Merge branch 'refs/heads/dev' into test

This commit is contained in:
liss
2025-09-26 12:02:17 +08:00
19 changed files with 99 additions and 9 deletions

View File

@@ -19,7 +19,7 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>3.0.37</revision>
<revision>3.0.38</revision>
<!-- Maven 相关 -->
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>

View File

@@ -92,4 +92,10 @@ public class CompanyRelativityController {
return success(BeanUtils.toBean(pageResult, CompanyRelaDeptDO.class));
}
@PostMapping("/createOrUpdate-list")
@Operation(summary = "批量创建更新公司关系")
@PreAuthorize("@ss.hasPermission('base:company-relativity:create')")
public CommonResult<List<CompanyRelativityRespVO>> createOrUpdataCompanyList(@Valid @RequestBody List<CompanyRelativitySaveReqVO> createReqVOS) {
return success(companyRelativityService.createOrUpdataCompanyList(createReqVOS));
}
}

View File

@@ -35,4 +35,6 @@ public class ContactPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "是否启用")
private String isEnable;
}

View File

@@ -44,4 +44,7 @@ public class ContactRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "是否启用")
@ExcelProperty("是否启用")
private String isEnable;
}

View File

@@ -33,4 +33,7 @@ public class ContactSaveReqVO {
@NotEmpty(message = "联系地址不能为空")
private String address;
@Schema(description = "是否启用")
private String isEnable;
}

View File

@@ -166,7 +166,7 @@ public class TemplateInstanceController extends AbstractFileUploadController {
//根据id获取实例版本号
@GetMapping("/get-version")
@Operation(summary = "根据id获取实例版本号")
public CommonResult<Map<String,Object>> getVersion(@RequestParam("id") String id) {
public CommonResult<Map<String,Object>> getVersion(@Valid @NotEmpty(message = "模版实例id不能为空") @RequestParam("id") String id) {
return success(templateInstanceService.getVersion(id));
}

View File

@@ -6,6 +6,7 @@ import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.pojo.OnlyOffi
import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.service.OnlyOfficeCallbackService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.security.PermitAll;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@@ -33,7 +34,6 @@ public class OnlyOfficeCallbackController {
public ResponseEntity<Map<String, Integer>> handleCallback(@RequestBody OnlyOfficeCallback callback, @PathVariable String id) {
// 处理回调逻辑
callbackService.processCallback(callback,id);
// 返回必须的响应否则OnlyOffice会显示错误
Map<String, Integer> response = new HashMap<>();
response.put("error", 0);

View File

@@ -143,7 +143,7 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
// 2. 获取并验证文件名
String fileName = file.getOriginalFilename();
String directory = "template-instance";
String directory = "模版实例";
FileCreateReqDTO fileCreateReqDTO = new FileCreateReqDTO();
fileCreateReqDTO.setName(fileName);
fileCreateReqDTO.setContent(file.getBytes());
@@ -152,6 +152,7 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
// 7. 调用文件服务创建文件
CommonResult<String> result = fileApi.createFile(fileCreateReqDTO);
log.info("文件创建结果:{}", result);
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@@ -59,6 +59,11 @@ public class ContactDO extends BusinessBaseDO {
*/
@TableField("ADR")
private String address;
/**
* 是否启用
*/
@TableField("IS_ENB")
private String isEnable;
/**
* 公司编号
*/

View File

@@ -27,4 +27,5 @@ public interface FactoryMapper extends BaseMapperX<FactoryDO> {
.orderByDesc(FactoryDO::getId));
}
String selectMaxCode();
}

View File

@@ -29,4 +29,5 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
.orderByDesc(WarehouseDO::getId));
}
String selectMaxCode();
}

View File

@@ -62,4 +62,5 @@ public interface CompanyRelativityService {
*/
PageResult<CompanyRelaDeptDO> getCompanyRelativityPage(CompanyRelativityPageReqVO pageReqVO);
List<CompanyRelativityRespVO> createOrUpdataCompanyList(List<CompanyRelativitySaveReqVO> createReqVOS);
}

View File

@@ -116,6 +116,43 @@ public class CompanyRelativityServiceImpl implements CompanyRelativityService {
return new PageResult<>(pageList, (long) total);
}
@Override
public List<CompanyRelativityRespVO> createOrUpdataCompanyList(List<CompanyRelativitySaveReqVO> createReqVOS) {
if (CollUtil.isEmpty(createReqVOS)) {
return null;
}
List<CompanyRelativityDO> insertList = new ArrayList<>();
List<CompanyRelativityDO> updateList = new ArrayList<>();
// 分离需要插入和更新的数据
for (CompanyRelativitySaveReqVO createReqVO : createReqVOS) {
if (createReqVO.getId() == null) {
// 插入
CompanyRelativityDO companyRelativity = BeanUtils.toBean(createReqVO, CompanyRelativityDO.class);
insertList.add(companyRelativity);
} else {
// 校验存在
validateCompanyRelativityExists(createReqVO.getId());
// 更新
CompanyRelativityDO updateObj = BeanUtils.toBean(createReqVO, CompanyRelativityDO.class);
updateList.add(updateObj);
}
}
// 批量插入
if (CollUtil.isNotEmpty(insertList)) {
companyRelativityMapper.insertBatch(insertList);
}
// 批量更新
if (CollUtil.isNotEmpty(updateList)) {
companyRelativityMapper.updateBatch(updateList);
}
return BeanUtils.toBean(createReqVOS, CompanyRelativityRespVO.class);
}
private List<CompanyRelaDeptDO> buildTree(List<CompanyRelaDeptDO> list) {
// 创建一个map用于存储所有节点key为idvalue为节点对象
Map<Long, CompanyRelaDeptDO> nodeMap = new HashMap<>();

View File

@@ -36,6 +36,17 @@ public class FactoryServiceImpl implements FactoryService {
public FactoryRespVO createFactory(FactorySaveReqVO createReqVO) {
// 插入
FactoryDO factory = BeanUtils.toBean(createReqVO, FactoryDO.class);
// 工厂编码自动生成,格式 GC-0001,依次新增
String maxCode = factoryMapper.selectMaxCode();
if (maxCode == null) {
factory.setNumber("GC-0001");
} else {
String prefix = "GC-";
String numberPart = maxCode.substring(prefix.length());
int nextNumber = Integer.parseInt(numberPart) + 1;
String nextCode = prefix + String.format("%04d", nextNumber);
factory.setNumber(nextCode);
}
factoryMapper.insert(factory);
// 返回
return BeanUtils.toBean(factory, FactoryRespVO.class);
@@ -59,12 +70,12 @@ public class FactoryServiceImpl implements FactoryService {
}
@Override
public void deleteFactoryListByIds(List<Long> ids) {
public void deleteFactoryListByIds(List<Long> ids) {
// 校验存在
validateFactoryExists(ids);
// 删除
factoryMapper.deleteByIds(ids);
}
}
private void validateFactoryExists(List<Long> ids) {
List<FactoryDO> list = factoryMapper.selectByIds(ids);
@@ -92,7 +103,7 @@ public class FactoryServiceImpl implements FactoryService {
@Override
public void enableFactoryList(List<FactoryRespVO> saveReqVOS) {
List<FactoryDO> updateObj = BeanUtils.toBean(saveReqVOS, FactoryDO.class);
List<BatchResult> count = factoryMapper.updateById(updateObj);
List<BatchResult> count = factoryMapper.updateById(updateObj);
if (CollUtil.isEmpty(count)) {
throw exception(FACTORY_NOT_EXISTS);
}

View File

@@ -36,6 +36,17 @@ public class WarehouseServiceImpl implements WarehouseService {
public WarehouseRespVO createWarehouse(WarehouseSaveReqVO createReqVO) {
// 插入
WarehouseDO warehouse = BeanUtils.toBean(createReqVO, WarehouseDO.class);
// 库位编码自动生成,格式 KW-0001,依次新增
String maxCode = warehouseMapper.selectMaxCode();
if (maxCode == null) {
warehouse.setCoding("KW-0001");
} else {
String prefix = "KW-";
String numberPart = maxCode.substring(prefix.length());
int nextNumber = Integer.parseInt(numberPart) + 1;
String nextCode = prefix + String.format("%04d", nextNumber);
warehouse.setCoding(nextCode);
}
warehouseMapper.insert(warehouse);
// 返回
return BeanUtils.toBean(warehouse, WarehouseRespVO.class);

View File

@@ -359,7 +359,9 @@ private String incrementVersion(String currentVersion) {
@Override
public Map<String, Object> getVersion(String id) {
validateTemplateInstanceExists(Long.valueOf(id));
return Map.of("version", templateInstanceMapper.selectById(id).getVer());
String ver = templateInstanceMapper.selectById(id).getVer();
String newVer = incrementVersion(ver);
return Map.of("version",ver,"newVersion",newVer);
}
@Override

View File

@@ -9,4 +9,7 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectMaxCode" resultType="java.lang.String">
SELECT MAX(NUM) FROM sply_fact
</select>
</mapper>

View File

@@ -9,4 +9,7 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectMaxCode" resultType="java.lang.String">
SELECT max(CDG) FROM SPLY_WEH
</select>
</mapper>

View File

@@ -129,7 +129,7 @@
<dependency>
<groupId>com.zt.plat</groupId>
<artifactId>zt-module-base-server</artifactId>
<version>3.0.37</version>
<version>3.0.38</version>
<scope>compile</scope>
</dependency>
</dependencies>