Browse Source

fix 资料审核

he2802 3 years ago
parent
commit
97fe7257d4

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ProfileTpAddBo.java

@@ -37,6 +37,6 @@ public class ProfileTpAddBo {
     @ApiModelProperty("业务层级列表")
     private List<ProfileTpBusinessAddBo> businessList;
     /** key值,多个,拼接 */
-    @ApiModelProperty("key值,多个,拼接")
+    @ApiModelProperty("key值")
     private String keyValue;
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ProfileTpEditBo.java

@@ -43,7 +43,7 @@ public class ProfileTpEditBo {
     private List<ProfileTpBusinessAddBo> businessList;
 
     /** key值,多个,拼接 */
-    @ApiModelProperty("key值,多个,拼接")
+    @ApiModelProperty("key值")
     private String keyValue;
 
 }

+ 32 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpServiceImpl.java

@@ -4,13 +4,19 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.base.bo.ProfileTpAddBo;
+import com.zhongzheng.modules.base.bo.ProfileTpBusinessAddBo;
 import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
 import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
 import com.zhongzheng.modules.base.domain.ProfileTp;
+import com.zhongzheng.modules.base.domain.ProfileTpBusiness;
 import com.zhongzheng.modules.base.mapper.ProfileTpMapper;
 import com.zhongzheng.modules.base.service.IProfileTpBusinessService;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
+import com.zhongzheng.modules.course.bo.CourseChapterBusinessAddBo;
+import com.zhongzheng.modules.course.domain.CourseChapter;
+import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import com.zhongzheng.modules.course.domain.CourseChapterSection;
 import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,8 +24,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
+import org.springframework.transaction.annotation.Transactional;
+
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -71,19 +80,41 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean insertByAddBo(ProfileTpAddBo bo) {
         ProfileTp add = BeanUtil.toBean(bo, ProfileTp.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        return this.save(add);
+        boolean result = this.save(add);
+        if(bo.getBusinessList()!=null){
+            Collection<ProfileTpBusiness> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                ProfileTpBusiness addItem = BeanUtil.toBean(bo.getBusinessList().get(i), ProfileTpBusiness.class);
+                addItem.setProfileTpId(add.getProfileTpId());
+                coll.add(addItem);
+            }
+            iProfileTpBusinessService.saveBatch(coll);
+        }
+        return result;
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(ProfileTpEditBo bo) {
         ProfileTp update = BeanUtil.toBean(bo, ProfileTp.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
+        if(bo.getBusinessList()!= null){
+            iProfileTpBusinessService.remove(new LambdaQueryWrapper<ProfileTpBusiness>().eq(ProfileTpBusiness::getProfileTpId, bo.getProfileTpId()));
+            Collection<ProfileTpBusiness> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                ProfileTpBusiness addItem = BeanUtil.toBean(bo.getBusinessList().get(i), ProfileTpBusiness.class);
+                addItem.setProfileTpId(bo.getProfileTpId());
+                coll.add(addItem);
+            }
+            iProfileTpBusinessService.saveBatch(coll);
+        }
         return this.updateById(update);
     }
 

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/ProfileTpVo.java

@@ -37,7 +37,7 @@ public class ProfileTpVo {
 	@ApiModelProperty("0 禁用 1启用")
 	private Integer status;
 	/** key值,多个,拼接 */
-	@Excel(name = "key值,多个,拼接")
-	@ApiModelProperty("key值,多个,拼接")
+	@Excel(name = "key值")
+	@ApiModelProperty("key值")
 	private String keyValue;
 }