From 4d05f5ad16d67ae9c2773bece28aea4d5248cec4 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Mon, 23 Jun 2025 17:11:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E9=A9=BB=E6=B5=81=E7=A8=8B=20fix=20bu?= =?UTF-8?q?g=EF=BC=8C=20=E5=AE=A1=E6=A0=B8=E5=A4=87=E6=B3=A8=E5=92=8C?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=BA=97=E9=93=BA=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lakala/service/impl/LklTkServiceImpl.java | 1 - .../service/impl/ShopMchEntryServiceImpl.java | 28 +- .../impl/ShopStoreBaseServiceImpl.java | 12 +- .../impl/SyncThirdDataServiceImpl.java | 241 +++++++++--------- 4 files changed, 152 insertions(+), 130 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java index 1b0f6d13..18dd9433 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java @@ -614,7 +614,6 @@ public class LklTkServiceImpl { if (!success) { return new JSONObject().set("code", "500").set("message", "更新商户号失败"); -// throw new ApiException("更新商户号失败"); } // 备注:RMK 采用拉卡拉的入网电子合同签署流程,暂停e签宝的电子合同生成流程 diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java index c9e84bc4..0c07e3f8 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java @@ -984,13 +984,13 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl updateWrapper.eq("lkl_mer_cup_no", cupNo)); + String approvalRemark = ""; + if (hasEcSigned.equals(CommonConstant.Enable)) { + approvalRemark = "合同签署完成,商家信息正在提交审核,请耐心等待"; + } else if (hasApplyMerchant.equals(CommonConstant.Enable)) { + approvalRemark = "商家资质审核通过,系统正在初始化店铺,请稍后操作"; + } else if (storeStatus.equals(CommonConstant.Enable)) { + approvalRemark = "店铺创建成功,系统正在处理分账业务申请"; + } else if (hasApplySplit.equals(CommonConstant.Enable)) { + approvalRemark = "分账业务申请已通过,系统正在处理接收方申请"; + } else if (hasApplyReceiver.equals(CommonConstant.Enable)) { + approvalRemark = "分账接收方申请成功,系统正在处理接收方绑定"; + } else if (hasBindReceiver.equals(CommonConstant.Enable)) { + approvalRemark = "分账接收方绑定成功,入驻流程即将完成"; + } + + if (StrUtil.isNotBlank(approvalRemark)) { + updateWrapper.set("approval_remark", approvalRemark); + } + // 4. 构建需要更新的字段和值的映射关系 Map updateFieldMap = new LinkedHashMap<>(); updateFieldMap.put("approval_status", approvalStatus); // 审批状态 @@ -1319,6 +1338,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl entry.getValue() != null && entry.getValue() > 0) .forEach(entry -> updateWrapper.set(entry.getKey(), entry.getValue())); + // 6. 执行更新操作并返回结果 return update(updateWrapper); diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java index 112bf4a3..9a214b11 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java @@ -3371,13 +3371,11 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl rights_group_id = shopStoreEmployeeRightsGroups.stream().map(s -> s.getRights_group_id()).collect(Collectors.toList()); if (CollUtil.isNotEmpty(rights_group_id)) { // 初始化雇员信息 - ShopStoreEmployee shopStoreEmployee = new ShopStoreEmployee(); - shopStoreEmployee.setUser_id(userId); - shopStoreEmployee.setStore_id(storeId); - shopStoreEmployee.setRights_group_id(CollUtil.join(rights_group_id, ",")); - shopStoreEmployee.setEmployee_is_admin(CommonConstant.USER_TYPE_ADMIN); - - if (!shopStoreEmployeeService.saveOrUpdate(shopStoreEmployee)) { + UpdateWrapper queryWrapper = new UpdateWrapper<>(); + queryWrapper.eq("user_id", userId).eq("store_id", storeId) + .set("rights_group_id", CollUtil.join(rights_group_id, ",")) + .set("employee_is_admin", CommonConstant.USER_TYPE_ADMIN); + if (!shopStoreEmployeeService.update(queryWrapper)) { throw new ApiException(I18nUtil._("设置店铺管理员权限失败")); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java index 04d2ac1b..f6f56256 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncThirdDataServiceImpl.java @@ -152,6 +152,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements private ShopProductItemService shopProductItemService; @Autowired private ShopStoreActivityBaseService shopStoreActivityBaseService; + /** * 批量保存商品的分类 * @@ -770,7 +771,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements for (Map.Entry entry : stockDeltaMap.entrySet()) { String productKey = entry.getKey(); Integer delta = entry.getValue(); - if (StrUtil.isBlank(productKey) || delta == null) { + if (StrUtil.isBlank(productKey) || productKey.equals("0") || delta == null || delta.equals(0)) { continue; } @@ -846,41 +847,41 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements @Override - public ThirdApiRes fileUploadToOss(String appKey, String sign, String syncType,Date refreshDate, List folders) { - if (StrUtil.isBlank(appKey) || StrUtil.isBlank(sign) ) { + public ThirdApiRes fileUploadToOss(String appKey, String sign, String syncType, Date refreshDate, List folders) { + if (StrUtil.isBlank(appKey) || StrUtil.isBlank(sign)) { return new ThirdApiRes().fail(1003, I18nUtil._("缺少必要参数!")); } // 验签、appid,必要参数判断 SyncApp syncApp = syncAppService.getOne(new LambdaQueryWrapper() - .select(SyncApp::getApp_key, SyncApp::getApp_secret,SyncApp::getStore_id) + .select(SyncApp::getApp_key, SyncApp::getApp_secret, SyncApp::getStore_id) .eq(SyncApp::getApp_key, appKey) - .eq(SyncApp::getApp_secret,sign)); + .eq(SyncApp::getApp_secret, sign)); if (syncApp == null) { return new ThirdApiRes().fail(1001, I18nUtil._("签名有误!")); } String storeId = syncApp.getStore_id(); - if(null==syncApp.getStore_id()|| syncApp.getStore_id().isEmpty()){ + if (null == syncApp.getStore_id() || syncApp.getStore_id().isEmpty()) { logger.info("商店id为空"); - return new ThirdApiRes().fail(250,"商店id为空"); + return new ThirdApiRes().fail(250, "商店id为空"); } - if(folders==null||folders.isEmpty()){ + if (folders == null || folders.isEmpty()) { logger.info("没有商品数据"); - return new ThirdApiRes().fail(250,"没有商品数据"); + return new ThirdApiRes().fail(250, "没有商品数据"); } - String newfolder=new FileUtils().getSyncTypeFlag(syncType,clientPath)+storeId+FileUtils.pathSeparator+folders.get(0)+FileUtils.pathSeparator; + String newfolder = new FileUtils().getSyncTypeFlag(syncType, clientPath) + storeId + FileUtils.pathSeparator + folders.get(0) + FileUtils.pathSeparator; upLoadZipToOss(newfolder);//上传文件到cos //更新当前的获取时间,用户客户端获取 try { QueryWrapper storeDbConfigQueryWrapper = new QueryWrapper<>(); storeDbConfigQueryWrapper.eq("store_id", storeId); - StoreDbConfig storeDbConfig=storeDbConfigService.getOne(storeDbConfigQueryWrapper); - if(ObjectUtil.isNotEmpty(storeDbConfig)){ + StoreDbConfig storeDbConfig = storeDbConfigService.getOne(storeDbConfigQueryWrapper); + if (ObjectUtil.isNotEmpty(storeDbConfig)) { storeDbConfig.setRefreshTime(refreshDate); storeDbConfigService.saveOrUpdate(storeDbConfig); } - }catch (RuntimeException e){ - logger.error("同步时间失败"+e.getMessage()); + } catch (RuntimeException e) { + logger.error("同步时间失败" + e.getMessage()); } return new ThirdApiRes().success("上传成功"); } @@ -894,9 +895,9 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements } // 验签、appid,必要参数判断 SyncApp syncAppO = syncAppService.getOne(new LambdaQueryWrapper() - .select(SyncApp::getApp_key, SyncApp::getApp_secret,SyncApp::getStore_id) + .select(SyncApp::getApp_key, SyncApp::getApp_secret, SyncApp::getStore_id) .eq(SyncApp::getApp_key, appKey) - .eq(SyncApp::getApp_secret,sign)); + .eq(SyncApp::getApp_secret, sign)); if (syncAppO == null) { logger.error("签名有误!"); return; @@ -908,20 +909,21 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements /** * 批量新增或更新活动数据 + * * @param jsonArray */ - private void batchSaveShopStoreActivityBase(JSONArray jsonArray,Integer storeId) { - List addshopStoreActivityBaseList=new ArrayList<>(); - List updateShopStoreActivityBaseList=new ArrayList<>(); - Map stringIntegerMap= checkExistingActive(jsonArray,storeId); - jsonArray.stream().parallel().forEach(object->{ - final JSONObject jsonObj= (JSONObject) object; - String activityName=jsonObj.getStr("activityName"); - Integer activityTypeId=jsonObj.getInt("activityTypeId"); - if(null==activityTypeId){ + private void batchSaveShopStoreActivityBase(JSONArray jsonArray, Integer storeId) { + List addshopStoreActivityBaseList = new ArrayList<>(); + List updateShopStoreActivityBaseList = new ArrayList<>(); + Map stringIntegerMap = checkExistingActive(jsonArray, storeId); + jsonArray.stream().parallel().forEach(object -> { + final JSONObject jsonObj = (JSONObject) object; + String activityName = jsonObj.getStr("activityName"); + Integer activityTypeId = jsonObj.getInt("activityTypeId"); + if (null == activityTypeId) { return; } - ShopStoreActivityBase shopStoreActivityBase=new ShopStoreActivityBase(); + ShopStoreActivityBase shopStoreActivityBase = new ShopStoreActivityBase(); if (activityTypeId == 1) { activityTypeId = StateCode.ACTIVITY_TYPE_LIMITED_DISCOUNT; //限时秒杀 } @@ -929,17 +931,17 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements activityTypeId = StateCode.ACTIVITY_TYPE_ONE_PIECE_DISCOUNT; //折扣 } if (activityTypeId == 3) { - JSONArray activeMaxDesList=jsonObj.getJSONArray("activeMaxDesList"); + JSONArray activeMaxDesList = jsonObj.getJSONArray("activeMaxDesList"); activityTypeId = StateCode.ACTIVITY_TYPE_REDUCTION; //满减 - String rules= ActiveShopJsonUtils.getRules(activeMaxDesList); + String rules = ActiveShopJsonUtils.getRules(activeMaxDesList); shopStoreActivityBase.setActivity_rule(rules); } - Date activityStarttime=jsonObj.getDate("activityStarttime"); - Date activityEndtime=jsonObj.getDate("activityEndtime"); - Integer activityState=jsonObj.getInt("activityState"); - Date activityReleasetime= jsonObj.getDate("activityReleasetime"); - BigDecimal discount=jsonObj.getBigDecimal("discount"); - String key=activityName+"_"+activityStarttime.getTime()+"_"+activityState; + Date activityStarttime = jsonObj.getDate("activityStarttime"); + Date activityEndtime = jsonObj.getDate("activityEndtime"); + Integer activityState = jsonObj.getInt("activityState"); + Date activityReleasetime = jsonObj.getDate("activityReleasetime"); + BigDecimal discount = jsonObj.getBigDecimal("discount"); + String key = activityName + "_" + activityStarttime.getTime() + "_" + activityState; shopStoreActivityBase.setActivity_state(activityState); shopStoreActivityBase.setActivity_name(activityName); shopStoreActivityBase.setActivity_type(1);//免费参与 @@ -951,19 +953,19 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements shopStoreActivityBase.setActivity_endtime(activityEndtime); shopStoreActivityBase.setActivity_state(activityState); shopStoreActivityBase.setSubsite_id(0); - if(stringIntegerMap.containsKey(key)){//更新 - String keyVal= MapUtil.getStr(stringIntegerMap,key); - shopStoreActivityBase.setActivity_id(MapUtil.getInt(stringIntegerMap,keyVal.split("_")[0])); + if (stringIntegerMap.containsKey(key)) {//更新 + String keyVal = MapUtil.getStr(stringIntegerMap, key); + shopStoreActivityBase.setActivity_id(MapUtil.getInt(stringIntegerMap, keyVal.split("_")[0])); updateShopStoreActivityBaseList.add(shopStoreActivityBase); - }else { + } else { addshopStoreActivityBaseList.add(shopStoreActivityBase); } }); - if(CollectionUtil.isNotEmpty(addshopStoreActivityBaseList)){ - shopStoreActivityBaseService.saveBatch(addshopStoreActivityBaseList,addshopStoreActivityBaseList.size()); + if (CollectionUtil.isNotEmpty(addshopStoreActivityBaseList)) { + shopStoreActivityBaseService.saveBatch(addshopStoreActivityBaseList, addshopStoreActivityBaseList.size()); } - if(CollectionUtil.isNotEmpty(updateShopStoreActivityBaseList)){ + if (CollectionUtil.isNotEmpty(updateShopStoreActivityBaseList)) { shopStoreActivityBaseService.updateBatchById(updateShopStoreActivityBaseList); } @@ -974,6 +976,7 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements * 将商品添加到活动 * 1、找出匹配的活动 * 2、新增商品到活动列表 + * * @param appKey * @param sign * @param activeJsonArray @@ -987,9 +990,9 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements } // 验签、appid,必要参数判断 SyncApp syncAppO = syncAppService.getOne(new LambdaQueryWrapper() - .select(SyncApp::getApp_key, SyncApp::getApp_secret,SyncApp::getStore_id) + .select(SyncApp::getApp_key, SyncApp::getApp_secret, SyncApp::getStore_id) .eq(SyncApp::getApp_key, appKey) - .eq(SyncApp::getApp_secret,sign)); + .eq(SyncApp::getApp_secret, sign)); if (syncAppO == null) { logger.error("签名有误!"); return; @@ -1001,83 +1004,84 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements /** * 批量新增或更新活动商品数据 + * * @param jsonArray */ - private void batchAddActiveShopBase(JSONArray jsonArray,Integer storeId) { - List updateShopStoreActivityBaseList=new ArrayList<>(); - Map stringIntegerMap= checkExistingActive(jsonArray,storeId); - Map shopProduckKeyMap=shopProductBaseService.getProductBasicIdByStore(storeId);//获取货架号对应的商品id - Map shopItemKeyMap=shopProductItemService.getProductItemIdByStore(storeId);//获取商品id对应的item的id - Map rulesChe=new HashMap();//存储rule格式activeId:rules,如果不存在则从数据库取,存在则从缓存取数据 - jsonArray.forEach(object->{ - final JSONObject jsonObj= (JSONObject) object; - String activityName=jsonObj.getStr("activityName"); - Integer activityTypeId=jsonObj.getInt("activityTypeId"); - if(null==activityTypeId){ + private void batchAddActiveShopBase(JSONArray jsonArray, Integer storeId) { + List updateShopStoreActivityBaseList = new ArrayList<>(); + Map stringIntegerMap = checkExistingActive(jsonArray, storeId); + Map shopProduckKeyMap = shopProductBaseService.getProductBasicIdByStore(storeId);//获取货架号对应的商品id + Map shopItemKeyMap = shopProductItemService.getProductItemIdByStore(storeId);//获取商品id对应的item的id + Map rulesChe = new HashMap();//存储rule格式activeId:rules,如果不存在则从数据库取,存在则从缓存取数据 + jsonArray.forEach(object -> { + final JSONObject jsonObj = (JSONObject) object; + String activityName = jsonObj.getStr("activityName"); + Integer activityTypeId = jsonObj.getInt("activityTypeId"); + if (null == activityTypeId) { return; } - String ruleType=""; - List newItems=new ArrayList<>(); - ShopStoreActivityBase shopStoreActivityBase=new ShopStoreActivityBase(); - Integer productId=null; - String itemNo=jsonObj.getStr("itemNo"); - BigDecimal discount=jsonObj.getBigDecimal("discount"); - if(shopProduckKeyMap.containsKey(itemNo)){ - productId= (Integer) shopProduckKeyMap.get(itemNo); + String ruleType = ""; + List newItems = new ArrayList<>(); + ShopStoreActivityBase shopStoreActivityBase = new ShopStoreActivityBase(); + Integer productId = null; + String itemNo = jsonObj.getStr("itemNo"); + BigDecimal discount = jsonObj.getBigDecimal("discount"); + if (shopProduckKeyMap.containsKey(itemNo)) { + productId = (Integer) shopProduckKeyMap.get(itemNo); } - if(null==productId){ + if (null == productId) { return; } - Date activityStarttime=jsonObj.getDate("activityStarttime"); - Integer activityState=jsonObj.getInt("activityState"); + Date activityStarttime = jsonObj.getDate("activityStarttime"); + Integer activityState = jsonObj.getInt("activityState"); - String key=activityName+"_"+activityStarttime.getTime()+"_"+activityState; + String key = activityName + "_" + activityStarttime.getTime() + "_" + activityState; - if(stringIntegerMap.containsKey(key)){//更新 - String keyVal=MapUtil.getStr(stringIntegerMap,key); - String activityId=keyVal.split("_")[0]; - String rules=""; - if(null!=rulesChe.get(activityId)){ - rules=rulesChe.get(activityId); - }else { - rules=keyVal.split("_")[1]; + if (stringIntegerMap.containsKey(key)) {//更新 + String keyVal = MapUtil.getStr(stringIntegerMap, key); + String activityId = keyVal.split("_")[0]; + String rules = ""; + if (null != rulesChe.get(activityId)) { + rules = rulesChe.get(activityId); + } else { + rules = keyVal.split("_")[1]; } - String itemIds= (String) shopItemKeyMap.get(productId); - if(null!=itemIds){ - itemIds= (String) shopItemKeyMap.get(String.valueOf(productId)); + String itemIds = (String) shopItemKeyMap.get(productId); + if (null != itemIds) { + itemIds = (String) shopItemKeyMap.get(String.valueOf(productId)); } assert itemIds != null; if (activityTypeId == 1) {//限时秒杀 - ruleType=ActiveShopJsonUtils.SECKILL; - BigDecimal oldPrice=jsonObj.getBigDecimal("oldPrice"); - BigDecimal specPrice=jsonObj.getBigDecimal("specPrice"); - if(oldPrice.compareTo(BigDecimal.ZERO)>0&&specPrice.compareTo(BigDecimal.ZERO)>0){ - BigDecimal newDiscout=specPrice.divide(oldPrice,4, RoundingMode.HALF_UP); - newItems.addAll(getFulReduItemList(itemIds,ruleType,newDiscout));//获取满减规则的itemid + ruleType = ActiveShopJsonUtils.SECKILL; + BigDecimal oldPrice = jsonObj.getBigDecimal("oldPrice"); + BigDecimal specPrice = jsonObj.getBigDecimal("specPrice"); + if (oldPrice.compareTo(BigDecimal.ZERO) > 0 && specPrice.compareTo(BigDecimal.ZERO) > 0) { + BigDecimal newDiscout = specPrice.divide(oldPrice, 4, RoundingMode.HALF_UP); + newItems.addAll(getFulReduItemList(itemIds, ruleType, newDiscout));//获取满减规则的itemid } } if (activityTypeId == 2) {//折扣 - if(discount.compareTo(BigDecimal.ZERO)<=0){ + if (discount.compareTo(BigDecimal.ZERO) <= 0) { logger.error("商品折扣要大于0"); return; } - ruleType=ActiveShopJsonUtils.DISCOUNT; - newItems.addAll(getFulReduItemList(itemIds,ruleType,discount));//获取满减规则的itemid + ruleType = ActiveShopJsonUtils.DISCOUNT; + newItems.addAll(getFulReduItemList(itemIds, ruleType, discount));//获取满减规则的itemid } if (activityTypeId == 3) {//满减 - ruleType=ActiveShopJsonUtils.FULLREDUCE; - newItems.addAll(getFulReduItemList(itemIds,ruleType,null));//获取满减规则的itemid + ruleType = ActiveShopJsonUtils.FULLREDUCE; + newItems.addAll(getFulReduItemList(itemIds, ruleType, null));//获取满减规则的itemid } - shopStoreActivityBase.setActivity_id(MapUtil.getInt(stringIntegerMap,activityId)); - String newRules= ActiveShopJsonUtils.buildPromotionRule(ruleType,rules,newItems); - rulesChe.put(activityId,newRules); + shopStoreActivityBase.setActivity_id(MapUtil.getInt(stringIntegerMap, activityId)); + String newRules = ActiveShopJsonUtils.buildPromotionRule(ruleType, rules, newItems); + rulesChe.put(activityId, newRules); shopStoreActivityBase.setActivity_rule(rules); updateShopStoreActivityBaseList.add(shopStoreActivityBase); } }); - if(CollectionUtil.isNotEmpty(updateShopStoreActivityBaseList)){ + if (CollectionUtil.isNotEmpty(updateShopStoreActivityBaseList)) { shopStoreActivityBaseService.updateBatchById(updateShopStoreActivityBaseList); } @@ -1087,58 +1091,59 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements * 一对多,如product_id:1002,item_number:120_121;数据格式为item_id,item_id item_unit_price,item_unit_price * 最终组合item_id,item_id_item_unit_price,item_unit_price * 满减的切割规则的itemid + * * @param itemPrice * @return */ - private List getFulReduItemList(String itemPrice,String activeType,BigDecimal discount){ - List newItems=new ArrayList<>(); - String [] itemPriceArray=itemPrice.split("_"); - String itemIds=itemPriceArray[0]; - String unitPrices=itemPriceArray[1]; - switch (activeType){ + private List getFulReduItemList(String itemPrice, String activeType, BigDecimal discount) { + List newItems = new ArrayList<>(); + String[] itemPriceArray = itemPrice.split("_"); + String itemIds = itemPriceArray[0]; + String unitPrices = itemPriceArray[1]; + switch (activeType) { case ActiveShopJsonUtils.DISCOUNT: - if(itemIds.contains(",")){ - String [] itemIdsArray=itemIds.split(","); + if (itemIds.contains(",")) { + String[] itemIdsArray = itemIds.split(","); for (String itemId : itemIdsArray) { org.json.JSONObject jsonObject = new org.json.JSONObject(); jsonObject.put("item_id", itemId); jsonObject.put("rate", BigDecimalFormatter.formatWithoutTrailingZeros(discount.multiply(new BigDecimal(100)))); newItems.add(jsonObject); } - }else { - org.json.JSONObject jsonObject=new org.json.JSONObject(); - jsonObject.put("item_id",itemIds); + } else { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("item_id", itemIds); jsonObject.put("rate", BigDecimalFormatter.formatWithoutTrailingZeros(discount.multiply(new BigDecimal(100)))); newItems.add(jsonObject); } break; case ActiveShopJsonUtils.FULLREDUCE: - if(itemIds.contains(",")){ - String [] itemIdsArray=itemIds.split(","); - for(String itemId:itemIdsArray){ - org.json.JSONObject jsonObject=new org.json.JSONObject(); - jsonObject.put("item_id",itemId); + if (itemIds.contains(",")) { + String[] itemIdsArray = itemIds.split(","); + for (String itemId : itemIdsArray) { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("item_id", itemId); newItems.add(jsonObject); } - }else { - org.json.JSONObject jsonObject=new org.json.JSONObject(); - jsonObject.put("item_id",itemIds); + } else { + org.json.JSONObject jsonObject = new org.json.JSONObject(); + jsonObject.put("item_id", itemIds); newItems.add(jsonObject); } break; case ActiveShopJsonUtils.SECKILL: - if(itemIds.contains(",")){ - String [] unitPricesArray=unitPrices.split(","); - String [] itemIdsArray=itemIds.split(","); - for (int i=0;i