diff --git a/admin-pc/src/utils/request.js b/admin-pc/src/utils/request.js index f7ea2fe..4a4f7c9 100644 --- a/admin-pc/src/utils/request.js +++ b/admin-pc/src/utils/request.js @@ -17,7 +17,7 @@ let apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot"; const service = axios.create({ //baseURL: '/jeecg-boot', baseURL: apiBaseUrl, // api base_url - timeout: 9000 // 请求超时时间 + timeout: 9000000 // 请求超时时间 }) const err = (error) => { diff --git a/admin-pc/src/views/applet/shop/CommonShopList.vue b/admin-pc/src/views/applet/shop/CommonShopList.vue new file mode 100644 index 0000000..167ed2a --- /dev/null +++ b/admin-pc/src/views/applet/shop/CommonShopList.vue @@ -0,0 +1,253 @@ + + + + \ No newline at end of file diff --git a/admin-pc/src/views/applet/shop/modules/BrandSelectModal.vue b/admin-pc/src/views/applet/shop/modules/BrandSelectModal.vue new file mode 100644 index 0000000..963ed50 --- /dev/null +++ b/admin-pc/src/views/applet/shop/modules/BrandSelectModal.vue @@ -0,0 +1,495 @@ + + + + + \ No newline at end of file diff --git a/admin-pc/src/views/applet/shop/modules/CommonShopForm.vue b/admin-pc/src/views/applet/shop/modules/CommonShopForm.vue new file mode 100644 index 0000000..cc62dc7 --- /dev/null +++ b/admin-pc/src/views/applet/shop/modules/CommonShopForm.vue @@ -0,0 +1,286 @@ + + + \ No newline at end of file diff --git a/admin-pc/src/views/applet/shop/modules/CommonShopModal.Style#Drawer.vue b/admin-pc/src/views/applet/shop/modules/CommonShopModal.Style#Drawer.vue new file mode 100644 index 0000000..743282e --- /dev/null +++ b/admin-pc/src/views/applet/shop/modules/CommonShopModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/admin-pc/src/views/applet/shop/modules/CommonShopModal.vue b/admin-pc/src/views/applet/shop/modules/CommonShopModal.vue new file mode 100644 index 0000000..07bbe8b --- /dev/null +++ b/admin-pc/src/views/applet/shop/modules/CommonShopModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletClassServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletClassServiceImpl.java index cbe9fad..17dd36f 100644 --- a/module-common/src/main/java/org/jeecg/api/service/impl/AppletClassServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletClassServiceImpl.java @@ -9,6 +9,8 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.config.shiro.ShiroRealm; import org.jeecg.modules.commonAddress.service.ICommonAddressService; import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductPriceService; import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductService; import org.jeecg.modules.commonShop.entity.CommonShop; import org.jeecg.modules.commonShop.service.ICommonShopService; @@ -19,6 +21,7 @@ import org.jeecg.modules.commonVip.service.ICommonVipService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; @Service @@ -37,6 +40,8 @@ public class AppletClassServiceImpl implements AppletClassService { private ICommonVipService commonVipService; @Resource private ICommonBrandProductService commonBrandProductService; + @Resource + private ICommonBrandProductPriceService commonBrandProductPriceService; //获取价格预览分类列表 @Override @@ -99,11 +104,24 @@ public class AppletClassServiceImpl implements AppletClassService { @Override public Result getGoodsBrandProduct(String productId, String brandId) { - return Result.ok(commonBrandProductService.lambdaQuery() - .eq(CommonBrandProduct::getBrandId, brandId) + + CommonVip byId = commonVipService.getById(brandId); + + if (byId == null || StringUtils.isBlank(byId.getBrandCategory())){ + return Result.ok(new ArrayList<>()); + } + + List list = commonBrandProductService.lambdaQuery() .eq(CommonBrandProduct::getShopId, productId) - .list()); + .list(); + + for (CommonBrandProduct brandProduct : list) { + commonBrandProductPriceService.buildBrandProductPrice(brandProduct, byId.getBrandCategory()); + } + + return Result.ok(list); } + } diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java index 541d8cf..5d2cea8 100644 --- a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderServiceImpl.java @@ -16,6 +16,7 @@ import org.jeecg.modules.commonAddress.entity.CommonAddress; import org.jeecg.modules.commonAddress.service.ICommonAddressService; import org.jeecg.modules.commonAdminOrderBrowseRecord.entity.CommonAdminOrderBrowseRecord; import org.jeecg.modules.commonAdminOrderBrowseRecord.service.ICommonAdminOrderBrowseRecordService; +import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductPriceService; import org.jeecg.modules.commonConfig.service.ICommonConfigService; import org.jeecg.modules.commonMoneyLog.service.ICommonMoneyLogService; import org.jeecg.modules.commonOrder.entity.CommonOrder; @@ -80,6 +81,8 @@ public class AppletOrderServiceImpl implements AppletOrderService { private ILogisticsTrajectoryService logisticsTrajectoryService; @Autowired private ICommonBrandProductService commonBrandProductService; + @Resource + private ICommonBrandProductPriceService commonBrandProductPriceService; @Resource @@ -314,9 +317,14 @@ public class AppletOrderServiceImpl implements AppletOrderService { if (StringUtils.isNotBlank(sku.getStyleId())) { // 查询款式信息 CommonBrandProduct brandProduct = commonBrandProductService.getById(sku.getStyleId()); + CommonVip vip = commonVipService.getById(sku.getPinId()); + if (vip != null && StringUtils.isNotBlank(vip.getBrandCategory())){ + commonBrandProductPriceService.buildBrandProductPrice(brandProduct, vip.getBrandCategory()); + } if (brandProduct != null) { unitMinPrice = brandProduct.getMinPrice(); unitMaxPrice = brandProduct.getMaxPrice(); + sku.setImage(brandProduct.getImage()); log.info("使用款式价格计算,款式ID: {}, 最低价格: {}, 最高价格: {}", sku.getStyleId(), unitMinPrice, unitMaxPrice); } else { @@ -325,6 +333,7 @@ public class AppletOrderServiceImpl implements AppletOrderService { unitMaxPrice = commonShop.getMaxPrice(); } } else { + sku.setImage(commonShop.getImage()); // 使用商品价格 unitMinPrice = commonShop.getPrice(); unitMaxPrice = commonShop.getMaxPrice(); @@ -365,7 +374,6 @@ public class AppletOrderServiceImpl implements AppletOrderService { sku.setHasChild("1"); sku.setShopId(commonShop.getId()); sku.setTitle(commonShop.getName()); - sku.setImage(commonShop.getImage()); sku.setDetails(commonShop.getService()); sku.setShopClass(commonShop.getShopClass()); sku.setCreateTime(new Date()); diff --git a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderTeamServiceImpl.java b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderTeamServiceImpl.java index b6232a2..a75f82e 100644 --- a/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderTeamServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/api/service/impl/AppletOrderTeamServiceImpl.java @@ -566,8 +566,21 @@ public class AppletOrderTeamServiceImpl implements AppletOrderTeamService { if (StringUtils.isNotBlank(orderReq.getShopId())){ CommonShop shop = commonShopService.getById(orderReq.getShopId()); if (shop != null) { + + if (StringUtils.isNotBlank(orderReq.getStyleId())) { + // 查询款式信息 + CommonBrandProduct brandProduct = commonBrandProductService.getById(orderReq.getStyleId()); + if (brandProduct != null) { + orderReq.setImage(brandProduct.getImage()); + } else { + orderReq.setImage(shop.getImage()); + } + }else { + orderReq.setImage(shop.getImage()); + } + orderReq.setUnit(shop.getUnit()); - orderReq.setImage(shop.getImage()); + //orderReq.setImage(shop.getImage()); orderReq.setTitle(shop.getName()); orderReq.setDetails(shop.getService()); orderReq.setShopClass(shop.getShopClass()); diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/controller/CommonBrandProductController.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/controller/CommonBrandProductController.java index f5fad14..2edd30a 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/controller/CommonBrandProductController.java +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/controller/CommonBrandProductController.java @@ -1,36 +1,42 @@ package org.jeecg.modules.commonBrandProduct.controller; +import java.io.UnsupportedEncodingException; +import java.io.IOException; +import java.net.URLDecoder; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; -import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductService; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.extern.slf4j.Slf4j; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.vo.LoginUser; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.vo.CommonBrandProductPage; +import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductService; +import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductPriceService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -39,16 +45,18 @@ import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: 品牌款式 * @Author: jeecg-boot - * @Date: 2025-08-25 + * @Date: 2025-08-28 * @Version: V1.0 */ @Api(tags="品牌款式") @RestController @RequestMapping("/commonBrandProduct/commonBrandProduct") @Slf4j -public class CommonBrandProductController extends JeecgController { +public class CommonBrandProductController { @Autowired private ICommonBrandProductService commonBrandProductService; + @Autowired + private ICommonBrandProductPriceService commonBrandProductPriceService; /** * 分页列表查询 @@ -75,28 +83,36 @@ public class CommonBrandProductController extends JeecgController add(@RequestBody CommonBrandProduct commonBrandProduct) { - commonBrandProductService.save(commonBrandProduct); + public Result add(@RequestBody CommonBrandProductPage commonBrandProductPage) { + CommonBrandProduct commonBrandProduct = new CommonBrandProduct(); + BeanUtils.copyProperties(commonBrandProductPage, commonBrandProduct); + commonBrandProductService.saveMain(commonBrandProduct, commonBrandProductPage.getCommonBrandProductPriceList()); return Result.OK("添加成功!"); } /** * 编辑 * - * @param commonBrandProduct + * @param commonBrandProductPage * @return */ @AutoLog(value = "品牌款式-编辑") @ApiOperation(value="品牌款式-编辑", notes="品牌款式-编辑") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result edit(@RequestBody CommonBrandProduct commonBrandProduct) { - commonBrandProductService.updateById(commonBrandProduct); + public Result edit(@RequestBody CommonBrandProductPage commonBrandProductPage) { + CommonBrandProduct commonBrandProduct = new CommonBrandProduct(); + BeanUtils.copyProperties(commonBrandProductPage, commonBrandProduct); + CommonBrandProduct commonBrandProductEntity = commonBrandProductService.getById(commonBrandProduct.getId()); + if(commonBrandProductEntity==null) { + return Result.error("未找到对应数据"); + } + commonBrandProductService.updateMain(commonBrandProduct, commonBrandProductPage.getCommonBrandProductPriceList()); return Result.OK("编辑成功!"); } @@ -110,7 +126,7 @@ public class CommonBrandProductController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { - commonBrandProductService.removeById(id); + commonBrandProductService.delMain(id); return Result.OK("删除成功!"); } @@ -124,8 +140,8 @@ public class CommonBrandProductController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.commonBrandProductService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); + this.commonBrandProductService.delBatchMain(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); } /** @@ -143,6 +159,21 @@ public class CommonBrandProductController extends JeecgController> queryCommonBrandProductPriceListByMainId(@RequestParam(name="id",required=true) String id) { + List commonBrandProductPriceList = commonBrandProductPriceService.selectByMainId(id); + return Result.OK(commonBrandProductPriceList); } /** @@ -153,11 +184,43 @@ public class CommonBrandProductController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(commonBrandProduct, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //Step.2 获取导出数据 + List queryList = commonBrandProductService.list(queryWrapper); + // 过滤选中数据 + String selections = request.getParameter("selections"); + List commonBrandProductList = new ArrayList(); + if(oConvertUtils.isEmpty(selections)) { + commonBrandProductList = queryList; + }else { + List selectionList = Arrays.asList(selections.split(",")); + commonBrandProductList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); + } + + // Step.3 组装pageList + List pageList = new ArrayList(); + for (CommonBrandProduct main : commonBrandProductList) { + CommonBrandProductPage vo = new CommonBrandProductPage(); + BeanUtils.copyProperties(main, vo); + List commonBrandProductPriceList = commonBrandProductPriceService.selectByMainId(main.getId()); + vo.setCommonBrandProductPriceList(commonBrandProductPriceList); + pageList.add(vo); + } + + // Step.4 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "品牌款式列表"); + mv.addObject(NormalExcelConstants.CLASS, CommonBrandProductPage.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("品牌款式数据", "导出人:"+sysUser.getRealname(), "品牌款式")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; } /** - * 通过excel导入数据 + * 通过excel导入数据 * * @param request * @param response @@ -165,7 +228,34 @@ public class CommonBrandProductController extends JeecgController importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, CommonBrandProduct.class); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), CommonBrandProductPage.class, params); + for (CommonBrandProductPage page : list) { + CommonBrandProduct po = new CommonBrandProduct(); + BeanUtils.copyProperties(page, po); + commonBrandProductService.saveMain(po, page.getCommonBrandProductPriceList()); + } + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + log.error(e.getMessage(),e); + return Result.error("文件导入失败:"+e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.OK("文件导入失败!"); } } diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProduct.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProduct.java index a34d04e..7c45bc9 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProduct.java +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProduct.java @@ -3,7 +3,6 @@ package org.jeecg.modules.commonBrandProduct.entity; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.Date; -import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -14,20 +13,16 @@ import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; /** * @Description: 品牌款式 * @Author: jeecg-boot - * @Date: 2025-08-25 + * @Date: 2025-08-28 * @Version: V1.0 */ +@ApiModel(value="common_brand_product对象", description="品牌款式") @Data @TableName("common_brand_product") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="common_brand_product对象", description="品牌款式") public class CommonBrandProduct implements Serializable { private static final long serialVersionUID = 1L; @@ -58,22 +53,22 @@ public class CommonBrandProduct implements Serializable { @Excel(name = "款式图片", width = 15) @ApiModelProperty(value = "款式图片") private java.lang.String image; - /**最低价格*/ - @Excel(name = "最低价格", width = 15) - @ApiModelProperty(value = "最低价格") + /**默认最低价格*/ + @Excel(name = "默认最低价格", width = 15) + @ApiModelProperty(value = "默认最低价格") private java.math.BigDecimal minPrice; - /**最高价格*/ - @Excel(name = "最高价格", width = 15) - @ApiModelProperty(value = "最高价格") + /**默认最高价格*/ + @Excel(name = "默认最高价格", width = 15) + @ApiModelProperty(value = "默认最高价格") private java.math.BigDecimal maxPrice; - /**品牌*/ - @Excel(name = "品牌", width = 15, dictTable = "common_vip", dicText = "name", dicCode = "id") - @Dict(dictTable = "common_vip", dicText = "name", dicCode = "id") - @ApiModelProperty(value = "品牌") + /**品牌分类*/ + @Excel(name = "品牌分类", width = 15, dictTable = "common_brand_category", dicText = "name", dicCode = "id") + @Dict(dictTable = "common_brand_category", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "品牌分类") private java.lang.String brandId; /**商品*/ @Excel(name = "商品", width = 15, dictTable = "common_shop", dicText = "name", dicCode = "id") - @Dict(dictTable = "common_shop", dicText = "name", dicCode = "id") + @Dict(dictTable = "common_shop", dicText = "name", dicCode = "id") @ApiModelProperty(value = "商品") private java.lang.String shopId; } diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProductPrice.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProductPrice.java new file mode 100644 index 0000000..5f5bf0e --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/entity/CommonBrandProductPrice.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.commonBrandProduct.entity; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import java.util.Date; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.UnsupportedEncodingException; + +/** + * @Description: 款式价格配置 + * @Author: jeecg-boot + * @Date: 2025-08-28 + * @Version: V1.0 + */ +@ApiModel(value="common_brand_product_price对象", description="款式价格配置") +@Data +@TableName("common_brand_product_price") +public class CommonBrandProductPrice implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**最低价格*/ + @Excel(name = "最低价格", width = 15) + @ApiModelProperty(value = "最低价格") + private java.math.BigDecimal minPrice; + /**最高价格*/ + @Excel(name = "最高价格", width = 15) + @ApiModelProperty(value = "最高价格") + private java.math.BigDecimal maxPrice; + /**款式*/ + @ApiModelProperty(value = "款式") + private java.lang.String styleId; + /**品牌分类*/ + @Excel(name = "品牌分类", width = 15, dictTable = "common_brand_category", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "品牌分类") + private java.lang.String brandCategoryId; +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductMapper.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductMapper.java index 6a2b8fa..18b6810 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductMapper.java +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductMapper.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: 品牌款式 * @Author: jeecg-boot - * @Date: 2025-08-25 + * @Date: 2025-08-28 * @Version: V1.0 */ public interface CommonBrandProductMapper extends BaseMapper { diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductPriceMapper.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductPriceMapper.java new file mode 100644 index 0000000..d5a197b --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/CommonBrandProductPriceMapper.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.commonBrandProduct.mapper; + +import java.util.List; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Description: 款式价格配置 + * @Author: jeecg-boot + * @Date: 2025-08-28 + * @Version: V1.0 + */ +public interface CommonBrandProductPriceMapper extends BaseMapper { + + public boolean deleteByMainId(@Param("mainId") String mainId); + + public List selectByMainId(@Param("mainId") String mainId); +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/xml/CommonBrandProductPriceMapper.xml b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/xml/CommonBrandProductPriceMapper.xml new file mode 100644 index 0000000..f4558d5 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/mapper/xml/CommonBrandProductPriceMapper.xml @@ -0,0 +1,16 @@ + + + + + + DELETE + FROM common_brand_product_price + WHERE + style_id = #{mainId} + + + diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductPriceService.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductPriceService.java new file mode 100644 index 0000000..381a6f9 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductPriceService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.commonBrandProduct.service; + +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 款式价格配置 + * @Author: jeecg-boot + * @Date: 2025-08-28 + * @Version: V1.0 + */ +public interface ICommonBrandProductPriceService extends IService { + + public List selectByMainId(String mainId); + + public void buildBrandProductPrice(CommonBrandProduct brandProduct, String brandCategory); +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductService.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductService.java index d505481..81f90c3 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductService.java +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/ICommonBrandProductService.java @@ -1,14 +1,40 @@ package org.jeecg.modules.commonBrandProduct.service; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; import com.baomidou.mybatisplus.extension.service.IService; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; /** * @Description: 品牌款式 * @Author: jeecg-boot - * @Date: 2025-08-25 + * @Date: 2025-08-28 * @Version: V1.0 */ public interface ICommonBrandProductService extends IService { + /** + * 添加一对多 + * + */ + public void saveMain(CommonBrandProduct commonBrandProduct,List commonBrandProductPriceList) ; + + /** + * 修改一对多 + * + */ + public void updateMain(CommonBrandProduct commonBrandProduct,List commonBrandProductPriceList); + + /** + * 删除一对多 + */ + public void delMain (String id); + + /** + * 批量删除一对多 + */ + public void delBatchMain (Collection idList); + } diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductPriceServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductPriceServiceImpl.java new file mode 100644 index 0000000..e3cdf04 --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductPriceServiceImpl.java @@ -0,0 +1,60 @@ +package org.jeecg.modules.commonBrandProduct.service.impl; + +import lombok.extern.log4j.Log4j2; +import org.apache.commons.lang.StringUtils; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import org.jeecg.modules.commonBrandProduct.mapper.CommonBrandProductPriceMapper; +import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductPriceService; +import org.springframework.stereotype.Service; +import java.util.List; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description: 款式价格配置 + * @Author: jeecg-boot + * @Date: 2025-08-28 + * @Version: V1.0 + */ +@Log4j2 +@Service +public class CommonBrandProductPriceServiceImpl extends ServiceImpl implements ICommonBrandProductPriceService { + + @Autowired + private CommonBrandProductPriceMapper commonBrandProductPriceMapper; + + @Override + public List selectByMainId(String mainId) { + return commonBrandProductPriceMapper.selectByMainId(mainId); + } + + @Override + public void buildBrandProductPrice(CommonBrandProduct brandProduct, String brandCategory){ + + if (brandProduct == null || StringUtils.isBlank(brandCategory)){ + log.warn("品牌款式的价格配置失败 款式:{} 品牌分类: {}", brandProduct, brandCategory); + return; + } + + log.info("使用品牌款式下的价格配置 款式ID:{} 品牌分类: {}", brandProduct.getId(), brandCategory); + + List prices = lambdaQuery() + .eq(CommonBrandProductPrice::getBrandCategoryId, brandCategory) + .eq(CommonBrandProductPrice::getStyleId, brandProduct.getId()) + .list(); + + brandProduct.setBrandId(brandCategory); + if (prices.size() > 0){ + CommonBrandProductPrice price = prices.get(0); + if (price.getMinPrice() != null){ + log.info("设置最低价格: {}", price.getMinPrice()); + brandProduct.setMinPrice(price.getMinPrice()); + } + if (price.getMaxPrice() != null){ + log.info("设置最高价格: {}", price.getMaxPrice()); + brandProduct.setMaxPrice(price.getMaxPrice()); + } + } + } +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductServiceImpl.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductServiceImpl.java index 7dd6c55..f1f6ae6 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductServiceImpl.java +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/service/impl/CommonBrandProductServiceImpl.java @@ -1,19 +1,77 @@ package org.jeecg.modules.commonBrandProduct.service.impl; import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import org.jeecg.modules.commonBrandProduct.mapper.CommonBrandProductPriceMapper; import org.jeecg.modules.commonBrandProduct.mapper.CommonBrandProductMapper; import org.jeecg.modules.commonBrandProduct.service.ICommonBrandProductService; import org.springframework.stereotype.Service; - import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import java.io.Serializable; +import java.util.List; +import java.util.Collection; /** * @Description: 品牌款式 * @Author: jeecg-boot - * @Date: 2025-08-25 + * @Date: 2025-08-28 * @Version: V1.0 */ @Service public class CommonBrandProductServiceImpl extends ServiceImpl implements ICommonBrandProductService { + @Autowired + private CommonBrandProductMapper commonBrandProductMapper; + @Autowired + private CommonBrandProductPriceMapper commonBrandProductPriceMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveMain(CommonBrandProduct commonBrandProduct, List commonBrandProductPriceList) { + commonBrandProductMapper.insert(commonBrandProduct); + if(commonBrandProductPriceList!=null && commonBrandProductPriceList.size()>0) { + for(CommonBrandProductPrice entity:commonBrandProductPriceList) { + //外键设置 + entity.setStyleId(commonBrandProduct.getId()); + commonBrandProductPriceMapper.insert(entity); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateMain(CommonBrandProduct commonBrandProduct,List commonBrandProductPriceList) { + commonBrandProductMapper.updateById(commonBrandProduct); + + //1.先删除子表数据 + commonBrandProductPriceMapper.deleteByMainId(commonBrandProduct.getId()); + + //2.子表数据重新插入 + if(commonBrandProductPriceList!=null && commonBrandProductPriceList.size()>0) { + for(CommonBrandProductPrice entity:commonBrandProductPriceList) { + //外键设置 + entity.setStyleId(commonBrandProduct.getId()); + commonBrandProductPriceMapper.insert(entity); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delMain(String id) { + commonBrandProductPriceMapper.deleteByMainId(id); + commonBrandProductMapper.deleteById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delBatchMain(Collection idList) { + for(Serializable id:idList) { + commonBrandProductPriceMapper.deleteByMainId(id.toString()); + commonBrandProductMapper.deleteById(id); + } + } + } diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vo/CommonBrandProductPage.java b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vo/CommonBrandProductPage.java new file mode 100644 index 0000000..63e534f --- /dev/null +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vo/CommonBrandProductPage.java @@ -0,0 +1,76 @@ +package org.jeecg.modules.commonBrandProduct.vo; + +import java.util.List; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProduct; +import org.jeecg.modules.commonBrandProduct.entity.CommonBrandProductPrice; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelEntity; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 品牌款式 + * @Author: jeecg-boot + * @Date: 2025-08-28 + * @Version: V1.0 + */ +@Data +@ApiModel(value="common_brand_productPage对象", description="品牌款式") +public class CommonBrandProductPage { + + /**主键*/ + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**款式名称*/ + @Excel(name = "款式名称", width = 15) + @ApiModelProperty(value = "款式名称") + private java.lang.String name; + /**款式图片*/ + @Excel(name = "款式图片", width = 15) + @ApiModelProperty(value = "款式图片") + private java.lang.String image; + /**默认最低价格*/ + @Excel(name = "默认最低价格", width = 15) + @ApiModelProperty(value = "默认最低价格") + private java.math.BigDecimal minPrice; + /**默认最高价格*/ + @Excel(name = "默认最高价格", width = 15) + @ApiModelProperty(value = "默认最高价格") + private java.math.BigDecimal maxPrice; + /**品牌分类*/ + @Excel(name = "品牌分类", width = 15, dictTable = "common_brand_category", dicText = "name", dicCode = "id") + @Dict(dictTable = "common_brand_category", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "品牌分类") + private java.lang.String brandId; + /**商品*/ + @Excel(name = "商品", width = 15, dictTable = "common_shop", dicText = "name", dicCode = "id") + @Dict(dictTable = "common_shop", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "商品") + private java.lang.String shopId; + + @ExcelCollection(name="款式价格配置") + @ApiModelProperty(value = "款式价格配置") + private List commonBrandProductPriceList; + +} diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/CommonBrandProductList.vue b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/CommonBrandProductList.vue index ce355af..444d0b1 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/CommonBrandProductList.vue +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/CommonBrandProductList.vue @@ -4,31 +4,11 @@
- - - - - - - - - - - - - 查询 - 重置 - - {{ toggleSearchStatus ? '收起' : '展开' }} - - - -
- +
新增 @@ -56,15 +36,15 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/modules/CommonBrandProductModal.vue b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/modules/CommonBrandProductModal.vue index fb2711d..8024f44 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/modules/CommonBrandProductModal.vue +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue/modules/CommonBrandProductModal.vue @@ -1,26 +1,27 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.api.ts b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.api.ts index fa9937e..917f912 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.api.ts +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.api.ts @@ -9,16 +9,23 @@ enum Api { deleteBatch = '/commonBrandProduct/commonBrandProduct/deleteBatch', importExcel = '/commonBrandProduct/commonBrandProduct/importExcel', exportXls = '/commonBrandProduct/commonBrandProduct/exportXls', + commonBrandProductPriceList = '/commonBrandProduct/commonBrandProduct/queryCommonBrandProductPriceByMainId', } /** * 导出api * @param params */ export const getExportUrl = Api.exportXls; + /** * 导入api */ export const getImportUrl = Api.importExcel; +/** + * 查询子表数据 + * @param params + */ +export const commonBrandProductPriceList = Api.commonBrandProductPriceList; /** * 列表接口 * @param params diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.data.ts b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.data.ts index 2ad6e82..5f31dbf 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.data.ts +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProduct.data.ts @@ -2,6 +2,7 @@ import {BasicColumn} from '/@/components/Table'; import {FormSchema} from '/@/components/Table'; import { rules} from '/@/utils/helper/validator'; import { render } from '/@/utils/common/renderUtils'; +import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types' //列表数据 export const columns: BasicColumn[] = [ { @@ -12,23 +13,19 @@ export const columns: BasicColumn[] = [ { title: '款式图片', align:"center", - dataIndex: 'image' + dataIndex: 'image', + customRender:render.renderAvatar, }, { - title: '最低价格', + title: '默认最低价格', align:"center", dataIndex: 'minPrice' }, { - title: '最高价格', + title: '默认最高价格', align:"center", dataIndex: 'maxPrice' }, - { - title: '品牌', - align:"center", - dataIndex: 'brandId_dictText' - }, { title: '商品', align:"center", @@ -37,24 +34,6 @@ export const columns: BasicColumn[] = [ ]; //查询数据 export const searchFormSchema: FormSchema[] = [ - { - label: "品牌", - field: "brandId", - component: 'JSearchSelect', - componentProps:{ - dict:"common_vip,name,id" - }, - colProps: {span: 6}, - }, - { - label: "商品", - field: "shopId", - component: 'JSearchSelect', - componentProps:{ - dict:"common_shop,name,id" - }, - colProps: {span: 6}, - }, ]; //表单数据 export const formSchema: FormSchema[] = [ @@ -66,26 +45,20 @@ export const formSchema: FormSchema[] = [ { label: '款式图片', field: 'image', - component: 'Input', + component: 'JImageUpload', + componentProps:{ + }, }, { - label: '最低价格', + label: '默认最低价格', field: 'minPrice', component: 'InputNumber', }, { - label: '最高价格', + label: '默认最高价格', field: 'maxPrice', component: 'InputNumber', }, - { - label: '品牌', - field: 'brandId', - component: 'JSearchSelect', - componentProps:{ - dict:"common_vip,name,id" - }, - }, { label: '商品', field: 'shopId', @@ -95,3 +68,32 @@ export const formSchema: FormSchema[] = [ }, }, ]; +//子表单数据 +//子表表格配置 +export const commonBrandProductPriceColumns: JVxeColumn[] = [ + { + title: '最低价格', + key: 'minPrice', + type: JVxeTypes.input, + width:"200px", + placeholder: '请输入${title}', + defaultValue:'', + }, + { + title: '最高价格', + key: 'maxPrice', + type: JVxeTypes.input, + width:"200px", + placeholder: '请输入${title}', + defaultValue:'', + }, + { + title: '品牌分类', + key: 'brandCategoryId', + type: JVxeTypes.selectSearch, + dictCode:"common_brand_category,name,id", + width:"200px", + placeholder: '请输入${title}', + defaultValue:'', + }, + ] diff --git a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProductList.vue b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProductList.vue index 41780ec..0a67ad4 100644 --- a/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProductList.vue +++ b/module-common/src/main/java/org/jeecg/modules/commonBrandProduct/vue3/CommonBrandProductList.vue @@ -42,15 +42,15 @@