From 6b153719e385c8f36dbb01185d39eb9d2b77b9df Mon Sep 17 00:00:00 2001 From: "925116093-qq.com" <925116093@qq.com> Date: Mon, 7 Jul 2025 17:54:04 +0800 Subject: [PATCH] 202507071753 --- .../domain/ServiceGoods_20250515150557.java | 445 ------ .../domain/ServiceGoods_20250520173029.java | 450 ------- .../domain/ServiceGoods_20250520173036.java | 450 ------- .../domain/ServiceGoods_20250520173121.java | 453 ------- .../system/controller/ApplePayController.java | 4 +- .../system/controller/AppletController.java | 841 +++++++++--- .../controller/ServiceCateController.java | 84 +- .../controller/ServiceGoodsController.java | 46 + .../com/ruoyi/system/domain/ServiceCate.java | 29 + .../com/ruoyi/system/domain/ServiceGoods.java | 28 + .../mapper/system/ServiceCateMapper.xml | 17 +- .../mapper/system/ServiceGoodsMapper.xml | 12 +- ruoyi-ui/src/api/system/ServiceCate.js | 12 + ruoyi-ui/src/views/system/AdvImg/index.vue | 15 +- .../src/views/system/ServiceCate/index.vue | 1191 +++++++++++------ .../src/views/system/ServiceGoods/index.vue | 532 +++++++- .../src/views/system/SiteConfig/index.vue | 558 +++++--- 17 files changed, 2630 insertions(+), 2537 deletions(-) delete mode 100644 .history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250515150557.java delete mode 100644 .history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173029.java delete mode 100644 .history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173036.java delete mode 100644 .history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173121.java diff --git a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250515150557.java b/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250515150557.java deleted file mode 100644 index 993c694..0000000 --- a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250515150557.java +++ /dev/null @@ -1,445 +0,0 @@ -package com.ruoyi.system.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 服务内容对象 service_goods - * - * @author ruoyi - * @date 2025-05-13 - */ -public class ServiceGoods extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 标题 */ - @Excel(name = "标题") - private String title; - - /** 图标 */ - @Excel(name = "图标") - private String icon; - - /** 轮播图 */ - @Excel(name = "轮播图") - private String imgs; - - /** 副标题 */ - @Excel(name = "副标题") - private String subTitle; - - /** 简介 */ - @Excel(name = "简介") - private String info; - - /** 价格 */ - @Excel(name = "价格") - private BigDecimal price; - - /** 列表价格显示 */ - @Excel(name = "列表价格显示") - private String priceZn; - - /** 销量 */ - @Excel(name = "销量") - private Long sales; - - /** 库存 */ - @Excel(name = "库存") - private Long stock; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 详情 */ - @Excel(name = "详情") - private String description; - - /** 规格类型 1:单规格 2:多规格 */ - @Excel(name = "规格类型 1:单规格 2:多规格") - private Integer skuType; - - /** 规格 */ - @Excel(name = "规格") - private String sku; - - /** 经度 */ - @Excel(name = "经度") - private String latitude; - - /** 纬度 */ - @Excel(name = "纬度") - private String longitude; - - /** 1:服务 2:商品 */ - @Excel(name = "1:服务 2:商品") - private Integer type; - - /** 分类 */ - @Excel(name = "分类") - private Long cateId; - - /** 服务项目 */ - @Excel(name = "服务项目") - private String project; - - /** 排序 */ - @Excel(name = "排序") - private Integer sort; - - /** 物料费用 */ - @Excel(name = "物料费用") - private String material; - - /** 邮费 */ - @Excel(name = "邮费") - private BigDecimal postage; - - /** 基检现象 */ - @Excel(name = "基检现象") - private String basic; - - /** 保证金 */ - @Excel(name = "保证金") - private BigDecimal margin; - - /** 所需技能 */ - @Excel(name = "所需技能") - private String skillIds; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date createdAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date updatedAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date deletedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getTitle() - { - return title; - } - - public void setIcon(String icon) - { - this.icon = icon; - } - - public String getIcon() - { - return icon; - } - - public void setImgs(String imgs) - { - this.imgs = imgs; - } - - public String getImgs() - { - return imgs; - } - - public void setSubTitle(String subTitle) - { - this.subTitle = subTitle; - } - - public String getSubTitle() - { - return subTitle; - } - - public void setInfo(String info) - { - this.info = info; - } - - public String getInfo() - { - return info; - } - - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - - public void setPriceZn(String priceZn) - { - this.priceZn = priceZn; - } - - public String getPriceZn() - { - return priceZn; - } - - public void setSales(Long sales) - { - this.sales = sales; - } - - public Long getSales() - { - return sales; - } - - public void setStock(Long stock) - { - this.stock = stock; - } - - public Long getStock() - { - return stock; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - - public void setSkuType(Integer skuType) - { - this.skuType = skuType; - } - - public Integer getSkuType() - { - return skuType; - } - - public void setSku(String sku) - { - this.sku = sku; - } - - public String getSku() - { - return sku; - } - - public void setLatitude(String latitude) - { - this.latitude = latitude; - } - - public String getLatitude() - { - return latitude; - } - - public void setLongitude(String longitude) - { - this.longitude = longitude; - } - - public String getLongitude() - { - return longitude; - } - - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - public void setCateId(Long cateId) - { - this.cateId = cateId; - } - - public Long getCateId() - { - return cateId; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getProject() - { - return project; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public void setMaterial(String material) - { - this.material = material; - } - - public String getMaterial() - { - return material; - } - - public void setPostage(BigDecimal postage) - { - this.postage = postage; - } - - public BigDecimal getPostage() - { - return postage; - } - - public void setBasic(String basic) - { - this.basic = basic; - } - - public String getBasic() - { - return basic; - } - - public void setMargin(BigDecimal margin) - { - this.margin = margin; - } - - public BigDecimal getMargin() - { - return margin; - } - - public void setSkillIds(String skillIds) - { - this.skillIds = skillIds; - } - - public String getSkillIds() - { - return skillIds; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - public void setDeletedAt(Date deletedAt) - { - this.deletedAt = deletedAt; - } - - public Date getDeletedAt() - { - return deletedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("title", getTitle()) - .append("icon", getIcon()) - .append("imgs", getImgs()) - .append("subTitle", getSubTitle()) - .append("info", getInfo()) - .append("price", getPrice()) - .append("priceZn", getPriceZn()) - .append("sales", getSales()) - .append("stock", getStock()) - .append("status", getStatus()) - .append("description", getDescription()) - .append("skuType", getSkuType()) - .append("sku", getSku()) - .append("latitude", getLatitude()) - .append("longitude", getLongitude()) - .append("type", getType()) - .append("cateId", getCateId()) - .append("project", getProject()) - .append("sort", getSort()) - .append("material", getMaterial()) - .append("postage", getPostage()) - .append("basic", getBasic()) - .append("margin", getMargin()) - .append("skillIds", getSkillIds()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("deletedAt", getDeletedAt()) - .toString(); - } -} diff --git a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173029.java b/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173029.java deleted file mode 100644 index 4105d06..0000000 --- a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173029.java +++ /dev/null @@ -1,450 +0,0 @@ -package com.ruoyi.system.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 服务内容对象 service_goods - * - * @author ruoyi - * @date 2025-05-13 - */ -public class ServiceGoods extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 标题 */ - @Excel(name = "标题") - private String title; - - /** 图标 */ - @Excel(name = "图标") - private String icon; - - /** 轮播图 */ - @Excel(name = "轮播图") - private String imgs; - - /** 副标题 */ - @Excel(name = "副标题") - private String subTitle; - - /** 简介 */ - @Excel(name = "简介") - private String info; - - /** 价格 */ - @Excel(name = "价格") - private BigDecimal price; - - /** 列表价格显示 */ - @Excel(name = "列表价格显示") - private String priceZn; - - /** 销量 */ - @Excel(name = "销量") - private Long sales; - - /** 库存 */ - @Excel(name = "库存") - private Long stock; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 详情 */ - @Excel(name = "详情") - private String description; - - /** 规格类型 1:单规格 2:多规格 */ - @Excel(name = "规格类型 1:单规格 2:多规格") - private Integer skuType; - - /** 规格 */ - @Excel(name = "规格") - private String sku; - - /** 经度 */ - @Excel(name = "经度") - private String latitude; - - /** 纬度 */ - @Excel(name = "纬度") - private String longitude; - - /** 1:服务 2:商品 */ - @Excel(name = "1:服务 2:商品") - private Integer type; - - /** 分类 */ - @Excel(name = "分类") - private Long cateId; - -/** 分类 */ -@Excel(name = "分类名称") -private Long cateName; - - - /** 服务项目 */ - @Excel(name = "服务项目") - private String project; - - /** 排序 */ - @Excel(name = "排序") - private Integer sort; - - /** 物料费用 */ - @Excel(name = "物料费用") - private String material; - - /** 邮费 */ - @Excel(name = "邮费") - private BigDecimal postage; - - /** 基检现象 */ - @Excel(name = "基检现象") - private String basic; - - /** 保证金 */ - @Excel(name = "保证金") - private BigDecimal margin; - - /** 所需技能 */ - @Excel(name = "所需技能") - private String skillIds; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date createdAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date updatedAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date deletedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getTitle() - { - return title; - } - - public void setIcon(String icon) - { - this.icon = icon; - } - - public String getIcon() - { - return icon; - } - - public void setImgs(String imgs) - { - this.imgs = imgs; - } - - public String getImgs() - { - return imgs; - } - - public void setSubTitle(String subTitle) - { - this.subTitle = subTitle; - } - - public String getSubTitle() - { - return subTitle; - } - - public void setInfo(String info) - { - this.info = info; - } - - public String getInfo() - { - return info; - } - - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - - public void setPriceZn(String priceZn) - { - this.priceZn = priceZn; - } - - public String getPriceZn() - { - return priceZn; - } - - public void setSales(Long sales) - { - this.sales = sales; - } - - public Long getSales() - { - return sales; - } - - public void setStock(Long stock) - { - this.stock = stock; - } - - public Long getStock() - { - return stock; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - - public void setSkuType(Integer skuType) - { - this.skuType = skuType; - } - - public Integer getSkuType() - { - return skuType; - } - - public void setSku(String sku) - { - this.sku = sku; - } - - public String getSku() - { - return sku; - } - - public void setLatitude(String latitude) - { - this.latitude = latitude; - } - - public String getLatitude() - { - return latitude; - } - - public void setLongitude(String longitude) - { - this.longitude = longitude; - } - - public String getLongitude() - { - return longitude; - } - - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - public void setCateId(Long cateId) - { - this.cateId = cateId; - } - - public Long getCateId() - { - return cateId; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getProject() - { - return project; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public void setMaterial(String material) - { - this.material = material; - } - - public String getMaterial() - { - return material; - } - - public void setPostage(BigDecimal postage) - { - this.postage = postage; - } - - public BigDecimal getPostage() - { - return postage; - } - - public void setBasic(String basic) - { - this.basic = basic; - } - - public String getBasic() - { - return basic; - } - - public void setMargin(BigDecimal margin) - { - this.margin = margin; - } - - public BigDecimal getMargin() - { - return margin; - } - - public void setSkillIds(String skillIds) - { - this.skillIds = skillIds; - } - - public String getSkillIds() - { - return skillIds; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - public void setDeletedAt(Date deletedAt) - { - this.deletedAt = deletedAt; - } - - public Date getDeletedAt() - { - return deletedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("title", getTitle()) - .append("icon", getIcon()) - .append("imgs", getImgs()) - .append("subTitle", getSubTitle()) - .append("info", getInfo()) - .append("price", getPrice()) - .append("priceZn", getPriceZn()) - .append("sales", getSales()) - .append("stock", getStock()) - .append("status", getStatus()) - .append("description", getDescription()) - .append("skuType", getSkuType()) - .append("sku", getSku()) - .append("latitude", getLatitude()) - .append("longitude", getLongitude()) - .append("type", getType()) - .append("cateId", getCateId()) - .append("project", getProject()) - .append("sort", getSort()) - .append("material", getMaterial()) - .append("postage", getPostage()) - .append("basic", getBasic()) - .append("margin", getMargin()) - .append("skillIds", getSkillIds()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("deletedAt", getDeletedAt()) - .toString(); - } -} diff --git a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173036.java b/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173036.java deleted file mode 100644 index 2e19454..0000000 --- a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173036.java +++ /dev/null @@ -1,450 +0,0 @@ -package com.ruoyi.system.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 服务内容对象 service_goods - * - * @author ruoyi - * @date 2025-05-13 - */ -public class ServiceGoods extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 标题 */ - @Excel(name = "标题") - private String title; - - /** 图标 */ - @Excel(name = "图标") - private String icon; - - /** 轮播图 */ - @Excel(name = "轮播图") - private String imgs; - - /** 副标题 */ - @Excel(name = "副标题") - private String subTitle; - - /** 简介 */ - @Excel(name = "简介") - private String info; - - /** 价格 */ - @Excel(name = "价格") - private BigDecimal price; - - /** 列表价格显示 */ - @Excel(name = "列表价格显示") - private String priceZn; - - /** 销量 */ - @Excel(name = "销量") - private Long sales; - - /** 库存 */ - @Excel(name = "库存") - private Long stock; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 详情 */ - @Excel(name = "详情") - private String description; - - /** 规格类型 1:单规格 2:多规格 */ - @Excel(name = "规格类型 1:单规格 2:多规格") - private Integer skuType; - - /** 规格 */ - @Excel(name = "规格") - private String sku; - - /** 经度 */ - @Excel(name = "经度") - private String latitude; - - /** 纬度 */ - @Excel(name = "纬度") - private String longitude; - - /** 1:服务 2:商品 */ - @Excel(name = "1:服务 2:商品") - private Integer type; - - /** 分类 */ - @Excel(name = "分类") - private Long cateId; - -/** 分类 */ -@Excel(name = "分类名称") -private String cateName; - - - /** 服务项目 */ - @Excel(name = "服务项目") - private String project; - - /** 排序 */ - @Excel(name = "排序") - private Integer sort; - - /** 物料费用 */ - @Excel(name = "物料费用") - private String material; - - /** 邮费 */ - @Excel(name = "邮费") - private BigDecimal postage; - - /** 基检现象 */ - @Excel(name = "基检现象") - private String basic; - - /** 保证金 */ - @Excel(name = "保证金") - private BigDecimal margin; - - /** 所需技能 */ - @Excel(name = "所需技能") - private String skillIds; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date createdAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date updatedAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date deletedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getTitle() - { - return title; - } - - public void setIcon(String icon) - { - this.icon = icon; - } - - public String getIcon() - { - return icon; - } - - public void setImgs(String imgs) - { - this.imgs = imgs; - } - - public String getImgs() - { - return imgs; - } - - public void setSubTitle(String subTitle) - { - this.subTitle = subTitle; - } - - public String getSubTitle() - { - return subTitle; - } - - public void setInfo(String info) - { - this.info = info; - } - - public String getInfo() - { - return info; - } - - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - - public void setPriceZn(String priceZn) - { - this.priceZn = priceZn; - } - - public String getPriceZn() - { - return priceZn; - } - - public void setSales(Long sales) - { - this.sales = sales; - } - - public Long getSales() - { - return sales; - } - - public void setStock(Long stock) - { - this.stock = stock; - } - - public Long getStock() - { - return stock; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - - public void setSkuType(Integer skuType) - { - this.skuType = skuType; - } - - public Integer getSkuType() - { - return skuType; - } - - public void setSku(String sku) - { - this.sku = sku; - } - - public String getSku() - { - return sku; - } - - public void setLatitude(String latitude) - { - this.latitude = latitude; - } - - public String getLatitude() - { - return latitude; - } - - public void setLongitude(String longitude) - { - this.longitude = longitude; - } - - public String getLongitude() - { - return longitude; - } - - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - public void setCateId(Long cateId) - { - this.cateId = cateId; - } - - public Long getCateId() - { - return cateId; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getProject() - { - return project; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public void setMaterial(String material) - { - this.material = material; - } - - public String getMaterial() - { - return material; - } - - public void setPostage(BigDecimal postage) - { - this.postage = postage; - } - - public BigDecimal getPostage() - { - return postage; - } - - public void setBasic(String basic) - { - this.basic = basic; - } - - public String getBasic() - { - return basic; - } - - public void setMargin(BigDecimal margin) - { - this.margin = margin; - } - - public BigDecimal getMargin() - { - return margin; - } - - public void setSkillIds(String skillIds) - { - this.skillIds = skillIds; - } - - public String getSkillIds() - { - return skillIds; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - public void setDeletedAt(Date deletedAt) - { - this.deletedAt = deletedAt; - } - - public Date getDeletedAt() - { - return deletedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("title", getTitle()) - .append("icon", getIcon()) - .append("imgs", getImgs()) - .append("subTitle", getSubTitle()) - .append("info", getInfo()) - .append("price", getPrice()) - .append("priceZn", getPriceZn()) - .append("sales", getSales()) - .append("stock", getStock()) - .append("status", getStatus()) - .append("description", getDescription()) - .append("skuType", getSkuType()) - .append("sku", getSku()) - .append("latitude", getLatitude()) - .append("longitude", getLongitude()) - .append("type", getType()) - .append("cateId", getCateId()) - .append("project", getProject()) - .append("sort", getSort()) - .append("material", getMaterial()) - .append("postage", getPostage()) - .append("basic", getBasic()) - .append("margin", getMargin()) - .append("skillIds", getSkillIds()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("deletedAt", getDeletedAt()) - .toString(); - } -} diff --git a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173121.java b/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173121.java deleted file mode 100644 index fc0b42b..0000000 --- a/.history/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods_20250520173121.java +++ /dev/null @@ -1,453 +0,0 @@ -package com.ruoyi.system.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 服务内容对象 service_goods - * - * @author ruoyi - * @date 2025-05-13 - */ -public class ServiceGoods extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 标题 */ - @Excel(name = "标题") - private String title; - - /** 图标 */ - @Excel(name = "图标") - private String icon; - - /** 轮播图 */ - @Excel(name = "轮播图") - private String imgs; - - /** 副标题 */ - @Excel(name = "副标题") - private String subTitle; - - /** 简介 */ - @Excel(name = "简介") - private String info; - - /** 价格 */ - @Excel(name = "价格") - private BigDecimal price; - - /** 列表价格显示 */ - @Excel(name = "列表价格显示") - private String priceZn; - - /** 销量 */ - @Excel(name = "销量") - private Long sales; - - /** 库存 */ - @Excel(name = "库存") - private Long stock; - - /** 状态 */ - @Excel(name = "状态") - private String status; - - /** 详情 */ - @Excel(name = "详情") - private String description; - - /** 规格类型 1:单规格 2:多规格 */ - @Excel(name = "规格类型 1:单规格 2:多规格") - private Integer skuType; - - /** 规格 */ - @Excel(name = "规格") - private String sku; - - /** 经度 */ - @Excel(name = "经度") - private String latitude; - - /** 纬度 */ - @Excel(name = "纬度") - private String longitude; - - /** 1:服务 2:商品 */ - @Excel(name = "1:服务 2:商品") - private Integer type; - - /** 分类 */ - @Excel(name = "分类") - private Long cateId; - -/** 分类 */ -@Excel(name = "分类名称") -private String cateName; - - - /** 服务项目 */ - @Excel(name = "服务项目") - private String project; - - /** 排序 */ - @Excel(name = "排序") - private Integer sort; - - /** 物料费用 */ - @Excel(name = "物料费用") - private String material; - - /** 邮费 */ - @Excel(name = "邮费") - private BigDecimal postage; - - /** 基检现象 */ - @Excel(name = "基检现象") - private String basic; - - /** 保证金 */ - @Excel(name = "保证金") - private BigDecimal margin; - - /** 所需技能 */ - @Excel(name = "所需技能") - private String skillIds; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date createdAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date updatedAt; - - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Date deletedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getTitle() - { - return title; - } - - public void setIcon(String icon) - { - this.icon = icon; - } - - public String getIcon() - { - return icon; - } - - public void setImgs(String imgs) - { - this.imgs = imgs; - } - - public String getImgs() - { - return imgs; - } - - public void setSubTitle(String subTitle) - { - this.subTitle = subTitle; - } - - public String getSubTitle() - { - return subTitle; - } - - public void setInfo(String info) - { - this.info = info; - } - - public String getInfo() - { - return info; - } - - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - - public void setPriceZn(String priceZn) - { - this.priceZn = priceZn; - } - - public String getPriceZn() - { - return priceZn; - } - - public void setSales(Long sales) - { - this.sales = sales; - } - - public Long getSales() - { - return sales; - } - - public void setStock(Long stock) - { - this.stock = stock; - } - - public Long getStock() - { - return stock; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - - public void setSkuType(Integer skuType) - { - this.skuType = skuType; - } - - public Integer getSkuType() - { - return skuType; - } - - public void setSku(String sku) - { - this.sku = sku; - } - - public String getSku() - { - return sku; - } - - public void setLatitude(String latitude) - { - this.latitude = latitude; - } - - public String getLatitude() - { - return latitude; - } - - public void setLongitude(String longitude) - { - this.longitude = longitude; - } - - public String getLongitude() - { - return longitude; - } - - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - public void setCateId(Long cateId) - { - this.cateId = cateId; - } - - public Long getCateId() - { - return cateId; - } - - public void setProject(String project) - { - this.project = project; - } - - public String getProject() - { - return project; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public void setMaterial(String material) - { - this.material = material; - } - - public String getMaterial() - { - return material; - } - - public void setPostage(BigDecimal postage) - { - this.postage = postage; - } - - public BigDecimal getPostage() - { - return postage; - } - - public void setBasic(String basic) - { - this.basic = basic; - } - - public String getBasic() - { - return basic; - } - - public void setMargin(BigDecimal margin) - { - this.margin = margin; - } - - public BigDecimal getMargin() - { - return margin; - } - - public void setSkillIds(String skillIds) - { - this.skillIds = skillIds; - } - - public String getSkillIds() - { - return skillIds; - } - - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - public void setDeletedAt(Date deletedAt) - { - this.deletedAt = deletedAt; - } - - public Date getDeletedAt() - { - return deletedAt; - } - - - - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("title", getTitle()) - .append("icon", getIcon()) - .append("imgs", getImgs()) - .append("subTitle", getSubTitle()) - .append("info", getInfo()) - .append("price", getPrice()) - .append("priceZn", getPriceZn()) - .append("sales", getSales()) - .append("stock", getStock()) - .append("status", getStatus()) - .append("description", getDescription()) - .append("skuType", getSkuType()) - .append("sku", getSku()) - .append("latitude", getLatitude()) - .append("longitude", getLongitude()) - .append("type", getType()) - .append("cateId", getCateId()) - .append("project", getProject()) - .append("sort", getSort()) - .append("material", getMaterial()) - .append("postage", getPostage()) - .append("basic", getBasic()) - .append("margin", getMargin()) - .append("skillIds", getSkillIds()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("deletedAt", getDeletedAt()) - .toString(); - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ApplePayController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ApplePayController.java index a720bba..9e58582 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ApplePayController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ApplePayController.java @@ -881,9 +881,9 @@ public class ApplePayController extends BaseController { Map payResult = wechatPayUtil.createBatchOrderAndPay( user.getOpenid(), String.valueOf(order_id), - new BigDecimal(0.01), + new BigDecimal("0.01"), 1, - wechatPayUtil.PAY_FH+"api/order/amount/pay/notify"); + WechatPayUtil.PAY_FH +"api/order/amount/pay/notify"); if (payResult != null && Boolean.TRUE.equals(payResult.get("success"))) { Map responseData = new HashMap<>(); responseData.put("mainOrderId", order_id); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java index b82a28b..81f0797 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/AppletController.java @@ -1,5 +1,4 @@ package com.ruoyi.system.controller; - import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.core.controller.BaseController; @@ -31,7 +30,6 @@ import com.ruoyi.system.domain.QuoteCraft; import com.ruoyi.system.domain.QuoteType; import com.ruoyi.system.domain.QuoteMaterialType; import com.ruoyi.system.domain.QuoteMaterial; - /** * 小程序控制器 * @@ -107,41 +105,21 @@ public class AppletController extends BaseController { @Autowired private IQuoteMaterialService quoteMaterialService; @Autowired - private WechatPayUtil wechatPayUtil; - @Autowired private IGoodsOrderCursorService goodsOrderCursorService; @Autowired private IWorkerApplyService workerApplyService; - @Autowired - private IUserMemberRechargeProgramService userMemberRechargeProgramService; - @Autowired - private IUserMemberRechargeLogService userMemberRechargeLogService; - @Autowired - private IUserMemnerConsumptionLogService userMemnerConsumptionLogService; - @Autowired - private IUsersInvoiceInfoService usersInvoiceInfoService; - @Autowired - private IUserGroupBuyingService userGroupBuyingService; - @Autowired - private IUserSecondaryCardService userSecondaryCardService; - @Autowired - private IUserDemandQuotationService userDemandQuotationService; - @Autowired - private IUserBenefitPointsService userBenefitPointsService; - @Autowired - private WechatPayV3Util wechatPayV3Util; - - /** * 获取服务分类列表 - * * 功能说明: * - 获取状态为启用的服务分类 + * - 支持二级分类树形结构 + * - 将二级分类组装在一级分类下的children字段 + * - 只返回title和icon字段 * - 自动添加图片CDN前缀 * - 支持用户登录状态验证(可选) * * @param request HTTP请求对象 - * @return 分类列表数据 + * @return 分类树形列表数据(只包含title和icon) */ @GetMapping(value = "/api/service/cate") public AjaxResult getServiceCategories(HttpServletRequest request) { @@ -149,25 +127,59 @@ public class AppletController extends BaseController { // 验证用户登录状态(可选) AppletControllerUtil.getUserData(request.getHeader("token"), usersService); - // 查询启用状态的服务分类 + // 1. 查询所有启用状态的服务分类 ServiceCate serviceCateQuery = new ServiceCate(); serviceCateQuery.setStatus(1L); - List categoryList = serviceCateService.selectServiceCateList(serviceCateQuery); + List allCategoryList = serviceCateService.selectServiceCateList(serviceCateQuery); - // 为每个分类添加CDN前缀 - AppletControllerUtil.addImageCdnPrefixForCategories(categoryList); + // 2. 分离一级分类和二级分类 + List firstLevelCategories = new ArrayList<>(); + Map> secondLevelMap = new HashMap<>(); - return AppletControllerUtil.appletSuccess(categoryList); + for (ServiceCate category : allCategoryList) { + if (category.getParentId() == null || category.getParentId() == 0L) { + // 一级分类 + firstLevelCategories.add(category); + } else { + // 二级分类,按父级ID分组 + secondLevelMap.computeIfAbsent(category.getParentId(), k -> new ArrayList<>()).add(category); + } + } + + // 3. 构建简化的分类数据(只包含title和icon) + List> resultList = new ArrayList<>(); + + for (ServiceCate firstLevel : firstLevelCategories) { + Map firstLevelData = new HashMap<>(); + firstLevelData.put("id", firstLevel.getId()); + firstLevelData.put("title", firstLevel.getTitle()); + firstLevelData.put("icon", AppletControllerUtil.buildImageUrl(firstLevel.getIcon())); + + // 4. 处理二级分类 + List> childrenList = new ArrayList<>(); + List children = secondLevelMap.get(firstLevel.getId()); + if (children != null && !children.isEmpty()) { + for (ServiceCate child : children) { + Map childData = new HashMap<>(); + childData.put("id", child.getId()); + childData.put("title", child.getTitle()); + childData.put("icon", AppletControllerUtil.buildImageUrl(child.getIcon())); + childrenList.add(childData); + } + } + firstLevelData.put("children", childrenList); + + resultList.add(firstLevelData); + } + + return AppletControllerUtil.appletSuccess(resultList); } catch (Exception e) { return AppletControllerUtil.appletError("获取服务分类列表失败:" + e.getMessage()); } } - - /** * 获取系统配置信息 - * - * 功能说明: + * 功能说明: * - 根据配置名称获取对应的配置值 * - 配置值以JSON格式返回 * - 支持动态配置管理 @@ -183,13 +195,11 @@ public class AppletController extends BaseController { if (StringUtils.isEmpty(name)) { return AppletControllerUtil.appletWarning("配置名称不能为空"); } - // 查询配置信息 SiteConfig config = AppletControllerUtil.getSiteConfig(name, siteConfigService); if (config == null) { return AppletControllerUtil.appletWarning("未找到指定的配置项:" + name); } - // 解析配置值为JSON对象 JSONObject configJson = AppletControllerUtil.parseConfigValue(config.getValue()); return AppletControllerUtil.appletSuccess(configJson); @@ -197,8 +207,6 @@ public class AppletController extends BaseController { return AppletControllerUtil.appletError("获取配置信息失败:" + e.getMessage()); } } - - /** * 获取默认配置信息 * @@ -216,7 +224,6 @@ public class AppletController extends BaseController { SiteConfig configQuery = new SiteConfig(); configQuery.setName("config_one"); List list = siteConfigService.selectSiteConfigList(configQuery); - if (list != null && !list.isEmpty()) { JSONObject jsonObject = JSONObject.parseObject(list.get(0).getValue()); return AppletControllerUtil.appletSuccess(jsonObject); @@ -251,36 +258,28 @@ public class AppletController extends BaseController { if (!(Boolean) pageValidation.get("valid")) { return AppletControllerUtil.appletWarning((String) pageValidation.get("message")); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletUnauthorized(); } - // 3. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 4. 设置分页参数 PageHelper.startPage(page, limit); - // 5. 查询用户地址列表 UserAddress userAddressQuery = new UserAddress(); userAddressQuery.setUid(user.getId()); List addressList = userAddressService.selectUserAddressList(userAddressQuery); - // 6. 获取分页信息并构建响应 TableDataInfo tableDataInfo = getDataTable(addressList); - // 7. 构建符合要求的分页响应格式 Map pageData = PageUtil.buildPageResponse(tableDataInfo, page, limit); - return AppletControllerUtil.appletSuccess(pageData); - } catch (Exception e) { System.err.println("查询用户地址列表异常:" + e.getMessage()); return AppletControllerUtil.appletError("查询地址列表失败:" + e.getMessage()); @@ -306,42 +305,34 @@ public class AppletController extends BaseController { if (id == null || id <= 0) { return AppletControllerUtil.appletWarning("地址ID无效"); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletUnauthorized(); } - // 3. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 4. 查询地址信息 UserAddress userAddress = userAddressService.selectUserAddressById(id); if (userAddress == null) { return AppletControllerUtil.appletWarning("地址不存在"); } - // 5. 验证地址归属权 if (!userAddress.getUid().equals(user.getId())) { return AppletControllerUtil.appletWarning("无权访问该地址信息"); } - // 6. 转换为AddressApple格式并返回 AddressApple addressApple = AddressApple.fromUserAddress(userAddress); - return AppletControllerUtil.appletSuccess(addressApple); - } catch (Exception e) { System.err.println("查询用户地址详情异常:" + e.getMessage()); return AppletControllerUtil.appletError("查询地址详情失败:" + e.getMessage()); } } - /** * 修改用户收货地址 * @@ -361,7 +352,6 @@ public class AppletController extends BaseController { if (params == null || params.get("id") == null) { return AppletControllerUtil.appletWarning("地址ID不能为空"); } - Long addressId; try { addressId = Long.valueOf(params.get("id").toString()); @@ -371,61 +361,49 @@ public class AppletController extends BaseController { } catch (NumberFormatException e) { return AppletControllerUtil.appletWarning("地址ID格式错误"); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletUnauthorized(); } - // 3. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 4. 查询原地址信息并验证归属权 UserAddress existingAddress = userAddressService.selectUserAddressById(addressId); if (existingAddress == null) { return AppletControllerUtil.appletWarning("地址不存在"); } - if (!existingAddress.getUid().equals(user.getId())) { return AppletControllerUtil.appletWarning("无权修改该地址"); } - // 5. 构建更新的地址对象 UserAddress updateAddress = AppletControllerUtil.buildUpdateAddress(params, addressId, user.getId()); - // 6. 验证必填字段 String validationResult = AppletControllerUtil.validateAddressParams(updateAddress); if (validationResult != null) { return AppletControllerUtil.appletWarning(validationResult); } - // 7. 处理默认地址逻辑 if (updateAddress.getIsDefault() != null && updateAddress.getIsDefault() == 1L) { // 如果设置为默认地址,先将该用户的所有地址设为非默认 userAddressService.updateUserAddressDefault(user.getId()); } - // 8. 执行地址更新 int updateResult = userAddressService.updateUserAddress(updateAddress); - if (updateResult > 0) { return AppletControllerUtil.appletSuccess("地址修改成功"); } else { return AppletControllerUtil.appletWarning("地址修改失败"); } - } catch (Exception e) { System.err.println("修改用户地址异常:" + e.getMessage()); return AppletControllerUtil.appletError("修改地址失败:" + e.getMessage()); } } - - /** * 新增用户收货地址 * @@ -447,45 +425,36 @@ public class AppletController extends BaseController { if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletUnauthorized(); } - // 2. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 3. 构建新增的地址对象 UserAddress newAddress = AppletControllerUtil.buildNewAddress(params, user.getId()); - // 4. 验证必填字段 String validationResult = AppletControllerUtil.validateAddressParams(newAddress); if (validationResult != null) { return AppletControllerUtil.appletWarning(validationResult); } - // 5. 处理默认地址逻辑 if (newAddress.getIsDefault() != null && newAddress.getIsDefault() == 1L) { // 如果设置为默认地址,先将该用户的所有地址设为非默认 userAddressService.updateUserAddressDefault(user.getId()); } - // 6. 执行地址新增 int insertResult = userAddressService.insertUserAddress(newAddress); - if (insertResult > 0) { return AppletControllerUtil.appletSuccess("地址新增成功"); } else { return AppletControllerUtil.appletWarning("地址新增失败"); } - } catch (Exception e) { System.err.println("新增用户地址异常:" + e.getMessage()); return AppletControllerUtil.appletError("新增地址失败:" + e.getMessage()); } } - - - /** + /** * 售后返修申请接口 * * @param params 请求参数 包含order_id(订单ID)、phone(联系电话)、mark(返修原因备注) @@ -511,73 +480,58 @@ public class AppletController extends BaseController { if (params == null) { return AppletControllerUtil.appletWarning("请求参数不能为空"); } - String orderId = (String) params.get("order_id"); String phone = (String) params.get("phone"); String mark = (String) params.get("mark"); - if (StringUtils.isEmpty(orderId)) { return AppletControllerUtil.appletWarning("订单ID不能为空"); } - if (StringUtils.isEmpty(phone)) { return AppletControllerUtil.appletWarning("联系电话不能为空"); } - // 验证手机号格式 if (!phone.matches("^1[3-9]\\d{9}$")) { return AppletControllerUtil.appletWarning("联系电话格式不正确"); } - if (StringUtils.isEmpty(mark)) { return AppletControllerUtil.appletWarning("返修原因不能为空"); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletWarning("用户未登录或token无效"); } - // 3. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 4. 查询订单信息并验证归属权 Order order = orderService.selectOrderByOrderId(orderId); if (order == null) { return AppletControllerUtil.appletWarning("订单不存在"); } - if (!order.getUid().equals(user.getId())) { return AppletControllerUtil.appletWarning("无权操作此订单"); } - // 5. 验证订单状态是否允许申请售后 if (!AppletControllerUtil.isOrderAllowRework(order.getStatus())) { return AppletControllerUtil.appletWarning("当前订单状态不允许申请售后"); } - // 6. 处理售后返修申请 boolean reworkResult = AppletControllerUtil.processReworkApplication(order, phone, mark, user, orderReworkService, orderService); - if (reworkResult) { return AppletControllerUtil.appletSuccess("售后返修申请已提交,我们会尽快联系您处理"); } else { return AppletControllerUtil.appletWarning("售后申请提交失败,请稍后重试"); } - } catch (Exception e) { System.err.println("售后返修申请异常:" + e.getMessage()); return AppletControllerUtil.appletWarning("售后申请失败:" + e.getMessage()); } } - - - /** + /** * 获取用户服务订单列表 * * @param params 请求参数 包含page(页码)、limit(每页数量)、status(订单状态) @@ -592,39 +546,32 @@ public class AppletController extends BaseController { */ @PostMapping("api/service/order/lst") public AjaxResult getserviceorderlst(@RequestBody Map params, - HttpServletRequest request) { - + HttpServletRequest request) { int page = (int) params.get("page"); int limit = (int) params.get("limit"); String status = (String) params.get("status"); - // 1. 验证分页参数 Map pageValidation = PageUtil.validatePageParams(page, limit); if (!(Boolean) pageValidation.get("valid")) { return AppletControllerUtil.appletWarning((String) pageValidation.get("message")); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); if (!(Boolean) userValidation.get("valid")) { return AppletControllerUtil.appletWarning("用户未登录或token无效"); } - // 3. 获取用户信息 Users user = (Users) userValidation.get("user"); if (user == null) { return AppletControllerUtil.appletWarning("用户信息获取失败"); } - // 4. 设置分页参数 PageHelper.startPage(page, limit); - // 5. 查询用户地址列表 OrderApple order = new OrderApple(); // order.setType(1); order.setUid(user.getId()); - if (StringUtils.isNotNull(status) && !"".equals(status)) { order.setStatus(Long.valueOf(status)); } @@ -643,16 +590,12 @@ public class AppletController extends BaseController { } } } - // 6. 获取分页信息并构建响应 TableDataInfo tableDataInfo = getDataTable(orderList); - // 7. 构建符合要求的分页响应格式 Map pageData = PageUtil.buildPageResponse(tableDataInfo, page, limit); - return AppletControllerUtil.appletSuccess(pageData); } - /** * 获取用户商品订单列表 * @@ -673,13 +616,11 @@ public class AppletController extends BaseController { int page = (int) params.get("page"); int limit = (int) params.get("limit"); String status = (String) params.get("status"); - // 1. 验证分页参数 Map pageValidation = PageUtil.validatePageParams(page, limit); if (!(Boolean) pageValidation.get("valid")) { return AppletControllerUtil.appletWarning((String) pageValidation.get("message")); } - // 2. 验证用户登录状态 String token = request.getHeader("token"); Map userValidation = AppletLoginUtil.validateUserToken(token, usersService); @@ -833,73 +774,143 @@ public class AppletController extends BaseController { } } - - /** * 获取服务商品列表 - * 前端参数格式:{cate_id: 18, keywords:"dfffff"} - * 返回格式:按分类分组的商品列表 + * 前端参数格式:{cate_id: 18} + * 业务逻辑: + * - 如果cate_id为空或null:返回所有分类的服务分组 + * - 如果是一级分类:返回该一级分类下的服务分组 + 该一级分类下所有二级分类的服务分组 + * - 如果是二级分类:返回该二级分类下的服务分组 + * 返回格式:分类title + [服务列表] 的分组结构 */ @PostMapping(value = "/api/service/lst") public AjaxResult getServiceGoodsList(@RequestBody Map params, HttpServletRequest request) { try { + // 1. 获取分类ID参数 Long cateId = null; - String keywords = null; - - // 处理分类ID参数 if (params.get("cate_id") != null) { Object cateIdObj = params.get("cate_id"); - if (cateIdObj instanceof Integer) { - cateId = ((Integer) cateIdObj).longValue(); - } else if (cateIdObj instanceof String) { - try { - cateId = Long.parseLong((String) cateIdObj); - } catch (NumberFormatException e) { - return AppletControllerUtil.appletWarning("分类ID格式错误"); + try { + if (cateIdObj instanceof Integer) { + cateId = ((Integer) cateIdObj).longValue(); + } else if (cateIdObj instanceof String) { + String cateIdStr = cateIdObj.toString().trim(); + if (!cateIdStr.isEmpty()) { + cateId = Long.parseLong(cateIdStr); + } + } else { + cateId = Long.parseLong(cateIdObj.toString()); } + } catch (NumberFormatException e) { + return AppletControllerUtil.appletkaifaWarning("分类ID格式错误"); } } - // 处理关键词参数 - if (params.get("keywords") != null) { - keywords = params.get("keywords").toString().trim(); - if (keywords.isEmpty()) { - keywords = null; + // 2. 如果cate_id为空,查询默认的服务分类 + if (cateId == null) { + // 查询启用状态、类型为服务、排序第一的分类 + ServiceCate defaultCateQuery = new ServiceCate(); + defaultCateQuery.setStatus(1L); // 启用状态 + defaultCateQuery.setType(1L); // 类型为服务(假设1为服务类型) + List defaultCateList = serviceCateService.selectServiceCateList(defaultCateQuery); + + if (defaultCateList.isEmpty()) { + return AppletControllerUtil.appletkaifaWarning("未找到默认服务分类"); } + + // 按排序字段升序排列,取第一个 + defaultCateList.sort((a, b) -> { + Long sortA = a.getSort() != null ? a.getSort() : Long.MAX_VALUE; + Long sortB = b.getSort() != null ? b.getSort() : Long.MAX_VALUE; + return sortA.compareTo(sortB); + }); + + // 给cate_id赋值为排序第一的分类ID + cateId = defaultCateList.get(0).getId(); } - // 构建返回数据结构 + // 3. 构建返回数据 List> resultList = new ArrayList<>(); - if (cateId != null) { - // 查询指定分类 - ServiceCate category = serviceCateService.selectServiceCateById(cateId); - if (category != null) { - Map categoryData = AppletControllerUtil.buildCategoryData(category, keywords, serviceGoodsService); - resultList.add(categoryData); + // 3. 查询分类信息,判断是一级还是二级分类 + ServiceCate category = serviceCateService.selectServiceCateById(cateId); + if (category == null) { + return AppletControllerUtil.appletkaifaWarning("分类不存在"); + } + + if (category.getParentId() == null || category.getParentId() == 0L) { + // 一级分类:返回该一级分类的服务分组 + 所有二级分类的服务分组 + + // 先添加一级分类本身的服务 + List> firstLevelServices = getServicesByCategory(cateId); + if (!firstLevelServices.isEmpty()) { + Map firstLevelGroup = new HashMap<>(); + firstLevelGroup.put("id", category.getId()); + firstLevelGroup.put("title", category.getTitle()); + firstLevelGroup.put("services", firstLevelServices); + resultList.add(firstLevelGroup); } - } else { - // 查询所有分类 - ServiceCate serviceCateQuery = new ServiceCate(); - serviceCateQuery.setStatus(1L); - serviceCateQuery.setType(1L); - List categories = serviceCateService.selectServiceCateList(serviceCateQuery); - - for (ServiceCate category : categories) { - Map categoryData = AppletControllerUtil.buildCategoryData(category, keywords, serviceGoodsService); - // 只返回有商品的分类 - List> goods = (List>) categoryData.get("goods"); - if (!goods.isEmpty()) { - resultList.add(categoryData); + + // 再添加该一级分类下所有二级分类的服务分组 + ServiceCate childQuery = new ServiceCate(); + childQuery.setParentId(cateId); + childQuery.setStatus(1L); + List childCategories = serviceCateService.selectServiceCateList(childQuery); + + for (ServiceCate child : childCategories) { + List> childServices = getServicesByCategory(child.getId()); + if (!childServices.isEmpty()) { + Map childGroup = new HashMap<>(); + childGroup.put("id", category.getId()); + childGroup.put("title", child.getTitle()); + childGroup.put("services", childServices); + resultList.add(childGroup); } } + + } else { + // 二级分类:只返回该二级分类的服务分组 + List> services = getServicesByCategory(cateId); + if (!services.isEmpty()) { + Map group = new HashMap<>(); + group.put("id", category.getId()); + group.put("title", category.getTitle()); + group.put("services", services); + resultList.add(group); + } } return AppletControllerUtil.appletSuccess(resultList); } catch (Exception e) { - return AppletControllerUtil.appletWarning("查询服务商品列表失败:" + e.getMessage()); + return AppletControllerUtil.appletkaifaWarning("查询服务商品列表失败:" + e.getMessage()); } } + + + /** + * 根据分类ID查询该分类下的服务列表 + * @param categoryId 分类ID + * @return 服务列表(只包含id、title、icon) + */ + private List> getServicesByCategory(Long categoryId) { + List> serviceList = new ArrayList<>(); + + ServiceGoods queryGoods = new ServiceGoods(); + queryGoods.setCateId(categoryId); + queryGoods.setStatus("1"); // 只查询启用状态的商品 + + List goodsList = serviceGoodsService.selectServiceGoodsList(queryGoods); + + for (ServiceGoods goods : goodsList) { + Map serviceData = new HashMap<>(); + serviceData.put("id", goods.getId()); + serviceData.put("title", goods.getTitle()); + serviceData.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon())); + serviceList.add(serviceData); + } + + return serviceList; + } /** * 获取服务商品详细信息 * @@ -964,6 +975,7 @@ public class AppletController extends BaseController { // 构建查询条件 AdvImg advImgQuery = new AdvImg(); advImgQuery.setType(type); + advImgQuery.setStatus(1L); // 查询广告图片列表 List advImgList = advImgService.selectAdvImgList(advImgQuery); @@ -978,6 +990,254 @@ public class AppletController extends BaseController { return AppletControllerUtil.appletWarning("获取广告图片失败:" + e.getMessage()); } } + + /** + * 获取商城分类列表 + * + * @param request HTTP请求对象 + * @return 商城分类列表 + *

+ * 接口说明: + * - 查询类型为商品且状态为启用的分类数据 + * - 只返回title和icon字段 + * - 自动添加图片CDN前缀 + * - 保持原有排序不变 + * - 无需用户登录验证 + */ + @GetMapping(value = "/api/mall/cate/lst") + public AjaxResult getMallCategoryList(HttpServletRequest request) { + try { + // 构建查询条件 + ServiceCate serviceCateQuery = new ServiceCate(); + serviceCateQuery.setStatus(1L); // 状态为启用 + serviceCateQuery.setType(2L); // 类型为商品(假设2为商品类型,请根据实际业务调整) + + // 查询商城分类列表 + List categoryList = serviceCateService.selectServiceCateList(serviceCateQuery); + + // 构建返回数据(只包含title和icon) + List> resultList = new ArrayList<>(); + for (ServiceCate category : categoryList) { + Map categoryData = new HashMap<>(); + categoryData.put("id", category.getId()); + categoryData.put("title", category.getTitle()); + categoryData.put("icon", AppletControllerUtil.buildImageUrl(category.getIcon())); + resultList.add(categoryData); + } + + return AppletControllerUtil.appletSuccess(resultList); + } catch (Exception e) { + return AppletControllerUtil.appletError("获取商城分类列表失败:" + e.getMessage()); + } + } + + /** + * 获取热门推荐商品 + * + * @param request HTTP请求对象 + * @return 热门推荐商品列表(销量前6个) + *

+ * 接口说明: + * - 查询type=2的商品 + * - 按销量降序排列,取前6个 + * - 返回id、title、icon、price、sales字段 + * - 自动添加图片CDN前缀 + * - 无需用户登录验证 + */ + @GetMapping(value = "/api/hot/recommend") + public AjaxResult getHotRecommendGoods(HttpServletRequest request) { + try { + // 构建查询条件 + ServiceGoods queryGoods = new ServiceGoods(); + queryGoods.setType(2); // 查询type=2的商品 + queryGoods.setStatus("1"); // 只查询启用状态的商品 + + // 查询符合条件的商品列表 + List goodsList = serviceGoodsService.selectServiceGoodsList(queryGoods); + + // 按销量降序排序 + goodsList.sort((a, b) -> { + Long salesA = a.getSales() != null ? a.getSales() : 0L; + Long salesB = b.getSales() != null ? b.getSales() : 0L; + return salesB.compareTo(salesA); + }); + + // 取前6个 + if (goodsList.size() > 6) { + goodsList = goodsList.subList(0, 6); + } + + // 构建返回数据 + List> resultList = new ArrayList<>(); + for (ServiceGoods goods : goodsList) { + Map goodsData = new HashMap<>(); + goodsData.put("id", goods.getId()); + goodsData.put("title", goods.getTitle()); + goodsData.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon())); + goodsData.put("price", goods.getPrice() != null ? goods.getPrice().toString() : "0.00"); + goodsData.put("sales", goods.getSales() != null ? goods.getSales() : 0L); + resultList.add(goodsData); + } + + return AppletControllerUtil.appletSuccess(resultList); + } catch (Exception e) { + return AppletControllerUtil.appletError("获取热门推荐商品失败:" + e.getMessage()); + } + } + + /** + * 根据分类ID查询商品列表 + * + * @param cateId 分类ID + * @param request HTTP请求对象 + * @return 该分类下的商品列表 + *

+ * 接口说明: + * - 根据分类ID查询商品 + * - 只查询启用状态的商品 + * - 返回id、title、icon、price、sales字段 + * - 自动添加图片CDN前缀 + * - 无需用户登录验证 + */ + @GetMapping(value = "/api/goods/cate/{cateId}") + public AjaxResult getGoodsByCategory(@PathVariable("cateId") Long cateId, HttpServletRequest request) { + try { + // 参数验证 + if (cateId == null || cateId <= 0) { + return AppletControllerUtil.appletWarning("分类ID无效"); + } + + // 验证分类是否存在 + ServiceCate category = serviceCateService.selectServiceCateById(cateId); + if (category == null) { + return AppletControllerUtil.appletWarning("分类不存在"); + } + + // 构建查询条件 + ServiceGoods queryGoods = new ServiceGoods(); + queryGoods.setCateId(cateId); // 根据分类ID查询 + queryGoods.setStatus("1"); // 只查询启用状态的商品 + + // 查询该分类下的商品列表 + List goodsList = serviceGoodsService.selectServiceGoodsList(queryGoods); + + // 构建返回数据 + List> resultList = new ArrayList<>(); + for (ServiceGoods goods : goodsList) { + Map goodsData = new HashMap<>(); + goodsData.put("id", goods.getId()); + goodsData.put("title", goods.getTitle()); + goodsData.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon())); + goodsData.put("price", goods.getPrice() != null ? goods.getPrice().toString() : "0.00"); + goodsData.put("sales", goods.getSales() != null ? goods.getSales() : 0L); + resultList.add(goodsData); + } + + return AppletControllerUtil.appletSuccess(resultList); + } catch (Exception e) { + return AppletControllerUtil.appletError("查询分类商品失败:" + e.getMessage()); + } + } + + /** + * 获取一级城市列表 + * + * @param request HTTP请求对象 + * @return 一级城市列表 + *

+ * 接口说明: + * - 查询parent_id=0的城市数据 + * - 只返回id和title字段 + * - 无需用户登录验证 + */ + @GetMapping(value = "/api/city/list") + public AjaxResult getCityList(HttpServletRequest request) { + try { + // 构建查询条件 + DiyCity queryCond = new DiyCity(); + queryCond.setParentId(0L); // 查询parent_id=0的一级城市 + + // 查询一级城市列表 + List cityList = diyCityService.selectDiyCityList(queryCond); + + // 构建返回数据(只包含id和title) + List> resultList = new ArrayList<>(); + for (DiyCity city : cityList) { + Map cityData = new HashMap<>(); + cityData.put("id", city.getId()); + cityData.put("title", city.getTitle()); + resultList.add(cityData); + } + + return AppletControllerUtil.appletSuccess(resultList); + } catch (Exception e) { + return AppletControllerUtil.appletError("获取城市列表失败:" + e.getMessage()); + } + } + + /** + * 根据经纬度获取城市信息 + * + * @param params 请求参数,包含latitude(纬度)、longitude(经度) + * @param request HTTP请求对象 + * @return 城市信息 + *

+ * 接口说明: + * - 接收前端传入的经纬度坐标 + * - 调用高德地图逆地理编码API获取城市信息 + * - 返回城市名称和详细地址信息 + * - 无需用户登录验证 + */ + @PostMapping(value = "/api/location/city") + public AjaxResult getCityByLocation(@RequestBody Map params, HttpServletRequest request) { + try { + // 1. 参数验证 + if (params == null) { + return AppletControllerUtil.appletWarning("请求参数不能为空"); + } + + String latitude = params.get("latitude") != null ? params.get("latitude").toString() : ""; + String longitude = params.get("longitude") != null ? params.get("longitude").toString() : ""; + + if (latitude.isEmpty() || longitude.isEmpty()) { + return AppletControllerUtil.appletWarning("经纬度参数不能为空"); + } + + // 验证经纬度格式并转换为double + double lat, lng; + try { + lat = Double.parseDouble(latitude); + lng = Double.parseDouble(longitude); + + // 验证经纬度范围 + if (lat < -90 || lat > 90) { + return AppletControllerUtil.appletWarning("纬度范围应在-90到90之间"); + } + if (lng < -180 || lng > 180) { + return AppletControllerUtil.appletWarning("经度范围应在-180到180之间"); + } + } catch (NumberFormatException e) { + return AppletControllerUtil.appletWarning("经纬度格式错误"); + } + + // 2. 调用高德地图工具类获取位置信息 + String city = GaoDeMapUtil.getCityByLocation(lng, lat); + String address = GaoDeMapUtil.getAddressByLocation(lng, lat); + + // 3. 构建返回数据 + Map locationInfo = new HashMap<>(); + locationInfo.put("city", city != null ? city : ""); + locationInfo.put("formatted_address", address != null ? address : ""); + locationInfo.put("latitude", latitude); + locationInfo.put("longitude", longitude); + + return AppletControllerUtil.appletSuccess(locationInfo); + + } catch (Exception e) { + return AppletControllerUtil.appletError("获取位置信息失败:" + e.getMessage()); + } + } + /** * 微信用户登录接口 * @@ -5667,7 +5927,6 @@ public class AppletController extends BaseController { productInfo.put("stock", product.getStock()); productInfo.put("sku_type", product.getSkuType()); productInfo.put("icon", AppletControllerUtil.buildImageUrl(product.getIcon())); - responseData.put("product", productInfo); } else { // 商品不存在时的默认信息 @@ -5702,4 +5961,286 @@ public class AppletController extends BaseController { configData.put("hot", new String[]{"水电维修", "家电清洗", "灯具维修", "墙面翻新", "门窗家具", "改造维修", "防水维修"}); configData.put("kf", ""); } + + /** + * 获取首页通知公告列表接口 + * + * @param request HTTP请求对象 + * @return 上线状态的通知公告列表 + *

+ * 接口说明: + * - 查询config_seven配置中的通知公告数据 + * - 只返回status=1(上线)状态的公告 + * - 按sort字段升序排列 + * - 返回title、content、link、sort等字段 + * - 无需用户登录验证 + *

+ */ + @GetMapping(value = "/api/public/notice/list") + public AjaxResult getHomeNoticeList(HttpServletRequest request) { + try { + // 1. 查询config_seven配置 + SiteConfig configQuery = new SiteConfig(); + configQuery.setName("config_seven"); + List configList = siteConfigService.selectSiteConfigList(configQuery); + + if (configList.isEmpty()) { + // 配置不存在时返回空数组 + return AppletControllerUtil.appletSuccess(new ArrayList<>()); + } + + SiteConfig config = configList.get(0); + String configValue = config.getValue(); + + if (configValue == null || configValue.trim().isEmpty()) { + // 配置值为空时返回空数组 + return AppletControllerUtil.appletSuccess(new ArrayList<>()); + } + + // 2. 解析JSON配置 + JSONObject configJson; + try { + configJson = JSONObject.parseObject(configValue); + } catch (Exception e) { + System.err.println("解析config_seven配置JSON失败:" + e.getMessage()); + return AppletControllerUtil.appletSuccess(new ArrayList<>()); + } + + // 3. 获取notice数组 + if (!configJson.containsKey("notice")) { + return AppletControllerUtil.appletSuccess(new ArrayList<>()); + } + + Object noticeObj = configJson.get("notice"); + if (!(noticeObj instanceof JSONArray)) { + return AppletControllerUtil.appletSuccess(new ArrayList<>()); + } + + JSONArray noticeArray = (JSONArray) noticeObj; + + // 4. 过滤上线状态的公告并构建返回数据 + List> resultList = new ArrayList<>(); + + for (int i = 0; i < noticeArray.size(); i++) { + try { + JSONObject noticeItem = noticeArray.getJSONObject(i); + + // 检查状态是否为上线(status=1) + Integer status = noticeItem.getInteger("status"); + if (status == null || status != 1) { + continue; // 跳过下线或状态异常的公告 + } + + // 构建公告数据 + Map notice = new HashMap<>(); + notice.put("title", noticeItem.getString("title")); + notice.put("content", noticeItem.getString("content")); + notice.put("link", noticeItem.getString("link")); + notice.put("sort", noticeItem.getInteger("sort")); + notice.put("status", status); + + resultList.add(notice); + } catch (Exception e) { + // 单个公告解析失败时跳过,继续处理其他公告 + System.err.println("解析单个公告数据失败:" + e.getMessage()); + continue; + } + } + + // 5. 按sort字段升序排序 + resultList.sort((a, b) -> { + Integer sortA = (Integer) a.get("sort"); + Integer sortB = (Integer) b.get("sort"); + if (sortA == null) sortA = Integer.MAX_VALUE; + if (sortB == null) sortB = Integer.MAX_VALUE; + return sortA.compareTo(sortB); + }); + + return AppletControllerUtil.appletSuccess(resultList); + + } catch (Exception e) { + System.err.println("获取首页通知公告列表异常:" + e.getMessage()); + return AppletControllerUtil.appletError("获取通知公告列表失败:" + e.getMessage()); + } + } + + /** + * 获取报价产品列表接口 + * + * @param params 请求参数,包含limit(每页数量)、page(页码)、keywords(搜索关键词) + * @param request HTTP请求对象 + * @return 报价产品列表 + *

+ * 接口说明: + * - 查询servicetype=2的报价产品 + * - 支持按商品标题进行模糊查询 + * - 支持分页查询 + * - 自动添加图片CDN前缀 + * - 无需用户登录验证 + *

+ */ + @PostMapping(value = "/api/quote/product/lst") + public AjaxResult getQuoteProductList(@RequestBody Map params, HttpServletRequest request) { + try { + // 1. 获取分页参数并进行安全的类型转换 + int page = 1; + int limit = 15; + + if (params.get("page") != null) { + try { + page = Integer.parseInt(params.get("page").toString()); + if (page < 1) page = 1; + } catch (NumberFormatException e) { + page = 1; + } + } + + if (params.get("limit") != null) { + try { + limit = Integer.parseInt(params.get("limit").toString()); + if (limit < 1) limit = 15; + if (limit > 100) limit = 100; // 限制最大每页数量 + } catch (NumberFormatException e) { + limit = 15; + } + } + + String keywords = params.get("keywords") != null ? params.get("keywords").toString().trim() : ""; + + // 2. 验证分页参数 + Map pageValidation = PageUtil.validatePageParams(page, limit); + if (!(Boolean) pageValidation.get("valid")) { + return AppletControllerUtil.appletWarning((String) pageValidation.get("message")); + } + + // 3. 设置分页参数 + PageHelper.startPage(page, limit); + + // 4. 构建查询条件 + ServiceGoods queryGoods = new ServiceGoods(); + queryGoods.setServicetype(2); // 查询servicetype=2的报价产品 + queryGoods.setStatus(String.valueOf(1L)); // 只查询启用状态的商品 + + // 如果有关键词,设置标题模糊查询 + if (!keywords.isEmpty()) { + queryGoods.setTitle(keywords); + } + + // 5. 查询报价产品列表 + List goodsList = serviceGoodsService.selectServiceGoodsList(queryGoods); + + // 6. 构建返回数据 + List> resultList = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + for (ServiceGoods goods : goodsList) { + Map goodsData = new HashMap<>(); + + // 基本商品信息 + goodsData.put("id", goods.getId()); + goodsData.put("title", goods.getTitle()); + goodsData.put("sub_title", goods.getSubTitle()); + goodsData.put("price", goods.getPrice() != null ? goods.getPrice().toString() : "0.00"); + goodsData.put("price_zn", goods.getPriceZn()); + goodsData.put("servicetype", goods.getServicetype()); + goodsData.put("status", goods.getStatus()); + goodsData.put("type", goods.getType()); + goodsData.put("cate_id", goods.getCateId()); + goodsData.put("sort", goods.getSort()); + goodsData.put("stock", goods.getStock()); + goodsData.put("sales", goods.getSales()); + goodsData.put("sku_type", goods.getSkuType()); + + // 处理图片URL - 添加CDN前缀 + goodsData.put("icon", AppletControllerUtil.buildImageUrl(goods.getIcon())); + + // 处理轮播图 + if (goods.getImgs() != null && !goods.getImgs().isEmpty()) { + try { + List bannerList = AppletControllerUtil.parseStringToList(goods.getImgs()); + List processedBannerList = new ArrayList<>(); + for (String banner : bannerList) { + processedBannerList.add(AppletControllerUtil.buildImageUrl(banner)); + } + goodsData.put("banner", processedBannerList); + } catch (Exception e) { + goodsData.put("banner", new ArrayList<>()); + } + } else { + goodsData.put("banner", new ArrayList<>()); + } + +// // 处理标签 +// if (goods.getLabel() != null && !goods.getLabel().isEmpty()) { +// try { +// List labelList = AppletControllerUtil.parseStringToList(goods.getLabel()); +// goodsData.put("label", labelList); +// } catch (Exception e) { +// goodsData.put("label", new ArrayList<>()); +// } +// } else { +// goodsData.put("label", new ArrayList<>()); +// } + + // 时间字段格式化 + goodsData.put("created_at", goods.getCreatedAt() != null ? sdf.format(goods.getCreatedAt()) : null); + goodsData.put("updated_at", goods.getUpdatedAt() != null ? sdf.format(goods.getUpdatedAt()) : null); + + // 其他字段 + goodsData.put("basic", goods.getBasic()); + goodsData.put("images", goods.getImgs()); + goodsData.put("content", goods.getInfo()); + goodsData.put("sku", goods.getSku()); + + resultList.add(goodsData); + } + + // 7. 构建分页信息 + PageInfo pageInfo = new PageInfo<>(goodsList); + + // 8. 构建返回数据格式 + Map responseData = new HashMap<>(); + responseData.put("current_page", pageInfo.getPageNum()); + responseData.put("data", resultList); + responseData.put("from", pageInfo.getStartRow()); + responseData.put("last_page", pageInfo.getPages()); + responseData.put("per_page", pageInfo.getPageSize()); + responseData.put("to", pageInfo.getEndRow()); + responseData.put("total", pageInfo.getTotal()); + + // 构建分页链接信息 + String baseUrl = "https://www.huafurenjia.cn/api/quote/product/lst"; + responseData.put("first_page_url", baseUrl + "?page=1"); + responseData.put("last_page_url", baseUrl + "?page=" + pageInfo.getPages()); + responseData.put("next_page_url", pageInfo.isHasNextPage() ? + baseUrl + "?page=" + pageInfo.getNextPage() : null); + responseData.put("prev_page_url", pageInfo.isHasPreviousPage() ? + baseUrl + "?page=" + pageInfo.getPrePage() : null); + responseData.put("path", baseUrl); + + // 构建links数组 + List> links = new ArrayList<>(); + Map prevLink = new HashMap<>(); + prevLink.put("url", pageInfo.isHasPreviousPage() ? + baseUrl + "?page=" + pageInfo.getPrePage() : null); + prevLink.put("label", "« Previous"); + prevLink.put("active", false); + links.add(prevLink); + + Map nextLink = new HashMap<>(); + nextLink.put("url", pageInfo.isHasNextPage() ? + baseUrl + "?page=" + pageInfo.getNextPage() : null); + nextLink.put("label", "Next »"); + nextLink.put("active", false); + links.add(nextLink); + + responseData.put("links", links); + + return AppletControllerUtil.appletSuccess(responseData); + + } catch (Exception e) { + System.err.println("查询报价产品列表异常:" + e.getMessage()); + return AppletControllerUtil.appletError("查询报价产品列表失败:" + e.getMessage()); + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceCateController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceCateController.java index fe1a26a..a871f30 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceCateController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceCateController.java @@ -2,8 +2,8 @@ package com.ruoyi.system.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletRequest; -import com.ruoyi.system.domain.QuoteMaterialType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -24,7 +24,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** - * 服务分类Controller + * 服务分类Controller(二级分类管理) * * @author ruoyi * @date 2025-05-13 @@ -41,11 +41,23 @@ public class ServiceCateController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:ServiceCate:list')") @GetMapping("/list") - public TableDataInfo list(ServiceCate serviceCate) + public TableDataInfo list(ServiceCate serviceCate, HttpServletRequest request) { - startPage(); - List list = serviceCateService.selectServiceCateList(serviceCate); - return getDataTable(list); + // 如果pageSize大于1000,说明是要获取所有数据,不分页 + String pageSizeStr = request.getParameter("pageSize"); + if (pageSizeStr != null && Integer.parseInt(pageSizeStr) > 1000) { + // 不分页查询 + List list = serviceCateService.selectServiceCateList(serviceCate); + TableDataInfo dataTable = new TableDataInfo(); + dataTable.setRows(list); + dataTable.setTotal(list.size()); + return dataTable; + } else { + // 正常分页查询 + startPage(); + List list = serviceCateService.selectServiceCateList(serviceCate); + return getDataTable(list); + } } /** @@ -79,6 +91,28 @@ public class ServiceCateController extends BaseController @PostMapping public AjaxResult add(@RequestBody ServiceCate serviceCate) { + // 验证分类级别(只允许二级分类) + if (serviceCate.getParentId() == null) { + serviceCate.setParentId(0L); // 一级分类 + } else { + // 检查父级分类是否为一级分类 + ServiceCate parent = serviceCateService.selectServiceCateById(serviceCate.getParentId()); + if (parent == null) { + return error("父级分类不存在"); + } + if (parent.getParentId() != 0L) { + return error("只支持二级分类,不能在二级分类下创建子分类"); + } + } + + // 设置默认值 + if (serviceCate.getSort() == null) { + serviceCate.setSort(0L); + } + if (serviceCate.getBrowse() == null) { + serviceCate.setBrowse(0L); + } + return toAjax(serviceCateService.insertServiceCate(serviceCate)); } @@ -90,28 +124,56 @@ public class ServiceCateController extends BaseController @PutMapping public AjaxResult edit(@RequestBody ServiceCate serviceCate) { + // 不能将自己设为父级 + if (serviceCate.getId() != null && serviceCate.getId().equals(serviceCate.getParentId())) { + return error("不能将自己设为父级分类"); + } + + // 如果修改了父级分类,需要验证 + if (serviceCate.getParentId() != null && serviceCate.getParentId() != 0L) { + ServiceCate parent = serviceCateService.selectServiceCateById(serviceCate.getParentId()); + if (parent == null) { + return error("父级分类不存在"); + } + if (parent.getParentId() != 0L) { + return error("只支持二级分类,不能设置三级分类"); + } + } + return toAjax(serviceCateService.updateServiceCate(serviceCate)); } + /** - * 定时任务状态修改 + * 分类状态修改 */ @PreAuthorize("@ss.hasPermi('system:ServiceCate:changeStatus')") @Log(title = "修改状态", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody ServiceCate serviceCate) { - ServiceCate newserviceCate = serviceCateService.selectServiceCateById(serviceCate.getId()); - newserviceCate.setStatus(serviceCate.getStatus()); - return toAjax(serviceCateService.updateServiceCate(newserviceCate)); + ServiceCate newServiceCate = serviceCateService.selectServiceCateById(serviceCate.getId()); + newServiceCate.setStatus(serviceCate.getStatus()); + return toAjax(serviceCateService.updateServiceCate(newServiceCate)); } + /** * 删除服务分类 */ @PreAuthorize("@ss.hasPermi('system:ServiceCate:remove')") @Log(title = "服务分类", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { + // 检查是否有子分类 + for (Long id : ids) { + ServiceCate childQuery = new ServiceCate(); + childQuery.setParentId(id); + List children = serviceCateService.selectServiceCateList(childQuery); + if (children != null && children.size() > 0) { + ServiceCate parent = serviceCateService.selectServiceCateById(id); + return error("分类【" + parent.getTitle() + "】存在子分类,不能删除"); + } + } return toAjax(serviceCateService.deleteServiceCateByIds(ids)); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceGoodsController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceGoodsController.java index 0f26ad2..57f10fc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceGoodsController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ServiceGoodsController.java @@ -110,6 +110,9 @@ public class ServiceGoodsController extends BaseController { public AjaxResult add(@RequestBody ServiceGoods serviceGoods) { // 验证和处理基检现象数据格式 validateAndProcessBasicField(serviceGoods); + + // 处理一级和二级分类ID + processCategoryIds(serviceGoods); return toAjax(serviceGoodsService.insertServiceGoods(serviceGoods)); } @@ -123,6 +126,9 @@ public class ServiceGoodsController extends BaseController { public AjaxResult edit(@RequestBody ServiceGoods serviceGoods) { // 验证和处理基检现象数据格式 validateAndProcessBasicField(serviceGoods); + + // 处理一级和二级分类ID + processCategoryIds(serviceGoods); return toAjax(serviceGoodsService.updateServiceGoods(serviceGoods)); } @@ -201,4 +207,44 @@ public class ServiceGoodsController extends BaseController { } } } + + /** + * 处理一级和二级分类ID + * 根据选择的分类自动设置一级和二级分类ID + * 如果选择的是一级分类,则一级分类ID记录,二级分类ID设为0 + * 如果选择的是二级分类,则记录一级分类ID和二级分类ID + */ + private void processCategoryIds(ServiceGoods serviceGoods) { + Long cateId = serviceGoods.getCateId(); + if (cateId != null && cateId > 0) { + try { + // 查询当前选择的分类信息 + ServiceCate currentCate = serviceCateService.selectServiceCateById(cateId); + if (currentCate != null) { + // 判断是否为一级分类(parentId为null或0) + if (currentCate.getParentId() == null || currentCate.getParentId() == 0) { + // 选择的是一级分类 + serviceGoods.setFirstCateId(cateId); + serviceGoods.setSecondCateId(0L); + } else { + // 选择的是二级分类 + serviceGoods.setFirstCateId(currentCate.getParentId()); + serviceGoods.setSecondCateId(cateId); + } + } else { + // 分类不存在,设置为null + serviceGoods.setFirstCateId(null); + serviceGoods.setSecondCateId(null); + } + } catch (Exception e) { + // 异常情况下设置为null + serviceGoods.setFirstCateId(null); + serviceGoods.setSecondCateId(null); + } + } else { + // 没有选择分类 + serviceGoods.setFirstCateId(null); + serviceGoods.setSecondCateId(null); + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceCate.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceCate.java index 7e23a97..f46ceb7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceCate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceCate.java @@ -1,6 +1,7 @@ package com.ruoyi.system.domain; import java.util.Date; +import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -44,6 +45,13 @@ public class ServiceCate extends BaseEntity @Excel(name = "类型1:服务 2:商城") private Long type; + /** 父级分类ID */ + @Excel(name = "父级分类ID") + private Long parentId; + + /** 子分类列表 */ + private List children; + /** $column.columnComment */ @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private Date createdAt; @@ -126,6 +134,26 @@ public class ServiceCate extends BaseEntity return type; } + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Long getParentId() + { + return parentId; + } + + public void setChildren(List children) + { + this.children = children; + } + + public List getChildren() + { + return children; + } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; @@ -166,6 +194,7 @@ public class ServiceCate extends BaseEntity .append("status", getStatus()) .append("browse", getBrowse()) .append("type", getType()) + .append("parentId", getParentId()) .append("createdAt", getCreatedAt()) .append("updatedAt", getUpdatedAt()) .append("deletedAt", getDeletedAt()) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods.java index 7e406aa..ccdee0c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ServiceGoods.java @@ -94,6 +94,14 @@ public class ServiceGoods extends BaseEntity @Excel(name = "分类") private Long cateId; + /** 一级分类ID */ + @Excel(name = "一级分类ID") + private Long firstCateId; + + /** 二级分类ID */ + @Excel(name = "二级分类ID") + private Long secondCateId; + /** 分类 */ @Excel(name = "分类名称") private String cateName; @@ -377,6 +385,26 @@ private String cateName; return cateId; } + public void setFirstCateId(Long firstCateId) + { + this.firstCateId = firstCateId; + } + + public Long getFirstCateId() + { + return firstCateId; + } + + public void setSecondCateId(Long secondCateId) + { + this.secondCateId = secondCateId; + } + + public Long getSecondCateId() + { + return secondCateId; + } + public void setProject(String project) { this.project = project; diff --git a/ruoyi-system/src/main/resources/mapper/system/ServiceCateMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ServiceCateMapper.xml index 782c340..c36b70b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ServiceCateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ServiceCateMapper.xml @@ -12,13 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, title, icon, sort, status, browse, type, created_at, updated_at, deleted_at from service_cate + select id, title, icon, sort, status, browse, type, parent_id, created_at, updated_at, deleted_at from service_cate - - - @@ -67,6 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and created_at BETWEEN #{createdStart} AND #{createdEnd} and cate_id = #{cateId} + and first_cate_id = #{firstCateId} + and second_cate_id = #{secondCateId} and type = #{type} @@ -130,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" longitude, type, cate_id, + first_cate_id, + second_cate_id, project, sort, material, @@ -174,6 +180,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{longitude}, #{type}, #{cateId}, + #{firstCateId}, + #{secondCateId}, #{project}, #{sort}, #{material}, @@ -221,6 +229,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" longitude = #{longitude}, type = #{type}, cate_id = #{cateId}, + first_cate_id = #{firstCateId}, + second_cate_id = #{secondCateId}, project = #{project}, sort = #{sort}, material = #{material}, diff --git a/ruoyi-ui/src/api/system/ServiceCate.js b/ruoyi-ui/src/api/system/ServiceCate.js index e09c5ba..2dadc9e 100644 --- a/ruoyi-ui/src/api/system/ServiceCate.js +++ b/ruoyi-ui/src/api/system/ServiceCate.js @@ -53,3 +53,15 @@ export function delServiceCate(id) { method: 'delete' }) } + +// 获取所有分类列表(用于下拉选择,不分页) +export function getAllServiceCateList() { + return request({ + url: '/system/ServiceCate/list', + method: 'get', + params: { + pageNum: 1, + pageSize: 10000 // 设置大于1000的值,后端会返回所有数据不分页 + } + }) +} diff --git a/ruoyi-ui/src/views/system/AdvImg/index.vue b/ruoyi-ui/src/views/system/AdvImg/index.vue index 26dd584..101c865 100644 --- a/ruoyi-ui/src/views/system/AdvImg/index.vue +++ b/ruoyi-ui/src/views/system/AdvImg/index.vue @@ -19,7 +19,7 @@ /> - + 搜索 重置 @@ -86,9 +86,9 @@ - + - +