From 3c29066d5c288f576fa14983911be207cd90a900 Mon Sep 17 00:00:00 2001 From: qianshijiang <1965297290@qq.com> Date: Wed, 31 Dec 2025 16:13:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base-server/src/main/resources/application-dev.yml | 14 ++++++++++---- .../src/main/resources/application-local.yml | 14 ++++++++++---- .../src/main/resources/application-dev.yml | 14 ++++++++++---- .../src/main/resources/application-local.yml | 14 ++++++++++---- .../src/main/resources/application-dev.yml | 14 ++++++++++---- .../src/main/resources/application-local.yml | 14 ++++++++++---- .../src/main/resources/application-dev.yml | 14 ++++++++++---- .../src/main/resources/application-local.yml | 14 ++++++++++---- 8 files changed, 80 insertions(+), 32 deletions(-) diff --git a/base-server/src/main/resources/application-dev.yml b/base-server/src/main/resources/application-dev.yml index 38ea26dc..dde03828 100644 --- a/base-server/src/main/resources/application-dev.yml +++ b/base-server/src/main/resources/application-dev.yml @@ -37,14 +37,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/base-server/src/main/resources/application-local.yml b/base-server/src/main/resources/application-local.yml index 34a2edce..0f27eee8 100644 --- a/base-server/src/main/resources/application-local.yml +++ b/base-server/src/main/resources/application-local.yml @@ -39,14 +39,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-base/zt-module-base-server/src/main/resources/application-dev.yml b/zt-module-base/zt-module-base-server/src/main/resources/application-dev.yml index 30abeecd..1ab8ee42 100644 --- a/zt-module-base/zt-module-base-server/src/main/resources/application-dev.yml +++ b/zt-module-base/zt-module-base-server/src/main/resources/application-dev.yml @@ -37,14 +37,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-base/zt-module-base-server/src/main/resources/application-local.yml b/zt-module-base/zt-module-base-server/src/main/resources/application-local.yml index 3035e5d8..60367233 100644 --- a/zt-module-base/zt-module-base-server/src/main/resources/application-local.yml +++ b/zt-module-base/zt-module-base-server/src/main/resources/application-local.yml @@ -39,14 +39,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-dev.yml b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-dev.yml index 30abeecd..1ab8ee42 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-dev.yml +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-dev.yml @@ -37,14 +37,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-local.yml b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-local.yml index b47fe43e..0a86422c 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-local.yml +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/application-local.yml @@ -39,14 +39,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-erp/zt-module-erp-server/src/main/resources/application-dev.yml b/zt-module-erp/zt-module-erp-server/src/main/resources/application-dev.yml index 30abeecd..1ab8ee42 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/resources/application-dev.yml +++ b/zt-module-erp/zt-module-erp-server/src/main/resources/application-dev.yml @@ -37,14 +37,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: diff --git a/zt-module-erp/zt-module-erp-server/src/main/resources/application-local.yml b/zt-module-erp/zt-module-erp-server/src/main/resources/application-local.yml index 3035e5d8..60367233 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/resources/application-local.yml +++ b/zt-module-erp/zt-module-erp-server/src/main/resources/application-local.yml @@ -39,14 +39,20 @@ spring: primary: master datasource: master: - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #url: jdbc:dm://172.16.46.247:1050?schema=RUOYI-VUE-PRO + #username: SYSDBA + #password: pgbsci6ddJ6Sqj@e + url: jdbc:dm://172.17.11.98:20870?schema=JYGK_TEST username: SYSDBA - password: pgbsci6ddJ6Sqj@e + password: P@ssword25 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 data: From 7a05d1bd3fb54a3fdaa06d90b178219221c29650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E8=8D=A3=E6=99=9F?= <9691125+pan-rongsheng@user.noreply.gitee.com> Date: Sun, 4 Jan 2026 17:44:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/api/InternalSupplyFactoryApi.java | 21 +++ .../InternalSupplyFactoryDTO.java | 41 ++++++ .../tmpltp/enums/ErrorCodeConstants.java | 3 + .../InternalSupplyFactoryImpl.java | 34 +++++ .../InternalSupplyFactoryController.java | 120 ++++++++++++++++ .../vo/InternalSupplyFactoryPageReqVO.java | 41 ++++++ .../vo/InternalSupplyFactoryRespVO.java | 56 ++++++++ .../vo/InternalSupplyFactorySaveReqVO.java | 42 ++++++ .../InternalSupplyFactoryMapper.java | 34 +++++ .../base/dal/dataobject/base/ElementDO.java | 4 +- .../InternalSupplyFactoryDO.java | 82 +++++++++++ .../base/dal/mysql/base/ElementMapper.java | 2 +- .../InternalSupplyFactoryService.java | 75 ++++++++++ .../InternalSupplyFactoryServiceImpl.java | 131 ++++++++++++++++++ .../InternalSupplyFactoryMapper.xml | 12 ++ .../rpc/config/RpcConfiguration.java | 3 +- .../service/erp/ErpFactoryServiceImpl.java | 19 ++- 17 files changed, 705 insertions(+), 15 deletions(-) create mode 100644 zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/InternalSupplyFactoryApi.java create mode 100644 zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/dto/internalsupplyfactory/InternalSupplyFactoryDTO.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/api/internalsupplyfactory/InternalSupplyFactoryImpl.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/InternalSupplyFactoryController.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryPageReqVO.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryRespVO.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactorySaveReqVO.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dao/internalsupplyfactory/InternalSupplyFactoryMapper.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/internalsupplyfactory/InternalSupplyFactoryDO.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryService.java create mode 100644 zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryServiceImpl.java create mode 100644 zt-module-base/zt-module-base-server/src/main/resources/mapper/internalsupplyfactory/InternalSupplyFactoryMapper.xml diff --git a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/InternalSupplyFactoryApi.java b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/InternalSupplyFactoryApi.java new file mode 100644 index 00000000..19315096 --- /dev/null +++ b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/InternalSupplyFactoryApi.java @@ -0,0 +1,21 @@ +package com.zt.plat.module.api; + +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.module.api.dto.internalsupplyfactory.InternalSupplyFactoryDTO; +import com.zt.plat.module.base.enums.ApiConstants; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +@FeignClient(name = ApiConstants.NAME) +@Tag(name = "RPC 服务 - base") +public interface InternalSupplyFactoryApi { + String PREFIX = ApiConstants.PREFIX + "/internal-supply-factory"; + //批量创建 + @PostMapping(PREFIX + "/batch-create") + CommonResult> batchCreate(@Valid @RequestBody List reqVO); +} diff --git a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/dto/internalsupplyfactory/InternalSupplyFactoryDTO.java b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/dto/internalsupplyfactory/InternalSupplyFactoryDTO.java new file mode 100644 index 00000000..13de6255 --- /dev/null +++ b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/api/dto/internalsupplyfactory/InternalSupplyFactoryDTO.java @@ -0,0 +1,41 @@ +package com.zt.plat.module.api.dto.internalsupplyfactory; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +@Schema(description = "管理后台 - 内部工厂新增/修改 Request VO") +@Data +public class InternalSupplyFactoryDTO { + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "9235") + private Long id; + + @Schema(description = "工厂名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "工厂名称不能为空") + private String name; + + @Schema(description = "工厂编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "工厂编码不能为空") + private String number; + + @Schema(description = "公司编号") + private String erpCompanyNumber; + + @Schema(description = "类型") + private String type; + + @Schema(description = "绑定工厂名") + private String relName; + + @Schema(description = "绑定工厂编码") + private String relnumber; + + @Schema(description = "是否启用") + private String isEnable; + + @Schema(description = "操作类型") + private String operationType; + + @Schema(description = "公司名称-业务") + private String erpCompanyName; +} diff --git a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/tmpltp/enums/ErrorCodeConstants.java b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/tmpltp/enums/ErrorCodeConstants.java index 979c8713..1ef60b18 100644 --- a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/tmpltp/enums/ErrorCodeConstants.java +++ b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/tmpltp/enums/ErrorCodeConstants.java @@ -34,6 +34,9 @@ public interface ErrorCodeConstants { ErrorCode TMPL_INSC_DAT_BSN_NOT_EXISTS = new ErrorCode(1_027_000_530, "业务实例字段不存在"); ErrorCode TMPL_INSC_ITM_BSN_EXISTS = new ErrorCode(1_027_000_540, "业务实例条款已存在"); ErrorCode TMPL_INSC_DAT_BSN_EXISTS = new ErrorCode(1_027_000_541, "业务实例字段已存在"); + + ErrorCode INTERNAL_SUPPLY_FACTORY_NOT_EXISTS=new ErrorCode(1_027_000_580, "自定义工厂不存在"); + ErrorCode INTERNAL_SUPPLY_FACTORY_DONT_DELETE=new ErrorCode(1_027_000_581, "自定义工厂不能删除"); //Illegal operation type } diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/api/internalsupplyfactory/InternalSupplyFactoryImpl.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/api/internalsupplyfactory/InternalSupplyFactoryImpl.java new file mode 100644 index 00000000..0bd6abe4 --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/api/internalsupplyfactory/InternalSupplyFactoryImpl.java @@ -0,0 +1,34 @@ +package com.zt.plat.module.base.api.internalsupplyfactory; + +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import com.zt.plat.module.api.InternalSupplyFactoryApi; +import com.zt.plat.module.api.dto.internalsupplyfactory.InternalSupplyFactoryDTO; +import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO; +import com.zt.plat.module.base.service.internalsupplyfactory.InternalSupplyFactoryService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@Validated +public class InternalSupplyFactoryImpl implements InternalSupplyFactoryApi { + @Resource + private InternalSupplyFactoryService internalSupplyFactoryService; + @Override + public CommonResult> batchCreate(List reqVOS) { + List factoryDOS =new ArrayList<>(); + for (InternalSupplyFactoryDTO reqVO : reqVOS) { + InternalSupplyFactoryDO factoryDO = BeanUtils.toBean(reqVO, InternalSupplyFactoryDO.class); + factoryDO.setCompanyIdCustom(reqVO.getErpCompanyNumber()); + factoryDO.setCompanyNameCustom(reqVO.getErpCompanyName()); + factoryDOS.add(factoryDO); + } + internalSupplyFactoryService.bindFactory(factoryDOS); + return null; + } +} diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/InternalSupplyFactoryController.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/InternalSupplyFactoryController.java new file mode 100644 index 00000000..a8db3a03 --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/InternalSupplyFactoryController.java @@ -0,0 +1,120 @@ +package com.zt.plat.module.base.controller.admin.internalsupplyfactory; + +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO; +import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO; +import com.zt.plat.module.base.service.internalsupplyfactory.InternalSupplyFactoryService; +import org.springframework.web.bind.annotation.*; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; +import com.zt.plat.framework.business.annotation.FileUploadController; +import com.zt.plat.framework.business.controller.AbstractFileUploadController; + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import jakarta.validation.constraints.*; +import jakarta.validation.*; +import jakarta.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.util.object.BeanUtils; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +import com.zt.plat.framework.excel.core.util.ExcelUtils; + +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*; + + + +@Tag(name = "管理后台 - 供应链内部工厂") +@RestController +@RequestMapping("/base/internal-supply-factory") +@Validated +@FileUploadController(source = "bse.internalsupplyfactory") +public class InternalSupplyFactoryController extends AbstractFileUploadController implements BusinessControllerMarker{ + + static { + FileUploadController annotation = InternalSupplyFactoryController.class.getAnnotation(FileUploadController.class); + if (annotation != null) { + setFileUploadInfo(annotation); + } + } + + @Resource + private InternalSupplyFactoryService internalSupplyFactoryService; + + @PostMapping("/create") + @Operation(summary = "创建供应链内部工厂") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:create')") + public CommonResult createInternalSupplyFactory(@Valid @RequestBody InternalSupplyFactorySaveReqVO createReqVO) { + return success(internalSupplyFactoryService.createInternalSupplyFactory(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新供应链内部工厂") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:update')") + public CommonResult updateInternalSupplyFactory(@Valid @RequestBody InternalSupplyFactorySaveReqVO updateReqVO) { + internalSupplyFactoryService.updateInternalSupplyFactory(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除供应链内部工厂") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:delete')") + public CommonResult deleteInternalSupplyFactory(@RequestParam("id") Long id) { + internalSupplyFactoryService.deleteInternalSupplyFactory(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除供应链内部工厂") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:delete')") + public CommonResult deleteInternalSupplyFactoryList(@RequestBody BatchDeleteReqVO req) { + internalSupplyFactoryService.deleteInternalSupplyFactoryListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得供应链内部工厂") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:query')") + public CommonResult getInternalSupplyFactory(@RequestParam("id") Long id) { + InternalSupplyFactoryDO internalSupplyFactory = internalSupplyFactoryService.getInternalSupplyFactory(id); + return success(BeanUtils.toBean(internalSupplyFactory, InternalSupplyFactoryRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得供应链内部工厂分页") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:query')") + public CommonResult> getInternalSupplyFactoryPage(@Valid InternalSupplyFactoryPageReqVO pageReqVO) { + PageResult pageResult = internalSupplyFactoryService.getInternalSupplyFactoryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, InternalSupplyFactoryRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出供应链内部工厂 Excel") + @PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportInternalSupplyFactoryExcel(@Valid InternalSupplyFactoryPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = internalSupplyFactoryService.getInternalSupplyFactoryPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "供应链内部工厂.xls", "数据", InternalSupplyFactoryRespVO.class, + BeanUtils.toBean(list, InternalSupplyFactoryRespVO.class)); + } + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryPageReqVO.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryPageReqVO.java new file mode 100644 index 00000000..f48d0dfc --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryPageReqVO.java @@ -0,0 +1,41 @@ +package com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.zt.plat.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 供应链内部工厂分页 Request VO") +@Data +public class InternalSupplyFactoryPageReqVO extends PageParam { + + @Schema(description = "工厂名称", example = "张三") + private String name; + + @Schema(description = "工厂编码") + private String number; + + @Schema(description = "类型;数据字典(SPLY_FACT_TP)", example = "2") + private String type; + + @Schema(description = "绑定工厂名称", example = "赵六") + private String relativityName; + + @Schema(description = "绑定工厂编码") + private String relativityNumber; + + @Schema(description = "是否启用") + private String isEnable; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "操作类型", example = "2") + private String operationType; + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryRespVO.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryRespVO.java new file mode 100644 index 00000000..29dc89ba --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactoryRespVO.java @@ -0,0 +1,56 @@ +package com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 供应链内部工厂 Response VO") +@Data +@ExcelIgnoreUnannotated +public class InternalSupplyFactoryRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25522") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "工厂名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @ExcelProperty("工厂名称") + private String name; + + @Schema(description = "工厂编码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("工厂编码") + private String number; + + @Schema(description = "类型;数据字典(SPLY_FACT_TP)", example = "2") + @ExcelProperty("类型;数据字典(SPLY_FACT_TP)") + private String type; + + @Schema(description = "绑定工厂名称", example = "赵六") + @ExcelProperty("绑定工厂名称") + private String relativityName; + + @Schema(description = "绑定工厂编码") + @ExcelProperty("绑定工厂编码") + private String relativityNumber; + + @Schema(description = "是否启用") + @ExcelProperty("是否启用") + private String isEnable; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "操作类型", example = "2") + @ExcelProperty("操作类型") + private String operationType; + + @Schema(description = "公司名称-业务") + private String companyNameCustom; + @Schema(description = "公司编号-业务") + private String companyIdCustom; + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactorySaveReqVO.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactorySaveReqVO.java new file mode 100644 index 00000000..cba5dc18 --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/controller/admin/internalsupplyfactory/vo/InternalSupplyFactorySaveReqVO.java @@ -0,0 +1,42 @@ +package com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import jakarta.validation.constraints.*; + +@Schema(description = "管理后台 - 供应链内部工厂新增/修改 Request VO") +@Data +public class InternalSupplyFactorySaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25522") + private Long id; + + @Schema(description = "工厂名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @NotEmpty(message = "工厂名称不能为空") + private String name; + + @Schema(description = "工厂编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "工厂编码不能为空") + private String number; + + @Schema(description = "类型;数据字典(SPLY_FACT_TP)", example = "2") + private String type; + + @Schema(description = "绑定工厂名称", example = "赵六") + private String relativityName; + + @Schema(description = "绑定工厂编码") + private String relativityNumber; + + @Schema(description = "是否启用") + private String isEnable; + + @Schema(description = "操作类型", example = "2") + private String operationType; + @Schema(description = "公司名称-业务") + private String companyNameCustom; + @Schema(description = "公司编号-业务") + private String companyIdCustom; + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dao/internalsupplyfactory/InternalSupplyFactoryMapper.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dao/internalsupplyfactory/InternalSupplyFactoryMapper.java new file mode 100644 index 00000000..5f257c30 --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dao/internalsupplyfactory/InternalSupplyFactoryMapper.java @@ -0,0 +1,34 @@ +package com.zt.plat.module.base.dal.dao.internalsupplyfactory; + +import java.util.*; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO; +import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO; +import org.apache.ibatis.annotations.Mapper; + + +/** + * 供应链内部工厂 Mapper + * + * @author 后台管理-1 + */ +@Mapper +public interface InternalSupplyFactoryMapper extends BaseMapperX { + + default PageResult selectPage(InternalSupplyFactoryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(InternalSupplyFactoryDO::getName, reqVO.getName()) + .eqIfPresent(InternalSupplyFactoryDO::getNumber, reqVO.getNumber()) + .eqIfPresent(InternalSupplyFactoryDO::getType, reqVO.getType()) + .likeIfPresent(InternalSupplyFactoryDO::getRelativityName, reqVO.getRelativityName()) + .eqIfPresent(InternalSupplyFactoryDO::getRelativityNumber, reqVO.getRelativityNumber()) + .eqIfPresent(InternalSupplyFactoryDO::getIsEnable, reqVO.getIsEnable()) + .betweenIfPresent(InternalSupplyFactoryDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(InternalSupplyFactoryDO::getOperationType, reqVO.getOperationType()) + .orderByDesc(InternalSupplyFactoryDO::getId)); + } + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/base/ElementDO.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/base/ElementDO.java index 8a6430a9..840ce862 100644 --- a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/base/ElementDO.java +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/base/ElementDO.java @@ -47,8 +47,8 @@ public class ElementDO extends BaseDO { /** * 小数位数 */ - @TableField("DEC") - private Long decimalValue; +// @TableField("DEC") +// private Long decimalValue; /** * 是否启用 */ diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/internalsupplyfactory/InternalSupplyFactoryDO.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/internalsupplyfactory/InternalSupplyFactoryDO.java new file mode 100644 index 00000000..92106d4a --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/dataobject/internalsupplyfactory/InternalSupplyFactoryDO.java @@ -0,0 +1,82 @@ +package com.zt.plat.module.base.dal.dataobject.internalsupplyfactory; + +import lombok.*; +import java.util.*; + import java.time.LocalDateTime; + import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +/** +* 供应链内部工厂 DO +* +* @author 后台管理-1 +*/ +@TableName("bse_intl_sply_fact") +@KeySequence("bse_intl_sply_fact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class InternalSupplyFactoryDO extends BusinessBaseDO { + + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 工厂名称 + */ + @TableField("NAME") + private String name; + /** + * 工厂编码 + */ + @TableField("NUM") + private String number; + /** + * 类型;数据字典(SPLY_FACT_TP) + */ + @TableField("TP") + private String type; + /** + * 绑定工厂名称 + */ + @TableField("REL_NAME") + private String relativityName; + /** + * 绑定工厂编码 + */ + @TableField("REL_NUM") + private String relativityNumber; + /** + * 是否启用 + */ + @TableField("IS_ENB") + private String isEnable; + /** + * 操作类型 + */ + @TableField("OPTN_TP") + private String operationType; + /** + * 业务公司名称 + * COMPANY_NAME_CST + */ + @TableField("COMPANY_NAME_CST") + private String companyNameCustom; + + /** + * 业务公司编码 + * COMPANY_NAME_CST + */ + @TableField("COMPANY_ID_CST") + private String companyIdCustom; +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/mysql/base/ElementMapper.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/mysql/base/ElementMapper.java index 39069844..b92769b0 100644 --- a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/mysql/base/ElementMapper.java +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/dal/mysql/base/ElementMapper.java @@ -22,7 +22,7 @@ public interface ElementMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(ElementDO::getAbbreviation, reqVO.getAbbreviation()) .likeIfPresent(ElementDO::getName, reqVO.getName()) - .eqIfPresent(ElementDO::getDecimalValue, reqVO.getDecimalValue()) + // .eqIfPresent(ElementDO::getDecimalValue, reqVO.getDecimalValue()) .eqIfPresent(ElementDO::getIsEnable, reqVO.getIsEnable()) .likeIfPresent(ElementDO::getCoding, reqVO.getCoding()) .eqIfPresent(ElementDO::getGradeUnit, reqVO.getGradeUnit()) diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryService.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryService.java new file mode 100644 index 00000000..c29ac001 --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryService.java @@ -0,0 +1,75 @@ +package com.zt.plat.module.base.service.internalsupplyfactory; + +import java.util.*; + +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO; +import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO; +import jakarta.validation.*; + + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.PageParam; + +/** + * 供应链内部工厂 Service 接口 + * + * @author 后台管理-1 + */ +public interface InternalSupplyFactoryService { + + /** + * 创建供应链内部工厂 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + InternalSupplyFactoryRespVO createInternalSupplyFactory(@Valid InternalSupplyFactorySaveReqVO createReqVO); + + /** + * 更新供应链内部工厂 + * + * @param updateReqVO 更新信息 + */ + void updateInternalSupplyFactory(@Valid InternalSupplyFactorySaveReqVO updateReqVO); + + /** + * 删除供应链内部工厂 + * + * @param id 编号 + */ + void deleteInternalSupplyFactory(Long id); + + /** + * 批量删除供应链内部工厂 + * + * @param ids 编号 + */ + void deleteInternalSupplyFactoryListByIds(List ids); + + /** + * 获得供应链内部工厂 + * + * @param id 编号 + * @return 供应链内部工厂 + */ + InternalSupplyFactoryDO getInternalSupplyFactory(Long id); + + /** + * 获得供应链内部工厂分页 + * + * @param pageReqVO 分页查询 + * @return 供应链内部工厂分页 + */ + PageResult getInternalSupplyFactoryPage(InternalSupplyFactoryPageReqVO pageReqVO); + + + /** + * 绑定工厂 + * + * @param bindFactoryList 请求参数 + * + */ + void bindFactory(List bindFactoryList); +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryServiceImpl.java b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryServiceImpl.java new file mode 100644 index 00000000..cb91444f --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/java/com/zt/plat/module/base/service/internalsupplyfactory/InternalSupplyFactoryServiceImpl.java @@ -0,0 +1,131 @@ +package com.zt.plat.module.base.service.internalsupplyfactory; + +import cn.hutool.core.collection.CollUtil; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO; +import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO; +import com.zt.plat.module.base.dal.dao.internalsupplyfactory.InternalSupplyFactoryMapper; +import com.zt.plat.module.base.dal.dataobject.internalsupplyfactory.InternalSupplyFactoryDO; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.util.object.BeanUtils; + + +import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; + +import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.INTERNAL_SUPPLY_FACTORY_DONT_DELETE; +import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.INTERNAL_SUPPLY_FACTORY_NOT_EXISTS; + +/** + * 供应链内部工厂 Service 实现类 + * + * @author 后台管理-1 + */ +@Service +@Validated +public class InternalSupplyFactoryServiceImpl implements InternalSupplyFactoryService { + + @Resource + private InternalSupplyFactoryMapper internalSupplyFactoryMapper; + + @Override + public InternalSupplyFactoryRespVO createInternalSupplyFactory(InternalSupplyFactorySaveReqVO createReqVO) { + // 插入 + InternalSupplyFactoryDO internalSupplyFactory = BeanUtils.toBean(createReqVO, InternalSupplyFactoryDO.class); + internalSupplyFactoryMapper.insert(internalSupplyFactory); + // 返回 + return BeanUtils.toBean(internalSupplyFactory, InternalSupplyFactoryRespVO.class); + } + + @Override + public void updateInternalSupplyFactory(InternalSupplyFactorySaveReqVO updateReqVO) { + // 校验存在 + validateInternalSupplyFactoryExists(updateReqVO.getId()); + // 更新 + InternalSupplyFactoryDO updateObj = BeanUtils.toBean(updateReqVO, InternalSupplyFactoryDO.class); + //不允许修改除了绑定工厂名称、绑定工厂编码和操作以外的信息 + InternalSupplyFactoryDO factoryDO = new InternalSupplyFactoryDO(); + factoryDO.setId(updateObj.getId()); + factoryDO.setRelativityNumber(updateObj.getRelativityNumber()); + factoryDO.setRelativityName(updateObj.getRelativityName()); + factoryDO.setOperationType(updateObj.getOperationType()); + internalSupplyFactoryMapper.updateById(updateObj); + } + + @Override + public void deleteInternalSupplyFactory(Long id) { + // 校验存在 + validateInternalSupplyFactoryExists(id); + + // 删除 + internalSupplyFactoryMapper.deleteById(id); + } + + @Override + public void deleteInternalSupplyFactoryListByIds(List ids) { + // 校验存在 + validateInternalSupplyFactoryExists(ids); + //校验能否被删除 + validateInternalSupplyFactoryCanDel(ids); + // 删除 + internalSupplyFactoryMapper.deleteByIds(ids); + } + + private void validateInternalSupplyFactoryCanDel(List ids) { + List list = internalSupplyFactoryMapper.selectByIds(ids); + List internalSupplyFactoryDOS = + list.stream().filter(item -> item.getRelativityName() == null && item.getRelativityNumber() == null).toList(); + if (CollUtil.isEmpty(internalSupplyFactoryDOS)|| internalSupplyFactoryDOS.size() != ids.size()) { + throw exception(INTERNAL_SUPPLY_FACTORY_DONT_DELETE); + } + } + + private void validateInternalSupplyFactoryExists(List ids) { + List list = internalSupplyFactoryMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(INTERNAL_SUPPLY_FACTORY_NOT_EXISTS); + } + } + + private void validateInternalSupplyFactoryExists(Long id) { + if (internalSupplyFactoryMapper.selectById(id) == null) { + throw exception(INTERNAL_SUPPLY_FACTORY_NOT_EXISTS); + } + } + + @Override + public InternalSupplyFactoryDO getInternalSupplyFactory(Long id) { + return internalSupplyFactoryMapper.selectById(id); + } + + @Override + public PageResult getInternalSupplyFactoryPage(InternalSupplyFactoryPageReqVO pageReqVO) { + return internalSupplyFactoryMapper.selectPage(pageReqVO); + } + + @Override + public void bindFactory(List bindFactoryList) { + List internalSupplyFactoryDOS = new ArrayList<>(); + for (InternalSupplyFactoryDO internalSupplyFactoryDO : bindFactoryList) { + InternalSupplyFactoryDO internalSupplyFactory = new InternalSupplyFactoryDO(); + internalSupplyFactory.setName(internalSupplyFactoryDO.getName()); + internalSupplyFactory.setNumber(internalSupplyFactoryDO.getNumber()); + internalSupplyFactory.setType(internalSupplyFactoryDO.getType()); + internalSupplyFactory.setRelativityName(internalSupplyFactoryDO.getName()); + internalSupplyFactory.setRelativityNumber(internalSupplyFactoryDO.getNumber()); + internalSupplyFactory.setIsEnable("1"); + internalSupplyFactory.setCompanyIdCustom(internalSupplyFactoryDO.getCompanyIdCustom()); + internalSupplyFactory.setCompanyNameCustom(internalSupplyFactoryDO.getCompanyName()); + internalSupplyFactoryDOS.add(internalSupplyFactory); + } + internalSupplyFactoryMapper.insertBatch(internalSupplyFactoryDOS); + } + +} \ No newline at end of file diff --git a/zt-module-base/zt-module-base-server/src/main/resources/mapper/internalsupplyfactory/InternalSupplyFactoryMapper.xml b/zt-module-base/zt-module-base-server/src/main/resources/mapper/internalsupplyfactory/InternalSupplyFactoryMapper.xml new file mode 100644 index 00000000..a5e548df --- /dev/null +++ b/zt-module-base/zt-module-base-server/src/main/resources/mapper/internalsupplyfactory/InternalSupplyFactoryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/framework/rpc/config/RpcConfiguration.java b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/framework/rpc/config/RpcConfiguration.java index c1ce4caa..4964b387 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/framework/rpc/config/RpcConfiguration.java +++ b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/framework/rpc/config/RpcConfiguration.java @@ -1,5 +1,6 @@ package com.zt.plat.module.erp.framework.rpc.config; +import com.zt.plat.module.api.InternalSupplyFactoryApi; import com.zt.plat.module.base.api.materialinfomation.MaterialInfomationApi; import com.zt.plat.module.infra.api.businessfile.BusinessFileApi; import com.zt.plat.module.infra.api.file.FileApi; @@ -11,6 +12,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; @Configuration(value = "erpRpcConfiguration", proxyBeanMethods = false) -@EnableFeignClients(clients = {DeptApi.class, SequenceApi.class, AdminUserApi.class, BusinessFileApi.class, FileApi.class, MaterialInfomationApi.class}) +@EnableFeignClients(clients = {DeptApi.class, SequenceApi.class, AdminUserApi.class, BusinessFileApi.class, FileApi.class, MaterialInfomationApi.class, InternalSupplyFactoryApi.class}) public class RpcConfiguration { } diff --git a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpFactoryServiceImpl.java b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpFactoryServiceImpl.java index ea18cc4d..c436c385 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpFactoryServiceImpl.java +++ b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpFactoryServiceImpl.java @@ -7,6 +7,8 @@ import com.xxl.job.core.handler.annotation.XxlJob; import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.zt.plat.module.api.InternalSupplyFactoryApi; +import com.zt.plat.module.api.dto.internalsupplyfactory.InternalSupplyFactoryDTO; import com.zt.plat.module.erp.utils.ErpConfig; import com.zt.plat.module.erp.utils.MyRedisConfig; import com.zt.plat.module.erp.enums.OftenEnum; @@ -47,6 +49,8 @@ public class ErpFactoryServiceImpl implements ErpFactoryService { private MyRedisConfig myRedisConfig; @Resource private ErpConfig erpConfig; + @Resource + private InternalSupplyFactoryApi internalSupplyFactoryApi; @Override public ErpFactoryRespVO createErpFactory(ErpFactorySaveReqVO createReqVO) { @@ -98,13 +102,8 @@ public class ErpFactoryServiceImpl implements ErpFactoryService { if (updateObj.getType().equals("ERP") || updateObj.getIsEnable().equals("1")) { throw exception(ERP_FACTORY_NOT_ALLOW_UPDATE); } - //不允许修改除了绑定工厂名称、绑定工厂编码和操作以外的信息 - ErpFactoryDO erpFactoryDO = new ErpFactoryDO(); - erpFactoryDO.setId(updateObj.getId()); - erpFactoryDO.setRelnumber(updateObj.getRelnumber()); - erpFactoryDO.setRelnumber(updateObj.getRelnumber()); - erpFactoryDO.setOperationType(updateObj.getOperationType()); - erpFactoryMapper.updateById(erpFactoryDO); + + erpFactoryMapper.updateById(updateObj); } @Override @@ -276,11 +275,9 @@ public class ErpFactoryServiceImpl implements ErpFactoryService { // 批量新增和更新 if (!result.toInsert.isEmpty()) { //自动绑定工厂 - result.toInsert.forEach(r->{ - r.setRelName(r.getName()); - r.setRelnumber(r.getNumber()); - }); erpFactoryMapper.insertBatch(result.toInsert); + //工厂绑定 + internalSupplyFactoryApi.batchCreate(BeanUtils.toBean(result.toInsert, InternalSupplyFactoryDTO.class)); // 批量查询刚插入数据的id,提升效率 List insertedNumbers = result.toInsert.stream() .map(ErpFactoryDO::getNumber)