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

@@ -111,9 +111,11 @@ justauth:
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
# erp相关配置
erp:
address: hana-dev.yncic.com
sapsys: ZTDEV203
secretKey: 123456789 # erp秘钥
eplat:
share:

View File

@@ -101,9 +101,11 @@ zt:
access-log: # 访问日志的配置项
enable: true
# erp相关配置
erp:
address: hana-dev.yncic.com
sapsys: ZTDEV203
secretKey: 123456789 # erp秘钥
eplat:
share:

View File

@@ -90,6 +90,9 @@
<logger name="com.zt.plat.module.base.dal.mysql" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="com.zt.plat.module.base.dal.dao" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<logger name="com.zt.plat.module.contractorder.dal.mysql" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
@@ -107,5 +110,4 @@
<appender-ref ref="GRPC"/>
</root>
</springProfile>
</configuration>

View File

@@ -0,0 +1,29 @@
CREATE INDEX idx_hs_cls_tenant_deleted_cls
ON bse_mtrl_hs_cls(tenant_id, deleted, CLS_ID, INF_ID);
CREATE INDEX idx_hs_cls_composite
ON bse_mtrl_hs_cls(tenant_id, deleted, CLS_ID);
CREATE INDEX idx_mtrl_inf_tenant_deleted_id
ON bse_mtrl_inf(tenant_id, deleted, id);
CREATE INDEX idx_mtrl_inf_tenant_deleted_cd
ON bse_mtrl_inf(tenant_id, deleted, CD, id);
CREATE INDEX idx_mtrl_inf_cover
ON bse_mtrl_inf(tenant_id, deleted, CD, id, NAME, RMK, create_time, update_time, creator, updater);
CREATE INDEX idx_hs_prps_tenant_deleted_inf
ON bse_mtrl_hs_prps(tenant_id, deleted, INF_ID, PRPS_ID);
CREATE INDEX idx_hs_prps_tenant_inf_deleted
ON bse_mtrl_hs_prps(tenant_id, INF_ID, deleted);
CREATE INDEX idx_hs_prps_cover
ON bse_mtrl_hs_prps(tenant_id, deleted, INF_ID, PRPS_ID, UNT_ID, IS_KY, IS_MTNG, SRT, DEPT_ID);
CREATE INDEX idx_mtrl_prps_tenant_deleted_id
ON bse_mtrl_prps(tenant_id, deleted, id);
CREATE INDEX idx_mtrl_prps_cover
ON bse_mtrl_prps(tenant_id, deleted, id, CD, NAME, UNT_QTY_ID, DIC_DAT_VAL, DAT_TP, RMK, DEPT_ID);

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)) {

View File

@@ -21,7 +21,7 @@ public class ErpSubmitReqDTO {
* "bskey": 调用系统业务单据编号,必须,在外部系统唯一,用于关联
* "usrid": 外部系统用户id
* "usrnm": 外部系统用户名
* "sign": 签名uuid+srcsys+密码MD5 32位小写签名密码另行约定
* "sign": 签名uuid+srcsys+密码MD5 32位小写签名秘钥另行约定
* "req": {具体参数参见RFC功能列表}
*/
@Schema(description = "接口编号必须参见RFC功能列表可调用接口编号范围051-900")
@@ -40,7 +40,7 @@ public class ErpSubmitReqDTO {
@NotBlank(message = "外部系统用户名不能为空")
private String usrnm;
@Schema(description = "签名uuid+srcsys+密码MD5 32位小写签名密码另行约定")
@Schema(description = "签名uuid+srcsys+密码MD5 32位小写签名秘钥另行约定")
private String sign;
@Schema(description = "具体参数参见RFC功能列表")

View File

@@ -1,10 +1,12 @@
package com.zt.plat.module.erp.utils;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity;
@@ -13,6 +15,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@@ -29,6 +32,9 @@ public class ErpConfig {
@Value("${erp.sapsys:}")
private String sapsys;
@Value("${erp.secretKey:}")
private String secretKey;
/**
* 调用ERP接口获取erp数据
*/
@@ -110,7 +116,11 @@ public class ErpConfig {
requestBody.put("usrid", reqDTO.getUsrid());
requestBody.put("usrnm", reqDTO.getUsrnm());
// todo 密码另行约定
//requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
if (StringUtils.isBlank(reqDTO.getSign())) {
requestBody.put("sign", DigestUtil.md5Hex(uuid + "DSC" + secretKey, StandardCharsets.UTF_8));
} else {
requestBody.put("sign", reqDTO.getSign());
}
if (reqDTO.getReq() != null) {
requestBody.put("req", reqDTO.getReq());
}
@@ -166,4 +176,5 @@ public class ErpConfig {
}
}
}