|
@@ -18,6 +18,7 @@ package org.springblade.mocha.controller;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@@ -28,9 +29,12 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
|
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
|
|
+import org.springblade.client.entity.FeesDesc;
|
|
|
|
|
+import org.springblade.client.entity.GoodsDesc;
|
|
|
import org.springblade.client.entity.GoodsSpecification;
|
|
import org.springblade.client.entity.GoodsSpecification;
|
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IGoodsDescClient;
|
|
import org.springblade.client.feign.IGoodsDescClient;
|
|
|
|
|
+import org.springblade.client.feign.IRedisClient;
|
|
|
import org.springblade.client.vo.GoodsDescVO;
|
|
import org.springblade.client.vo.GoodsDescVO;
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
import org.springblade.core.mp.support.Condition;
|
|
@@ -41,6 +45,7 @@ import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.mocha.entity.GoodsSpecificationDto;
|
|
import org.springblade.mocha.entity.GoodsSpecificationDto;
|
|
|
import org.springblade.mocha.excel.PriceBankExcel;
|
|
import org.springblade.mocha.excel.PriceBankExcel;
|
|
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springblade.mocha.entity.PriceBank;
|
|
import org.springblade.mocha.entity.PriceBank;
|
|
@@ -68,6 +73,9 @@ public class PriceBankController extends BladeController {
|
|
|
private final IGoodsDescClient goodsDescClient;
|
|
private final IGoodsDescClient goodsDescClient;
|
|
|
private final ICorpsDescClient corpsDescClient;
|
|
private final ICorpsDescClient corpsDescClient;
|
|
|
|
|
|
|
|
|
|
+ private final RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
+ private IRedisClient redisClient;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 详情
|
|
* 详情
|
|
|
*/
|
|
*/
|
|
@@ -173,6 +181,84 @@ public class PriceBankController extends BladeController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 自定义分页 出口价格库
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/pageListAll")
|
|
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
|
|
+ @ApiOperation(value = "分页", notes = "传入priceBank")
|
|
|
|
|
+ public R<List<PriceBank>> page(PriceBankVO priceBank) {
|
|
|
|
|
+ LambdaQueryWrapper<PriceBank> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ if (priceBank.getGoodTypeId() != null) {
|
|
|
|
|
+ List<Long> goodTypeMessage = corpsDescClient.getGoodTypeMessage(priceBank.getGoodTypeId());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(goodTypeMessage)){
|
|
|
|
|
+ lambdaQueryWrapper.in(PriceBank::getGoodTypeId, goodTypeMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ lambdaQueryWrapper.eq(PriceBank::getIsDeleted,0);
|
|
|
|
|
+ lambdaQueryWrapper.eq(PriceBank::getStatus,0);
|
|
|
|
|
+ lambdaQueryWrapper.eq(PriceBank::getTenantId, SecureUtil.getTenantId());
|
|
|
|
|
+ lambdaQueryWrapper.eq(PriceBank::getTradeType,"CK");
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(priceBank.getCname()),PriceBank::getCname,priceBank.getCname());
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(priceBank.getCode()),PriceBank::getCode,priceBank.getCode());
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(priceBank.getCorpId()),PriceBank::getCorpId,priceBank.getCorpId());
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(priceBank.getSpecs()),PriceBank::getSpecs,priceBank.getSpecs());
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(priceBank.getGoodsTypeName()),PriceBank::getGoodsTypeName,priceBank.getGoodsTypeName());
|
|
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(priceBank.getStatusTime()),PriceBank::getEndTime,priceBank.getStatusTime());
|
|
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(priceBank.getEname()),PriceBank::getEname,priceBank.getEname());
|
|
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(priceBank.getDateValidityStart()),PriceBank::getEndTime,priceBank.getDateValidityStart());
|
|
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(priceBank.getDateValidityEnd()),PriceBank::getEndTime,priceBank.getDateValidityEnd());
|
|
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(priceBank.getBillType()),PriceBank::getBillType,priceBank.getBillType());
|
|
|
|
|
+ lambdaQueryWrapper.orderByDesc(PriceBank::getId);
|
|
|
|
|
+ //客户
|
|
|
|
|
+ List<CorpsDesc> corpsDescList = new ArrayList<>();
|
|
|
|
|
+ corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
|
|
|
|
|
+ if (corpsDescList.size() == 0) {
|
|
|
|
|
+ redisClient.basicData("corps");
|
|
|
|
|
+ corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
|
|
|
|
|
+ }
|
|
|
|
|
+ //商品
|
|
|
|
|
+ List<GoodsDesc> goodsList = new ArrayList<>();
|
|
|
|
|
+ goodsList = castToList(redisTemplate.opsForValue().get("goods"), GoodsDesc.class);
|
|
|
|
|
+ if (goodsList.size() == 0) {
|
|
|
|
|
+ redisClient.basicData("goods");
|
|
|
|
|
+ goodsList = castToList(redisTemplate.opsForValue().get("goods"), GoodsDesc.class);
|
|
|
|
|
+ }
|
|
|
|
|
+ List<PriceBank> pages = priceBankService.list(lambdaQueryWrapper);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(pages)){
|
|
|
|
|
+ for(PriceBank item :pages){
|
|
|
|
|
+ if (ObjectUtils.isNotNull(item.getItemId())) {
|
|
|
|
|
+ //商品
|
|
|
|
|
+ GoodsDesc goodsDesc = goodsList.stream().filter(goods -> goods.getId().equals(item.getItemId())).findFirst().orElse(null);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(goodsDesc)) {
|
|
|
|
|
+ item.setCnameDescription(goodsDesc.getCnameDescription());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /*R<GoodsDescVO> goodsDesc = goodsDescClient.selectGoodsMessage(item.getItemId());
|
|
|
|
|
+ if (goodsDesc != null && goodsDesc.getData() != null){
|
|
|
|
|
+ item.setCnameDescription(goodsDesc.getData().getCnameDescription());
|
|
|
|
|
+ }*/
|
|
|
|
|
+ if (item.getCorpId() != null) {
|
|
|
|
|
+ //客户
|
|
|
|
|
+ CorpsDesc corpsDesc = corpsDescList.stream().filter(corps -> corps.getId().equals(item.getCorpId())).findFirst().orElse(null);
|
|
|
|
|
+ if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
|
|
+ item.setCorpCode(corpsDesc.getCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ /*R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());
|
|
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
|
|
+ item.setCorpCode(corpMessage.getData().getCode());
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ List<GoodsSpecification> goodsSpecificationList = goodsDescClient.goodsSpecificationList(item.getItemId());
|
|
|
|
|
+ List<GoodsSpecificationDto> goodsSpecificationDtoList = BeanUtil.copy(goodsSpecificationList, GoodsSpecificationDto.class);
|
|
|
|
|
+ item.setGoodsSpecificationList(goodsSpecificationDtoList);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.data(pages);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 新增 出口价格库
|
|
* 新增 出口价格库
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
@@ -288,5 +374,25 @@ public class PriceBankController extends BladeController {
|
|
|
return priceBankService.updateParts(ids);
|
|
return priceBankService.updateParts(ids);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将Object转换成List类型
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param obj Object对象
|
|
|
|
|
+ * @param clazz 数据类型
|
|
|
|
|
+ * @param <T> 泛型类型
|
|
|
|
|
+ * @return List类型
|
|
|
|
|
+ */
|
|
|
|
|
+ public static <T> List<T> castToList(Object obj, Class<T> clazz) {
|
|
|
|
|
+ List<T> resList = new ArrayList<>();
|
|
|
|
|
+ // 如果不是List<?>对象,是没有办法转换的
|
|
|
|
|
+ if (obj instanceof List<?>) {
|
|
|
|
|
+ for (Object o : (List<?>) obj) {
|
|
|
|
|
+ // 将对应的元素进行类型转换
|
|
|
|
|
+ resList.add(clazz.cast(o));
|
|
|
|
|
+ }
|
|
|
|
|
+ return resList;
|
|
|
|
|
+ }
|
|
|
|
|
+ return resList;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|