Sfoglia il codice sorgente

Merge branch 'liude' of wuyongqiang/admin into forever

liude 11 mesi fa
parent
commit
900cb90c15

+ 12 - 4
pom.xml

@@ -18,7 +18,9 @@
     <properties>
         <uc-api.version>1.0.0-SNAPSHOT</uc-api.version>
         <vehicle-api.version>1.0.0-SNAPSHOT</vehicle-api.version>
+        <framework-dubbo.version>1.0.0-RELEASE</framework-dubbo.version>
         <framework-redis.version>1.0.0-RELEASE</framework-redis.version>
+        <framework-oauth.version>1.0.0-RELEASE</framework-oauth.version>
         <framework-security.version>1.0.0-RELEASE</framework-security.version>
     </properties>
 
@@ -27,25 +29,31 @@
             <groupId>com.chelvc.cloud</groupId>
             <artifactId>uc-api</artifactId>
             <version>${uc-api.version}</version>
-            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>com.chelvc.cloud</groupId>
             <artifactId>vehicle-api</artifactId>
             <version>${vehicle-api.version}</version>
-            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.chelvc.framework</groupId>
+            <artifactId>framework-dubbo</artifactId>
+            <version>${framework-dubbo.version}</version>
         </dependency>
         <dependency>
             <groupId>com.chelvc.framework</groupId>
             <artifactId>framework-redis</artifactId>
             <version>${framework-redis.version}</version>
-            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.chelvc.framework</groupId>
+            <artifactId>framework-oauth</artifactId>
+            <version>${framework-oauth.version}</version>
         </dependency>
         <dependency>
             <groupId>com.chelvc.framework</groupId>
             <artifactId>framework-security</artifactId>
             <version>${framework-security.version}</version>
-            <optional>true</optional>
         </dependency>
     </dependencies>
 </project>

+ 14 - 3
src/main/java/com/chelvc/cloud/admin/controller/CategoryController.java

