Browse Source

Merge remote-tracking branch 'origin/saas' into saas

hgw 3 years ago
parent
commit
028f786506

+ 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;
     }
 

+ 1 - 6
mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml

@@ -234,18 +234,13 @@
     </select>
     <sql id="queryTeacherIdsByClassGroupIdSql">
         <where>
-            <if test="classGroupId != null">
-                AND class_group_id_ = #{classGroupId}
-            </if>
+            class_group_id_ = #{classGroupId}
             <if test="groupType != null">
                 AND group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="musicGroupId != null">
                 AND music_group_id_ = #{musicGroupId}
             </if>
-            <if test="tenantId != null">
-                AND tenant_id_ = #{tenantId}
-            </if>
         </where>
     </sql>
 </mapper>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/InspectionMapper.xml

@@ -86,7 +86,7 @@
 
     <sql id="queryPageSql">
         <where>
-        	tenant_id_ = #{tenantId}
+        	i.tenant_id_ = #{tenantId}
             <if test="organId != null">
                 AND FIND_IN_SET(i.organ_id_,#{organId})
             </if>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupQuitMapper.xml

@@ -122,7 +122,7 @@
     </select>
     <sql id="queryPageSql">
         <where>
-        	tenant_id_ = #{tenantId}
+        	mgq.tenant_id_ = #{tenantId}
             <if test="ids != null and ids != ''">
                 AND FIND_IN_SET(mgq.id_,#{ids})
             </if>

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

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