|
@@ -5,6 +5,7 @@ import com.caimei.model.ResponseJson;
|
|
|
import com.caimei.model.dto.ProductSaveDto;
|
|
|
import com.caimei.model.vo.ProductFormVo;
|
|
|
import com.caimei.model.vo.ProductListVo;
|
|
|
+import com.caimei.model.vo.ProductTypeListVo;
|
|
|
import com.caimei.service.auth.AuthProductService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -13,9 +14,11 @@ import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -136,4 +139,108 @@ public class AuthProductApi {
|
|
|
Integer auditBy = paramsMap.getInteger("auditBy");
|
|
|
return authProductService.auditProduct(productId, auditStatus, invalidReason, auditBy);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("添加/编辑设备分类")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = false, name = "productTypeId", value = "设备分类id"),
|
|
|
+ @ApiImplicitParam(required = false, name = "authUserId", value = "供应商用户id"),
|
|
|
+ @ApiImplicitParam(required = false, name = "name", value = "设备分类名称"),
|
|
|
+ @ApiImplicitParam(required = false, name = "image", value = "图片"),
|
|
|
+ @ApiImplicitParam(required = false, name = "createBy", value = "创建人用户id")
|
|
|
+ })
|
|
|
+ @PostMapping("/type/save")
|
|
|
+ public ResponseJson saveProductType(Integer productTypeId, Integer authUserId, String name, String image, Integer createBy) {
|
|
|
+ if (null == authUserId) {
|
|
|
+ return ResponseJson.error("参数异常,供应商用户id不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(name)) {
|
|
|
+ return ResponseJson.error("参数异常,设备分类名称不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(image)) {
|
|
|
+ return ResponseJson.error("参数异常,图片不能为空");
|
|
|
+ }
|
|
|
+ return authProductService.saveProductType(productTypeId, authUserId, name, image, createBy);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除设备分类")
|
|
|
+ @ApiImplicitParam(name = "productTypeId", value = "设备分类id", required = true)
|
|
|
+ @PostMapping("/type/delete")
|
|
|
+ public ResponseJson deleteProductType(Integer productTypeId) {
|
|
|
+ if (null == productTypeId) {
|
|
|
+ return ResponseJson.error("参数异常,设备分类id不能为空");
|
|
|
+ }
|
|
|
+ return authProductService.deleteProductType(productTypeId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("更新设备分类状态")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "设备分类id", value = "productTypeId", required = true),
|
|
|
+ @ApiImplicitParam(name = "上线状态:0已下线,1已上线,2待上线", value = "status", required = true)
|
|
|
+ })
|
|
|
+ @PostMapping("/type/update/status")
|
|
|
+ public ResponseJson updateProductTypeStatus(Integer productTypeId, Integer status) {
|
|
|
+ if (productTypeId == null) {
|
|
|
+ return ResponseJson.error("请输入设备分类id");
|
|
|
+ }
|
|
|
+ if (status == null) {
|
|
|
+ return ResponseJson.error("请输入要更新的状态值");
|
|
|
+ } else if (status != 0 && status != 1) {
|
|
|
+ return ResponseJson.error("状态值只能为0或1");
|
|
|
+ }
|
|
|
+ return authProductService.updateProductTypeStatus(productTypeId, status);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("设备分类列表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1设备分类列表,2设备分类审核列表"),
|
|
|
+ @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
|
|
|
+ @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
|
|
|
+ @ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
|
|
|
+ @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
|
|
|
+ })
|
|
|
+ @GetMapping("/type/list")
|
|
|
+ public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+ if (null == authUserId) {
|
|
|
+ return ResponseJson.error("参数异常,供应商用户id不能为空", null);
|
|
|
+ }
|
|
|
+ return authProductService.getProductTypeList(listType, authUserId, name, status, auditStatus, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("设备分类下拉框列表")
|
|
|
+ @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
|
|
|
+ @GetMapping("/type/select")
|
|
|
+ public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
|
|
|
+ if (null == authUserId) {
|
|
|
+ return ResponseJson.error("参数异常,供应商用户id不能为空", null);
|
|
|
+ }
|
|
|
+ return authProductService.getProductTypeSelectList(authUserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("审核设备分类")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "productTypeId", required = true, value = "供应商用户id"),
|
|
|
+ @ApiImplicitParam(name = "auditStatus", required = true, value = "审核状态:0审核未通过,1审核通过,2待审核"),
|
|
|
+ @ApiImplicitParam(name = "invalidReason", required = false, value = "审核不通过原因"),
|
|
|
+ @ApiImplicitParam(name = "auditBy", required = true, value = "审核人用户id")
|
|
|
+ })
|
|
|
+ @PostMapping("/type/audit")
|
|
|
+ public ResponseJson auditProduct(Integer productTypeId, Integer auditStatus, String invalidReason, Integer auditBy) {
|
|
|
+ if (productTypeId == null) {
|
|
|
+ return ResponseJson.error("请输入商品id");
|
|
|
+ }
|
|
|
+ if (auditStatus == null) {
|
|
|
+ return ResponseJson.error("请输入审核结果");
|
|
|
+ }
|
|
|
+ if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
|
|
|
+ return ResponseJson.error("请输入审核不通过的原因");
|
|
|
+ }
|
|
|
+ if (auditBy == null) {
|
|
|
+ return ResponseJson.error("请输入审核人用户id");
|
|
|
+ }
|
|
|
+ return authProductService.auditProductType(productTypeId, auditStatus, invalidReason, auditBy);
|
|
|
+ }
|
|
|
}
|