入驻流程 fix bug, 审核备注和创建店铺相关的问题

This commit is contained in:
Jack 2025-06-23 17:11:39 +08:00
parent 04157e9575
commit 4d05f5ad16
4 changed files with 152 additions and 130 deletions

View File

@ -614,7 +614,6 @@ public class LklTkServiceImpl {
if (!success) {
return new JSONObject().set("code", "500").set("message", "更新商户号失败");
// throw new ApiException("更新商户号失败");
}
// 备注RMK 采用拉卡拉的入网电子合同签署流程暂停e签宝的电子合同生成流程

View File

@ -984,13 +984,13 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
* @param lklInnerMerNo 拉卡拉内部商户号
* @param lklMerCupNo 拉卡拉外部商户号
* @param termNos 拉卡拉分配的业务终端号
* @param lklAuditStatus 拉卡拉审核状态
* @param lklTkAuditStatus 拉卡拉审核状态
* @param approvalStatus 入驻材料审核状态
* @param lklTkRegNotifyReq 异步通知返回的请求数据
* @return
*/
@Override
public Boolean updateMerchEntryLklAuditStatusByLklMerCupNo(String lklInnerMerNo, String lklMerCupNo, String termNos, Integer lklAuditStatus, Integer approvalStatus, String lklTkRegNotifyReq) {
public Boolean updateMerchEntryLklAuditStatusByLklMerCupNo(String lklInnerMerNo, String lklMerCupNo, String termNos, Integer lklTkAuditStatus, Integer approvalStatus, String lklTkRegNotifyReq) {
if (StrUtil.isBlank(lklInnerMerNo)) {
return false;
}
@ -1007,8 +1007,8 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
updateWrapper.set("lkl_term_no", termNos);
}
if (ObjectUtil.isNotEmpty(lklAuditStatus)) {
updateWrapper.set("lkl_tk_audit_status", lklAuditStatus);
if (ObjectUtil.isNotEmpty(lklTkAuditStatus)) {
updateWrapper.set("lkl_tk_audit_status", lklTkAuditStatus);
}
if (ObjectUtil.isNotEmpty(approvalStatus)) {
@ -1303,6 +1303,25 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
.filter(StrUtil::isNotBlank)
.ifPresent(cupNo -> 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<String, Integer> updateFieldMap = new LinkedHashMap<>();
updateFieldMap.put("approval_status", approvalStatus); // 审批状态
@ -1319,6 +1338,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
.filter(entry -> entry.getValue() != null && entry.getValue() > 0)
.forEach(entry -> updateWrapper.set(entry.getKey(), entry.getValue()));
// 6. 执行更新操作并返回结果
return update(updateWrapper);

View File

@ -3371,13 +3371,11 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
List<Integer> 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<ShopStoreEmployee> 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._("设置店铺管理员权限失败"));
}

View File

@ -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<String, Integer> 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<String> folders) {
if (StrUtil.isBlank(appKey) || StrUtil.isBlank(sign) ) {
public ThirdApiRes fileUploadToOss(String appKey, String sign, String syncType, Date refreshDate, List<String> folders) {
if (StrUtil.isBlank(appKey) || StrUtil.isBlank(sign)) {
return new ThirdApiRes().fail(1003, I18nUtil._("缺少必要参数!"));
}
// 验签appid必要参数判断
SyncApp syncApp = syncAppService.getOne(new LambdaQueryWrapper<SyncApp>()
.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<StoreDbConfig> 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<SyncApp>()
.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<ShopStoreActivityBase> addshopStoreActivityBaseList=new ArrayList<>();
List<ShopStoreActivityBase> updateShopStoreActivityBaseList=new ArrayList<>();
Map<String, String> 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<ShopStoreActivityBase> addshopStoreActivityBaseList = new ArrayList<>();
List<ShopStoreActivityBase> updateShopStoreActivityBaseList = new ArrayList<>();
Map<String, String> 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<SyncApp>()
.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<ShopStoreActivityBase> updateShopStoreActivityBaseList=new ArrayList<>();
Map<String, String> stringIntegerMap= checkExistingActive(jsonArray,storeId);
Map shopProduckKeyMap=shopProductBaseService.getProductBasicIdByStore(storeId);//获取货架号对应的商品id
Map shopItemKeyMap=shopProductItemService.getProductItemIdByStore(storeId);//获取商品id对应的item的id
Map<String,String> 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<ShopStoreActivityBase> updateShopStoreActivityBaseList = new ArrayList<>();
Map<String, String> stringIntegerMap = checkExistingActive(jsonArray, storeId);
Map shopProduckKeyMap = shopProductBaseService.getProductBasicIdByStore(storeId);//获取货架号对应的商品id
Map shopItemKeyMap = shopProductItemService.getProductItemIdByStore(storeId);//获取商品id对应的item的id
Map<String, String> 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<org.json.JSONObject> 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<org.json.JSONObject> 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<org.json.JSONObject> getFulReduItemList(String itemPrice,String activeType,BigDecimal discount){
List<org.json.JSONObject> newItems=new ArrayList<>();
String [] itemPriceArray=itemPrice.split("_");
String itemIds=itemPriceArray[0];
String unitPrices=itemPriceArray[1];
switch (activeType){
private List<org.json.JSONObject> getFulReduItemList(String itemPrice, String activeType, BigDecimal discount) {
List<org.json.JSONObject> 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<itemIdsArray.length;i++) {
if (itemIds.contains(",")) {
String[] unitPricesArray = unitPrices.split(",");
String[] itemIdsArray = itemIds.split(",");
for (int i = 0; i < itemIdsArray.length; i++) {
org.json.JSONObject jsonObject = new org.json.JSONObject();
jsonObject.put("item_id", itemIdsArray[i]);
jsonObject.put("price", BigDecimalFormatter.formatWithoutTrailingZeros(discount.multiply(new BigDecimal(unitPricesArray[i]))));
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("price", BigDecimalFormatter.formatWithoutTrailingZeros(discount.multiply(new BigDecimal(unitPrices))));
newItems.add(jsonObject);
}