From 47cd81f4c914a4dbdb8d91d05fafa0e2bf150a2c Mon Sep 17 00:00:00 2001 From: liyuqi Date: Mon, 24 Feb 2025 15:56:21 +0800 Subject: [PATCH] beautify code --- .../app/AppPendingStorageController.java | 6 +- .../app/AppPmsOrderOutController.java | 3 +- .../controller/app/AppVehicleController.java | 3 +- .../framework/config/SecurityConfig.java | 2 +- .../app/domain/AppPendingStorageRequest.java | 145 ++++++++++++++++++ .../com/ruoyi/app/domain/AppPmsOrderOut.java | 11 ++ .../app/domain/DTO/OtherStockInRequest.java | 28 ++++ .../service/IAppPendingStorageService.java | 3 +- .../impl/AppPendingStorageServiceImpl.java | 26 +++- .../mapper/app/AppPmsOrderOutMapper.xml | 2 + 10 files changed, 222 insertions(+), 7 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPendingStorageRequest.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/app/domain/DTO/OtherStockInRequest.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPendingStorageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPendingStorageController.java index da184031..eb282b65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPendingStorageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPendingStorageController.java @@ -4,6 +4,8 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.app.domain.AppPendingStorage; +import com.ruoyi.app.domain.AppPendingStorageRequest; +import com.ruoyi.app.domain.DTO.OtherStockInRequest; import com.ruoyi.app.service.IAppPendingStorageService; import com.ruoyi.common.annotation.Anonymous; import org.springframework.security.access.prepost.PreAuthorize; @@ -106,7 +108,7 @@ public class AppPendingStorageController extends BaseController } @PostMapping("/addOtherList") - public AjaxResult addOtherList(@RequestBody List appPendingStorageList) { - return toAjax(appPendingStorageService.addAppListPmsOrderIn(appPendingStorageList)); + public AjaxResult addOtherList(@RequestBody OtherStockInRequest otherStockInRequest) { + return toAjax(appPendingStorageService.addAppListPmsOrderIn(otherStockInRequest)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsOrderOutController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsOrderOutController.java index 62ae26cd..4d843880 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsOrderOutController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppPmsOrderOutController.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.ruoyi.app.domain.AppPmsOrderIn; import com.ruoyi.app.domain.AppPmsOrderOut; import com.ruoyi.app.service.IAppPmsOrderOutService; +import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.web.controller.section.EnhanceDataList; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -76,9 +77,9 @@ public class AppPmsOrderOutController extends BaseController /** * 新增【请填写功能名称】 */ - @PreAuthorize("@ss.hasPermi('system:out:add')") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping + @Anonymous public AjaxResult add(@RequestBody AppPmsOrderOut appPmsOrderOut) { return toAjax(appPmsOrderOutService.insertAppPmsOrderOut(appPmsOrderOut)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppVehicleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppVehicleController.java index 6b2e37c4..5b1cfc9e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppVehicleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppVehicleController.java @@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse; import com.ruoyi.app.domain.AppTask; import com.ruoyi.app.domain.AppVehicle; import com.ruoyi.app.service.IAppVehicleService; +import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.web.controller.section.EnhanceDataList; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -66,8 +67,8 @@ public class AppVehicleController extends BaseController /** * 获取【请填写功能名称】详细信息 */ - @PreAuthorize("@ss.hasPermi('system:vehicle:query')") @GetMapping(value = "/{vehicleId}") + @Anonymous public AjaxResult getInfo(@PathVariable("vehicleId") String vehicleId) { return success(appVehicleService.selectAppVehicleByVehicleId(vehicleId)); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 9f850928..d844d163 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -114,7 +114,7 @@ public class SecurityConfig requests.antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() - .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn","/app/task/sendLocation", "/app/task/taskResult","/app/task/kk", "/system/storage/**", "/app/location/count").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn", "/app/pmsOrderOut/**", "/app/task/sendLocation", "/app/task/taskResult","/app/task/kk", "/system/storage/**", "/app/location/count", "/app/vehicle/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); }) diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPendingStorageRequest.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPendingStorageRequest.java new file mode 100644 index 00000000..78221755 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPendingStorageRequest.java @@ -0,0 +1,145 @@ +package com.ruoyi.app.domain; + +import java.math.BigDecimal; + +public class AppPendingStorageRequest { + /** 物料号 */ + private String goodsId; + + /** 物料数量 */ + private BigDecimal goodsNum; + + /** 单据号 */ + private String listId; + + /** 单据类型 */ + private Long orderType; + + /** 客户名称 */ + private String customerName; + + /** 物料描述 */ + private String goodsDesc; + + /** 重量 */ + private Double weight; + + /** 尺寸 */ + private Long size; + + /** 单位 */ + private String unit; + + /** 备用一 */ + private String spare1; + + /** 备用二 */ + private String spare2; + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } + + public BigDecimal getGoodsNum() { + return goodsNum; + } + + public void setGoodsNum(BigDecimal goodsNum) { + this.goodsNum = goodsNum; + } + + public String getListId() { + return listId; + } + + public void setListId(String listId) { + this.listId = listId; + } + + public Long getOrderType() { + return orderType; + } + + public void setOrderType(Long orderType) { + this.orderType = orderType; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getGoodsDesc() { + return goodsDesc; + } + + public void setGoodsDesc(String goodsDesc) { + this.goodsDesc = goodsDesc; + } + + public Double getWeight() { + return weight; + } + + public void setWeight(Double weight) { + this.weight = weight; + } + + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public String getSpare1() { + return spare1; + } + + public void setSpare1(String spare1) { + this.spare1 = spare1; + } + + public String getSpare2() { + return spare2; + } + + public void setSpare2(String spare2) { + this.spare2 = spare2; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + @Override + public String toString() { + return "AppPendingStorageRequest{" + + "goodsId='" + goodsId + '\'' + + ", goodsNum=" + goodsNum + + ", listId='" + listId + '\'' + + ", orderType=" + orderType + + ", customerName='" + customerName + '\'' + + ", goodsDesc='" + goodsDesc + '\'' + + ", weight=" + weight + + ", size=" + size + + ", spare1='" + spare1 + '\'' + + ", spare2='" + spare2 + '\'' + + '}'; + } + + public AppPendingStorageRequest() { + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPmsOrderOut.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPmsOrderOut.java index 8b8cb5a7..7c46206b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPmsOrderOut.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/AppPmsOrderOut.java @@ -47,6 +47,9 @@ public class AppPmsOrderOut extends BaseEntity @Excel(name = "预留2") private String spare2; + @Excel(name = "订单状态") + private String orderStatus; + public void setListId(String listId) { this.listId = listId; @@ -120,6 +123,14 @@ public class AppPmsOrderOut extends BaseEntity return spare2; } + public String getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(String orderStatus) { + this.orderStatus = orderStatus; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/domain/DTO/OtherStockInRequest.java b/ruoyi-system/src/main/java/com/ruoyi/app/domain/DTO/OtherStockInRequest.java new file mode 100644 index 00000000..fb3d3b09 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/app/domain/DTO/OtherStockInRequest.java @@ -0,0 +1,28 @@ +package com.ruoyi.app.domain.DTO; + +import com.ruoyi.app.domain.AppPendingStorageRequest; + +import java.util.List; + +public class OtherStockInRequest { + private List data; + + + private String vehicleNo; + + public String getVehicleNo() { + return vehicleNo; + } + + public void setVehicleNo(String vehicleNo) { + this.vehicleNo = vehicleNo; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppPendingStorageService.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppPendingStorageService.java index 02fb62c4..460ccf9a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppPendingStorageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppPendingStorageService.java @@ -1,6 +1,7 @@ package com.ruoyi.app.service; import com.ruoyi.app.domain.AppPendingStorage; +import com.ruoyi.app.domain.DTO.OtherStockInRequest; import java.util.List; @@ -74,5 +75,5 @@ public interface IAppPendingStorageService * @param appPendingStorageList 载具号 * @return 结果 */ - public int addAppListPmsOrderIn(List appPendingStorageList); + public int addAppListPmsOrderIn(OtherStockInRequest otherStockInRequest); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppPendingStorageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppPendingStorageServiceImpl.java index a4ded2f0..a70f6c3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppPendingStorageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppPendingStorageServiceImpl.java @@ -1,14 +1,18 @@ package com.ruoyi.app.service.impl; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import com.ruoyi.app.domain.AppPendingStorage; +import com.ruoyi.app.domain.AppPendingStorageRequest; +import com.ruoyi.app.domain.DTO.OtherStockInRequest; import com.ruoyi.app.mapper.AppPendingStorageMapper; import com.ruoyi.app.service.IAppPendingStorageService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.uuid.UUID; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -129,7 +133,27 @@ public class AppPendingStorageServiceImpl implements IAppPendingStorageService return appPendingStorageMapper.insertAppPendingStorage(appPendingStorage); } - public int addAppListPmsOrderIn(List appPendingStorageList) { + public int addAppListPmsOrderIn(OtherStockInRequest otherStockInRequest) { + List appPendingStorageList = new ArrayList(); + List appPendingStorageRequestList = otherStockInRequest.getData(); + String vehicleNo = otherStockInRequest.getVehicleNo(); + + for (AppPendingStorageRequest appPendingStorageRequest : appPendingStorageRequestList) { + AppPendingStorage appPendingStorage = new AppPendingStorage(); + BeanUtils.copyProperties(appPendingStorageRequest, appPendingStorage); + appPendingStorage.setCreateTime(DateUtils.getNowDate()); + appPendingStorage.setUpdateTime(DateUtils.getNowDate()); + appPendingStorage.setVehicleNo(vehicleNo); + appPendingStorage.setOrderId(appPendingStorageRequest.getListId()); + appPendingStorage.setRecordId(UUID.randomUUID().toString()); + appPendingStorage.setGoodsCode(appPendingStorageRequest.getGoodsId()); + appPendingStorage.setStatus(2L); + appPendingStorage.setStorageType(1L); + appPendingStorage.setCreatePerson("test"); + appPendingStorage.setCustomerId(appPendingStorageRequest.getCustomerName()); + + appPendingStorageList.add(appPendingStorage); + } return appPendingStorageMapper.insertAppPendingStorageList(appPendingStorageList); } } diff --git a/ruoyi-system/src/main/resources/mapper/app/AppPmsOrderOutMapper.xml b/ruoyi-system/src/main/resources/mapper/app/AppPmsOrderOutMapper.xml index d913bd7a..792b3ce1 100644 --- a/ruoyi-system/src/main/resources/mapper/app/AppPmsOrderOutMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/app/AppPmsOrderOutMapper.xml @@ -48,6 +48,7 @@ goods_desc, spare1, spare2, + order_status, #{listId}, @@ -58,6 +59,7 @@ #{goodsDesc}, #{spare1}, #{spare2}, + #{orderStatus},