瀏覽代碼

fengji org.apache.ibatis.binding.BindingException: Parameter 'tenantId' not found

yanite 3 年之前
父節點
當前提交
6d42103ffc

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupBuyParamsDto.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
+import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
@@ -8,7 +9,7 @@ import java.util.List;
  * @Author Joburgess
  * @Date 2019/10/2
  */
-public class VipGroupBuyParamsDto {
+public class VipGroupBuyParamsDto extends BaseEntity {
 
     @ApiModelProperty(value = "vip课程ID")
     private Long vipGroupId;

+ 13 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/AppRedemptionCodeServiceImpl.java

@@ -18,11 +18,13 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.ByteArrayInputStream;
@@ -53,9 +55,10 @@ public class AppRedemptionCodeServiceImpl extends ServiceImpl<RedemptionCodeDao,
     private final static Logger logger = LoggerFactory.getLogger(AppRedemptionCodeServiceImpl.class);
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public List<AppRedemptionCode> importRedemptionCode(MultipartFile file) throws Exception {
         Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(
-                new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
+                new ByteArrayInputStream(file.getBytes()), 0, file.getOriginalFilename());
 
         InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
         Map<String, String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.REDEMPTIONCODE.getMsg());
@@ -83,13 +86,20 @@ public class AppRedemptionCodeServiceImpl extends ServiceImpl<RedemptionCodeDao,
                 try {
                     AppRedemptionCode redemptionCode = JSONObject.parseObject(objectMap.toJSONString(),
                                                                               AppRedemptionCode.class);
+                    if (redemptionCode.getCode() == null) continue;
                     redemptionCodesList.add(redemptionCode);
-                    redemptionCodeDao.insert(redemptionCode);
                 } catch (Exception ex) {
-                    throw new BizException("导入数据出错", ex);
+                    throw new BizException("导入数据出错:" + ex, ex);
                 }
             }
         }
+        try {
+            redemptionCodeDao.insertBatch(redemptionCodesList);
+        } catch (DuplicateKeyException dupKeyEx) {
+            throw new BizException("数据重复:" + dupKeyEx.getCause(), dupKeyEx);
+        } catch (Exception ex) {
+            throw new BizException("导入数据出错:" + ex, ex);
+        }
         return redemptionCodesList;
     }
 

+ 2 - 2
mec-web/src/main/resources/columnMapper.ini

@@ -50,5 +50,5 @@
 缴费单号 = calenderId
 
 [兑换码分配模板表]
-分配码 = code
-兑换链接 = url
+码 = code
+链接地址 = url