|
|
@@ -16,22 +16,17 @@
|
|
|
*/
|
|
|
package org.springblade.salesPart.goods.controller;
|
|
|
|
|
|
-import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.validation.Valid;
|
|
|
-
|
|
|
-import org.springblade.client.entity.GoodsDesc;
|
|
|
-import org.springblade.client.entity.GoodsType;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
@@ -41,20 +36,22 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
-import org.springblade.salesPart.entity.*;
|
|
|
-import org.springblade.salesPart.excel.CorpsDescExportExcel;
|
|
|
+import org.springblade.salesPart.corps.service.ICorpsDescService;
|
|
|
+import org.springblade.salesPart.entity.PjCorpsDesc;
|
|
|
+import org.springblade.salesPart.entity.PjGoodsDesc;
|
|
|
+import org.springblade.salesPart.entity.PjGoodsType;
|
|
|
+import org.springblade.salesPart.entity.PjProductLaunch;
|
|
|
import org.springblade.salesPart.excel.GoodsDescExportExcel;
|
|
|
import org.springblade.salesPart.excel.GoodsExcel;
|
|
|
+import org.springblade.salesPart.goods.service.IGoodsDescService;
|
|
|
import org.springblade.salesPart.goods.service.IGoodsTypeService;
|
|
|
-import org.springblade.system.entity.Dept;
|
|
|
-import org.springblade.system.feign.ISysClient;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
|
|
|
import org.springblade.salesPart.vo.GoodsDescVO;
|
|
|
-import org.springblade.salesPart.goods.service.IGoodsDescService;
|
|
|
-import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
@@ -72,11 +69,10 @@ import java.util.stream.Collectors;
|
|
|
@Api(value = "配件批发商品表", tags = "配件批发商品表接口")
|
|
|
public class GoodsDescController extends BladeController {
|
|
|
|
|
|
- private final IGoodsDescService goodsService;
|
|
|
+ private final ICorpsDescService corpsDescService;
|
|
|
private final IGoodsTypeService goodsDescType;
|
|
|
private final IGoodsDescService goodsDescService;
|
|
|
-
|
|
|
- private final ISysClient iSysClient;
|
|
|
+ private final IProductLaunchService productLaunchService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -86,7 +82,7 @@ public class GoodsDescController extends BladeController {
|
|
|
@ApiOperation(value = "详情", notes = "传入goods")
|
|
|
public R<PjGoodsDesc> detail(PjGoodsDesc goods) {
|
|
|
goods.setTenantId(AuthUtil.getTenantId());
|
|
|
- PjGoodsDesc detail = goodsService.getMessageById(goods);
|
|
|
+ PjGoodsDesc detail = goodsDescService.getMessageById(goods);
|
|
|
return R.data(detail);
|
|
|
}
|
|
|
|
|
|
@@ -119,11 +115,11 @@ public class GoodsDescController extends BladeController {
|
|
|
.like(ObjectUtils.isNotEmpty(goods.getCode()), PjGoodsDesc::getCode, goods.getCode())//编码
|
|
|
.eq(ObjectUtils.isNotEmpty(goods.getWhether()), PjGoodsDesc::getWhether, goods.getWhether())//是否管理到批次号
|
|
|
.eq(ObjectUtils.isNotEmpty(goods.getExplosionProof()), PjGoodsDesc::getExplosionProof, goods.getExplosionProof());//是否防爆
|
|
|
- if (ObjectUtil.isNotEmpty(goods.getCname())){
|
|
|
+ if (ObjectUtil.isNotEmpty(goods.getCname())) {
|
|
|
lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(PjGoodsDesc::getCreateTime);
|
|
|
- IPage<PjGoodsDesc> pages = goodsService.page(Condition.getPage(query),lambdaQueryWrapper);
|
|
|
+ IPage<PjGoodsDesc> pages = goodsDescService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
|
|
|
pages.getRecords().forEach(e -> {
|
|
|
String typeId = e.getGoodsTypeId();
|
|
|
@@ -150,7 +146,7 @@ public class GoodsDescController extends BladeController {
|
|
|
public R<IPage<GoodsDescVO>> page(GoodsDescVO goods, Query query) {
|
|
|
goods.setTenantId(SecureUtil.getTenantId());
|
|
|
goods.setIsDeleted(0);
|
|
|
- IPage<GoodsDescVO> pages = goodsService.selectGoodsPage(Condition.getPage(query), goods);
|
|
|
+ IPage<GoodsDescVO> pages = goodsDescService.selectGoodsPage(Condition.getPage(query), goods);
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
|
|
|
@@ -213,7 +209,7 @@ public class GoodsDescController extends BladeController {
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "删除", notes = "传入ids")
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
- return R.status(goodsService.removeByIds(Func.toLongList(ids)));
|
|
|
+ return R.status(goodsDescService.removeByIds(Func.toLongList(ids)));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -269,10 +265,10 @@ public class GoodsDescController extends BladeController {
|
|
|
.eq(ObjectUtils.isNotEmpty(goods.getSalesCompanyId()), PjGoodsDesc::getSalesCompanyId, goods.getSalesCompanyId())//所属公司
|
|
|
.eq(ObjectUtils.isNotEmpty(goods.getWhether()), PjGoodsDesc::getWhether, goods.getWhether())//是否管理到批次号
|
|
|
.eq(ObjectUtils.isNotEmpty(goods.getExplosionProof()), PjGoodsDesc::getExplosionProof, goods.getExplosionProof());//是否防爆
|
|
|
- if (ObjectUtil.isNotEmpty(goods.getCname())){
|
|
|
+ if (ObjectUtil.isNotEmpty(goods.getCname())) {
|
|
|
lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
|
|
|
}
|
|
|
- List<PjGoodsDesc> list = goodsService.list(lambdaQueryWrapper);
|
|
|
+ List<PjGoodsDesc> list = goodsDescService.list(lambdaQueryWrapper);
|
|
|
list.forEach(e -> {
|
|
|
String typeId = e.getGoodsTypeId();
|
|
|
String[] split = typeId.split(",");
|
|
|
@@ -294,8 +290,8 @@ public class GoodsDescController extends BladeController {
|
|
|
@GetMapping("/updateEnableOrNot")
|
|
|
@ApiOperationSupport(order = 11)
|
|
|
@ApiOperation(value = "启用禁用", notes = "传入goodsDesc")
|
|
|
- public R updateEnableOrNot(PjGoodsDesc goodsDesc){
|
|
|
- if (goodsDesc.getId() == null){
|
|
|
+ public R updateEnableOrNot(PjGoodsDesc goodsDesc) {
|
|
|
+ if (goodsDesc.getId() == null) {
|
|
|
return R.fail(500, "请选择数据");
|
|
|
}
|
|
|
boolean status = goodsDescService.updateById(goodsDesc);
|
|
|
@@ -312,14 +308,62 @@ public class GoodsDescController extends BladeController {
|
|
|
LambdaQueryWrapper<PjGoodsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjGoodsDesc::getIsDeleted, 0);
|
|
|
- if (ObjectUtil.isNotEmpty(goods.getCname())){//商品名称
|
|
|
+ if (ObjectUtil.isNotEmpty(goods.getCname())) {//商品名称
|
|
|
lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
|
|
|
}
|
|
|
- List<PjGoodsDesc> list = goodsService.list(lambdaQueryWrapper);
|
|
|
+ List<PjGoodsDesc> list = goodsDescService.list(lambdaQueryWrapper);
|
|
|
|
|
|
return R.data(list);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品下拉 配件批发商品表
|
|
|
+ */
|
|
|
+ @GetMapping("/goodsListXs")
|
|
|
+ @ApiOperationSupport(order = 12)
|
|
|
+ @ApiOperation(value = "商品下拉", notes = "传入goods")
|
|
|
+ public R<List<PjGoodsDesc>> goodsListXs(PjGoodsDesc goods) {
|
|
|
+
|
|
|
+ List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(new LambdaQueryWrapper<PjProductLaunch>()
|
|
|
+ .eq(PjProductLaunch::getIsDeleted, 0)
|
|
|
+ .ne(PjProductLaunch::getInventory, 0)
|
|
|
+ .eq(PjProductLaunch::getUpAndDownShelves, 1)
|
|
|
+ .apply("find_in_set(sales_company_id,'" + AuthUtil.getDeptId() + "')")
|
|
|
+ .apply("find_in_set('" + AuthUtil.getDeptId() + "',shared_company)"));
|
|
|
+ List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).distinct().collect(Collectors.toList());
|
|
|
+ PjCorpsDesc pjCorpsDesc = corpsDescService.getById(goods.getCustomId());
|
|
|
+ String priceSystem = "";
|
|
|
+ if (ObjectUtils.isNotNull(pjCorpsDesc)){
|
|
|
+ priceSystem = pjCorpsDesc.getPriceSystem();
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<PjGoodsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjGoodsDesc::getIsDeleted, 0);
|
|
|
+ if (ObjectUtil.isNotEmpty(goods.getCname())) {//商品名称
|
|
|
+ lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(ids) && ids.size() > 0) {
|
|
|
+ lambdaQueryWrapper.in(PjGoodsDesc::getId, ids);
|
|
|
+ }
|
|
|
+ List<PjGoodsDesc> list = goodsDescService.list(lambdaQueryWrapper);
|
|
|
+ for (PjGoodsDesc item : list) {
|
|
|
+ PjProductLaunch pjProductLaunch = pjProductLaunchList.stream().filter(e-> e.getGoodsId().equals(item.getId())).findFirst().orElse(new PjProductLaunch());
|
|
|
+ if (ObjectUtils.isNotNull(pjProductLaunch)){
|
|
|
+ if ("售价1".equals(priceSystem)){
|
|
|
+ item.setPrice(pjProductLaunch.getPriceOne());
|
|
|
+ }else if ("售价2".equals(priceSystem)){
|
|
|
+ item.setPrice(pjProductLaunch.getPriceTwo());
|
|
|
+ }else if ("售价3".equals(priceSystem)){
|
|
|
+ item.setPrice(pjProductLaunch.getPriceThree());
|
|
|
+ }else if ("售价4".equals(priceSystem)){
|
|
|
+ item.setPrice(pjProductLaunch.getPriceFour());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 递归查询ID
|
|
|
*/
|
|
|
@@ -342,7 +386,7 @@ public class GoodsDescController extends BladeController {
|
|
|
@ApiOperation(value = "详情", notes = "传入goods")
|
|
|
public R<PjGoodsDesc> goodsDetail(PjGoodsDesc goods) {
|
|
|
goods.setTenantId(AuthUtil.getTenantId());
|
|
|
- PjGoodsDesc detail = goodsService.getGoodsDetail(goods);
|
|
|
+ PjGoodsDesc detail = goodsDescService.getGoodsDetail(goods);
|
|
|
return R.data(detail);
|
|
|
}
|
|
|
}
|