封装接口,erp定时任务,调用缓存map替换list
This commit is contained in:
@@ -51,7 +51,7 @@ spring:
|
|||||||
redis:
|
redis:
|
||||||
host: 172.16.46.63 # 地址
|
host: 172.16.46.63 # 地址
|
||||||
port: 30379 # 端口
|
port: 30379 # 端口
|
||||||
database: 0 # 数据库索引
|
database: 6 # 数据库索引
|
||||||
# password: 123456 # 密码,建议生产环境开启
|
# password: 123456 # 密码,建议生产环境开启
|
||||||
|
|
||||||
xxl:
|
xxl:
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.zt.plat.module.erp.api;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
||||||
|
import com.zt.plat.module.erp.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME)
|
||||||
|
@Tag(name = "RPC 服务 - ERP")
|
||||||
|
public interface ErpExternalApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/erp-external";
|
||||||
|
|
||||||
|
@PostMapping(PREFIX + "/submit")
|
||||||
|
@Operation(summary = "erp数据提交")
|
||||||
|
ResponseEntity<String> submitDataToErp(@Valid @RequestBody ErpSubmitReqDTO reqDTO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.zt.plat.module.erp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Schema(description = "RPC 服务 - 提交 ERP DTO")
|
||||||
|
@Data
|
||||||
|
public class ErpSubmitReqDTO {
|
||||||
|
/**
|
||||||
|
* 调用ERP接口更新erp数据
|
||||||
|
*
|
||||||
|
* 请求参数说明:
|
||||||
|
* "uuid": 请求uuid,必须
|
||||||
|
* "sapsys": SAP系统ID, 必须
|
||||||
|
* "srcsys": 源调用系统ID,必须
|
||||||
|
* "funcnr": 接口编号,必须,参见RFC功能列表,可调用接口编号范围051-900
|
||||||
|
* "bskey": 调用系统业务单据编号,必须,在外部系统唯一,用于关联
|
||||||
|
* "usrid": 外部系统用户id
|
||||||
|
* "usrnm": 外部系统用户名
|
||||||
|
* "sign": 签名,uuid+srcsys+密码,MD5 32位小写签名,密码另行约定
|
||||||
|
* "req": {具体参数,参见RFC功能列表}
|
||||||
|
*/
|
||||||
|
private String uuid;
|
||||||
|
private String srcsys;
|
||||||
|
private String funcnr;
|
||||||
|
private String bskey;
|
||||||
|
private String usrid;
|
||||||
|
private String usrnm;
|
||||||
|
private String sign;
|
||||||
|
private Map<String, Object> req;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.zt.plat.module.erp.enums;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.enums.RpcConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 相关的枚举
|
||||||
|
*
|
||||||
|
* @author ZT
|
||||||
|
*/
|
||||||
|
public class ApiConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名
|
||||||
|
*
|
||||||
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
|
*/
|
||||||
|
public static final String NAME = "erp-server";
|
||||||
|
|
||||||
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/erp";
|
||||||
|
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.zt.plat.module.erp.api;
|
||||||
|
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
||||||
|
import com.zt.plat.module.erp.common.conf.ErpConfig;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ERP Api 实现类
|
||||||
|
*
|
||||||
|
* @author ZT
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Validated
|
||||||
|
public class ErpExternalApiImpl implements ErpExternalApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpConfig erpConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
|
||||||
|
return erpConfig.pushDataToErp(reqDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ public class OftenEnum {
|
|||||||
公司代码("001", "BUKRS", ""),
|
公司代码("001", "BUKRS", ""),
|
||||||
工厂信息("002", "WERKS", ""),
|
工厂信息("002", "WERKS", ""),
|
||||||
客商信息("003", "PARTNER", "DATUM"),
|
客商信息("003", "PARTNER", "DATUM"),
|
||||||
成本中心("004", "", ""),
|
成本中心("004", "KOSTL", ""),
|
||||||
内部订单("005", "", ""),
|
内部订单("005", "", ""),
|
||||||
库位信息("006", "", ""),
|
库位信息("006", "", ""),
|
||||||
采购组织("007", "", ""),
|
采购组织("007", "", ""),
|
||||||
@@ -33,7 +33,7 @@ public class OftenEnum {
|
|||||||
生产订单明细("018", "", ""),
|
生产订单明细("018", "", ""),
|
||||||
库存明细("019", "", ""),
|
库存明细("019", "", ""),
|
||||||
发票状态("020", "", ""),
|
发票状态("020", "", ""),
|
||||||
物料数据("021", "", "ERSDA");
|
物料数据("021", "MATNR", "ERSDA");
|
||||||
|
|
||||||
private final String funcnr;
|
private final String funcnr;
|
||||||
private final String datakey;
|
private final String datakey;
|
||||||
|
|||||||
@@ -103,9 +103,8 @@ public class ErpAssetController {
|
|||||||
|
|
||||||
@PostMapping("/getErpAssetTask")
|
@PostMapping("/getErpAssetTask")
|
||||||
@Operation(summary = "定时获得erp更新资产卡片")
|
@Operation(summary = "定时获得erp更新资产卡片")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-asset:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-asset:create')")
|
||||||
public void getErpCompanyTask() {
|
public void getErpCompanyTask() {
|
||||||
erpAssetService.callErpRfcInterface();
|
erpAssetService.callErpRfcInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -107,12 +107,4 @@ public class ErpCustomerController {
|
|||||||
public void getErpCustomerTask() {
|
public void getErpCustomerTask() {
|
||||||
erpCustomerService.callErpRfcInterface();
|
erpCustomerService.callErpRfcInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/initialize")
|
|
||||||
@Operation(summary = "把数据库数据number搞到redis")
|
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-customer:create')")
|
|
||||||
public void initialize() {
|
|
||||||
erpCustomerService.initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user