erp分页查询优化
This commit is contained in:
@@ -6,10 +6,12 @@ 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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - ERP")
|
||||
@@ -21,4 +23,8 @@ public interface ErpExternalApi {
|
||||
@Operation(summary = "erp数据提交")
|
||||
HashMap<String, String> submitDataToErp(@Valid @RequestBody ErpSubmitReqDTO reqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/query")
|
||||
@Operation(summary = "erp数据查询")
|
||||
HashMap<String, Object> queryDataToErp(@Valid @RequestBody String funcnr, Map<String, Object> req);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zt.plat.module.erp.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "RPC 服务 - 查询 ERP DTO")
|
||||
@Data
|
||||
public class ErpQueryReqDTO {
|
||||
/**
|
||||
* 调用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 funcnr;
|
||||
private String bskey;
|
||||
private String usrid;
|
||||
private String usrnm;
|
||||
private String sign;
|
||||
private Map<String, Object> req;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ERP Api 实现类
|
||||
@@ -25,4 +26,9 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
||||
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
|
||||
return erpConfig.pushDataToErp(reqDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> queryDataToErp(String funcnr, Map<String, Object> req) {
|
||||
return erpConfig.fetchDataFromERP(funcnr, req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ public class ErpFactoryPageReqVO extends PageParam {
|
||||
private String number;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private String companyNumber;
|
||||
private String erpCompanyNumber;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyName;
|
||||
private String erpCompanyName;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@@ -23,7 +23,10 @@ public class ErpFactoryRespVO {
|
||||
private String number;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private String companyNumber;
|
||||
private String erpCompanyNumber;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private String erpCompanyName;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@@ -20,10 +20,7 @@ public class ErpFactorySaveReqVO {
|
||||
private String number;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private String companyNumber;
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
private String companyName;
|
||||
private String erpCompanyNumber;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -18,6 +19,9 @@ public class ErpWarehouseRespVO {
|
||||
@ExcelProperty("工厂编码;将查询参数存入")
|
||||
private String factoryNumber;
|
||||
|
||||
@Schema(description = "工厂名称")
|
||||
private String factoryName;
|
||||
|
||||
@Schema(description = "库位描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("库位描述")
|
||||
private String name;
|
||||
|
||||
@@ -41,13 +41,13 @@ public class ErpFactoryDO extends BusinessBaseDO {
|
||||
* 公司编号
|
||||
*/
|
||||
@TableField("CPN_ID")
|
||||
private String companyNumber;
|
||||
private String erpCompanyNumber;
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String companyName;
|
||||
private String erpCompanyName;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
@@ -220,7 +220,7 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
|
||||
ErpFactoryDO DO = new ErpFactoryDO();
|
||||
DO.setName(dataJson.getString("NAME1"));
|
||||
DO.setNumber(number);
|
||||
DO.setCompanyNumber(dataJson.getString("BUKRS"));
|
||||
DO.setErpCompanyNumber(dataJson.getString("BUKRS"));
|
||||
DO.setType("ERP");
|
||||
if (numbers.get(number)!=null) {
|
||||
// 更新
|
||||
|
||||
@@ -5,10 +5,8 @@ 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 jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -16,7 +14,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.*;
|
||||
@@ -25,7 +22,6 @@ import static dm.jdbc.util.DriverUtil.log;
|
||||
@Configuration
|
||||
public class ErpConfig {
|
||||
|
||||
|
||||
@Value("${erp.address}")
|
||||
private String erpAddress;
|
||||
|
||||
|
||||
@@ -10,23 +10,31 @@
|
||||
-->
|
||||
|
||||
<select id="getPageByReq" resultType="com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO">
|
||||
select f.*, c.NAME as companyName
|
||||
from sply_erp_fact f left join sply_erp_company c on f.CPN_ID = c.NUM;
|
||||
select f.id,
|
||||
f.name as name,
|
||||
f.NUM as number,
|
||||
f.CPN_ID as erpCompanyNumber,
|
||||
f.TP as type,
|
||||
f.REL_NAME as relName,
|
||||
f.REL_NUM as relnumber,
|
||||
f.IS_ENB as isEnable,
|
||||
c.NAME as erpCompanyName
|
||||
from sply_erp_fact f left join sply_erp_cpn c on f.CPN_ID = c.NUM
|
||||
where f.DELETED = 0
|
||||
<if test="reqVO.name != null">
|
||||
and f.NAME like concat('%', #{reqVO.name}, '%')
|
||||
<if test="name != null">
|
||||
and f.NAME like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="reqVO.number != null">
|
||||
and f.NUM like concat('%', #{reqVO.number}, '%')
|
||||
<if test="number != null">
|
||||
and f.NUM like concat('%', #{number}, '%')
|
||||
</if>
|
||||
<if test="reqVO.companyNumber != null">
|
||||
and f.CPN_ID = like concat('%', #{reqVO.companyNumber}, '%')
|
||||
<if test="erpCompanyNumber != null">
|
||||
and f.CPN_ID = like concat('%', #{erpCompanyNumber}, '%')
|
||||
</if>
|
||||
<if test="reqVO.companyName != null">
|
||||
and c.NAME like concat('%', #{reqVO.companyName}, '%')
|
||||
<if test="erpCompanyName != null">
|
||||
and c.NAME like concat('%', #{erpCompanyName}, '%')
|
||||
</if>
|
||||
<if test="reqVO.type != null">
|
||||
and f.TP like concat('%', #{reqVO.type}, '%')
|
||||
<if test="type != null">
|
||||
and f.TP like concat('%', #{type}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -14,23 +14,31 @@
|
||||
</select>
|
||||
|
||||
<select id="getPageByReq" resultType="com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO">
|
||||
select f.*, c.NAME as f
|
||||
select f.id,
|
||||
f.name as name,
|
||||
f.NUM as number,
|
||||
f.TP as type,
|
||||
f.REL_NAME as relName,
|
||||
f.REL_NUM as relnumber,
|
||||
f.IS_ENB as isEnable,
|
||||
f.FACT_NUM as factoryNumber,
|
||||
c.NAME as factoryName
|
||||
from sply_erp_wrh f left join sply_erp_fact c on f.FACT_NUM = c.NUM;
|
||||
where f.DELETED = 0
|
||||
<if test="reqVO.name != null">
|
||||
and f.NAME like concat('%', #{reqVO.name}, '%')
|
||||
<if test="name != null">
|
||||
and f.NAME like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="reqVO.number != null">
|
||||
and f.NUM like concat('%', #{reqVO.number}, '%')
|
||||
<if test="number != null">
|
||||
and f.NUM like concat('%', #{number}, '%')
|
||||
</if>
|
||||
<if test="reqVO.factoryNumber != null">
|
||||
<if test="factoryNumber != null">
|
||||
and f.FACT_NUM = like concat('%', #{factoryNumber}, '%')
|
||||
</if>
|
||||
<if test="reqVO.factoryName != null">
|
||||
<if test="factoryName != null">
|
||||
and c.NAME like concat('%', #{factoryName}, '%')
|
||||
</if>
|
||||
<if test="reqVO.type != null">
|
||||
and f.TP like concat('%', #{reqVO.type}, '%')
|
||||
<if test="type != null">
|
||||
and f.TP like concat('%', #{type}, '%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user