From 4d41ad6d6cecc008b6ecfc235686968cfc32848c Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 11 八月 2025 17:05:18 +0800 Subject: [PATCH] 物料接口功能优化 --- rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseSyncParams.java | 12 ++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/MatnrService.java | 4 + rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java | 3 - rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java | 26 ++++++-- rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/excel/MatnrsTemplate.java | 14 +--- rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseMatParms.java | 52 +++++++++++++++++ rsf-server/src/main/java/com/vincent/rsf/server/api/controller/ReceiveMsgController.java | 12 ++++ 7 files changed, 105 insertions(+), 18 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/ReceiveMsgController.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/ReceiveMsgController.java index d372ae8..e38d229 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/ReceiveMsgController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/ReceiveMsgController.java @@ -1,10 +1,13 @@ package com.vincent.rsf.server.api.controller; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.server.api.controller.params.BaseMatParms; import com.vincent.rsf.server.api.controller.params.OrderParams; import com.vincent.rsf.server.api.service.ReceiveMsgService; import com.vincent.rsf.server.common.utils.ExcelUtil; import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate; +import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate; +import com.vincent.rsf.server.manager.service.MatnrService; import com.vincent.rsf.server.system.controller.BaseController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -33,6 +36,8 @@ @Autowired private ReceiveMsgService receiveMsgService; + @Autowired + private MatnrService matnrService; /** * @author Ryan @@ -72,4 +77,11 @@ // return R.ok(); } + @ApiOperation("鍩虹鐗╂枡淇℃伅鍚屾") + @PostMapping("/sync/base/matnrs") + public R syncMatnrs(@RequestBody List<BaseMatParms> matnrs) { + + return R.ok(); + } + } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseMatParms.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseMatParms.java new file mode 100644 index 0000000..d1acc08 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseMatParms.java @@ -0,0 +1,52 @@ +package com.vincent.rsf.server.api.controller.params; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.experimental.Accessors; +import lombok.Data; + +@Data +@Accessors(chain = true) +public class BaseMatParms { + + @ApiModelProperty("鐗╂枡鍚嶇О") + private String maktx; + + @ApiModelProperty("鐗╂枡缂栫爜*") + private String matnr; + + @ApiModelProperty("鐗╂枡鍒嗙粍") + private Long groupName; + + @ApiModelProperty("鍨嬪彿") + private String model; + + @ApiModelProperty("閲嶉噺") + private String weight; + + @ApiModelProperty("棰滆壊") + private String color; + + @ApiModelProperty("灏哄") + private String size; + + @ApiModelProperty("鎻忚堪") + private String describle; + + @ApiModelProperty("鏍囧寘鏁伴噺") + private String nromNum; + + @ApiModelProperty("鍗曚綅") + private String unit; + + @ApiModelProperty("ABC绫�") + private String stockLevel; + + @ApiModelProperty("鏈夋晥鏈�") + private String valid; + + @ApiModelProperty("鏉″舰鐮�") + private String barcode; + + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseSyncParams.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseSyncParams.java new file mode 100644 index 0000000..8c9019c --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/controller/params/BaseSyncParams.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.api.controller.params; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +@ApiModel(value = "BaseSyncParams", description = "鍚屾鍩虹鍙傛暟") +public class BaseSyncParams { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/excel/MatnrsTemplate.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/excel/MatnrsTemplate.java index cf0f72e..d488f6e 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/excel/MatnrsTemplate.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/excel/MatnrsTemplate.java @@ -1,17 +1,15 @@ package com.vincent.rsf.server.manager.entity.excel; -import cn.afterturn.easypoi.excel.annotation.Excel; import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelAutoColumnSize; import com.vincent.rsf.server.manager.entity.excel.annotation.ExcelComment; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import lombok.experimental.Accessors; - +import cn.afterturn.easypoi.excel.annotation.Excel; import javax.validation.constraints.NotNull; -import java.io.Serializable; +import lombok.experimental.Accessors; +import lombok.Data; + /** + * * @author Ryan * @version 1.0 * @title MatnrsTemplate @@ -37,7 +35,6 @@ @Excel(name = "璐т富鏍囪瘑") @ExcelComment(example = "123") private Long shipperId; - @NotNull @@ -144,6 +141,5 @@ @Excel(name = "鏄惁鍏嶆") @ExcelComment(notNull = false, example = "0") private String flagCheck; - } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/MatnrService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/MatnrService.java index 09f3c06..b326886 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/MatnrService.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/MatnrService.java @@ -6,8 +6,10 @@ import com.vincent.rsf.server.common.domain.PageParam; import com.vincent.rsf.server.manager.controller.params.MatnrToGroupParams; import com.vincent.rsf.server.manager.entity.Matnr; +import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate; import org.springframework.web.multipart.MultipartFile; +import java.util.List; import java.util.Map; public interface MatnrService extends IService<Matnr> { @@ -25,4 +27,6 @@ boolean batchUpdate(MatnrToGroupParams params); PageParam<Matnr, BaseParam> getPages(Map<String, Object> map); + + List<Matnr> getMatnrTempletes(List<MatnrsTemplate> list); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java index fa494fc..fe62567 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java @@ -56,8 +56,26 @@ if (result.getList().isEmpty()) { throw new CoolException("鐗╂枡瀵煎叆澶辫触锛侊紒"); } - List<Matnr> matnrs = new ArrayList<>(); + List<MatnrsTemplate> list = result.getList(); + /** + * 鑾峰彇瀵煎叆鐗╂枡妯℃澘 + */ + List<Matnr> matnrs = getMatnrTempletes(list); + + if (!this.saveBatch(matnrs)) { + throw new CoolException("瀵煎叆澶辫触锛侊紒"); + } + return R.ok("瀵煎叆鎴愬姛锛侊紒"); + } + + /** + * 鑾峰彇鐗╂枡妯℃澘淇℃伅 + * @param list + * @return + */ + public List<Matnr> getMatnrTempletes(List<MatnrsTemplate> list) { + List<Matnr> matnrs = new ArrayList<>(); list.forEach(template -> { Matnr matnr = new Matnr(); matnr.setBarcode(template.getBarcode()) @@ -103,11 +121,7 @@ } matnrs.add(matnr); }); - - if (!this.saveBatch(matnrs)) { - throw new CoolException("瀵煎叆澶辫触锛侊紒"); - } - return R.ok("瀵煎叆鎴愬姛锛侊紒"); + return matnrs; } @Override diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java index 972a3f9..032fd35 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/BaseController.java @@ -16,9 +16,6 @@ */ public class BaseController { - - - public User getLoginUser() { try { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); -- Gitblit v1.9.1