feat(shop): 升级Swagger注解并优化经销商申请逻辑- 将Swagger注解从v2升级至v3版本
- 优化经销商申请时用户ID设置逻辑,避免重复赋值 - 更新控制器返回信息文案,统一为"保存成功" -修正权限注解中的权限标识引用错误 - 为实体类添加JSON时间格式化注解 - 统一使用Schema替代ApiModel和ApiModelProperty注解
This commit is contained in:
@@ -89,7 +89,9 @@ public class ShopDealerApplyController extends BaseController {
|
|||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
shopDealerApply.setApplyTime(LocalDateTime.now());
|
shopDealerApply.setApplyTime(LocalDateTime.now());
|
||||||
shopDealerApply.setUserId(loginUser.getUserId());
|
if(shopDealerApply.getUserId() == null) {
|
||||||
|
shopDealerApply.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (shopDealerApply.getRefereeId() != null) {
|
if (shopDealerApply.getRefereeId() != null) {
|
||||||
if(shopDealerUserService.getByIdRel(shopDealerApply.getRefereeId()) == null){
|
if(shopDealerUserService.getByIdRel(shopDealerApply.getRefereeId()) == null){
|
||||||
@@ -129,7 +131,7 @@ public class ShopDealerApplyController extends BaseController {
|
|||||||
shopDealerUserService.save(dealerUser);
|
shopDealerUserService.save(dealerUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success("修改成功");
|
return success("保存成功");
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import com.gxwebsoft.common.system.entity.User;
|
|||||||
import com.gxwebsoft.shop.entity.ShopDealerRecord;
|
import com.gxwebsoft.shop.entity.ShopDealerRecord;
|
||||||
import com.gxwebsoft.shop.param.ShopDealerRecordParam;
|
import com.gxwebsoft.shop.param.ShopDealerRecordParam;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerRecordService;
|
import com.gxwebsoft.shop.service.ShopDealerRecordService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -23,40 +23,37 @@ import java.util.List;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2025-10-02 12:21:50
|
* @since 2025-10-02 12:21:50
|
||||||
*/
|
*/
|
||||||
@Api(tags = "客户跟进情况管理")
|
@Tag(name = "客户跟进情况管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/shop-dealer-record")
|
@RequestMapping("/api/shop/shop-dealer-record")
|
||||||
public class ShopDealerRecordController extends BaseController {
|
public class ShopDealerRecordController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopDealerRecordService shopDealerRecordService;
|
private ShopDealerRecordService shopDealerRecordService;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:list')")
|
@Operation(summary = "分页查询客户跟进情况")
|
||||||
@ApiOperation("分页查询客户跟进情况")
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ShopDealerRecord>> page(ShopDealerRecordParam param) {
|
public ApiResult<PageResult<ShopDealerRecord>> page(ShopDealerRecordParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(shopDealerRecordService.pageRel(param));
|
return success(shopDealerRecordService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:list')")
|
@Operation(summary = "查询全部客户跟进情况")
|
||||||
@ApiOperation("查询全部客户跟进情况")
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ShopDealerRecord>> list(ShopDealerRecordParam param) {
|
public ApiResult<List<ShopDealerRecord>> list(ShopDealerRecordParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(shopDealerRecordService.listRel(param));
|
return success(shopDealerRecordService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:list')")
|
@Operation(summary = "根据id查询客户跟进情况")
|
||||||
@ApiOperation("根据id查询客户跟进情况")
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ShopDealerRecord> get(@PathVariable("id") Integer id) {
|
public ApiResult<ShopDealerRecord> get(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(shopDealerRecordService.getByIdRel(id));
|
return success(shopDealerRecordService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:save')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:save')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("添加客户跟进情况")
|
@Operation(summary = "添加客户跟进情况")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ShopDealerRecord shopDealerRecord) {
|
public ApiResult<?> save(@RequestBody ShopDealerRecord shopDealerRecord) {
|
||||||
// 记录当前登录用户id
|
// 记录当前登录用户id
|
||||||
@@ -70,9 +67,9 @@ public class ShopDealerRecordController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:update')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("修改客户跟进情况")
|
@Operation(summary = "修改客户跟进情况")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody ShopDealerRecord shopDealerRecord) {
|
public ApiResult<?> update(@RequestBody ShopDealerRecord shopDealerRecord) {
|
||||||
if (shopDealerRecordService.updateById(shopDealerRecord)) {
|
if (shopDealerRecordService.updateById(shopDealerRecord)) {
|
||||||
@@ -81,9 +78,9 @@ public class ShopDealerRecordController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:remove')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:remove')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("删除客户跟进情况")
|
@Operation(summary = "删除客户跟进情况")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
if (shopDealerRecordService.removeById(id)) {
|
if (shopDealerRecordService.removeById(id)) {
|
||||||
@@ -92,9 +89,9 @@ public class ShopDealerRecordController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:save')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:save')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("批量添加客户跟进情况")
|
@Operation(summary = "批量添加客户跟进情况")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<ShopDealerRecord> list) {
|
public ApiResult<?> saveBatch(@RequestBody List<ShopDealerRecord> list) {
|
||||||
if (shopDealerRecordService.saveBatch(list)) {
|
if (shopDealerRecordService.saveBatch(list)) {
|
||||||
@@ -103,9 +100,9 @@ public class ShopDealerRecordController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:update')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("批量修改客户跟进情况")
|
@Operation(summary = "批量修改客户跟进情况")
|
||||||
@PutMapping("/batch")
|
@PutMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopDealerRecord> batchParam) {
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopDealerRecord> batchParam) {
|
||||||
if (batchParam.update(shopDealerRecordService, "id")) {
|
if (batchParam.update(shopDealerRecordService, "id")) {
|
||||||
@@ -114,9 +111,9 @@ public class ShopDealerRecordController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerRecord:remove')")
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:remove')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("批量删除客户跟进情况")
|
@Operation(summary = "批量删除客户跟进情况")
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
if (shopDealerRecordService.removeByIds(ids)) {
|
if (shopDealerRecordService.removeByIds(ids)) {
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package com.gxwebsoft.shop.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import io.swagger.annotations.ApiModel;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -19,46 +20,48 @@ import java.time.LocalDateTime;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ApiModel(value = "ShopDealerRecord对象", description = "客户跟进情况")
|
@Schema(description = "客户跟进情况")
|
||||||
public class ShopDealerRecord implements Serializable {
|
public class ShopDealerRecord implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "ID")
|
@Schema(description = "ID")
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
@Schema(description = "上级id, 0是顶级")
|
||||||
private Integer parentId;
|
private Integer parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "客户ID")
|
@Schema(description = "客户ID")
|
||||||
private Integer dealerId;
|
private Integer dealerId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "内容")
|
@Schema(description = "内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@Schema(description = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@Schema(description = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@Schema(description = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0待处理, 1已完成")
|
@Schema(description = "状态, 0待处理, 1已完成")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
@Schema(description = "是否删除, 0否, 1是")
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户id")
|
@Schema(description = "租户id")
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
import com.gxwebsoft.common.core.web.BaseParam;
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -18,42 +17,42 @@ import lombok.EqualsAndHashCode;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModel(value = "ShopDealerRecordParam对象", description = "客户跟进情况查询参数")
|
@Schema(description = "客户跟进情况查询参数")
|
||||||
public class ShopDealerRecordParam extends BaseParam {
|
public class ShopDealerRecordParam extends BaseParam {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "ID")
|
@Schema(description = "ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
@Schema(description = "上级id, 0是顶级")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer parentId;
|
private Integer parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "客户ID")
|
@Schema(description = "客户ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer dealerId;
|
private Integer dealerId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "内容")
|
@Schema(description = "内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@Schema(description = "用户ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@Schema(description = "排序(数字越小越靠前)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@Schema(description = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0待处理, 1已完成")
|
@Schema(description = "状态, 0待处理, 1已完成")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
@Schema(description = "是否删除, 0否, 1是")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user