@@ -7,8 +7,8 @@ import com.chelvc.cloud.vehicle.api.dto.CategoryDTO;
 import com.chelvc.cloud.vehicle.api.param.CategoryModifyParam;
 import com.chelvc.cloud.vehicle.api.param.CategoryPagingParam;
 import com.chelvc.cloud.vehicle.api.service.CategoryService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.model.Pagination;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.common.model.Pagination;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
  **/
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class CategoryController {
     @DubboReference
@@ -66,4 +66,15 @@ public class CategoryController {
     public Pagination<CategoryDTO> getCategoryPaging(@Valid CategoryPagingParam param) {
         return this.categoryService.getCategoryPaging(param);
     }
+
+
+    /**
+     * 删除分类
+     *
+     * @param id    分类主键
+     */
+    @GetMapping("/category/delete/{id}")
+    public void deleteCategory(@PathVariable("id") @Min(value = 1, message = "分类主键不能小于1") Long id) {
+        this.categoryService.deleteCategory(id);
+    }
 }

+ 5 - 7
src/main/java/com/chelvc/cloud/admin/controller/ClientController.java

@@ -7,9 +7,9 @@ import com.chelvc.cloud.uc.api.dto.ClientDTO;
 import com.chelvc.cloud.uc.api.param.ClientModifyParam;
 import com.chelvc.cloud.uc.api.param.ClientPagingParam;
 import com.chelvc.cloud.uc.api.service.ClientService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.model.Pagination;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
+import com.chelvc.framework.common.model.Pagination;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class ClientController {
     @DubboReference
@@ -65,9 +65,7 @@ public class ClientController {
      */
     @GetMapping("/client/{id}")
     public ClientDTO getClient(@PathVariable("id") @Min(value = 1, message = "客户端主键不能小于1") Long id) {
-        ClientDTO client = this.clientService.getClient(id);
-        ErrorUtils.requireResource(client, "客户端不存在");
-        return client;
+        return ResourceUtils.required(this.clientService.getClient(id), "客户端不存在");
     }
 
     /**

+ 73 - 0
src/main/java/com/chelvc/cloud/admin/controller/CouponController.java

@@ -0,0 +1,73 @@
+package com.chelvc.cloud.admin.controller;
+
+import com.chelvc.cloud.vehicle.api.dto.CouponDTO;
+import com.chelvc.cloud.vehicle.api.param.CouponModifyParam;
+import com.chelvc.cloud.vehicle.api.param.CouponPagingParam;
+import com.chelvc.cloud.vehicle.api.service.CouponService;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.common.model.Pagination;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+/**
+ * 商品优惠券接口
+ *
+ * @author liude
+ * @Date 2023/8/29
+ **/
+@Validated
+@RestController
+@ResponseWrapping
+@PreAuthorize("isBusiness('EMPLOYEE')")
+public class CouponController {
+    @DubboReference
+    private CouponService couponService;
+
+    /**
+     * 新增商品优惠券
+     *
+     * @param param 新增参数
+     * @return 商品优惠券主键
+     */
+    @PostMapping("/coupon")
+    public Long addCoupon(@RequestBody @Valid CouponModifyParam param) {
+        return this.couponService.addCoupon(param);
+    }
+
+    /**
+     * 修改商品优惠券
+     *
+     * @param id    商品优惠券主键
+     * @param param 修改参数
+     */
+    @PutMapping("/coupon/{id}")
+    public void updateCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id,
+                               @RequestBody @Valid CouponModifyParam param) {
+        this.couponService.updateCoupon(id, param);
+    }
+
+    /**
+     * 删除商品优惠券
+     *
+     * @param id    商品优惠券主键
+     */
+    @PutMapping("/coupon/delete/{id}")
+    public void deleteCoupon(@PathVariable("id") @Min(value = 1, message = "商品优惠券主键不能小于1") Long id) {
+        this.couponService.deleteCoupon(id);
+    }
+
+    /**
+     * 查询商品优惠券分页
+     *
+     * @param param 查询参数
+     * @return 商品优惠券分页信息
+     */
+    @GetMapping("/coupon/paging")
+    public Pagination<CouponDTO> getCouponPaging(@Valid CouponPagingParam param) {
+        return this.couponService.getCouponPaging(param);
+    }
+}

+ 4 - 6
src/main/java/com/chelvc/cloud/admin/controller/DepartmentController.java

@@ -8,8 +8,8 @@ import com.chelvc.cloud.uc.api.dto.DepartmentDTO;
 import com.chelvc.cloud.uc.api.param.DepartmentModifyParam;
 import com.chelvc.cloud.uc.api.param.DepartmentQueryParam;
 import com.chelvc.cloud.uc.api.service.DepartmentService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class DepartmentController {
     @DubboReference
@@ -65,9 +65,7 @@ public class DepartmentController {
      */
     @GetMapping("/department/{id}")
     public DepartmentDTO getDepartment(@PathVariable("id") @Min(value = 1, message = "部门主键不能小于1") Long id) {
-        DepartmentDTO department = this.departmentService.getDepartment(id);
-        ErrorUtils.requireResource(department, "部门不存在");
-        return department;
+        return ResourceUtils.required(this.departmentService.getDepartment(id), "部门不存在");
     }
 
     /**

+ 6 - 34
src/main/java/com/chelvc/cloud/admin/controller/EmployeeController.java

@@ -9,13 +9,10 @@ import com.chelvc.cloud.uc.api.dto.EmployeeDTO;
 import com.chelvc.cloud.uc.api.dto.EmployeeDetailDTO;
 import com.chelvc.cloud.uc.api.param.EmployeeModifyParam;
 import com.chelvc.cloud.uc.api.param.EmployeePagingParam;
-import com.chelvc.cloud.uc.api.param.PasswordResetParam;
-import com.chelvc.cloud.uc.api.param.PasswordUpdateParam;
 import com.chelvc.cloud.uc.api.service.EmployeeService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.context.SessionContextHolder;
-import com.chelvc.framework.base.model.Pagination;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
+import com.chelvc.framework.common.model.Pagination;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -34,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class EmployeeController {
     @DubboReference
@@ -63,35 +60,12 @@ public class EmployeeController {
         this.employeeService.updateEmployee(id, param);
     }
 
-    /**
-     * 需改当前员工密码
-     *
-     * @param param 修改参数
-     */
-    @PutMapping("/employee/mine/password")
-    public void updateMinePassword(@RequestBody @Valid PasswordUpdateParam param) {
-        Long id = SessionContextHolder.getSession().getId();
-        this.employeeService.updateEmployeePassword(id, param);
-    }
-
-    /**
-     * 重置员工密码
-     *
-     * @param id    员工主键
-     * @param param 修改参数
-     */
-    @PutMapping("/employee/{id}/password")
-    public void updateEmployeePassword(@PathVariable("id") @Min(value = 1, message = "员工主键不能小于1") Long id,
-                                       @RequestBody @Valid PasswordResetParam param) {
-        this.employeeService.resetEmployeePassword(id, param);
-    }
-
     /**
      * 获取当前员工个人信息
      *
      * @return 员工个人信息
      */
-    @GetMapping("/employee/personal")
+    @GetMapping("/employee/mine")
     public PersonalVO getPersonal() {
         EmployeeDetailDTO employee = this.employeeService.getMine();
         return EmployeeCopier.INSTANCE.employee2personal(employee);
@@ -105,9 +79,7 @@ public class EmployeeController {
      */
     @GetMapping("/employee/{id}")
     public EmployeeDTO getEmployee(@PathVariable("id") @Min(value = 1, message = "员工主键不能小于1") Long id) {
-        EmployeeDTO employee = this.employeeService.getEmployee(id);
-        ErrorUtils.requireResource(employee, "员工不存在");
-        return employee;
+        return ResourceUtils.required(this.employeeService.getEmployee(id), "员工不存在");
     }
 
     /**

+ 73 - 0
src/main/java/com/chelvc/cloud/admin/controller/GoodsController.java

@@ -0,0 +1,73 @@
+package com.chelvc.cloud.admin.controller;
+import com.chelvc.cloud.vehicle.api.dto.GoodsDTO;
+import com.chelvc.cloud.vehicle.api.param.GoodsModifyParam;
+import com.chelvc.cloud.vehicle.api.param.GoodsPagingParam;
+import com.chelvc.cloud.vehicle.api.service.GoodsService;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.common.model.Pagination;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+/**
+ * 商品接口
+ *
+ * @author liude
+ * @Date 2023/8/29
+ **/
+@Validated
+@RestController
+@ResponseWrapping
+@PreAuthorize("isBusiness('EMPLOYEE')")
+public class GoodsController {
+    @DubboReference
+    private GoodsService goodsService;
+
+    /**
+     * 新增商品
+     *
+     * @param param 新增参数
+     * @return 商品主键
+     */
+    @PostMapping("/goods")
+    public Long addGoods(@RequestBody @Valid GoodsModifyParam param) {
+        return this.goodsService.addGoods(param);
+    }
+
+    /**
+     * 修改商品
+     *
+     * @param id    商品主键
+     * @param param 修改参数
+     */
+    @PutMapping("/goods/{id}")
+    public void updateGoods(@PathVariable("id") @Min(value = 1, message = "商品主键不能小于1") Long id,
+                               @RequestBody @Valid GoodsModifyParam param) {
+        this.goodsService.updateGoods(id, param);
+    }
+
+    /**
+     * 删除商品
+     *
+     * @param id    商品主键
+     */
+    @PutMapping("/goods/delete/{id}")
+    public void deleteGoods(@PathVariable("id") @Min(value = 1, message = "商品主键不能小于1") Long id) {
+        this.goodsService.deleteGoods(id);
+    }
+
+    /**
+     * 查询商品分页
+     *
+     * @param param 查询参数
+     * @return 商品分页信息
+     */
+    @GetMapping("/goods/paging")
+    public Pagination<GoodsDTO> getGoodsPaging(@Valid GoodsPagingParam param) {
+        return this.goodsService.getGoodsPaging(param);
+    }
+}

+ 14 - 6
src/main/java/com/chelvc/cloud/admin/controller/MenuController.java

@@ -8,8 +8,8 @@ import com.chelvc.cloud.uc.api.dto.MenuDTO;
 import com.chelvc.cloud.uc.api.param.MenuModifyParam;
 import com.chelvc.cloud.uc.api.param.MenuQueryParam;
 import com.chelvc.cloud.uc.api.service.MenuService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class MenuController {
     @DubboReference
@@ -57,6 +57,16 @@ public class MenuController {
         this.menuService.updateMenu(id, param);
     }
 
+    /**
+     * 删除菜单
+     *
+     * @param id    菜单主键
+     */
+    @GetMapping("/menu/delete/{id}")
+    public void deleteMenu(@PathVariable("id") @Min(value = 1, message = "菜单主键不能小于1") Long id) {
+        this.menuService.deleteMenu(id);
+    }
+
     /**
      * 获取菜单信息
      *
@@ -65,9 +75,7 @@ public class MenuController {
      */
     @GetMapping("/menu/{id}")
     public MenuDTO getMenu(@PathVariable("id") @Min(value = 1, message = "菜单主键不能小于1") Long id) {
-        MenuDTO menu = this.menuService.getMenu(id);
-        ErrorUtils.requireResource(menu, "菜单不存在");
-        return menu;
+        return ResourceUtils.required(this.menuService.getMenu(id), "菜单不存在");
     }
 
     /**

+ 69 - 0
src/main/java/com/chelvc/cloud/admin/controller/MerchantController.java

@@ -0,0 +1,69 @@
+package com.chelvc.cloud.admin.controller;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
+import com.chelvc.cloud.vehicle.api.param.MerchantModifyParam;
+import com.chelvc.cloud.vehicle.api.param.MerchantPagingParam;
+import com.chelvc.cloud.vehicle.api.service.MerchantService;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.common.model.Pagination;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 商家接口
+ *
+ * @author Woody
+ * @date 2023/9/3
+ */
+@Validated
+@RestController
+@ResponseWrapping
+@PreAuthorize("isBusiness('EMPLOYEE')")
+public class MerchantController {
+    @DubboReference
+    private MerchantService merchantService;
+
+    /**
+     * 新增商家
+     *
+     * @param param 新增参数
+     * @return 商家主键
+     */
+    @PostMapping("/merchant")
+    public Long addMerchant(@RequestBody @Valid MerchantModifyParam param) {
+        return this.merchantService.addMerchant(param);
+    }
+
+    /**
+     * 修改商家
+     *
+     * @param id    商家主键
+     * @param param 修改参数
+     */
+    @PutMapping("/merchant/{id}")
+    public void updateMerchant(@PathVariable("id") @Min(value = 1, message = "商家主键不能小于1") Long id,
+                               @RequestBody @Valid MerchantModifyParam param) {
+        this.merchantService.updateMerchant(id, param);
+    }
+
+    /**
+     * 查询商家分页
+     *
+     * @param param 查询参数
+     * @return 商家分页信息
+     */
+    @GetMapping("/merchant/paging")
+    public Pagination<MerchantDTO> getMerchantPaging(@Valid MerchantPagingParam param) {
+        return this.merchantService.getMerchantPaging(param);
+    }
+}

+ 5 - 7
src/main/java/com/chelvc/cloud/admin/controller/ResourceController.java

@@ -7,9 +7,9 @@ import com.chelvc.cloud.uc.api.dto.ResourceDTO;
 import com.chelvc.cloud.uc.api.param.ResourceModifyParam;
 import com.chelvc.cloud.uc.api.param.ResourcePagingParam;
 import com.chelvc.cloud.uc.api.service.ResourceService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.model.Pagination;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
+import com.chelvc.framework.common.model.Pagination;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class ResourceController {
     @DubboReference
@@ -65,9 +65,7 @@ public class ResourceController {
      */
     @GetMapping("/resource/{id}")
     public ResourceDTO getResource(@PathVariable("id") @Min(value = 1, message = "资源主键不能小于1") Long id) {
-        ResourceDTO resource = this.resourceService.getResource(id);
-        ErrorUtils.requireResource(resource, "资源不存在");
-        return resource;
+        return ResourceUtils.required(this.resourceService.getResource(id), "资源不存在");
     }
 
     /**

+ 16 - 10
src/main/java/com/chelvc/cloud/admin/controller/RoleController.java

@@ -9,9 +9,9 @@ import com.chelvc.cloud.uc.api.param.PermissionModifyParam;
 import com.chelvc.cloud.uc.api.param.RoleModifyParam;
 import com.chelvc.cloud.uc.api.param.RolePagingParam;
 import com.chelvc.cloud.uc.api.service.RoleService;
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
-import com.chelvc.framework.base.model.Pagination;
-import com.chelvc.framework.base.util.ErrorUtils;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.base.util.ResourceUtils;
+import com.chelvc.framework.common.model.Pagination;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Validated
 @RestController
-@UnifiedResponseBody
+@ResponseWrapping
 @PreAuthorize("isBusiness('EMPLOYEE')")
 public class RoleController {
     @DubboReference
@@ -59,6 +59,16 @@ public class RoleController {
         this.roleService.updateRole(id, param);
     }
 
+    /**
+     * 删除角色
+     *
+     * @param id    角色主键
+     */
+    @PutMapping("/role/delete/{id}")
+    public void deleteRole(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
+        this.roleService.deleteRole(id);
+    }
+
     /**
      * 修改角色权限
      *
@@ -79,9 +89,7 @@ public class RoleController {
      */
     @GetMapping("/role/{id}")
     public RoleDTO getRole(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
-        RoleDTO role = this.roleService.getRole(id);
-        ErrorUtils.requireResource(role, "角色不存在");
-        return role;
+        return ResourceUtils.required(this.roleService.getRole(id), "角色不存在");
     }
 
     /**
@@ -92,9 +100,7 @@ public class RoleController {
      */
     @GetMapping("/role/{id}/detail")
     public RoleDetailDTO getRoleDetail(@PathVariable("id") @Min(value = 1, message = "角色主键不能小于1") Long id) {
-        RoleDetailDTO detail = this.roleService.getRoleDetail(id);
-        ErrorUtils.requireResource(detail, "角色不存在");
-        return detail;
+        return ResourceUtils.required(this.roleService.getRoleDetail(id), "角色不存在");
     }
 
     /**

+ 73 - 0
src/main/java/com/chelvc/cloud/admin/controller/UserController.java

@@ -0,0 +1,73 @@
+package com.chelvc.cloud.admin.controller;
+import com.chelvc.cloud.vehicle.api.dto.GoodsDTO;
+import com.chelvc.cloud.vehicle.api.param.GoodsModifyParam;
+import com.chelvc.cloud.vehicle.api.param.GoodsPagingParam;
+import com.chelvc.cloud.vehicle.api.service.GoodsService;
+import com.chelvc.framework.base.annotation.ResponseWrapping;
+import com.chelvc.framework.common.model.Pagination;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
+
+/**
+ * 用户模块
+ *
+ * @author liude
+ * @Date 2023/10/19
+ **/
+@Validated
+@RestController
+@ResponseWrapping
+@PreAuthorize("isBusiness('EMPLOYEE')")
+public class UserController {
+    @DubboReference
+    private GoodsService goodsService;
+
+    /**
+     * 新增商品
+     *
+     * @param param 新增参数
+     * @return 商品主键
+     */
+    @PostMapping("/goods")
+    public Long addGoods(@RequestBody @Valid GoodsModifyParam param) {
+        return this.goodsService.addGoods(param);
+    }
+
+    /**
+     * 修改商品
+     *
+     * @param id    商品主键
+     * @param param 修改参数
+     */
+    @PutMapping("/goods/{id}")
+    public void updateGoods(@PathVariable("id") @Min(value = 1, message = "商品主键不能小于1") Long id,
+                               @RequestBody @Valid GoodsModifyParam param) {
+        this.goodsService.updateGoods(id, param);
+    }
+
+    /**
+     * 删除商品
+     *
+     * @param id    商品主键
+     */
+    @PutMapping("/goods/delete/{id}")
+    public void deleteGoods(@PathVariable("id") @Min(value = 1, message = "商品主键不能小于1") Long id) {
+        this.goodsService.deleteGoods(id);
+    }
+
+    /**
+     * 查询商品分页
+     *
+     * @param param 查询参数
+     * @return 商品分页信息
+     */
+    @GetMapping("/goods/paging")
+    public Pagination<GoodsDTO> getGoodsPaging(@Valid GoodsPagingParam param) {
+        return this.goodsService.getGoodsPaging(param);
+    }
+}

+ 1 - 1
src/main/java/com/chelvc/cloud/admin/vo/PersonalVO.java

@@ -3,7 +3,7 @@ package com.chelvc.cloud.admin.vo;
 import java.io.Serializable;
 import java.util.List;
 
-import com.chelvc.framework.base.model.Tree;
+import com.chelvc.framework.common.model.Tree;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;

+ 2 - 1
src/main/resources/application-dev.yml

@@ -17,6 +17,7 @@ nacos:
     server-addr: 47.108.128.78:6848
 
 platform:
-  security:
+  oauth:
     token:
       secret: oauth.token.secret@chelvc!@#2023
+      recheck: true

+ 2 - 1
src/main/resources/application-pre.yml

@@ -17,6 +17,7 @@ nacos:
     server-addr: 127.0.0.1:6848
 
 platform:
-  security:
+  oauth:
     token:
       secret: oauth.token.secret@chelvc!@#2023
+      recheck: true

+ 2 - 1
src/main/resources/application-prod.yml

@@ -17,6 +17,7 @@ nacos:
     server-addr: 127.0.0.1:6848
 
 platform:
-  security:
+  oauth:
     token:
       secret: oauth.token.secret@chelvc!@#2023
+      recheck: true

+ 2 - 1
src/main/resources/application-test.yml

@@ -17,6 +17,7 @@ nacos:
     server-addr: 127.0.0.1:6848
 
 platform:
-  security:
+  oauth:
     token:
       secret: oauth.token.secret@chelvc!@#2023
+      recheck: true

+ 8 - 2
src/main/resources/logback-spring.xml

@@ -4,6 +4,8 @@
 
 	<springProperty name="LOG_PATH" source="logging.path" defaultValue="./"/>
 
+	<turboFilter class="com.chelvc.framework.base.interceptor.DynamicLoggingInterceptor"/>
+
 	<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
 		<encoder>
 			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger: %msg%n</pattern>
@@ -24,10 +26,14 @@
 		</rollingPolicy>
 	</appender>
 
-	<logger name="RocketmqClient" level="error"/>
+	<appender name="ASYNC_FILE_APPENDER" class="ch.qos.logback.classic.AsyncAppender">
+		<queueSize>256</queueSize>
+		<discardingThreshold>0</discardingThreshold>
+		<appender-ref ref="FILE_APPENDER"/>
+	</appender>
 
 	<root level="info">
 		<appender-ref ref="CONSOLE_APPENDER"/>
-		<appender-ref ref="FILE_APPENDER"/>
+		<appender-ref ref="ASYNC_FILE_APPENDER"/>
 	</root>
 </configuration>