From 95d2ffaabf57edb2084204010e54d400c11c68df Mon Sep 17 00:00:00 2001 From: sunjianxi <839419401@qq.com> Date: Tue, 3 Mar 2026 16:30:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jinchao/controller/CatalogController.java | 29 ++++++ .../controller/WaterBillController.java | 12 +++ .../entity/OrderProjectProductEntity.java | 12 +++ .../modules/jinchao/pojo/vo/ProductVO.java | 4 + .../service/impl/ProductServiceImpl.java | 93 ++++++++++--------- 5 files changed, 104 insertions(+), 46 deletions(-) diff --git a/src/main/java/org/springblade/modules/jinchao/controller/CatalogController.java b/src/main/java/org/springblade/modules/jinchao/controller/CatalogController.java index 81f85a3..e2d5a7e 100644 --- a/src/main/java/org/springblade/modules/jinchao/controller/CatalogController.java +++ b/src/main/java/org/springblade/modules/jinchao/controller/CatalogController.java @@ -25,6 +25,7 @@ */ package org.springblade.modules.jinchao.controller; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; @@ -33,6 +34,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import jakarta.validation.Valid; +import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.annotation.IsAdmin; import org.springblade.core.mp.support.Condition; @@ -40,6 +42,10 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.modules.jinchao.constant.BaseCol; +import org.springblade.modules.jinchao.pojo.entity.OrderEntity; +import org.springblade.modules.jinchao.pojo.entity.OrderProjectProductEntity; +import org.springblade.modules.jinchao.service.IOrderProjectProductService; +import org.springblade.modules.jinchao.service.IOrderService; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -52,6 +58,7 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.excel.util.ExcelUtil; +import java.util.Arrays; import java.util.Map; import java.util.List; @@ -70,6 +77,8 @@ import jakarta.servlet.http.HttpServletResponse; public class CatalogController extends BladeController { private final ICatalogService catalogService; + private final IOrderProjectProductService orderProjectProductService; + private final IOrderService orderService; /** * [产品目录] 详情 @@ -135,6 +144,26 @@ public class CatalogController extends BladeController { if(catalog1 != null && Long.compare(catalog1.getId(),catalog.getId()) != 0){ return R.fail("简称已存在!"); } + List orderList = orderService.list(Wrappers.lambdaQuery().in(BaseEntity::getStatus, Arrays.asList(new Integer[]{1,2,3,4}))); + if(CollectionUtils.isNotEmpty(orderList)){ + for(OrderEntity order : orderList){ + List list1 = orderProjectProductService.list(Wrappers.lambdaQuery().eq(OrderProjectProductEntity::getCatalogOneId,catalog.getId()).eq(OrderProjectProductEntity::getOrderId,order.getId())); + if(CollectionUtils.isNotEmpty(list1)){ + for(OrderProjectProductEntity orderProjectProduct : list1){ + orderProjectProduct.setCatalogOne(catalog.getName()); + orderProjectProductService.updateById(orderProjectProduct); + } + } + List list2 = orderProjectProductService.list(Wrappers.lambdaQuery().eq(OrderProjectProductEntity::getCatalogTwoId,catalog.getId()).eq(OrderProjectProductEntity::getOrderId,order.getId())); + if(CollectionUtils.isNotEmpty(list2)){ + for(OrderProjectProductEntity orderProjectProduct : list2){ + orderProjectProduct.setCatalogTwo(catalog.getName()); + orderProjectProductService.updateById(orderProjectProduct); + } + } + } + } + return R.status(catalogService.updateById(catalog)); } diff --git a/src/main/java/org/springblade/modules/jinchao/controller/WaterBillController.java b/src/main/java/org/springblade/modules/jinchao/controller/WaterBillController.java index 73b0268..8978230 100644 --- a/src/main/java/org/springblade/modules/jinchao/controller/WaterBillController.java +++ b/src/main/java/org/springblade/modules/jinchao/controller/WaterBillController.java @@ -26,6 +26,8 @@ package org.springblade.modules.jinchao.controller; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -45,9 +47,11 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.modules.jinchao.excel.WaterBillExcel; import org.springblade.modules.jinchao.pojo.entity.OrderEntity; +import org.springblade.modules.jinchao.pojo.entity.RemittanceRecordEntity; import org.springblade.modules.jinchao.pojo.entity.WaterBillEntity; import org.springblade.modules.jinchao.pojo.vo.WaterBillVO; import org.springblade.modules.jinchao.service.IOrderService; +import org.springblade.modules.jinchao.service.IRemittanceRecordService; import org.springblade.modules.jinchao.service.IWaterBillService; import org.springblade.modules.jinchao.wrapper.WaterBillWrapper; import org.springblade.modules.system.pojo.entity.User; @@ -76,6 +80,7 @@ public class WaterBillController extends BladeController { private final IWaterBillService waterBillService; private final IOrderService orderService; + private final IRemittanceRecordService remittanceRecordService; /** * 水单表 详情 @@ -152,6 +157,13 @@ public class WaterBillController extends BladeController { @ApiOperationSupport(order = 7) @Operation(summary = "逻辑删除", description = "传入ids") public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { + List idList = Func.toLongList(ids); + for(Long id : idList){ + List remittanceRecordList = remittanceRecordService.list(Wrappers.lambdaQuery().eq(RemittanceRecordEntity::getWaterBillId,id)); + if(CollectionUtils.isNotEmpty(remittanceRecordList)){ + return R.fail("该水单已生成汇款记录,无法删除!"); + } + } return R.status(waterBillService.deleteLogic(Func.toLongList(ids))); } diff --git a/src/main/java/org/springblade/modules/jinchao/pojo/entity/OrderProjectProductEntity.java b/src/main/java/org/springblade/modules/jinchao/pojo/entity/OrderProjectProductEntity.java index acb2bb2..1a39ff2 100644 --- a/src/main/java/org/springblade/modules/jinchao/pojo/entity/OrderProjectProductEntity.java +++ b/src/main/java/org/springblade/modules/jinchao/pojo/entity/OrderProjectProductEntity.java @@ -127,4 +127,16 @@ public class OrderProjectProductEntity extends TenantEntity { */ @Schema(description = "倍率") private Double multiple; + + /** + * 产品大类id + */ + @Schema(description = "产品大类id") + private Long catalogOneId; + + /** + * 产品小类id + */ + @Schema(description = "产品小类id") + private Long catalogTwoId; } diff --git a/src/main/java/org/springblade/modules/jinchao/pojo/vo/ProductVO.java b/src/main/java/org/springblade/modules/jinchao/pojo/vo/ProductVO.java index ceb516f..a06f216 100644 --- a/src/main/java/org/springblade/modules/jinchao/pojo/vo/ProductVO.java +++ b/src/main/java/org/springblade/modules/jinchao/pojo/vo/ProductVO.java @@ -97,4 +97,8 @@ public class ProductVO extends ProductEntity { private String startTime; private String endTime; + + private Long catalogOneId; + + private Long catalogTwoId; } diff --git a/src/main/java/org/springblade/modules/jinchao/service/impl/ProductServiceImpl.java b/src/main/java/org/springblade/modules/jinchao/service/impl/ProductServiceImpl.java index 042e376..fdb36b8 100644 --- a/src/main/java/org/springblade/modules/jinchao/service/impl/ProductServiceImpl.java +++ b/src/main/java/org/springblade/modules/jinchao/service/impl/ProductServiceImpl.java @@ -147,6 +147,8 @@ public class ProductServiceImpl extends BaseServiceImpl pagesVO = Condition.getPage(query); pagesVO.setRecords(listVO); pagesVO.setSize(listVO.size()); - if(user.getRoleName().equals("administrator")){ - // 迭代器去添加元素。 - ListIterator it = pagesVO.getRecords().listIterator(); - while (it.hasNext()) { - ProductVO vo1 = it.next(); - // 默认 - vo1.setBizType(ProductConst.BIZ_TYPE_PRICE_STANDARD); - // TYPE_PRICE_CUSTOM 数据是拼接上的 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); - wrapper.eq(BizPriceEntity::getProductId,vo1.getId()); - if(customerId != null){ - wrapper.eq(BizPriceEntity::getCustomerId,customerId); - } - long count = bizPriceService.count(wrapper); - if (count != 0L) { - List listBP = bizPriceService.listByProductId(vo1.getId(),customerId); - listBP.forEach(bp -> { - ProductVO vo2 = new ProductVO(); - BeanUtils.copyProperties(vo1, vo2); - BeanUtils.copyProperties(bp, vo2); - vo2.setId(vo1.getId()); - // 特定价 - vo2.setBizType(ProductConst.BIZ_TYPE_PRICE_CUSTOM); - vo2.setBizPriceId(bp.getId()); - vo2.setStandardPrice(bp.getBizPrice()); - // - CustomerEntity customer = customerService.getById(bp.getCustomerId()); - if (customer != null) { - String countryValue = dictService.getValue(ContactConst.DICT_CUSTOMER_COUNTRY, customer.getCountry()); - String sbRemark = - countryValue + - customer.getCompanyName() + - "专用"; - vo2.setBizRemark(sbRemark); - vo2.setCustomerCompanyName(customer.getCompanyName()); - } - { - User u = userService.getById(vo2.getSaleUserId()); - if (u != null) { - vo2.setSaleUserRealName(u.getRealName()); - } + // 迭代器去添加元素。 + ListIterator it = pagesVO.getRecords().listIterator(); + while (it.hasNext()) { + ProductVO vo1 = it.next(); + // 默认 + vo1.setBizType(ProductConst.BIZ_TYPE_PRICE_STANDARD); + // TYPE_PRICE_CUSTOM 数据是拼接上的 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.eq(BizPriceEntity::getProductId,vo1.getId()); + if(customerId != null){ + wrapper.eq(BizPriceEntity::getCustomerId,customerId); + } + long count = bizPriceService.count(wrapper); + if (count != 0L) { + it.remove(); + List listBP = bizPriceService.listByProductId(vo1.getId(),customerId); + listBP.forEach(bp -> { + ProductVO vo2 = new ProductVO(); + BeanUtils.copyProperties(vo1, vo2); + BeanUtils.copyProperties(bp, vo2); + vo2.setId(vo1.getId()); + // 特定价 + vo2.setBizType(ProductConst.BIZ_TYPE_PRICE_CUSTOM); + vo2.setBizPriceId(bp.getId()); + vo2.setStandardPrice(bp.getBizPrice()); + // + CustomerEntity customer = customerService.getById(bp.getCustomerId()); + if (customer != null) { + String countryValue = dictService.getValue(ContactConst.DICT_CUSTOMER_COUNTRY, customer.getCountry()); + String sbRemark = + countryValue + + customer.getCompanyName() + + "专用"; + vo2.setBizRemark(sbRemark); + vo2.setCustomerCompanyName(customer.getCompanyName()); + } + { + User u = userService.getById(vo2.getSaleUserId()); + if (u != null) { + vo2.setSaleUserRealName(u.getRealName()); } - it.add(vo2); - }); - } else { - log.info("not contain."); - } + } + it.add(vo2); + }); + } else { + log.info("not contain."); } }