Compare commits
3 Commits
detached
...
feature/de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26622ca4bf | ||
|
|
473dfb06da | ||
|
|
dd49f0d1fe |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,34 @@
|
||||
package org.nl.wms.ext.mdm.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author Eric.Yang
|
||||
* @Version V1.1
|
||||
* @Date 2025/5/29
|
||||
* @Description 处理状态统一返回消息类
|
||||
*/
|
||||
@Data
|
||||
public class CommonResponseDto {
|
||||
//状态
|
||||
private String status;
|
||||
//描述
|
||||
private String message;
|
||||
//处理结果集合
|
||||
private List<ResponseItemsData> responseData;
|
||||
|
||||
/**
|
||||
统一返回消息类 构造
|
||||
*/
|
||||
public static CommonResponseDto adapter(String status,String message,List<ResponseItemsData> responseData) {
|
||||
CommonResponseDto commonResponseDto = new CommonResponseDto();
|
||||
commonResponseDto.setStatus(status);
|
||||
commonResponseDto.setMessage(message);
|
||||
commonResponseDto.setResponseData(responseData);
|
||||
return commonResponseDto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.ext.mdm.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResponseItemsData {
|
||||
//主数据唯一主键
|
||||
private Long mdId;
|
||||
//主数据编码
|
||||
private String mdCode;
|
||||
//主数据描述
|
||||
private String mdDescription;
|
||||
//处理状态
|
||||
private String status;
|
||||
//处理状态描述
|
||||
private String message;
|
||||
|
||||
/**
|
||||
统一构造方法
|
||||
*/
|
||||
public static ResponseItemsData adapter(Long mdId,String mdCode,String mdDescription,String status,String message){
|
||||
ResponseItemsData responseItemsData = new ResponseItemsData();
|
||||
responseItemsData.setMdId(mdId);
|
||||
responseItemsData.setMdCode(mdCode);
|
||||
responseItemsData.setMdDescription(mdDescription);
|
||||
responseItemsData.setStatus(status);
|
||||
responseItemsData.setMessage(message);
|
||||
return responseItemsData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.wms.ext.mdm.entity;
|
||||
|
||||
|
||||
/**
|
||||
* @Author Eric.Yang
|
||||
* @Version V1.1
|
||||
* @Date 2025/6/10
|
||||
* @Description 接口状态统一码
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
ACCEPT_SUCCESS("S", "分发成功"),
|
||||
ACCEPT_FAIL("E", "分发失败");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
StatusEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.nl.wms.ext.mdm.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.mdm.entity.CommonResponseDto;
|
||||
import org.nl.wms.ext.mdm.service.MdmToLmsService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Eric.Yang
|
||||
* @version V1.1
|
||||
* @Date 2025/5/29
|
||||
* @Description MDM主数据平台与LMS接口
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mdm")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class MdmToLmsController {
|
||||
|
||||
@Resource
|
||||
private MdmToLmsService mdmToLmsService;
|
||||
|
||||
@PostMapping("/transCustomerInfo")
|
||||
@Log("MDM给LMS推送客户信息")
|
||||
public CommonResponseDto transCustomerInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transCustomerInfo(jsonData);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/transSupplierInfo")
|
||||
@Log("MDM给LMS推送供应商信息")
|
||||
public CommonResponseDto transSupplierInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transSupplierInfo(jsonData);
|
||||
}
|
||||
|
||||
@PostMapping("/transMaterialInfo")
|
||||
@Log("MDM给LMS推送物料主数据信息")
|
||||
public CommonResponseDto transMaterialInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transMaterialInfo(jsonData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.ext.mdm.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.mdm.entity.CommonResponseDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MdmToLmsService {
|
||||
|
||||
CommonResponseDto transCustomerInfo(JSONObject jsonData);
|
||||
|
||||
CommonResponseDto transSupplierInfo(JSONObject jsonData);
|
||||
|
||||
CommonResponseDto transMaterialInfo(JSONObject jsonData);
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
package org.nl.wms.ext.mdm.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mdm.entity.CommonResponseDto;
|
||||
import org.nl.wms.ext.mdm.entity.ResponseItemsData;
|
||||
import org.nl.wms.ext.mdm.entity.StatusEnum;
|
||||
import org.nl.wms.ext.mdm.service.MdmToLmsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author Eric.Yang
|
||||
* @Version V1.1
|
||||
* @Date 2025/5/29
|
||||
* @Description MDM数据对接接口业务实现类
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MdmToLmsServiceImpl implements MdmToLmsService {
|
||||
|
||||
/**
|
||||
* @Description: MDM客户主数据接口
|
||||
* @Author Eric.Yang
|
||||
* @Date: 2025/6/3 9:12
|
||||
**/
|
||||
@Override
|
||||
public CommonResponseDto transCustomerInfo(JSONObject jsonData) {
|
||||
log.info("MDM客户主数据业务请求参数为:{}", jsonData);
|
||||
CommonResponseDto commonResponseDto = new CommonResponseDto();
|
||||
if(CollectionUtil.isEmpty(jsonData)){
|
||||
commonResponseDto.setStatus("E");
|
||||
commonResponseDto.setMessage("MDM传输数据为空!");
|
||||
return commonResponseDto;
|
||||
}
|
||||
List<ResponseItemsData> responseItemsData = Lists.newArrayList();
|
||||
JSONArray customers = jsonData.getJSONArray("customer");
|
||||
if(CollectionUtil.isNotEmpty(customers)){
|
||||
for (int i = 0; i < customers.size(); i++) {
|
||||
JSONObject json = customers.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
//客户编号
|
||||
String mdCode = json.getString("mdCode");
|
||||
//主数据描述
|
||||
String mdDescription = json.getString("mdDescription");
|
||||
try {
|
||||
//客户名称
|
||||
String customerName = json.getString("customerName");
|
||||
//核心字段判断
|
||||
if (StrUtil.isEmpty(mdCode) || StrUtil.isEmpty(customerName)) {
|
||||
throw new BadRequestException("MDM->客户编码或名称不能为空!");
|
||||
}
|
||||
//客户简称
|
||||
String abbreviation = json.getString("abbreviation");
|
||||
//客户状态 01合格 02冻结 03禁用 04黑名单
|
||||
String customerStatus = json.getString("customerStatus");
|
||||
JSONArray salesOrgs = json.getJSONArray("salesOrg");
|
||||
if (CollectionUtil.isEmpty(salesOrgs)) {
|
||||
throw new BadRequestException("MDM->客户数据核心字段数据为空,缺失字段:[salesOrgs]!");
|
||||
}
|
||||
JSONObject salesOrg = salesOrgs.getJSONObject(0);
|
||||
JSONArray salesList = salesOrg.getJSONArray("sales");
|
||||
if (CollectionUtil.isEmpty(salesList)) {
|
||||
throw new BadRequestException("MDM->客户数据核心字段数据为空,缺失字段:[sales]!");
|
||||
}
|
||||
JSONObject sales = salesList.getJSONObject(0);
|
||||
JSONArray parList = sales.getJSONArray("par");
|
||||
if (CollectionUtil.isEmpty(parList)) {
|
||||
throw new BadRequestException("MDM->客户数据核心字段数据为空,缺失字段:[par]!");
|
||||
}
|
||||
JSONObject par = parList.getJSONObject(0);
|
||||
//业务员工号
|
||||
String empSupplier = par.getString("empSupplier");
|
||||
//业务员名称
|
||||
String empSupplierDesc = par.getString("empSupplierDesc");
|
||||
String sales_owner = StrUtil.join("|",empSupplier,empSupplierDesc);
|
||||
//插入客户表
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + mdCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) {
|
||||
customer_jo = new JSONObject();
|
||||
customer_jo.put("cust_id", mdId);
|
||||
customer_jo.put("cust_code", mdCode);
|
||||
customer_jo.put("cust_name", customerName);
|
||||
customer_jo.put("cust_simple_name", abbreviation);
|
||||
customer_jo.put("mdm_status", customerStatus);
|
||||
customer_jo.put("sales_owner", sales_owner);
|
||||
customer_jo.put("create_id", currentUserId);
|
||||
customer_jo.put("create_name", "mdmAdmin");
|
||||
customer_jo.put("create_time", now);
|
||||
WQLObject.getWQLObject("md_cs_customerbase").insert(customer_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
} else {
|
||||
customer_jo.put("cust_name", customerName);
|
||||
customer_jo.put("cust_simple_name", abbreviation);
|
||||
customer_jo.put("sales_owner", sales_owner);
|
||||
customer_jo.put("update_optid", currentUserId);
|
||||
customer_jo.put("update_optname", "mdmAdmin");
|
||||
customer_jo.put("mdm_status", customerStatus);
|
||||
customer_jo.put("update_time", now);
|
||||
WQLObject.getWQLObject("md_cs_customerbase").update(customer_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
String message = e.getMessage();
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_FAIL.getCode(),message.contains("MDM")?message:StatusEnum.ACCEPT_FAIL.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
log.error("MDM客户数据接口业务实现类处理数据异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
commonResponseDto.setStatus(StatusEnum.ACCEPT_SUCCESS.getCode());
|
||||
commonResponseDto.setMessage(StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
commonResponseDto.setResponseData(responseItemsData);
|
||||
return commonResponseDto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: MDM供应商主数据接口
|
||||
* @Author Eric.Yang
|
||||
* @Date: 2025/6/5 9:12
|
||||
**/
|
||||
@Override
|
||||
public CommonResponseDto transSupplierInfo(JSONObject jsonData) {
|
||||
log.info("MDM供应商主数据请求参数为:{}", jsonData);
|
||||
CommonResponseDto commonResponseDto = new CommonResponseDto();
|
||||
if(CollectionUtil.isEmpty(jsonData)){
|
||||
commonResponseDto.setStatus("E");
|
||||
commonResponseDto.setMessage("MDM传输数据为空!");
|
||||
return commonResponseDto;
|
||||
}
|
||||
List<ResponseItemsData> responseItemsData = Lists.newArrayList();
|
||||
JSONArray supplier = jsonData.getJSONArray("supplier");
|
||||
if(CollectionUtil.isNotEmpty(supplier)){
|
||||
for (int i = 0; i < supplier.size(); i++) {
|
||||
JSONObject json = supplier.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
//客户编号
|
||||
String mdCode = json.getString("mdCode");
|
||||
//主数据描述
|
||||
String mdDescription = json.getString("mdDescription");
|
||||
try {
|
||||
//供应商名称
|
||||
String supplierName = json.getString("supplierName");
|
||||
//供应商简称
|
||||
String abbreviation = json.getString("abbreviation");
|
||||
//股份供应商状态 01合格 02潜在 03不合作 04黑名单
|
||||
String gfSupplierStatus = json.getString("gfSupplierStatus");
|
||||
//插入客户表
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
//核心字段判断
|
||||
if (StrUtil.isEmpty(mdCode) || StrUtil.isEmpty(supplierName)) {
|
||||
throw new BadRequestException("MDM->供应商编码或名称不能为空!");
|
||||
}
|
||||
JSONObject supplier_jo = WQLObject.getWQLObject("md_cs_transportationbase").query("cust_code = '" + mdCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(supplier_jo)) {
|
||||
supplier_jo = new JSONObject();
|
||||
supplier_jo.put("cust_id", mdId);
|
||||
supplier_jo.put("cust_code", mdCode);
|
||||
supplier_jo.put("cust_name", supplierName);
|
||||
supplier_jo.put("cust_simple_name", abbreviation);
|
||||
supplier_jo.put("mdm_status", gfSupplierStatus);
|
||||
supplier_jo.put("create_id", currentUserId);
|
||||
supplier_jo.put("create_name", "mdmAdmin");
|
||||
supplier_jo.put("create_time", now);
|
||||
WQLObject.getWQLObject("md_cs_transportationbase").insert(supplier_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
} else {
|
||||
supplier_jo.put("cust_name", supplierName);
|
||||
supplier_jo.put("cust_simple_name", abbreviation);
|
||||
supplier_jo.put("update_optid", currentUserId);
|
||||
supplier_jo.put("update_optname", "mdmAdmin");
|
||||
supplier_jo.put("mdm_status", gfSupplierStatus);
|
||||
supplier_jo.put("update_time", now);
|
||||
WQLObject.getWQLObject("md_cs_transportationbase").update(supplier_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
//获取抛出异常的信息
|
||||
String message = e.getMessage();
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_FAIL.getCode(),message.contains("MDM")?message:StatusEnum.ACCEPT_FAIL.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
log.error("MDM供应商数据接口数据异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
commonResponseDto.setStatus(StatusEnum.ACCEPT_SUCCESS.getCode());
|
||||
commonResponseDto.setMessage(StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
commonResponseDto.setResponseData(responseItemsData);
|
||||
return commonResponseDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: MDM物料主数据接口
|
||||
* @Author Eric.Yang
|
||||
* @Date: 2025/6/3 9:12
|
||||
**/
|
||||
@Override
|
||||
public CommonResponseDto transMaterialInfo(JSONObject jsonData) {
|
||||
log.info("MDM物料主数据请求参数为:{}", jsonData);
|
||||
CommonResponseDto commonResponseDto = new CommonResponseDto();
|
||||
if(CollectionUtil.isEmpty(jsonData)){
|
||||
commonResponseDto.setStatus("E");
|
||||
commonResponseDto.setMessage("MDM传输数据为空!");
|
||||
return commonResponseDto;
|
||||
}
|
||||
List<ResponseItemsData> responseItemsData = Lists.newArrayList();
|
||||
JSONArray materiels = jsonData.getJSONArray("materiels");
|
||||
if(CollectionUtil.isNotEmpty(materiels)){
|
||||
for (int i = 0; i < materiels.size(); i++) {
|
||||
JSONObject json = materiels.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
//物料编码
|
||||
String mdCode = json.getString("mdCode");
|
||||
//物料名称
|
||||
String mdDescription = json.getString("mdDescription");
|
||||
try {
|
||||
//计量单位
|
||||
String meins = json.getString("meins");
|
||||
//跨工厂的物料状态 Y有效 D冻结 N无效
|
||||
String mstae = json.getString("mstae");
|
||||
//插入客户表
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(mdCode) || StrUtil.isEmpty(mdDescription)) {
|
||||
throw new BadRequestException("MDM->物料编码或名称不能为空!");
|
||||
}
|
||||
JSONObject material_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + mdCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(material_jo)) {
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + meins + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("MDM->未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
material_jo = new JSONObject();
|
||||
material_jo.put("material_id", mdId);
|
||||
material_jo.put("material_code", mdCode);
|
||||
material_jo.put("material_name", mdDescription);
|
||||
material_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
material_jo.put("mdm_status", mstae);
|
||||
material_jo.put("create_id", currentUserId);
|
||||
material_jo.put("create_name", "mdmAdmin");
|
||||
material_jo.put("create_time", now);
|
||||
WQLObject.getWQLObject("md_me_materialbase").insert(material_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
} else {
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '" + meins + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("MDM->未查询到相关计量单位,请进行维护!");
|
||||
}
|
||||
material_jo.put("material_name", mdDescription);
|
||||
material_jo.put("base_unit_id", unit.getString("measure_unit_id"));
|
||||
material_jo.put("mdm_status", mstae);
|
||||
material_jo.put("update_optid", currentUserId);
|
||||
material_jo.put("update_optname", "mdmAdmin");
|
||||
material_jo.put("update_time", now);
|
||||
WQLObject.getWQLObject("md_me_materialbase").update(material_jo);
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_SUCCESS.getCode(), StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
//获取抛出异常的信息
|
||||
String message = e.getMessage();
|
||||
ResponseItemsData itemsData = ResponseItemsData.adapter(mdId, mdCode, mdDescription, StatusEnum.ACCEPT_FAIL.getCode(),message.contains("MDM")?message:StatusEnum.ACCEPT_FAIL.getMessage());
|
||||
responseItemsData.add(itemsData);
|
||||
log.error("MDM物料主数据接口数据异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
commonResponseDto.setStatus(StatusEnum.ACCEPT_SUCCESS.getCode());
|
||||
commonResponseDto.setMessage(StatusEnum.ACCEPT_SUCCESS.getMessage());
|
||||
commonResponseDto.setResponseData(responseItemsData);
|
||||
return commonResponseDto;
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,9 @@ spring:
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://localhost:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://10.1.3.88:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: NLABC&hl123
|
||||
slave:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -84,9 +84,9 @@ spring:
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://127.0.0.1:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql:///10.1.3.85:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: 123456
|
||||
password: NLABC&hl123
|
||||
rules:
|
||||
readwrite-splitting:
|
||||
data-sources:
|
||||
|
||||
@@ -1,206 +0,0 @@
|
||||
server:
|
||||
port: 8013
|
||||
#配置数据源
|
||||
spring:
|
||||
shardingsphere:
|
||||
datasource:
|
||||
names: master,slave
|
||||
master:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 初始连接数
|
||||
initial-size: 20
|
||||
# 最小连接数
|
||||
min-idle: 30
|
||||
# 最大连接数
|
||||
max-active: 300
|
||||
# 是否自动回收超时连接
|
||||
socket-timeout: 10
|
||||
query-time-out: 7
|
||||
transaction-query-timeout: 30
|
||||
# 获取连接超时时间
|
||||
max-wait: 4000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://10.1.3.87:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: root
|
||||
password: NLABC&hl123
|
||||
slave:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 初始连接数
|
||||
initial-size: 20
|
||||
# 最小连接数
|
||||
min-idle: 30
|
||||
# 最大连接数
|
||||
max-active: 300
|
||||
|
||||
socket-timeout: 10
|
||||
query-time-out: 7
|
||||
transaction-query-timeout: 30
|
||||
# 获取连接超时时间
|
||||
max-wait: 4000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://10.1.3.89:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: root
|
||||
password: NLABC&hl123
|
||||
rules:
|
||||
readwrite-splitting:
|
||||
data-sources:
|
||||
db:
|
||||
type: Static
|
||||
props:
|
||||
#接口有事务,读写分离不生效,默认全部使用主库
|
||||
write-data-source-name: master
|
||||
read-data-source-names: slave
|
||||
#负载均衡算法名称
|
||||
load-balancer-name: round-robin
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:11}
|
||||
host: ${REDIS_HOST:10.1.3.91}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
redisson:
|
||||
config: |
|
||||
threads: 4
|
||||
nettyThreads: 4
|
||||
singleServerConfig:
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
database: 11
|
||||
address: redis://10.1.3.91:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
cache-enable: true
|
||||
# 是否限制单用户登录
|
||||
single-login: false
|
||||
# 验证码
|
||||
login-code:
|
||||
# 验证码类型配置 查看 LoginProperties 类
|
||||
code-type: arithmetic
|
||||
# 登录图形验证码有效时间/分钟
|
||||
expiration: 2
|
||||
# 验证码高度
|
||||
width: 111
|
||||
# 验证码宽度
|
||||
heigth: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
|
||||
#jwt
|
||||
jwt:
|
||||
header: Authorization
|
||||
# 令牌前缀
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
path: ~/file/
|
||||
avatar: ~/avatar/
|
||||
linux:
|
||||
path: /home/eladmin/file/
|
||||
avatar: /home/eladmin/avatar/
|
||||
windows:
|
||||
path: C:\eladmin\file\
|
||||
avatar: C:\eladmin\avatar\
|
||||
# 文件大小 /M
|
||||
maxSize: 100
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: d:\log\wms
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
# token 名称 (同时也是cookie名称)
|
||||
token-name: Authorization
|
||||
# token 有效期,单位s 默认30天, -1代表永不过期
|
||||
timeout: 2592000
|
||||
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||
activity-timeout: -1
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: false
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
is-share: false
|
||||
# token风格
|
||||
token-style: random-128
|
||||
# 是否输出操作日志
|
||||
is-log: false
|
||||
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
|
||||
# token 前缀
|
||||
token-prefix: Bearer
|
||||
cookie:
|
||||
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
|
||||
domain:
|
||||
@@ -1,152 +0,0 @@
|
||||
server:
|
||||
port: 8010
|
||||
#ERP系统相关
|
||||
erp:
|
||||
oracle:
|
||||
enabled: false
|
||||
jdbcurl: jdbc:oracle:thin:@192.168.81.251:1522:ORCL2
|
||||
username: system
|
||||
password: 123456
|
||||
sqlserver:
|
||||
enabled: false
|
||||
jdbcurl: jdbc:sqlserver://47.97.157.227:1433;DatabaseName=testdb-lx
|
||||
username: sa
|
||||
password: Nl@123
|
||||
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:whxr}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:whxr_mes1}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:root}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
min-idle: 15
|
||||
# 最大连接数
|
||||
max-active: 30
|
||||
# 是否自动回收超时连接
|
||||
remove-abandoned: true
|
||||
# 超时时间(以秒数为单位)
|
||||
remove-abandoned-timeout: 180
|
||||
# 获取连接超时时间
|
||||
max-wait: 3000
|
||||
# 连接有效性检测时间
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 连接在池中最小生存的时间
|
||||
min-evictable-idle-time-millis: 300000
|
||||
# 连接在池中最大生存的时间
|
||||
max-evictable-idle-time-millis: 900000
|
||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||
test-while-idle: true
|
||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||
test-on-borrow: true
|
||||
# 是否在归还到池中前进行检验
|
||||
test-on-return: false
|
||||
# 检测连接是否有效
|
||||
validation-query: select 1
|
||||
# 配置监控统计
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
url-pattern: /druid/*
|
||||
reset-enable: false
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 记录慢SQL
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:1}
|
||||
host: ${REDIS_HOST:47.111.78.178}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 10000
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
cache-enable: false
|
||||
# 是否限制单用户登录
|
||||
single-login: false
|
||||
# 验证码
|
||||
login-code:
|
||||
# 验证码类型配置 查看 LoginProperties 类
|
||||
code-type: arithmetic
|
||||
# 登录图形验证码有效时间/分钟
|
||||
expiration: 2
|
||||
# 验证码高度
|
||||
width: 111
|
||||
# 验证码宽度
|
||||
heigth: 36
|
||||
# 内容长度
|
||||
length: 2
|
||||
# 字体名称,为空则使用默认字体
|
||||
font-name:
|
||||
# 字体大小
|
||||
font-size: 25
|
||||
|
||||
#jwt
|
||||
jwt:
|
||||
header: Authorization
|
||||
# 令牌前缀
|
||||
token-start-with: Bearer
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
code-key: code-key-
|
||||
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||
detect: 1800000
|
||||
# 续期时间范围,默认1小时,单位毫秒
|
||||
renew: 3600000
|
||||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: true
|
||||
|
||||
#是否开启 swagger-ui
|
||||
swagger:
|
||||
enabled: true
|
||||
|
||||
# IP 本地解析
|
||||
ip:
|
||||
local-parsing: true
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
mac:
|
||||
path: ~/file/
|
||||
avatar: ~/avatar/
|
||||
linux:
|
||||
path: /home/eladmin/file/
|
||||
avatar: /home/eladmin/avatar/
|
||||
windows:
|
||||
path: C:\eladmin\file\
|
||||
avatar: C:\eladmin\avatar\
|
||||
# 文件大小 /M
|
||||
maxSize: 100
|
||||
avatarMaxSize: 5
|
||||
logging:
|
||||
file:
|
||||
path: C:\log\wms
|
||||
config: classpath:logback-spring.xml
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lms\lucene\index
|
||||
@@ -25,7 +25,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<include resource="log/SapToLms.xml"/>
|
||||
<include resource="log/AcsToLMS.xml"/>
|
||||
<include resource="log/LmsToAcs.xml"/>
|
||||
|
||||
<include resource="log/MdmToLms.xml"/>
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 控制台高亮-->
|
||||
<withJansi>true</withJansi>
|
||||
|
||||
Reference in New Issue
Block a user