|  | @@ -80,19 +80,25 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 积分规则明细导入
 | 
	
		
			
				|  |  | +     * 使用原来逻辑和修改整合在一起
 | 
	
		
			
				|  |  | +     * isUpdate是否是修改
 | 
	
		
			
				|  |  |       * @param pointsRulesList
 | 
	
		
			
				|  |  |       * @param mkaId
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public R rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId) {
 | 
	
		
			
				|  |  | +    public R rulesUploadDetil(List<Mall2RulesDto> pointsRulesList, Long mkaId,Boolean isUpdate) {
 | 
	
		
			
				|  |  |          StringBuilder stringBuilder = new StringBuilder();
 | 
	
		
			
				|  |  |          Integer pointsType = mall2PointsRulesDao.queryRulesDetilId(mkaId);
 | 
	
		
			
				|  |  |          if(pointsRulesList.size()>0){
 | 
	
		
			
				|  |  |              for(Mall2RulesDto mall2RulesDto : pointsRulesList) {
 | 
	
		
			
				|  |  | +                log.debug("积分规则明细导入数据:{}",JacksonUtil.toJson(mall2RulesDto));
 | 
	
		
			
				|  |  |                  //校验参数
 | 
	
		
			
				|  |  |                  checkMsg(pointsType,mall2RulesDto);
 | 
	
		
			
				|  |  |                  //获取门店ID
 | 
	
		
			
				|  |  |                  Long id = storeDao.queryObjectRulesByName(Objects.isNull(mall2RulesDto.getStoreName()) ? "": mall2RulesDto.getStoreName().trim());
 | 
	
		
			
				|  |  | +                if (Objects.isNull(id)){
 | 
	
		
			
				|  |  | +                    return R.error("门店名称不存在请确认再进行添加");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  mall2RulesDto.setStoreId(id);
 | 
	
		
			
				|  |  |                  switch (pointsType) {
 | 
	
		
			
				|  |  |                      //门店
 | 
	
	
		
			
				|  | @@ -100,6 +106,7 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 | 
	
		
			
				|  |  |                          Long store = storeDao.queryObjectRulesByName(mall2RulesDto.getPointsRulesName().trim());
 | 
	
		
			
				|  |  |                          if (Objects.isNull(store)){
 | 
	
		
			
				|  |  |                              stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的门店名称不存在请确认再添加,");
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  |  //                            return R.error("门店名称不存在请确认再添加");
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          mall2RulesDto.setRulesId(store+"");
 | 
	
	
		
			
				|  | @@ -109,6 +116,7 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 | 
	
		
			
				|  |  |                          Long category = categoryDao.queryObjectCategoryByName(mall2RulesDto.getPointsRulesName().trim());
 | 
	
		
			
				|  |  |                          if (Objects.isNull(category)){
 | 
	
		
			
				|  |  |                              stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的类别名称不存在请确认再添加,");
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  |  //                            return R.error("类别名称不存在请确认再添加");
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          mall2RulesDto.setRulesId( category+ "");
 | 
	
	
		
			
				|  | @@ -118,6 +126,7 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 | 
	
		
			
				|  |  |                          String s = productStoreRelaDao.queryproductStoreByName(mall2RulesDto.getPointsRulesName().trim(), id);
 | 
	
		
			
				|  |  |                          if (Objects.isNull(s)){
 | 
	
		
			
				|  |  |                              stringBuilder.append(mall2RulesDto.getPointsRulesName()+"的商品条码不存在请确认再添加,");
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  |  //                            return R.error("商品条码不存在请确认再添加");
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          mall2RulesDto.setRulesId(mall2RulesDto.getPointsRulesName().trim());
 | 
	
	
		
			
				|  | @@ -144,10 +153,16 @@ public class Mall2PointsRulesServiceImpl implements Mall2PointsRulesService {
 | 
	
		
			
				|  |  |                  return R.error(stringBuilder.toString());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(pointsRulesList.size()>0){
 | 
	
		
			
				|  |  | +            if(pointsRulesList.size()>0 && isUpdate == false){
 | 
	
		
			
				|  |  |                  log.debug("积分规则明细导入数据:{}", JacksonUtil.toJson(pointsRulesList));
 | 
	
		
			
				|  |  |                  mall2PointsRulesDao.saveMall2PointsRulesDetil(pointsRulesList);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            if(pointsRulesList.size()>0 && isUpdate){
 | 
	
		
			
				|  |  | +                log.debug("积分规则明细修改数据:{}", JacksonUtil.toJson(pointsRulesList));
 | 
	
		
			
				|  |  | +                mall2PointsRulesDao.updateMall2PointsRulesDetil(pointsRulesList);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return R.ok();
 | 
	
		
			
				|  |  |      }
 |