|
|
@@ -483,7 +483,7 @@ public class StockGoodsController extends BladeController {
|
|
|
}
|
|
|
} else {
|
|
|
if (AuthUtil.getUserRole().equals("客户")) {
|
|
|
- CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(),AuthUtil.getTenantId());
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(), AuthUtil.getTenantId());
|
|
|
if (ObjectUtils.isNull(corpsAttn)) {
|
|
|
throw new RuntimeException("未查到用户信息");
|
|
|
} else {
|
|
|
@@ -552,6 +552,103 @@ public class StockGoodsController extends BladeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 自定义分页 手机端库存(新-配件)
|
|
|
+ */
|
|
|
+ @GetMapping("/app-stockPartsPageQB")
|
|
|
+ public R<IPage<AppStockPartsVO>> stockPartsPageQB(HttpServletRequest request, AppStockPartsVO appStockPartsVO, Query query) {
|
|
|
+ System.out.println("Blade-Auth=" + request.getHeader("Blade-Auth"));
|
|
|
+ if (ObjectUtils.isNull(request.getHeader("Blade-Auth"))) {
|
|
|
+ // 获取租户信息
|
|
|
+ R<Tenant> tenant = sysClient.getTenantByAppId(request.getHeader("appId"));
|
|
|
+ if (tenant.isSuccess() && ObjectUtils.isNotNull(tenant.getData())) {
|
|
|
+ appStockPartsVO.setTenantId(tenant.getData().getTenantId());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("获取数据失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ appStockPartsVO.setTenantId(AuthUtil.getTenantId());
|
|
|
+ }
|
|
|
+ if (appStockPartsVO.getLabel() != null && appStockPartsVO.getLabel().length > 0) {
|
|
|
+ appStockPartsVO.setLabels(StringUtil.join(appStockPartsVO.getLabel(), ","));
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(appStockPartsVO.getGoodsTypeId())) {
|
|
|
+ List<GoodsType> goodsTypeList = goodsDescClient.getGoodsTypeId(appStockPartsVO.getGoodsTypeId());
|
|
|
+ if (ObjectUtils.isNotNull(goodsTypeList) && goodsTypeList.size() > 0) {
|
|
|
+ List<Long> idList = goodsTypeList.stream().map(GoodsType::getId).distinct().collect(Collectors.toList());
|
|
|
+ StringBuilder ids = new StringBuilder();
|
|
|
+ for (Long id : idList) {
|
|
|
+ ids.append(id).append(",");
|
|
|
+ }
|
|
|
+ ids.append(appStockPartsVO.getGoodsTypeId());
|
|
|
+ appStockPartsVO.setGoodsTypeId(ids.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String shoppingMall = "";
|
|
|
+ Long corpId = null;
|
|
|
+ if (ObjectUtils.isNotNull(appStockPartsVO.getCorpId())) {
|
|
|
+ CorpsDesc corpsDesc = corpsDescClient.getCorpId(appStockPartsVO.getCorpId());
|
|
|
+ if (ObjectUtils.isNull(corpsDesc)) {
|
|
|
+ throw new RuntimeException("未查到用户信息");
|
|
|
+ } else {
|
|
|
+ shoppingMall = corpsDesc.getShoppingMall();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (AuthUtil.getUserRole().equals("客户")) {
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(), AuthUtil.getTenantId());
|
|
|
+ if (ObjectUtils.isNull(corpsAttn)) {
|
|
|
+ throw new RuntimeException("未查到用户信息");
|
|
|
+ } else {
|
|
|
+ CorpsDesc corpsDesc = corpsDescClient.getCorpId(corpsAttn.getPid());
|
|
|
+ if (ObjectUtils.isNull(corpsDesc)) {
|
|
|
+ throw new RuntimeException("未查到用户信息");
|
|
|
+ } else {
|
|
|
+ shoppingMall = corpsDesc.getShoppingMall();
|
|
|
+ corpId = corpsDesc.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ shoppingMall = "游客";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ appStockPartsVO.setUserType(shoppingMall);
|
|
|
+ String finalShoppingMall = shoppingMall;
|
|
|
+ if ("常买".equals(appStockPartsVO.getLabels())) {
|
|
|
+ appStockPartsVO.setCorpId(corpId);
|
|
|
+ appStockPartsVO.setStandard(sysClient.getParamService("hot.selling.standard"));
|
|
|
+ }
|
|
|
+ IPage<AppStockPartsVO> pages = stockGoodsService.selectAppStockPartsPage(Condition.getPage(query), appStockPartsVO);
|
|
|
+ List<AppStockPartsVO> records = pages.getRecords();
|
|
|
+ if (CollectionUtils.isNotEmpty(records)) {
|
|
|
+ records.forEach(item -> {
|
|
|
+ if (StringUtils.isNotBlank(item.getLabels())) {
|
|
|
+ item.setLabel(item.getLabels().split(","));
|
|
|
+ } else {
|
|
|
+ item.setLabel(new String[]{});
|
|
|
+ }
|
|
|
+ if ("零售价".equals(finalShoppingMall) || "游客".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getStandardPrice());
|
|
|
+ } else if ("售价1".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getWholesalePrice());
|
|
|
+ } else if ("售价2".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getRepairDepotPrice());
|
|
|
+ } else if ("售价3".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getStorePrice());
|
|
|
+ } else if ("售价4".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getPrice());
|
|
|
+ } else if ("特价".equals(finalShoppingMall)) {
|
|
|
+ item.setSalesPrice(item.getSpecialOffer());
|
|
|
+ } else {
|
|
|
+ item.setSalesPrice(item.getSpecialOffer());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(item.getSalesPrice())) {
|
|
|
+ item.setSalesPrice(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 查询库存总数量和总金额
|
|
|
*/
|
|
|
@GetMapping("/stockPartsTotal")
|
|
|
@@ -585,7 +682,7 @@ public class StockGoodsController extends BladeController {
|
|
|
}
|
|
|
String shoppingMall = "";
|
|
|
if (AuthUtil.getUserRole().equals("客户")) {
|
|
|
- CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(),AuthUtil.getTenantId());
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(), AuthUtil.getTenantId());
|
|
|
if (ObjectUtils.isNull(corpsAttn)) {
|
|
|
throw new RuntimeException("未查到用户信息");
|
|
|
} else {
|
|
|
@@ -628,7 +725,7 @@ public class StockGoodsController extends BladeController {
|
|
|
}
|
|
|
} else {
|
|
|
if (AuthUtil.getUserRole().equals("客户")) {
|
|
|
- CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(),AuthUtil.getTenantId());
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(AuthUtil.getUserId(), AuthUtil.getTenantId());
|
|
|
if (ObjectUtils.isNull(corpsAttn)) {
|
|
|
throw new RuntimeException("未查到用户信息");
|
|
|
} else {
|