mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2024-12-29 11:29:58 +08:00
Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server
This commit is contained in:
commit
aa93a8301a
6 changed files with 83 additions and 0 deletions
|
@ -46,6 +46,14 @@ public class ShopMaterialStoreController {
|
|||
shopMaterialStoreService.queryShopMaterialById(inputObject, outputObject);
|
||||
}
|
||||
|
||||
@ApiOperation(id = "queryShopMaterialByIds", value = "根据id批量获取商城商品信息", method = "POST", allUse = "0")
|
||||
@ApiImplicitParams(value = {
|
||||
@ApiImplicitParam(id = "ids", name = "ids", value = "主键id,多个逗号隔开", required = "required")})
|
||||
@RequestMapping("/post/ShopMaterialStoreController/queryShopMaterialByIds")
|
||||
public void queryShopMaterialByIds(InputObject inputObject, OutputObject outputObject) {
|
||||
shopMaterialStoreService.queryShopMaterialByIds(inputObject, outputObject);
|
||||
}
|
||||
|
||||
@ApiOperation(id = "queryShopMaterialByMaterialIdAndStoreId", value = "根据商品id和门店id获取商城商品信息", method = "GET", allUse = "0")
|
||||
@ApiImplicitParams(value = {
|
||||
@ApiImplicitParam(id = "materialId", name = "materialId", value = "商品id", required = "required"),
|
||||
|
|
|
@ -48,4 +48,6 @@ public interface ShopMaterialStoreService extends SkyeyeBusinessService<ShopMate
|
|||
void queryShopMaterialByMaterialIdAndStoreId(InputObject inputObject, OutputObject outputObject);
|
||||
|
||||
Map<String, List<ShopMaterialStore>> queryShopMaterialListByStoreIds(List<String> storeIds);
|
||||
|
||||
void queryShopMaterialByIds(InputObject inputObject, OutputObject outputObject);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.skyeye.annotation.service.SkyeyeService;
|
||||
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
|
||||
import com.skyeye.common.constans.CommonCharConstants;
|
||||
import com.skyeye.common.constans.CommonNumConstants;
|
||||
import com.skyeye.common.entity.search.CommonPageInfo;
|
||||
import com.skyeye.common.object.InputObject;
|
||||
|
@ -34,6 +35,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -203,6 +205,39 @@ public class ShopMaterialStoreServiceImpl extends SkyeyeBusinessServiceImpl<Shop
|
|||
outputObject.settotal(CommonNumConstants.NUM_ONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryShopMaterialByIds(InputObject inputObject, OutputObject outputObject) {
|
||||
String ids = inputObject.getParams().get("ids").toString();
|
||||
List<String> idList = Arrays.asList(ids.split(CommonCharConstants.COMMA_MARK))
|
||||
.stream().filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(idList)) {
|
||||
return;
|
||||
}
|
||||
List<ShopMaterialStore> shopMaterialStoreList = selectByIds(idList.toArray(new String[]{}));
|
||||
Map<String, ShopMaterialStore> storeMap = shopMaterialStoreList.stream()
|
||||
.collect(Collectors.toMap(ShopMaterialStore::getMaterialId, Function.identity(), (v1, v2) -> v1));
|
||||
|
||||
List<String> materialIds = shopMaterialStoreList.stream()
|
||||
.map(ShopMaterialStore::getMaterialId).distinct().collect(Collectors.toList());
|
||||
Map<String, ShopMaterial> shopMaterialMap = shopMaterialService.queryShopMaterialByMaterialId(materialIds);
|
||||
List<ShopMaterial> shopMaterialList = shopMaterialMap.values().stream().collect(Collectors.toList());
|
||||
shopMaterialList.forEach(shopMaterial -> {
|
||||
shopMaterial.getMaterialMation().setMaterialNorms(null);
|
||||
shopMaterial.getMaterialMation().setUnitGroupMation(null);
|
||||
shopMaterial.getMaterialMation().setMaterialProcedure(null);
|
||||
shopMaterial.getMaterialMation().setNormsSpec(null);
|
||||
shopMaterial.getShopMaterialNormsList().forEach(shopMaterialNorms -> {
|
||||
shopMaterialNorms.setEstimatePurchasePrice(null);
|
||||
});
|
||||
// 门店商品数据
|
||||
ShopMaterialStore shopMaterialStore = storeMap.get(shopMaterial.getMaterialId());
|
||||
shopMaterial.setShopMaterialStore(shopMaterialStore);
|
||||
shopMaterial.setDefaultStoreId(shopMaterialStore.getStoreId());
|
||||
});
|
||||
outputObject.setBeans(shopMaterialList);
|
||||
outputObject.settotal(shopMaterialList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryShopMaterialByMaterialIdAndStoreId(InputObject inputObject, OutputObject outputObject) {
|
||||
Map<String, Object> params = inputObject.getParams();
|
||||
|
|
|
@ -27,6 +27,15 @@ public interface IShopMaterialNormsRest {
|
|||
@PostMapping("/queryShopMaterialByMaterialIdList")
|
||||
String queryShopMaterialByMaterialIdList(@RequestParam("materialIds") String materialIds);
|
||||
|
||||
/**
|
||||
* 根据id批量获取商城商品信息
|
||||
*
|
||||
* @param ids 主键id,多个逗号隔开
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/queryShopMaterialByIds")
|
||||
String queryShopMaterialByIds(@RequestParam("ids") String ids);
|
||||
|
||||
/**
|
||||
* 新增门店时,将所有商品同步到该门店
|
||||
*
|
||||
|
|
|
@ -20,5 +20,13 @@ public interface IShopMaterialNormsService {
|
|||
|
||||
List<Map<String, Object>> queryShopMaterialByMaterialIdList(String materialIds);
|
||||
|
||||
/**
|
||||
* 根据id批量获取商城商品信息
|
||||
*
|
||||
* @param ids 商城商品materialId与storeId的关系id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> queryShopMaterialByIds(List<String> ids);
|
||||
|
||||
List<Map<String, Object>> queryAllShopMaterialListForChoose();
|
||||
}
|
|
@ -4,16 +4,22 @@
|
|||
|
||||
package com.skyeye.rest.shopmaterialnorms.sevice.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.skyeye.base.rest.service.impl.IServiceImpl;
|
||||
import com.skyeye.common.client.ExecuteFeignClient;
|
||||
import com.skyeye.common.constans.CommonCharConstants;
|
||||
import com.skyeye.common.object.ResultEntity;
|
||||
import com.skyeye.rest.shopmaterialnorms.rest.IShopMaterialNormsRest;
|
||||
import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName: IShopMaterialNormsServiceImpl
|
||||
|
@ -43,6 +49,21 @@ public class IShopMaterialNormsServiceImpl extends IServiceImpl implements IShop
|
|||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryShopMaterialByIds(List<String> ids) {
|
||||
if (ids == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ids = ids.stream().filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String joinIds = Joiner.on(CommonCharConstants.COMMA_MARK).join(ids);
|
||||
ResultEntity resultEntity = ExecuteFeignClient.get(() -> iShopMaterialNormsRest.queryShopMaterialByIds(joinIds));
|
||||
List<Map<String, Object>> rows = resultEntity.getRows();
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryAllShopMaterialListForChoose() {
|
||||
ResultEntity resultEntity = ExecuteFeignClient.get(() -> iShopMaterialNormsRest.queryAllShopMaterialListForChoose());
|
||||
|
|
Loading…
Reference in a new issue