he2802 преди 2 години
родител
ревизия
648a9ed83f
променени са 55 файла, в които са добавени 2294 реда и са изтрити 349 реда
  1. 42 0
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/course/TopMajorController.java
  2. 43 0
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/course/TopSchoolController.java
  3. 0 69
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/distribution/DistributionActivityGoodsController.java
  4. 7 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java
  5. 49 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/domain/ActivityGoodsPrice.java
  6. 13 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/mapper/ActivityGoodsPriceMapper.java
  7. 17 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/IActivityGoodsPriceService.java
  8. 28 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityGoodsPriceServiceImpl.java
  9. 0 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/domain/DistributionActivityGoods.java
  10. 3 38
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityGoodsService.java
  11. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityPosterService.java
  12. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityService.java
  13. 1275 66
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityGoodsServiceImpl.java
  14. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityPosterServiceImpl.java
  15. 79 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityServiceImpl.java
  16. 22 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsPullTenantBo.java
  17. 5 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java
  18. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java
  19. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformRemindService.java
  20. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformSysUserService.java
  21. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformRemindServiceImpl.java
  22. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformSysUserServiceImpl.java
  23. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysRoleService.java
  24. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysTenantService.java
  25. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysUserRoleService.java
  26. 10 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysRoleServiceImpl.java
  27. 14 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysUserRoleServiceImpl.java
  28. 0 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/domain/DistributionActivityTemplateGoods.java
  29. 103 31
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/service/impl/DistributionActivityTemplateServiceImpl.java
  30. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/vo/DistributionActivityTemplateVo.java
  31. 34 34
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopCourseBusinessQueryBo.java
  32. 10 9
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopCourseProjectTypeQueryBo.java
  33. 23 6
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopMajorQueryBo.java
  34. 24 11
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopSchoolQueryBo.java
  35. 48 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/domain/TopActivityGoodsPrice.java
  36. 14 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopActivityGoodsPriceMapper.java
  37. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopCourseBusinessMapper.java
  38. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopMajorMapper.java
  39. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopSchoolMapper.java
  40. 13 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopActivityGoodsPriceService.java
  41. 18 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopActivityGoodsPriceServiceImpl.java
  42. 3 24
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopCourseBusinessServiceImpl.java
  43. 22 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopCourseEducationTypeServiceImpl.java
  44. 1 11
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopMajorServiceImpl.java
  45. 20 17
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopSchoolServiceImpl.java
  46. 12 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseBusinessVo.java
  47. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseEducationTypeVo.java
  48. 8 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseProjectTypeVo.java
  49. 16 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopMajorVo.java
  50. 27 9
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopSchoolVo.java
  51. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/ITopSysUserService.java
  52. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysUserServiceImpl.java
  53. 71 0
      zhongzheng-system/src/main/resources/mapper/modules/top/TopCourseBusinessMapper.xml
  54. 43 0
      zhongzheng-system/src/main/resources/mapper/modules/top/TopMajorMapper.xml
  55. 97 0
      zhongzheng-system/src/main/resources/mapper/modules/top/TopSchoolMapper.xml

+ 42 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/course/TopMajorController.java

@@ -0,0 +1,42 @@
+package com.zhongzheng.controller.course;
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.top.goods.bo.TopMajorQueryBo;
+import com.zhongzheng.modules.top.goods.service.ITopMajorService;
+import com.zhongzheng.modules.top.goods.vo.TopMajorVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 专业Controller
+ * 
+ * @author ruoyi
+ * @date 2021-10-09
+ */
+@Api(value = "专业控制器", tags = {"专业管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/course/major")
+public class TopMajorController extends BaseController {
+
+    private final ITopMajorService iTopMajorService;
+
+    /**
+     * 查询专业列表
+     */
+    @ApiOperation("查询专业列表")
+    @GetMapping("/list")
+    public TableDataInfo<TopMajorVo> list(TopMajorQueryBo bo) {
+        startPage();
+        List<TopMajorVo> list = iTopMajorService.queryList(bo);
+        return getDataTable(list);
+    }
+}

+ 43 - 0
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/course/TopSchoolController.java

@@ -0,0 +1,43 @@
+package com.zhongzheng.controller.course;
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import com.zhongzheng.modules.top.goods.bo.TopSchoolQueryBo;
+import com.zhongzheng.modules.top.goods.service.ITopSchoolService;
+import com.zhongzheng.modules.top.goods.vo.TopSchoolVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 高校Controller
+ * 
+ * @author ruoyi
+ * @date 2021-10-09
+ */
+@Api(value = "高校控制器", tags = {"高校管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/user/school")
+public class TopSchoolController extends BaseController {
+
+    private final ITopSchoolService iTopSchoolService;
+
+    /**
+     * 查询高校列表
+     */
+    @ApiOperation("查询高校列表")
+    @GetMapping("/list")
+    public TableDataInfo<TopSchoolVo> list(TopSchoolQueryBo bo) {
+        startPage();
+        List<TopSchoolVo> list = iTopSchoolService.queryList(bo);
+        return getDataTable(list);
+    }
+
+}

+ 0 - 69
zhongzheng-admin/src/main/java/com/zhongzheng/controller/distribution/DistributionActivityGoodsController.java

@@ -33,73 +33,4 @@ import java.util.List;
 @RequestMapping("/system/goods")
 public class DistributionActivityGoodsController extends BaseController {
 
-    private final IDistributionActivityGoodsService iDistributionActivityGoodsService;
-
-    /**
-     * 查询【请填写功能名称】列表
-     */
-    @ApiOperation("查询【请填写功能名称】列表")
-    @PreAuthorize("@ss.hasPermi('system:goods:list')")
-    @GetMapping("/list")
-    public TableDataInfo<DistributionActivityGoodsVo> list(DistributionActivityGoodsQueryBo bo) {
-        startPage();
-        List<DistributionActivityGoodsVo> list = iDistributionActivityGoodsService.queryList(bo);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出【请填写功能名称】列表
-     */
-    @ApiOperation("导出【请填写功能名称】列表")
-    @PreAuthorize("@ss.hasPermi('system:goods:export')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult<DistributionActivityGoodsVo> export(DistributionActivityGoodsQueryBo bo) {
-        List<DistributionActivityGoodsVo> list = iDistributionActivityGoodsService.queryList(bo);
-        ExcelUtil<DistributionActivityGoodsVo> util = new ExcelUtil<DistributionActivityGoodsVo>(DistributionActivityGoodsVo.class);
-        return util.exportExcel(list, "【请填写功能名称】");
-    }
-
-    /**
-     * 获取【请填写功能名称】详细信息
-     */
-    @ApiOperation("获取【请填写功能名称】详细信息")
-    @PreAuthorize("@ss.hasPermi('system:goods:query')")
-    @GetMapping("/{id}")
-    public AjaxResult<DistributionActivityGoodsVo> getInfo(@PathVariable("id" ) Long id) {
-        return AjaxResult.success(iDistributionActivityGoodsService.queryById(id));
-    }
-
-    /**
-     * 新增【请填写功能名称】
-     */
-    @ApiOperation("新增【请填写功能名称】")
-    @PreAuthorize("@ss.hasPermi('system:goods:add')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
-    @PostMapping()
-    public AjaxResult<Void> add(@RequestBody DistributionActivityGoodsAddBo bo) {
-        return toAjax(iDistributionActivityGoodsService.insertByAddBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 修改【请填写功能名称】
-     */
-    @ApiOperation("修改【请填写功能名称】")
-    @PreAuthorize("@ss.hasPermi('system:goods:edit')")
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
-    @PutMapping()
-    public AjaxResult<Void> edit(@RequestBody DistributionActivityGoodsEditBo bo) {
-        return toAjax(iDistributionActivityGoodsService.updateByEditBo(bo) ? 1 : 0);
-    }
-
-    /**
-     * 删除【请填写功能名称】
-     */
-    @ApiOperation("删除【请填写功能名称】")
-    @PreAuthorize("@ss.hasPermi('system:goods:remove')")
-    @Log(title = "【请填写功能名称】" , businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult<Void> remove(@PathVariable Long[] ids) {
-        return toAjax(iDistributionActivityGoodsService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
-    }
 }

+ 7 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java

@@ -29,6 +29,7 @@ import com.zhongzheng.modules.system.vo.SysTenantVo;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
@@ -241,4 +242,10 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
         return baseMapper.findTenantId(bo);
     }
 
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public List<SysTenant> getListSysTenant() {
+        return list(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getStatus, 1));
+    }
+
 }

+ 49 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/domain/ActivityGoodsPrice.java

@@ -0,0 +1,49 @@
+package com.zhongzheng.modules.activity.domain;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 【活动商品价格】对象 top_certificate
+ *
+ * @author ruoyi
+ * @date 2023-03-15
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("activity_goods_price")
+public class ActivityGoodsPrice implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 商品ID */
+    private Long goodsId;
+    /** 商品价格 */
+    private BigDecimal goodsPrice;
+    /** 活动编码 */
+    private String activityCode;
+    /** 类型 */
+    private Integer type;
+    /**  状态 1正常 0关闭 */
+    private Integer status;
+    /** 创建时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** 更新时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+    private Long tenantId;
+
+}

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/mapper/ActivityGoodsPriceMapper.java

@@ -0,0 +1,13 @@
+package com.zhongzheng.modules.activity.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
+
+/**
+ * 商品推荐Mapper接口
+ *
+ * @author hjl
+ * @date 2022-04-13
+ */
+public interface ActivityGoodsPriceMapper extends BaseMapper<ActivityGoodsPrice> {
+}

+ 17 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/IActivityGoodsPriceService.java

@@ -0,0 +1,17 @@
+package com.zhongzheng.modules.activity.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
+
+import java.util.List;
+
+/**
+ * 商品推荐Service接口
+ *
+ * @author hjl
+ * @date 2022-04-13
+ */
+public interface IActivityGoodsPriceService extends IService<ActivityGoodsPrice> {
+
+    void saveBatchEntity(List<ActivityGoodsPrice> priceList);
+}

+ 28 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityGoodsPriceServiceImpl.java

@@ -0,0 +1,28 @@
+package com.zhongzheng.modules.activity.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
+import com.zhongzheng.modules.activity.mapper.ActivityGoodsPriceMapper;
+import com.zhongzheng.modules.activity.service.IActivityGoodsPriceService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 商品推荐Service业务层处理
+ *
+ * @author hjl
+ * @date 2022-04-13
+ */
+@Service
+@DS("slave")
+public class ActivityGoodsPriceServiceImpl extends ServiceImpl<ActivityGoodsPriceMapper, ActivityGoodsPrice> implements IActivityGoodsPriceService {
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public void saveBatchEntity(List<ActivityGoodsPrice> priceList) {
+        saveBatch(priceList);
+    }
+}

+ 0 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/domain/DistributionActivityGoods.java

@@ -32,8 +32,6 @@ private static final long serialVersionUID=1L;
     private Long distributionId;
     /** 商品ID */
     private Long goodsId;
-    /** 商品活动价格 */
-    private BigDecimal goodsPrice;
     /** 总佣金上限 */
     private BigDecimal profitMax;
     /** 状态:1有效,0无效 */

+ 3 - 38
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityGoodsService.java

@@ -1,13 +1,9 @@
 package com.zhongzheng.modules.distribution.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsAddBo;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsEditBo;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsQueryBo;
 import com.zhongzheng.modules.distribution.domain.DistributionActivityGoods;
-import com.zhongzheng.modules.distribution.vo.DistributionActivityGoodsVo;
+import com.zhongzheng.modules.goods.bo.GoodsPullTenantBo;
 
-import java.util.Collection;
 import java.util.List;
 
 /**
@@ -17,40 +13,9 @@ import java.util.List;
  * @date 2023-03-06
  */
 public interface IDistributionActivityGoodsService extends IService<DistributionActivityGoods> {
-    /**
-     * 查询单个
-     *
-     * @return
-     */
-    DistributionActivityGoodsVo queryById(Long id);
 
-    /**
-     * 查询列表
-     */
-    List<DistributionActivityGoodsVo> queryList(DistributionActivityGoodsQueryBo bo);
+    boolean pullGoods(GoodsPullTenantBo bo);
 
-    /**
-     * 根据新增业务对象插入【请填写功能名称】
-     *
-     * @param bo 【请填写功能名称】新增业务对象
-     * @return
-     */
-    Boolean insertByAddBo(DistributionActivityGoodsAddBo bo);
+    void saveBatchEntity(List<DistributionActivityGoods> activityGoodsList);
 
-    /**
-     * 根据编辑业务对象修改【请填写功能名称】
-     *
-     * @param bo 【请填写功能名称】编辑业务对象
-     * @return
-     */
-    Boolean updateByEditBo(DistributionActivityGoodsEditBo bo);
-
-    /**
-     * 校验并删除数据
-     *
-     * @param ids     主键集合
-     * @param isValid 是否校验,true-删除前校验,false-不校验
-     * @return
-     */
-    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityPosterService.java

@@ -51,4 +51,7 @@ public interface IDistributionActivityPosterService extends IService<Distributio
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void savePoster(DistributionActivityPoster poster);
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/IDistributionActivityService.java

@@ -54,4 +54,6 @@ public interface IDistributionActivityService extends IService<DistributionActiv
     boolean editStatus(DistributionStatusEditBo bo);
 
 	boolean pullGoods(Long distributionId);
+
+    void saveEntity(DistributionActivity dailyActivity);
 }

+ 1275 - 66
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityGoodsServiceImpl.java

@@ -1,23 +1,55 @@
 package com.zhongzheng.modules.distribution.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.Page;
+import com.zhongzheng.common.core.redis.RedisCache;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsAddBo;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsEditBo;
-import com.zhongzheng.modules.distribution.bo.DistributionActivityGoodsQueryBo;
+import com.zhongzheng.modules.bank.domain.*;
+import com.zhongzheng.modules.bank.service.*;
+import com.zhongzheng.modules.base.domain.Certificate;
+import com.zhongzheng.modules.base.domain.CertificateCommon;
+import com.zhongzheng.modules.base.domain.CertificateTp;
+import com.zhongzheng.modules.base.service.*;
+import com.zhongzheng.modules.course.domain.*;
+import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.distribution.domain.DistributionActivityGoods;
 import com.zhongzheng.modules.distribution.mapper.DistributionActivityGoodsMapper;
 import com.zhongzheng.modules.distribution.service.IDistributionActivityGoodsService;
-import com.zhongzheng.modules.distribution.vo.DistributionActivityGoodsVo;
+import com.zhongzheng.modules.exam.domain.ExamPaper;
+import com.zhongzheng.modules.exam.service.IExamPaperService;
+import com.zhongzheng.modules.goods.bo.GoodsPullTenantBo;
+import com.zhongzheng.modules.goods.domain.*;
+import com.zhongzheng.modules.goods.service.*;
+import com.zhongzheng.modules.pay.domain.PayServe;
+import com.zhongzheng.modules.pay.domain.PaySupply;
+import com.zhongzheng.modules.pay.service.IPayServeService;
+import com.zhongzheng.modules.pay.service.IPaySupplyService;
+import com.zhongzheng.modules.polyv.service.IPolyvCataService;
+import com.zhongzheng.modules.polyv.service.IPolyvVideoService;
+import com.zhongzheng.modules.system.bo.GoodsCopyEnum;
+import com.zhongzheng.modules.system.domain.SysGoodsCopyRecord;
+import com.zhongzheng.modules.system.service.ISysGoodsCopyRecordService;
+import com.zhongzheng.modules.top.goods.domain.TopGoods;
+import com.zhongzheng.modules.top.goods.service.*;
+import com.zhongzheng.modules.user.domain.School;
+import com.zhongzheng.modules.user.service.ISchoolService;
+import net.polyv.common.v1.util.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -30,77 +62,1254 @@ import java.util.stream.Collectors;
 @DS("slave")
 public class DistributionActivityGoodsServiceImpl extends ServiceImpl<DistributionActivityGoodsMapper, DistributionActivityGoods> implements IDistributionActivityGoodsService {
 
+    @Autowired
+    private IGoodsService iGoodsService;
+    @Autowired
+    private IGoodsCourseService iGoodsCourseService;
+    @Autowired
+    private IGoodsAttachedService iGoodsAttachedService;
+    @Autowired
+    private ICourseService iCourseService;
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
+    @Autowired
+    private ICourseMenuExamService iCourseMenuExamService;
+    @Autowired
+    private ICourseModuleService iCourseModuleService;
+    @Autowired
+    private ICourseModuleBusinessService iCourseModuleBusinessService;
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
+    @Autowired
+    private ICourseModuleChapterService iCourseModuleChapterService;
+    @Autowired
+    private ICourseSectionWatchPerService iCourseSectionWatchPerService;
+    @Autowired
+    private IGoodsSpecTemplateService goodsSpecTemplateService;
+    @Autowired
+    private IGoodsSpecAttributeService goodsSpecAttributeService;
+    @Autowired
+    private IGoodsSpecAttributeRelationService goodsSpecAttributeRelationService;
+    @Autowired
+    private ICourseEducationTypeService iCourseEducationTypeService;
+    @Autowired
+    private ICourseHandoutsService iCourseHandoutsService;
+    @Autowired
+    private ICourseHandoutsBusinessService iCourseHandoutsBusinessService;
+    @Autowired
+    private ICourseEducationTierService iCourseEducationTierService;
+    @Autowired
+    private ICourseProjectTypeService iCourseProjectTypeService;
+    @Autowired
+    private ICourseSectionService iCourseSectionService;
+    @Autowired
+    private ICourseSectionBusinessService iCourseSectionBusinessService;
+    @Autowired
+    private ICourseBusinessService iCourseBusinessService;
+    @Autowired
+    private ICourseSubjectService iCourseSubjectService;
+    @Autowired
+    private ICourseSubjectProjectService iCourseSubjectProjectService;
+    @Autowired
+    private IExamService iExamService;
+    @Autowired
+    private IExamPaperService iExamPaperService;
+    @Autowired
+    private IExamQuestionService iExamQuestionService;
+    @Autowired
+    private IGoodsSpecService goodsSpecService;
+    @Autowired
+    private IQuestionService iQuestionService;
+    @Autowired
+    private IQuestionBusinessService iQuestionBusinessService;
+    @Autowired
+    private IQuestionChapterService iQuestionChapterService;
+    @Autowired
+    private IQuestionChapterExamService iQuestionChapterExamService;
+    @Autowired
+    private IQuestionModuleService iQuestionModuleService;
+    @Autowired
+    private IQuestionModuleChapterService iQuestionModuleChapterService;
+    @Autowired
+    private ICertificateService iCertificateService;
+    @Autowired
+    private ICertificateCommonService iCertificateCommonService;
+    @Autowired
+    private ICertificateTpService iCertificateTpService;
+    @Autowired
+    private IGoodsCourseTeacherService goodsCourseTeacherService;
+    @Autowired
+    private ICourseChapterService iCourseChapterService;
+    @Autowired
+    private ICourseChapterBusinessService iCourseChapterBusinessService;
+    @Autowired
+    private IPaySupplyService iPaySupplyService;
+    @Autowired
+    private ICourseStreamingService iCourseStreamingService;
+    @Autowired
+    private ICourseStreamingBusinessService iCourseStreamingBusinessService;
+    @Autowired
+    private IPolyvVideoService iPolyvVideoService;
+    @Autowired
+    private IPolyvCataService iPolyvCataService;
+    @Autowired
+    private IProfileFieldService iProfileFieldService;
+    @Autowired
+    private IProfileTpService iProfileTpService;
+    @Autowired
+    private IProfileTpBusinessService iProfileTpBusinessService;
+    @Autowired
+    private IMajorService iMajorService;
+    @Autowired
+    private IMajorProjectService iMajorProjectService;
+    @Autowired
+    private IPayServeService iPayServeService;
+    @Autowired
+    private ISchoolService iSchoolService;
+    @Autowired
+    private ISysGoodsCopyRecordService iSysGoodsCopyRecordService;
+
+    @Autowired
+    private ITopGoodsCopyService iTopGoodsCopyService;
+    @Autowired
+    private ITopGoodsCourseService iTopGoodsCourseService;
+    @Autowired
+    private ITopGoodsAttachedService iTopGoodsAttachedService;
+    @Autowired
+    private ITopCourseService iTopCourseService;
+    @Autowired
+    private ITopCourseMenuService iTopCourseMenuService;
+    @Autowired
+    private ITopCourseMenuExamService iTopCourseMenuExamService;
+    @Autowired
+    private ITopCourseModuleService iTopCourseModuleService;
+    @Autowired
+    private ITopCourseModuleBusinessService iTopCourseModuleBusinessService;
+    @Autowired
+    private ITopCourseChapterSectionService iTopCourseChapterSectionService;
+    @Autowired
+    private ITopCourseModuleChapterService iTopCourseModuleChapterService;
+    @Autowired
+    private ITopCourseSectionWatchPerService iTopCourseSectionWatchPerService;
+    @Autowired
+    private ITopGoodsSpecTemplateService topGoodsSpecTemplateService;
+    @Autowired
+    private ITopGoodsSpecAttributeService topGoodsSpecAttributeService;
+    @Autowired
+    private ITopGoodsSpecAttributeRelationService topGoodsSpecAttributeRelationService;
+    @Autowired
+    private ITopCourseEducationTypeService iTopCourseEducationTypeService;
+    @Autowired
+    private ITopCourseHandoutsService iTopCourseHandoutsService;
+    @Autowired
+    private ITopCourseHandoutsBusinessService iTopCourseHandoutsBusinessService;
+    @Autowired
+    private ITopCourseEducationTierService iTopCourseEducationTierService;
+    @Autowired
+    private ITopCourseProjectTypeService iTopCourseProjectTypeService;
+    @Autowired
+    private ITopCourseSectionService iTopCourseSectionService;
+    @Autowired
+    private ITopCourseSectionBusinessService iTopCourseSectionBusinessService;
+    @Autowired
+    private ITopCourseBusinessService iTopCourseBusinessService;
+    @Autowired
+    private ITopCourseSubjectService iTopCourseSubjectService;
+    @Autowired
+    private ITopCourseSubjectProjectService iTopCourseSubjectProjectService;
+    @Autowired
+    private ITopExamService iTopExamService;
+    @Autowired
+    private ITopExamPaperService iTopExamPaperService;
+    @Autowired
+    private ITopExamQuestionService iTopExamQuestionService;
+    @Autowired
+    private ITopGoodsSpecService topGoodsSpecService;
+    @Autowired
+    private ITopQuestionService iTopQuestionService;
+    @Autowired
+    private ITopQuestionBusinessService iTopQuestionBusinessService;
+    @Autowired
+    private ITopQuestionChapterService iTopQuestionChapterService;
+    @Autowired
+    private ITopQuestionChapterExamService iTopQuestionChapterExamService;
+    @Autowired
+    private ITopQuestionModuleService iTopQuestionModuleService;
+    @Autowired
+    private ITopQuestionModuleChapterService iTopQuestionModuleChapterService;
+    @Autowired
+    private ITopCertificateService iTopCertificateService;
+    @Autowired
+    private ITopCertificateCommonService iTopCertificateCommonService;
+    @Autowired
+    private ITopCertificateTpService iTopCertificateTpService;
+    @Autowired
+    private ITopGoodsCourseTeacherService topGoodsCourseTeacherService;
+    @Autowired
+    private ITopCourseChapterService iTopCourseChapterService;
+    @Autowired
+    private ITopCourseChapterBusinessService iTopCourseChapterBusinessService;
+    @Autowired
+    private ITopPaySupplyService iTopPaySupplyService;
+    @Autowired
+    private ITopCourseStreamingService iTopCourseStreamingService;
+    @Autowired
+    private ITopCourseStreamingBusinessService iTopCourseStreamingBusinessService;
+    @Autowired
+    private ITopPolyvVideoService iTopPolyvVideoService;
+    @Autowired
+    private ITopPolyvCataService iTopPolyvCataService;
+    @Autowired
+    private ITopProfileFieldService iTopProfileFieldService;
+    @Autowired
+    private ITopProfileTpService iTopProfileTpService;
+    @Autowired
+    private ITopProfileTpBusinessService iTopProfileTpBusinessService;
+    @Autowired
+    private ITopMajorService iTopMajorService;
+    @Autowired
+    private ITopMajorProjectService iTopMajorProjectService;
+    @Autowired
+    private ITopPayServeService iTopPayServeService;
+    @Autowired
+    private RedisCache redisCache;
+
     @Override
-    public DistributionActivityGoodsVo queryById(Long id){
-        DistributionActivityGoods db = this.baseMapper.selectById(id);
-        return BeanUtil.toBean(db, DistributionActivityGoodsVo.class);
+    @Transactional(rollbackFor = Exception.class)
+    public boolean pullGoods(GoodsPullTenantBo bo) {
+        String key = "GOODS_PULL";
+        Object object = redisCache.getCacheObject(key);
+        if (ObjectUtils.isNotNull(object)){
+            throw new CustomException("存在商品正在拉取中,请稍后重试!");
+        }
+        try {
+            redisCache.setCacheObject(key,DateUtils.getNowTime(),30, TimeUnit.MINUTES);
+            Long newTenantId = bo.getTenantId();
+            List<GoodsSpecAttributeRelation> newRelationList = new ArrayList<>();
+            List<SysGoodsCopyRecord> recordList = new ArrayList<>();
+            for (TopGoods goodsTop : bo.getGoodsList()) {
+                Long oldGoodsId = goodsTop.getGoodsId();
+                Goods goods = BeanUtil.toBean(goodsTop, Goods.class);
+                //新增
+                goods.setGoodsId(null);
+                goods.setTenantId(newTenantId);
+
+                //供应方ID
+                if (ObjectUtil.isNotNull(goods.getSupplyId())){
+                    PaySupply supply = iPaySupplyService.getById(goods.getSupplyId());
+                    if (ObjectUtils.isNotNull(supply)){
+                        Long oldSupplyId = supply.getSupplyId();
+                        //新机构是否存在
+                        Long newSupplyId = getNewIdByTenant(supply.getSupplyId(), GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId);
+                        if (ObjectUtil.isNotNull(newSupplyId)){
+                            goods.setSupplyId(newSupplyId);
+                        }else {
+                            supply.setSupplyId(null);
+                            supply.setTenantId(newTenantId);
+                            //服务类型ID
+                            if (ObjectUtil.isNotNull(supply.getServerId())){
+                                PayServe payServe = iPayServeService.getById(supply.getServerId());
+                                Long oldServeId = payServe.getServeId();
+                                if (ObjectUtils.isNotNull(payServe)){
+                                    Long newPayServerId = getNewIdByTenant(payServe.getServeId(), GoodsCopyEnum.PAY_SERVE.getType(),newTenantId);
+                                    if (ObjectUtils.isNotNull(newPayServerId)){
+                                        supply.setServerId(newPayServerId);
+                                    }else {
+                                        //新增服务
+                                        payServe.setServeId(null);
+                                        payServe.setTenantId(newTenantId);
+                                        iPayServeService.save(payServe);
+                                        supply.setServerId(payServe.getServeId());
+                                        addSysGoodsRecord(oldServeId,payServe.getServeId(),GoodsCopyEnum.PAY_SERVE.getType(),newTenantId,recordList);
+                                    }
+                                }
+                            }
+                            iPaySupplyService.save(supply);
+                            goods.setSupplyId(supply.getSupplyId());
+                            addSysGoodsRecord(oldSupplyId,supply.getSupplyId(),GoodsCopyEnum.PAY_SUPPLY.getType(),newTenantId,recordList);
+                        }
+                    }
+                }
+
+                //教育类型
+                if (ObjectUtil.isNotNull(goods.getEducationTypeId())){
+                    goods.setEducationTypeId(getNewEducationTypeId(goods.getEducationTypeId(),newTenantId,recordList));
+                }
+
+                //业务层次
+                if (ObjectUtil.isNotNull(goods.getBusinessId())){
+                    goods.setBusinessId(getNewBusinessId(goods.getBusinessId(),newTenantId,recordList));
+                }
+
+                //所属院校
+                if (ObjectUtil.isNotNull(goods.getSchoolId())){
+                    School school = iSchoolService.getById(goods.getSchoolId());
+                    if (ObjectUtil.isNotNull(school)){
+                        Long oid = school.getId();
+                        School newSchool = iSchoolService.getSchoolByTenant(school.getEncoder(),newTenantId);
+                        if (ObjectUtil.isNotNull(newSchool)){
+                            goods.setSchoolId(newSchool.getId());
+                        }else {
+                            school.setId(null);
+                            school.setTenantId(newTenantId);
+                            iSchoolService.save(school);
+                            goods.setSchoolId(school.getId());
+                            addSysGoodsRecord(oid,school.getId(),GoodsCopyEnum.SCHOOL.getType(),newTenantId,recordList);
+                        }
+                    }
+                }
+
+                //所属专业
+                if (ObjectUtil.isNotNull(goods.getMajorId())){
+                    goods.setMajorId(getNewMajorId(goods.getMajorId(),newTenantId,recordList));
+                }
+
+                //项目
+                if (ObjectUtil.isNotNull(goods.getProjectId())){
+                    goods.setProjectId(getNewProjectTypeId(goods.getProjectId().longValue(),newTenantId,recordList).intValue());
+                }
+
+                //讲义
+                if (ObjectUtil.isNotNull(goods.getHandoutsId())){
+                    CourseHandouts courseHandouts = iCourseHandoutsService.getById(goods.getHandoutsId());
+                    if (ObjectUtil.isNotNull(courseHandouts)){
+                        Long oid = courseHandouts.getHandoutsId();
+                        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId);
+                        if (ObjectUtil.isNotNull(newId)){
+                            goods.setHandoutsId(newId);
+                        }else {
+                            //讲义业务层次
+                            List<CourseHandoutsBusiness> handoutsBusinessList = iCourseHandoutsBusinessService
+                                    .list(new LambdaQueryWrapper<CourseHandoutsBusiness>()
+                                            .eq(CourseHandoutsBusiness::getHandoutsId, courseHandouts.getHandoutsId()));
+                            courseHandouts.setHandoutsId(null);
+                            courseHandouts.setTenantId(newTenantId);
+                            iCourseHandoutsService.save(courseHandouts);
+                            addSysGoodsRecord(oid,courseHandouts.getHandoutsId(),GoodsCopyEnum.COURSE_HANDOUTS.getType(),newTenantId,recordList);
+                            goods.setHandoutsId(courseHandouts.getHandoutsId());
+                            if (CollectionUtils.isNotEmpty(handoutsBusinessList)){
+                                List<CourseHandoutsBusiness> collect = handoutsBusinessList.stream().map(business -> {
+                                    business.setId(null);
+                                    business.setTenantId(newTenantId);
+                                    //项目
+                                    business.setEducationId(getNewEducationTypeId(business.getEducationId(), newTenantId,recordList));
+                                    //业务
+                                    business.setBusinessId(getNewBusinessId(business.getBusinessId(), newTenantId,recordList));
+                                    //科目
+                                    business.setSubjectId(getNewSubjectId(business.getSubjectId(), newTenantId,recordList));
+                                    //讲义
+                                    business.setHandoutsId(courseHandouts.getHandoutsId());
+                                    return business;
+                                }).collect(Collectors.toList());
+                                iCourseHandoutsBusinessService.saveBatch(collect);
+                            }
+                        }
+                    }
+                }
+
+                //科目ID,拼接
+                if (StringUtils.isNotBlank(goods.getSubjectIds())){
+                    List<Long> subIds = new ArrayList<>();
+                    List<Long> ids = Arrays.asList(goods.getSubjectIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
+                    ids.forEach(item -> {
+                        Long newSubjectId = getNewSubjectId(item, newTenantId,recordList);
+                        if (ObjectUtils.isNotNull(newSubjectId)){
+                            subIds.add(newSubjectId);
+                        }
+                    });
+                    if (CollectionUtils.isNotEmpty(subIds)){
+                        goods.setSubjectIds(subIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
+                    }
+                }
+
+                //证书类型
+                if (ObjectUtils.isNotNull(goods.getCertificateTypeId())){
+                    goods.setCertificateTypeId(getNewCertificateTypeId(goods.getCertificateTypeId(),newTenantId,recordList));
+                }
+
+                //证书
+                if (ObjectUtils.isNotNull(goods.getCertificateId())){
+                    goods.setCertificateId(getNewCertificateId(goods.getCertificateId(),newTenantId,recordList));
+                }
+
+                //证书模板
+                if (ObjectUtils.isNotNull(goods.getCertificateTpId())){
+                    goods.setCertificateTpId(getNewCertificateTpId(goods.getCertificateTpId(),newTenantId,recordList));
+                }
+
+                //规格模板
+                if (ObjectUtils.isNotNull(goods.getSpecTemplateId())){
+                    Long oldSpecTemplateId = goods.getSpecTemplateId();
+                    Long newSpecTemplateId = getNewIdByTenant(oldSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
+                    GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(oldSpecTemplateId);
+                    if (ObjectUtils.isNotNull(newSpecTemplateId)){
+                        //更新
+                        List<Long> specIds = goodsSpecService.getIdsByTenant(newSpecTemplateId,newTenantId);
+                        if (CollectionUtils.isNotEmpty(specIds)){
+                            //删除关联信息
+                            List<Long> specAttrIds = goodsSpecAttributeService.getIdsByTenant(specIds);
+                            if (CollectionUtils.isNotEmpty(specAttrIds)){
+                                goodsSpecAttributeService.deleteByIdsTenant(specAttrIds);
+                                iSysGoodsCopyRecordService.deleteByTenantId(specAttrIds,GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
+                                goodsSpecAttributeRelationService.deleteByTemplateIdTenant(newSpecTemplateId,newTenantId);
+                            }
+                            goodsSpecService.deleteByIdsTenant(specIds);
+                            iSysGoodsCopyRecordService.deleteByTenantId(specIds,GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId);
+                        }
+                    }else {
+                        //新增
+                        specTemplate.setEducationTypeId(getNewEducationTypeId(specTemplate.getEducationTypeId(),newTenantId,recordList));
+                        specTemplate.setBusinessId(getNewBusinessId(specTemplate.getBusinessId(), newTenantId,recordList));
+                        specTemplate.setSpecTemplateId(null);
+                        specTemplate.setTenantId(newTenantId);
+                        goodsSpecTemplateService.save(specTemplate);
+                        newSpecTemplateId = specTemplate.getSpecTemplateId();
+                        addSysGoodsRecord(oldSpecTemplateId,newSpecTemplateId,GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId,recordList);
+                    }
+
+                    //新增关联
+                    List<GoodsSpec> specList = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>()
+                            .eq(GoodsSpec::getSpecTemplateId, oldSpecTemplateId));
+                    if (CollectionUtils.isNotEmpty(specList)){
+                        for (GoodsSpec item : specList) {
+                            Long oldSpecId = item.getSpecId();
+                            item.setSpecId(null);
+                            item.setSpecTemplateId(newSpecTemplateId);
+                            item.setTenantId(newTenantId);
+                            goodsSpecService.save(item);
+                            addSysGoodsRecord(oldSpecId,item.getSpecId(),GoodsCopyEnum.GOODS_SPEC.getType(),newTenantId,recordList);
+                            List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService
+                                    .list(new LambdaQueryWrapper<GoodsSpecAttribute>()
+                                            .eq(GoodsSpecAttribute::getSpecId, oldSpecId));
+                            if (CollectionUtils.isNotEmpty(specAttributeList)){
+                                List<GoodsSpecAttribute> collect = specAttributeList.stream().map(attrItem -> {
+                                    attrItem.setOId(attrItem.getSpecAttributeId());
+                                    attrItem.setSpecAttributeId(null);
+                                    attrItem.setSpecId(item.getSpecId());
+                                    attrItem.setTenantId(newTenantId);
+                                    return attrItem;
+                                }).collect(Collectors.toList());
+                                goodsSpecAttributeService.saveBatch(collect);
+                                for (GoodsSpecAttribute attr : collect) {
+                                    addSysGoodsRecord(attr.getOId(),attr.getSpecAttributeId(),GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId,recordList);
+                                }
+                            }
+                        }
+                    }
+                    //模板属性值关联
+                    List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService
+                            .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
+                                    .eq(GoodsSpecAttributeRelation::getSpecTemplateId,oldSpecTemplateId));
+                    if (CollectionUtils.isNotEmpty(relationList)){
+                        newRelationList.addAll(relationList);
+                    }
+                    goods.setSpecTemplateId(newSpecTemplateId);
+                }
+                //新增
+                iGoodsService.save(goods);
+                addSysGoodsRecord(oldGoodsId,goods.getGoodsId(),GoodsCopyEnum.GOODS.getType(),newTenantId,recordList);
+                Long newGoodsId = goods.getGoodsId();
+
+                //商品课程
+                List<CourseMenuExam> newCourseMenuExamList = new ArrayList<>();
+                disposeGoodsCourse(oldGoodsId,newGoodsId,newTenantId,newCourseMenuExamList,recordList);
+                //课程双师
+                disposeGoodsCourseTeacher(oldGoodsId,newGoodsId,newTenantId);
+                //商品试卷
+                disposeGoodsAttached(oldGoodsId,newGoodsId,newTenantId,recordList);
+
+                //处理商品试卷
+                if (CollectionUtils.isNotEmpty(newCourseMenuExamList)){
+                    for (CourseMenuExam menuExam : newCourseMenuExamList) {
+                        menuExam.setExamId(getNewExamId(menuExam.getExamId(),newTenantId,recordList));
+                    }
+                    iCourseMenuExamService.saveBatch(newCourseMenuExamList);
+                }
+            }
+
+            //规格模板商品重新绑定
+            if (CollectionUtils.isNotEmpty(newRelationList)){
+                for (GoodsSpecAttributeRelation relation : newRelationList) {
+                    relation.setId(null);
+                    relation.setTenantId(newTenantId);
+                    //模板ID
+                    if (ObjectUtils.isNotNull(relation.getSpecTemplateId())){
+                        GoodsSpecTemplate specTemplate = goodsSpecTemplateService.getById(relation.getSpecTemplateId());
+                        Long newId = getNewIdByTenant(specTemplate.getSpecTemplateId(), GoodsCopyEnum.GOODS_SPEC_TEMPLATE.getType(),newTenantId);
+                        if (ObjectUtils.isNotNull(newId)){
+                            relation.setSpecTemplateId(newId);
+                        }else {
+                            relation.setSpecTemplateId(null);
+                        }
+                    }
+
+                    //商品ID
+                    if (ObjectUtils.isNotNull(relation.getGoodsId())){
+                        Goods goods = iGoodsService.getById(relation.getGoodsId());
+                        Long newId = getNewIdByTenant(goods.getGoodsId(), GoodsCopyEnum.GOODS.getType(),newTenantId);
+                        if (ObjectUtils.isNotNull(newId)){
+                            relation.setGoodsId(newId);
+                        }else {
+                            relation.setGoodsId(null);
+                        }
+                    }
+
+                    //规格属性IDS
+                    if (StringUtils.isNotBlank(relation.getSpecAttributeIds())){
+                        List<Long> ids = Arrays.asList(relation.getSpecAttributeIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList());
+                        List<GoodsSpecAttribute> specAttributeList = goodsSpecAttributeService.listByIds(ids);
+                        if (CollectionUtils.isNotEmpty(specAttributeList)){
+                            List<Long> newIds = new ArrayList<>();
+                            specAttributeList.forEach(item -> {
+                                Long newId = getNewIdByTenant(item.getSpecAttributeId(), GoodsCopyEnum.GOODS_SPEC_ATTRIBUTE.getType(),newTenantId);
+                                if (ObjectUtils.isNotNull(newId)){
+                                    newIds.add(newId);
+                                }else {
+                                    GoodsSpecAttribute newSpecAttribute = goodsSpecAttributeService.getSpecAttrByTenant(item.getName(),item.getCreateTime(),newTenantId);
+                                    if (ObjectUtils.isNotNull(newSpecAttribute)){
+                                        newIds.add(newSpecAttribute.getSpecAttributeId());
+                                    }
+                                }
+                            });
+                            if (CollectionUtils.isNotEmpty(newIds)){
+                                relation.setSpecAttributeIds(newIds.stream().map(x -> x.toString()).collect(Collectors.joining(",")));
+                            }
+                        }
+                    }
+                }
+                goodsSpecAttributeRelationService.saveBatch(newRelationList);
+            }
+            redisCache.deleteObject(key);
+        }catch (Exception e){
+            //释放
+            redisCache.deleteObject(key);
+            log.error("商品增量报错:"+e.getMessage());
+        }
+        return true;
     }
 
     @Override
-    public List<DistributionActivityGoodsVo> queryList(DistributionActivityGoodsQueryBo bo) {
-        LambdaQueryWrapper<DistributionActivityGoods> lqw = Wrappers.lambdaQuery();
-        lqw.eq(bo.getDistributionId() != null, DistributionActivityGoods::getDistributionId, bo.getDistributionId());
-        lqw.eq(bo.getGoodsId() != null, DistributionActivityGoods::getGoodsId, bo.getGoodsId());
-        lqw.eq(bo.getProfitMax() != null, DistributionActivityGoods::getProfitMax, bo.getProfitMax());
-        lqw.eq(bo.getStatus() != null, DistributionActivityGoods::getStatus, bo.getStatus());
-        lqw.eq(bo.getProfitType() != null, DistributionActivityGoods::getProfitType, bo.getProfitType());
-        lqw.eq(bo.getProfitOne() != null, DistributionActivityGoods::getProfitOne, bo.getProfitOne());
-        lqw.eq(bo.getProfitTwo() != null, DistributionActivityGoods::getProfitTwo, bo.getProfitTwo());
-        lqw.eq(bo.getProfitThree() != null, DistributionActivityGoods::getProfitThree, bo.getProfitThree());
-        return entity2Vo(this.list(lqw));
-    }
-
-    /**
-    * 实体类转化成视图对象
-    *
-    * @param collection 实体类集合
-    * @return
-    */
-    private List<DistributionActivityGoodsVo> entity2Vo(Collection<DistributionActivityGoods> collection) {
-        List<DistributionActivityGoodsVo> voList = collection.stream()
-                .map(any -> BeanUtil.toBean(any, DistributionActivityGoodsVo.class))
-                .collect(Collectors.toList());
-        if (collection instanceof Page) {
-            Page<DistributionActivityGoods> page = (Page<DistributionActivityGoods>)collection;
-            Page<DistributionActivityGoodsVo> pageVo = new Page<>();
-            BeanUtil.copyProperties(page,pageVo);
-            pageVo.addAll(voList);
-            voList = pageVo;
-        }
-        return voList;
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public void saveBatchEntity(List<DistributionActivityGoods> activityGoodsList) {
+        saveBatch(activityGoodsList);
     }
 
-    @Override
-    public Boolean insertByAddBo(DistributionActivityGoodsAddBo bo) {
-        DistributionActivityGoods add = BeanUtil.toBean(bo, DistributionActivityGoods.class);
-        validEntityBeforeSave(add);
-        add.setCreateTime(DateUtils.getNowTime());
-        add.setUpdateTime(DateUtils.getNowTime());
-        return this.save(add);
+    private void disposeGoodsCourseTeacher(Long oldGoodsId, Long newGoodsId, Long newTenantId) {
+        //双师关联
+        goodsCourseTeacherService.deleteByIdTeanant(newGoodsId,newTenantId);
+        List<GoodsCourseTeacher> list = goodsCourseTeacherService
+                .list(new LambdaQueryWrapper<GoodsCourseTeacher>()
+                        .eq(GoodsCourseTeacher::getGoodsId, oldGoodsId));
+        if (CollectionUtils.isNotEmpty(list)){
+            for (GoodsCourseTeacher teacher : list) {
+                teacher.setId(null);
+                teacher.setTenantId(newTenantId);
+                teacher.setGoodsId(newGoodsId);
+                if (StringUtils.isNotBlank(teacher.getCourseIds())){
+                    String ids = Arrays.asList(teacher.getCourseIds().split(",")).stream().map(x -> {
+                        Long oid = Long.valueOf(x);
+                        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE.getType(),newTenantId);
+                        return ObjectUtils.isNotNull(newId)?newId.toString() : "";
+                    }).collect(Collectors.joining(","));
+                    teacher.setCourseIds(ids);
+                }
+            }
+            goodsCourseTeacherService.saveBatch(list);
+        }
+
     }
 
-    @Override
-    public Boolean updateByEditBo(DistributionActivityGoodsEditBo bo) {
-        DistributionActivityGoods update = BeanUtil.toBean(bo, DistributionActivityGoods.class);
-        validEntityBeforeSave(update);
-        update.setUpdateTime(DateUtils.getNowTime());
-        return this.updateById(update);
+    private void addSysGoodsRecord(Long oldId,Long newId,Integer type,Long newTenantId,List<SysGoodsCopyRecord> array){
+        SysGoodsCopyRecord record = new SysGoodsCopyRecord();
+        record.setOldId(oldId);
+        record.setNewId(newId);
+        record.setType(type);
+        record.setCreateTime(DateUtils.getNowTime());
+        record.setUpdateTime(DateUtils.getNowTime());
+        record.setTenantId(newTenantId);
+        iSysGoodsCopyRecordService.save(record);
+//        array.add(record);
     }
 
-    /**
-     * 保存前的数据校验
-     *
-     * @param entity 实体类数据
-     */
-    private void validEntityBeforeSave(DistributionActivityGoods entity){
-        //TODO 做一些数据校验,如唯一约束
+    private void disposeGoodsAttached(Long oldGoodsId,Long newGoodsId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        List<GoodsAttached> goodsAttached = iGoodsAttachedService
+                .list(new LambdaQueryWrapper<GoodsAttached>()
+                        .eq(GoodsAttached::getGoodsId, oldGoodsId));
+        if (CollectionUtils.isEmpty(goodsAttached)){
+            return;
+        }
+
+        iGoodsAttachedService.deleteByIdTenant(newGoodsId,newTenantId);
+        //题库
+        for (GoodsAttached attached : goodsAttached) {
+            attached.setId(null);
+            attached.setTenantId(newTenantId);
+            attached.setGoodsId(newGoodsId);
+            Long majorId = attached.getMajorId();
+            switch (attached.getType()){
+                case 1:
+                    //模块卷
+                    attached.setMajorId(getNewModuleExamId(majorId,newTenantId,array));
+                    break;
+                case 2:
+                    //章卷
+                    attached.setMajorId(getNewChapterExamId(majorId,newTenantId,array));
+                    break;
+                case 3:
+                    //试卷
+                    attached.setMajorId(getNewExamId(majorId,newTenantId,array));
+                    break;
+            }
+        }
+        iGoodsAttachedService.saveBatch(goodsAttached);
+
     }
 
-    @Override
-    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
-            //TODO 做一些业务上的校验,判断是否需要校验
+    private void disposeGoodsCourse(Long oldGoodsId,Long newGoodsId,Long newTenantId,List<CourseMenuExam> menuExamList,List<SysGoodsCopyRecord> array){
+        List<GoodsCourse> goodsCourseList = iGoodsCourseService
+                .list(new LambdaQueryWrapper<GoodsCourse>()
+                        .eq(GoodsCourse::getGoodsId, oldGoodsId));
+        if (CollectionUtils.isEmpty(goodsCourseList)){
+            return;
+        }
+        //删除之前关联重新添加
+        iGoodsCourseService.deleteByIdTenant(newGoodsId,newTenantId);
+        for (GoodsCourse goodsCourse : goodsCourseList) {
+            Course course = iCourseService.getById(goodsCourse.getCourseId());
+            if(ObjectUtils.isNotNull(course)){
+                Long oldCourseId = course.getCourseId();
+                Long newCourseId = getNewIdByTenant(oldCourseId, GoodsCopyEnum.COURSE.getType(),newTenantId);
+//                Course newCourse = iCourseService.getCourseByTenant(course.getCode(),newTenantId);
+                if (ObjectUtils.isNull(newCourseId)){
+                    course.setCourseId(null);
+                    course.setTenantId(newTenantId);
+                    course.setEducationTypeId(getNewEducationTypeId(course.getEducationTypeId(),newTenantId,array));
+                    course.setBusinessId(getNewBusinessId(course.getBusinessId(),newTenantId,array));
+                    course.setSubjectId(getNewSubjectId(course.getSubjectId(), newTenantId,array));
+                    course.setProjectId(getNewProjectTypeId(course.getProjectId(), newTenantId,array));
+                    course.setMajorId(getNewMajorId(course.getMajorId(),newTenantId,array));
+                    iCourseService.save(course);
+                    newCourseId = course.getCourseId();
+                    addSysGoodsRecord(oldCourseId,newCourseId,GoodsCopyEnum.COURSE.getType(),newTenantId,array);
+                }
+                //商品课程关联
+                iCourseMenuService.deleteByIdTenant(newCourseId,newTenantId);
+                List<CourseMenu> courseMenuList = iCourseMenuService
+                        .list(new LambdaQueryWrapper<CourseMenu>()
+                                .eq(CourseMenu::getCourseId, oldCourseId)
+                                .eq(CourseMenu::getStatus,1));
+                if (CollectionUtils.isNotEmpty(courseMenuList)){
+                    for (CourseMenu courseMenu : courseMenuList) {
+                        courseMenu.setId(null);
+                        courseMenu.setTenantId(newTenantId);
+                        courseMenu.setCourseId(newCourseId);
+                        Long menuId = courseMenu.getMenuId();
+                        switch (courseMenu.getType()){
+                            case 1:
+                                //模块
+                                courseMenu.setMenuId(getNewModuleId(menuId,newTenantId,array));
+                                break;
+                            case 2:
+                                //章
+                                courseMenu.setMenuId(getNewChapterId(menuId,newTenantId,array));
+                                break;
+                            case 3:
+                                //节
+                                courseMenu.setMenuId(getNewSectionId(menuId,newTenantId,array));
+                                break;
+                        }
+                    }
+                    iCourseMenuService.saveBatch(courseMenuList);
+                }
+
+                goodsCourse.setId(null);
+                goodsCourse.setCourseId(newCourseId);
+                goodsCourse.setGoodsId(newGoodsId);
+                goodsCourse.setTenantId(newTenantId);
+                iGoodsCourseService.save(goodsCourse);
+
+                //课程试卷
+                iCourseMenuExamService.deleteByIdTenant(newCourseId,newTenantId);
+                List<CourseMenuExam> courseMenuExamList = iCourseMenuExamService
+                        .list(new LambdaQueryWrapper<CourseMenuExam>()
+                                .eq(CourseMenuExam::getCourseId, oldCourseId));
+                if (CollectionUtils.isNotEmpty(courseMenuExamList)){
+                    for (CourseMenuExam item : courseMenuExamList) {
+                        item.setId(null);
+                        item.setCourseId(newCourseId);
+                        item.setModuleId(getNewModuleId(item.getModuleId(),newTenantId,array));
+                        item.setChapterId(getNewChapterId(item.getChapterId(),newTenantId,array));
+                        item.setSectionId(getNewSectionId(item.getSectionId(),newTenantId,array));
+                        item.setTenantId(newTenantId);
+                    }
+                    menuExamList.addAll(courseMenuExamList);
+                }
+            }
+        }
+
+    }
+
+    private Long getNewModuleExamId(Long moduleExamId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        QuestionModule questionModule = iQuestionModuleService.getById(moduleExamId);
+        if (ObjectUtils.isNotNull(questionModule)){
+            Long oldModuleExamId = questionModule.getModuleExamId();
+            Long newModuleExamId = getNewIdByTenant(oldModuleExamId, GoodsCopyEnum.QUESTION_MODULE.getType(),newTenantId);
+//            QuestionModule newQuestionModule = iQuestionModuleService.getModuleByTenant(questionModule.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newModuleExamId)){
+                questionModule.setModuleExamId(null);
+                questionModule.setTenantId(newTenantId);
+                iQuestionModuleService.save(questionModule);
+                newModuleExamId = questionModule.getModuleExamId();
+                addSysGoodsRecord(oldModuleExamId,newModuleExamId,GoodsCopyEnum.QUESTION_MODULE.getType(),newTenantId,array);
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newModuleExamId,newTenantId,4);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldModuleExamId)
+                            .eq(QuestionBusiness::getType,4));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                    item.setMajorId(newModuleExamId);
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //模块章卷
+            iQuestionModuleChapterService.deleteByIdAndTenant(newModuleExamId,newTenantId);
+            List<QuestionModuleChapter> questionModuleChapterList = iQuestionModuleChapterService
+                    .list(new LambdaQueryWrapper<QuestionModuleChapter>()
+                            .eq(QuestionModuleChapter::getModuleExamId, oldModuleExamId));
+            if (CollectionUtils.isNotEmpty(questionModuleChapterList)){
+                for (QuestionModuleChapter item : questionModuleChapterList) {
+                    item.setId(null);
+                    item.setModuleExamId(newModuleExamId);
+                    item.setTenantId(newTenantId);
+                    item.setChapterExamId(getNewChapterExamId(item.getChapterExamId(),newTenantId,array));
+                }
+                iQuestionModuleChapterService.saveBatch(questionModuleChapterList);
+            }
+            return newModuleExamId;
+        }
+        return null;
+    }
+    private Long getNewChapterExamId(Long oldChapterExamId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        QuestionChapter questionChapter = iQuestionChapterService.getOne(new LambdaQueryWrapper<QuestionChapter>().eq(QuestionChapter::getChapterExamId,oldChapterExamId));
+        if (ObjectUtils.isNotNull(questionChapter)){
+            Long oid = questionChapter.getChapterExamId();
+            Long newChapterExamId = getNewIdByTenant(oid,GoodsCopyEnum.QUESTION_CHAPTER.getType(),newTenantId);
+//            QuestionChapter newQuestionChapter = iQuestionChapterService.getChaptereExamByTenant(questionChapter.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newChapterExamId)){
+                questionChapter.setChapterExamId(null);
+                questionChapter.setTenantId(newTenantId);
+                iQuestionChapterService.save(questionChapter);
+                newChapterExamId = questionChapter.getChapterExamId();
+                addSysGoodsRecord(oid,newChapterExamId,GoodsCopyEnum.QUESTION_CHAPTER.getType(),newTenantId,array);
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newChapterExamId,newTenantId,3);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldChapterExamId)
+                            .eq(QuestionBusiness::getType,3));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newChapterExamId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //章试卷
+            iQuestionChapterExamService.deleteByIdAndTenant(newChapterExamId,newTenantId);
+            List<QuestionChapterExam> questionChapterExamList = iQuestionChapterExamService
+                    .list(new LambdaQueryWrapper<QuestionChapterExam>()
+                            .eq(QuestionChapterExam::getChapterExamId, oldChapterExamId));
+            if (CollectionUtils.isNotEmpty(questionChapterExamList)){
+                for (QuestionChapterExam item : questionChapterExamList) {
+                    item.setId(null);
+                    item.setChapterExamId(newChapterExamId);
+                    item.setTenantId(newTenantId);
+                    item.setExamId(getNewExamId(item.getExamId(),newTenantId,array));
+                }
+                iQuestionChapterExamService.saveBatch(questionChapterExamList);
+            }
+            return newChapterExamId;
+        }
+        return null;
+    }
+    private Long getNewExamId(Long oldExamId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        Exam exam = iExamService.getById(oldExamId);
+        if (ObjectUtils.isNotNull(exam)){
+            Long oid = exam.getExamId();
+            Long newExamId = getNewIdByTenant(oid,GoodsCopyEnum.EXAM.getType(),newTenantId);
+            if (ObjectUtils.isNull(newExamId)){
+                //试卷类型
+                ExamPaper examPaper = iExamPaperService.getById(exam.getExamPaperId());
+                if (ObjectUtils.isNotNull(examPaper)){
+                    Long paperOid = examPaper.getPaperId();
+                    Long newExamPaperId = getNewIdByTenant(paperOid, GoodsCopyEnum.EXAM_PAPER.getType(),newTenantId);
+                    if (ObjectUtils.isNotNull(newExamPaperId)){
+                        exam.setExamPaperId(newExamPaperId);
+                    }else {
+                        examPaper.setPaperId(null);
+                        examPaper.setTenantId(newTenantId);
+                        iExamPaperService.save(examPaper);
+                        exam.setExamPaperId(examPaper.getPaperId());
+                        addSysGoodsRecord(paperOid,examPaper.getPaperId(),GoodsCopyEnum.EXAM_PAPER.getType(),newTenantId,array);
+                    }
+                }
+                exam.setExamId(null);
+                exam.setTenantId(newTenantId);
+                iExamService.save(exam);
+                newExamId = exam.getExamId();
+                addSysGoodsRecord(oid,newExamId,GoodsCopyEnum.EXAM.getType(),newTenantId, array);
+            }
+
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newExamId,newTenantId,2);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldExamId)
+                            .eq(QuestionBusiness::getMajorId,2));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newExamId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+
+            //试卷题目关联
+            iExamQuestionService.deleteByIdAndTenant(newExamId,newTenantId);
+            List<ExamQuestion> examQuestionList = iExamQuestionService
+                    .list(new LambdaQueryWrapper<ExamQuestion>()
+                            .eq(ExamQuestion::getExamId, oldExamId));
+            if (CollectionUtils.isNotEmpty(examQuestionList)){
+                for (ExamQuestion item : examQuestionList) {
+                    item.setId(null);
+                    item.setExamId(newExamId);
+                    item.setTenantId(newTenantId);
+                    item.setQuestionId(getNewQuestionId(item.getQuestionId(),newTenantId,array));
+                }
+                iExamQuestionService.saveBatch(examQuestionList);
+            }
+
+            return newExamId;
         }
-        return this.removeByIds(ids);
+        return null;
     }
+    private Long getNewQuestionId(Long oldQuestionId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        Question question = iQuestionService.getById(oldQuestionId);
+        if (ObjectUtils.isNotNull(question)){
+            Long oid = question.getQuestionId();
+            Long newQuestionId = getNewIdByTenant(oid,GoodsCopyEnum.QUESTION.getType(),newTenantId);
+//            Question newQuestion = iQuestionService.getQuestionByTenant(question.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newQuestionId)){
+                //新增
+                question.setQuestionId(null);
+                question.setTenantId(newTenantId);
+                iQuestionService.save(question);
+                newQuestionId = question.getQuestionId();
+                addSysGoodsRecord(oid,newQuestionId,GoodsCopyEnum.QUESTION.getType(),newTenantId,array);
+            }
+            //删除之前的关联
+            iQuestionBusinessService.deleteByIdAndTenant(newQuestionId,newTenantId,1);
+            //新关联
+            List<QuestionBusiness> questionBusinessList = iQuestionBusinessService
+                    .list(new LambdaQueryWrapper<QuestionBusiness>()
+                            .eq(QuestionBusiness::getMajorId, oldQuestionId)
+                            .eq(QuestionBusiness::getType,1));
+            if (CollectionUtils.isNotEmpty(questionBusinessList)){
+                for (QuestionBusiness item : questionBusinessList) {
+                    item.setId(null);
+                    item.setMajorId(newQuestionId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iQuestionBusinessService.saveBatch(questionBusinessList);
+            }
+            return newQuestionId;
+        }
+        return null;
+    }
+    private Long getNewModuleId(Long oldModuleId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        CourseModule module = iCourseModuleService.getById(oldModuleId);
+        if (ObjectUtils.isNotNull(module)){
+            Long oid = module.getModuleId();
+            Long newModuleId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_MODULE.getType(),newTenantId);
+//            CourseModule newModule = iCourseModuleService.getModuleByTenant(module.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newModuleId)){
+                module.setModuleId(null);
+                module.setTenantId(newTenantId);
+                iCourseModuleService.save(module);
+                newModuleId = module.getModuleId();
+                addSysGoodsRecord(oid,newModuleId,GoodsCopyEnum.COURSE_MODULE.getType(),newTenantId,array);
+            }
+
+            //删除之前的关联
+            iCourseModuleBusinessService.deleteByIdAndTenant(newModuleId,newTenantId);
+            //新关联
+            List<CourseModuleBusiness> moduleBusinessList = iCourseModuleBusinessService
+                    .list(new LambdaQueryWrapper<CourseModuleBusiness>()
+                            .eq(CourseModuleBusiness::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleBusinessList)){
+                for (CourseModuleBusiness item : moduleBusinessList) {
+                    item.setId(null);
+                    item.setTenantId(newTenantId);
+                    item.setModuleId(newModuleId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iCourseModuleBusinessService.saveBatch(moduleBusinessList);
+            }
+
+            //模块章
+            iCourseModuleChapterService.deleteByIdAndTenant(newModuleId,newTenantId);
+            List<CourseModuleChapter> moduleChapterList = iCourseModuleChapterService
+                    .list(new LambdaQueryWrapper<CourseModuleChapter>()
+                            .eq(CourseModuleChapter::getModuleId, oldModuleId));
+            if (CollectionUtils.isNotEmpty(moduleChapterList)){
+                for (CourseModuleChapter item : moduleChapterList) {
+                    item.setId(null);
+                    item.setModuleId(newModuleId);
+                    item.setTenantId(newTenantId);
+                    item.setChapterId(getNewChapterId(item.getChapterId(),newTenantId,array));
+                }
+                iCourseModuleChapterService.saveBatch(moduleChapterList);
+            }
+            return newModuleId;
+        }
+        return null;
+    }
+    private Long getNewChapterId(Long oldChapterId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        CourseChapter chapter = iCourseChapterService.getById(oldChapterId);
+        if (ObjectUtils.isNotNull(chapter)){
+            Long oid = chapter.getChapterId();
+            Long newChapterId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_CHAPTER.getType(),newTenantId);
+//            CourseChapter newChapter = iCourseChapterService.getChapterByTenant(chapter.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newChapterId)){
+                chapter.setChapterId(null);
+                chapter.setTenantId(newTenantId);
+                iCourseChapterService.save(chapter);
+                newChapterId = chapter.getChapterId();
+                addSysGoodsRecord(oid,newChapterId,GoodsCopyEnum.COURSE_CHAPTER.getType(),newTenantId,array);
+            }
+            //删除之前的关联
+            iCourseChapterBusinessService.deleteByIdAndTenant(newChapterId,newTenantId);
+            //新关联
+            List<CourseChapterBusiness> chapterBusinessList = iCourseChapterBusinessService
+                    .list(new LambdaQueryWrapper<CourseChapterBusiness>()
+                            .eq(CourseChapterBusiness::getChapterId, oldChapterId));
+            if (CollectionUtils.isNotEmpty(chapterBusinessList)){
+                for (CourseChapterBusiness item : chapterBusinessList) {
+                    item.setId(null);
+                    item.setChapterId(newChapterId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iCourseChapterBusinessService.saveBatch(chapterBusinessList);
+            }
+
+            //章节关联
+            iCourseChapterSectionService.deleteByIdAndTenant(newChapterId,newTenantId);
+            List<CourseChapterSection> chapterSectionList = iCourseChapterSectionService
+                    .list(new LambdaQueryWrapper<CourseChapterSection>()
+                            .eq(CourseChapterSection::getChapterId, oldChapterId));
+            if (CollectionUtils.isNotEmpty(chapterSectionList)){
+                for (CourseChapterSection item : chapterSectionList) {
+                    item.setId(null);
+                    item.setChapterId(newChapterId);
+                    item.setTenantId(newTenantId);
+                    item.setSectionId(getNewSectionId(item.getSectionId(),newTenantId,array));
+                }
+                iCourseChapterSectionService.saveBatch(chapterSectionList);
+            }
+
+            return newChapterId;
+        }
+        return null;
+    }
+    private Long getNewSectionId(Long oldSectionId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        CourseSection section = iCourseSectionService.getById(oldSectionId);
+        if (ObjectUtils.isNotNull(section)){
+            Long oid = section.getSectionId();
+            Long newSectionId = getNewIdByTenant(oid,GoodsCopyEnum.COURSE_SECTION.getType(),newTenantId);
+//            CourseSection newSection = iCourseSectionService.getSectionByTenant(section.getCode(),newTenantId);
+            if (ObjectUtils.isNull(newSectionId)){
+                //新增
+                section.setSectionId(null);
+                section.setTenantId(newTenantId);
+                iCourseSectionService.save(section);
+                newSectionId = section.getSectionId();
+                addSysGoodsRecord(oid,newSectionId,GoodsCopyEnum.COURSE_SECTION.getType(),newTenantId,array);
+            }
+            //删除之前的关联
+            iCourseSectionBusinessService.deleteByIdAndTenant(newSectionId,newTenantId);
+            //新关联
+            List<CourseSectionBusiness> sectionBusinessList = iCourseSectionBusinessService
+                    .list(new LambdaQueryWrapper<CourseSectionBusiness>()
+                            .eq(CourseSectionBusiness::getSectionId, oldSectionId));
+            if (CollectionUtils.isNotEmpty(sectionBusinessList)){
+                for (CourseSectionBusiness item : sectionBusinessList) {
+                    item.setId(null);
+                    item.setSectionId(newSectionId);
+                    item.setTenantId(newTenantId);
+                    item.setEducationTypeId(getNewEducationTypeId(item.getEducationTypeId(), newTenantId,array));
+                    item.setBusinessId(getNewBusinessId(item.getBusinessId(), newTenantId,array));
+                    item.setSubjectId(getNewSubjectId(item.getSubjectId(), newTenantId,array));
+                    item.setProjectId(getNewProjectTypeId(item.getProjectId(), newTenantId,array));
+                }
+                iCourseSectionBusinessService.saveBatch(sectionBusinessList);
+            }
+            return newSectionId;
+        }
+        return null;
+    }
+    private Long getNewCertificateId(Long certificateId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        CertificateCommon certificateCommon = iCertificateCommonService.getById(certificateId);
+        if (ObjectUtils.isNotNull(certificateCommon)){
+            Long oid = certificateCommon.getId();
+            Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE_COMMON.getType(),newTenantId);
+//            CertificateCommon newCertificateCommon = iCertificateCommonService.getCertificateByTenant(certificateCommon.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newId)){
+                return newId;
+            }else {
+                certificateCommon.setId(null);
+                certificateCommon.setTenantId(newTenantId);
+                //证书类型
+                //证书类型
+                if (ObjectUtils.isNotNull(certificateCommon.getCertificateTypeId())){
+                    certificateCommon.setCertificateTypeId(getNewCertificateTypeId(certificateCommon.getCertificateTypeId(),newTenantId,array));
+                }
+                iCertificateCommonService.save(certificateCommon);
+                addSysGoodsRecord(oid,certificateCommon.getId(),GoodsCopyEnum.CERTIFICATE_COMMON.getType(),newTenantId,array);
+                return certificateCommon.getId();
+            }
+        }
+        return null;
+    }
+
+    private Long getNewCertificateTpId(Long certificateTpId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        CertificateTp certificateTp = iCertificateTpService.getById(certificateTpId);
+        if (ObjectUtils.isNotNull(certificateTp)){
+            Long oid = certificateTp.getTpId();
+            Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE_TP.getType(),newTenantId);
+//            CertificateTp newCertificateTp =iCertificateTpService.getCertificateTpByTenant(certificateTp.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newId)){
+                return newId;
+            }else {
+                certificateTp.setTpId(null);
+                certificateTp.setTenantId(newTenantId);
+                certificateTp.setCertificateId(getNewCertificateId(certificateTp.getCertificateId(),newTenantId,array));
+                certificateTp.setTypeId(getNewCertificateTypeId(certificateTp.getTypeId(),newTenantId,array));
+                iCertificateTpService.save(certificateTp);
+                addSysGoodsRecord(oid,certificateTp.getTpId(),  GoodsCopyEnum.CERTIFICATE_TP.getType(),newTenantId,array);
+                return certificateTp.getTpId();
+            }
+        }
+        return null;
+    }
+
+    private Long getNewCertificateTypeId(Long certificateTypeId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        Certificate certificate = iCertificateService.getById(certificateTypeId);
+        if (ObjectUtils.isNotNull(certificate)){
+            Long oid = certificate.getId();
+            Long newId = getNewIdByTenant(oid, GoodsCopyEnum.CERTIFICATE.getType(),newTenantId);
+//            Certificate newCertificate = iCertificateService.getCertificateByTenant(certificate.getCode(),newTenantId);
+            if (ObjectUtils.isNotNull(newId)){
+                return newId;
+            }else {
+                certificate.setId(null);
+                certificate.setTenantId(newTenantId);
+                iCertificateService.save(certificate);
+                addSysGoodsRecord(oid,certificate.getId(),GoodsCopyEnum.CERTIFICATE.getType(),newTenantId,array);
+                return certificate.getId();
+            }
+        }
+        return null;
+    }
+    private Long getNewEducationTypeId(Long oldEducationTypeId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        //教育类型
+        CourseEducationType educationType = iCourseEducationTypeService.getById(oldEducationTypeId);
+        if (ObjectUtils.isNull(educationType)){
+            return null;
+        }
+        Long oId = educationType.getId();
+        Long newEducationTypeId = getNewIdByTenant(educationType.getId(), GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType(),newTenantId);
+        if (ObjectUtil.isNull(newEducationTypeId)){
+            //新增教育类型
+            educationType.setId(null);
+            educationType.setTenantId(newTenantId);
+            iCourseEducationTypeService.save(educationType);
+            addSysGoodsRecord(oId,educationType.getId(),GoodsCopyEnum.COURSE_EDUCATION_TYPE.getType(),newTenantId,array);
+            return educationType.getId();
+        }
+        return newEducationTypeId;
+    }
+
+    private Long getNewProjectTypeId(Long projectTypeId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        //项目类型
+        CourseProjectType project = iCourseProjectTypeService.getById(projectTypeId);
+        if (ObjectUtils.isNull(project)){
+            return null;
+        }
+        Long oid = project.getId();
+        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_PROJECT_TYPE.getType(),newTenantId);
+//        CourseProjectType newProject = iCourseProjectTypeService.getProjectByTenant(project.getEncoder(),newTenantId);
+        if (ObjectUtil.isNull(newId)){
+            //新增项目类型
+            project.setId(null);
+            project.setTenantId(newTenantId);
+            //教育类型
+            Long newEducationTypeId = getNewEducationTypeId(project.getEducationId().longValue(), newTenantId,array);
+            project.setEducationId(newEducationTypeId.intValue());
+            iCourseProjectTypeService.save(project);
+            addSysGoodsRecord(oid,project.getId(),GoodsCopyEnum.COURSE_PROJECT_TYPE.getType(),newTenantId,array);
+            return project.getId();
+        }
+        return newId;
+    }
+
+    private Long getNewMajorId(Long majorId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        //专业
+        Major major = iMajorService.getById(majorId);
+        if (ObjectUtils.isNull(major)){
+            return null;
+        }
+        Long oid = major.getId();
+        Long newMajorId = getNewIdByTenant(oid,GoodsCopyEnum.MAJOR.getType(),newTenantId);
+//        Major newMajor = iMajorService.getMajorByTenant(major.getEncoder(), newTenantId);
+        if (ObjectUtil.isNull(newMajorId)){
+            //新增专业
+            major.setId(null);
+            major.setTenantId(newTenantId);
+            iMajorService.save(major);
+            newMajorId = major.getId();
+            addSysGoodsRecord(oid,major.getId(),GoodsCopyEnum.MAJOR.getType(),newTenantId,array);
+        }
+
+        //专业项目关联
+        iMajorProjectService.deleteByIdTenant(newMajorId,newTenantId);
+        List<MajorProject> majorProjectList = iMajorProjectService
+                .list(new LambdaQueryWrapper<MajorProject>()
+                        .eq(MajorProject::getMajorId, majorId));
+        if (CollectionUtil.isNotEmpty(majorProjectList)){
+            for (MajorProject item : majorProjectList) {
+                item.setId(null);
+                item.setTenantId(newTenantId);
+                item.setMajorId(newMajorId);
+                item.setProjectId(getNewProjectTypeId(item.getProjectId(),newTenantId,array));
+            }
+            iMajorProjectService.saveBatch(majorProjectList);
+        }
+
+        return newMajorId;
+    }
+
+    private Long getNewBusinessId(Long businessId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        //业务层次
+        CourseBusiness business = iCourseBusinessService.getById(businessId);
+        if (ObjectUtils.isNull(business)){
+            return null;
+        }
+        Long oid = business.getId();
+        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_BUSINESS.getType(),newTenantId);
+//        CourseBusiness newBusiness = iCourseBusinessService.getBusinessByTenant(business.getEncoder(),newTenantId);
+        if (ObjectUtil.isNull(newId)){
+            //新增业务层次
+            business.setId(null);
+            business.setTenantId(newTenantId);
+            business.setProjectId(getNewProjectTypeId(business.getProjectId().longValue(),newTenantId,array).intValue());
+            iCourseBusinessService.save(business);
+            addSysGoodsRecord(oid,business.getId(),GoodsCopyEnum.COURSE_BUSINESS.getType(),newTenantId,array);
+            return business.getId();
+        }
+        return newId;
+    }
+
+
+    private Long getNewSubjectId(Long subjectId,Long newTenantId,List<SysGoodsCopyRecord> array){
+        //业务层次
+        CourseSubject courseSubject = iCourseSubjectService.getById(subjectId);
+        if (ObjectUtils.isNull(courseSubject)){
+            return null;
+        }
+        Long oid = courseSubject.getId();
+        Long newId = getNewIdByTenant(oid, GoodsCopyEnum.COURSE_SUBJECT.getType(),newTenantId);
+//        CourseSubject newCourseSubject = iCourseSubjectService.getSubjectByTenant(courseSubject.getEncoder(),newTenantId);
+        if (ObjectUtil.isNull(newId)){
+            //业务项目关联
+            List<CourseSubjectProject> projectList = iCourseSubjectProjectService
+                    .list(new LambdaQueryWrapper<CourseSubjectProject>()
+                            .eq(CourseSubjectProject::getSubjectId, courseSubject.getId()));
+            //新增业务层次
+            courseSubject.setId(null);
+            courseSubject.setTenantId(newTenantId);
+            iCourseSubjectService.save(courseSubject);
+            addSysGoodsRecord(oid,courseSubject.getId(),GoodsCopyEnum.COURSE_SUBJECT.getType(),newTenantId,array);
+            if (CollectionUtils.isNotEmpty(projectList)){
+                List<CourseSubjectProject> collect = projectList.stream().map(item -> {
+                    item.setId(null);
+                    item.setSubjectId(courseSubject.getId());
+                    //项目ID
+                    Long newProjectTypeId = getNewProjectTypeId(item.getProjectId(), newTenantId,array);
+                    item.setProjectId(newProjectTypeId);
+                    item.setTenantId(newTenantId);
+                    return item;
+                }).collect(Collectors.toList());
+                iCourseSubjectProjectService.saveBatch(collect);
+            }
+            return courseSubject.getId();
+        }
+        return newId;
+    }
+
+    private Long getNewIdByTenant(Long oldId, Integer type,Long tenantId){
+        if (ObjectUtils.isNull(oldId) || oldId <= 0L){
+            return null;
+        }
+        try {
+
+            SysGoodsCopyRecord record = iSysGoodsCopyRecordService.getNewIdByTenant(oldId,type,tenantId);
+            if (ObjectUtils.isEmpty(record)){
+//                throw new CustomException(String.format("新ID查找失败old:%s,type:%s",oldId,type));
+                return null;
+            }
+            return record.getNewId();
+        }catch (Exception e){
+//            throw new CustomException(String.format("(getone报错)新ID查找失败old:%s,type:%s",oldId,type));
+            return null;
+        }
+    }
+
 }

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityPosterServiceImpl.java

@@ -36,6 +36,8 @@ import com.zhongzheng.modules.system.service.ISysTenantService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.imageio.ImageIO;
 import java.awt.*;
@@ -226,4 +228,10 @@ public class DistributionActivityPosterServiceImpl extends ServiceImpl<Distribut
     }
 
 
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public void savePoster(DistributionActivityPoster poster) {
+        save(poster);
+    }
+
 }

+ 79 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/distribution/service/impl/DistributionActivityServiceImpl.java

@@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
+import com.zhongzheng.modules.activity.service.IActivityGoodsPriceService;
 import com.zhongzheng.modules.distribution.bo.DistributionActivityAddBo;
 import com.zhongzheng.modules.distribution.bo.DistributionActivityEditBo;
 import com.zhongzheng.modules.distribution.bo.DistributionActivityQueryBo;
@@ -32,7 +35,10 @@ import com.zhongzheng.modules.top.goods.domain.TopGoods;
 import com.zhongzheng.modules.top.goods.service.ITopGoodsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -58,6 +64,8 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
     private IDistributionActivityPosterService iDistributionActivityPosterService;
     @Autowired
     private IDistributionActivityTemplateGoodsService iDistributionActivityTemplateGoodsService;
+    @Autowired
+    private IActivityGoodsPriceService iActivityGoodsPriceService;
 
     @Override
     public DistributionActivityVo queryById(Long distributionId){
@@ -73,7 +81,22 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
                 DistributionActivityGoodsVo goodsVo = BeanUtil.toBean(item, DistributionActivityGoodsVo.class);
                 Goods goods = iGoodsService.getById(goodsVo.getGoodsId());
                 goodsVo.setGoodsName(goods.getGoodsName());
-                goodsVo.setGoodsPrice(goods.getStandPrice());
+                if (item.getProfitType() == 1){
+                    //百分比
+                    goodsVo.setProfitMax(item.getProfitMax().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitOne(item.getProfitOne().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitTwo(item.getProfitTwo().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitThree(item.getProfitThree().multiply(new BigDecimal(100)));
+                }
+                ActivityGoodsPrice price = iActivityGoodsPriceService
+                        .getOne(new LambdaQueryWrapper<ActivityGoodsPrice>()
+                                .eq(ActivityGoodsPrice::getActivityCode, vo.getCode())
+                                .eq(ActivityGoodsPrice::getGoodsId, item.getGoodsId())
+                                .eq(ActivityGoodsPrice::getStatus, 1)
+                                .last("limit 1"));
+                if (ObjectUtils.isNotNull(price)){
+                    goodsVo.setGoodsPrice(price.getGoodsPrice());
+                }
                 return goodsVo;
             }).collect(Collectors.toList());
             vo.setGoodsList(templateGoodsVos);
@@ -124,9 +147,11 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean insertByAddBo(DistributionActivityAddBo bo) {
         DistributionActivity add = BeanUtil.toBean(bo, DistributionActivity.class);
         validEntityBeforeSave(add);
+        add.setCode(ToolsUtils.getRandomString(8));
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
         this.save(add);
@@ -140,6 +165,28 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
                 return entity;
             }).collect(Collectors.toList());
             iDistributionActivityGoodsService.saveBatch(collect);
+            //商品活动价格
+            bo.getGoodsList().forEach(item -> {
+                ActivityGoodsPrice goodsPrice = iActivityGoodsPriceService
+                        .getOne(new LambdaQueryWrapper<ActivityGoodsPrice>()
+                                .eq(ActivityGoodsPrice::getActivityCode, add.getCode())
+                                .eq(ActivityGoodsPrice::getGoodsId, item.getGoodsId())
+                                .last("limit 1"));
+                if (ObjectUtils.isNotNull(goodsPrice)){
+                    goodsPrice.setGoodsPrice(item.getGoodsPrice());
+                    iActivityGoodsPriceService.updateById(goodsPrice);
+                }else {
+                    ActivityGoodsPrice price = new ActivityGoodsPrice();
+                    price.setGoodsPrice(item.getGoodsPrice());
+                    price.setActivityCode(add.getCode());
+                    price.setStatus(1);
+                    price.setGoodsId(item.getGoodsId());
+                    price.setType(1);
+                    price.setCreateTime(DateUtils.getNowTime());
+                    price.setUpdateTime(DateUtils.getNowTime());
+                    iActivityGoodsPriceService.save(price);
+                }
+            });
         }
 
         return true;
@@ -156,9 +203,11 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
         this.updateById(update);
-        //删除活动商品和下发机构重新绑定
+        //删除活动商品重新绑定
         iDistributionActivityGoodsService.remove(new LambdaQueryWrapper<DistributionActivityGoods>()
                 .eq(DistributionActivityGoods::getDistributionId,bo.getDistributionId()));
+        iActivityGoodsPriceService.remove(new LambdaQueryWrapper<ActivityGoodsPrice>()
+        .eq(ActivityGoodsPrice::getActivityCode,activityTemp.getCode()));
         //活动商品
         if (CollectionUtils.isNotEmpty(bo.getGoodsList())){
             List<DistributionActivityGoods> collect = bo.getGoodsList().stream().map(item -> {
@@ -169,6 +218,28 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
                 return entity;
             }).collect(Collectors.toList());
             iDistributionActivityGoodsService.saveBatch(collect);
+            //商品活动价格
+            bo.getGoodsList().forEach(item -> {
+                ActivityGoodsPrice goodsPrice = iActivityGoodsPriceService
+                        .getOne(new LambdaQueryWrapper<ActivityGoodsPrice>()
+                                .eq(ActivityGoodsPrice::getActivityCode, activityTemp.getCode())
+                                .eq(ActivityGoodsPrice::getGoodsId, item.getGoodsId())
+                                .last("limit 1"));
+                if (ObjectUtils.isNotNull(goodsPrice)){
+                    goodsPrice.setGoodsPrice(item.getGoodsPrice());
+                    iActivityGoodsPriceService.updateById(goodsPrice);
+                }else {
+                    ActivityGoodsPrice price = new ActivityGoodsPrice();
+                    price.setGoodsPrice(item.getGoodsPrice());
+                    price.setActivityCode(activityTemp.getCode());
+                    price.setStatus(1);
+                    price.setGoodsId(item.getGoodsId());
+                    price.setType(1);
+                    price.setCreateTime(DateUtils.getNowTime());
+                    price.setUpdateTime(DateUtils.getNowTime());
+                    iActivityGoodsPriceService.save(price);
+                }
+            });
         }
         return true;
     }
@@ -248,4 +319,10 @@ public class DistributionActivityServiceImpl extends ServiceImpl<DistributionAct
 
         return true;
     }
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public void saveEntity(DistributionActivity dailyActivity) {
+        save(dailyActivity);
+    }
 }

+ 22 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsPullTenantBo.java

@@ -0,0 +1,22 @@
+package com.zhongzheng.modules.goods.bo;
+
+import com.zhongzheng.modules.top.goods.domain.TopGoods;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2022年12月28日 9:28
+ */
+@Data
+public class GoodsPullTenantBo implements Serializable {
+
+    @ApiModelProperty("机构ID")
+    private Long tenantId;
+
+    @ApiModelProperty("商品集合")
+    private List<TopGoods> goodsList;
+}

+ 5 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsService.java

@@ -1,15 +1,16 @@
 package com.zhongzheng.modules.goods.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.activity.bo.ActivityRecommendGoodsQueryBo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.course.vo.CourseModuleFreeExamVo;
-import com.zhongzheng.modules.course.vo.CourseSubjectVo;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
 import com.zhongzheng.modules.goods.bo.*;
 import com.zhongzheng.modules.goods.domain.Goods;
-import com.zhongzheng.modules.goods.vo.*;
+import com.zhongzheng.modules.goods.vo.GoodsListAllVo;
+import com.zhongzheng.modules.goods.vo.GoodsSpecTemplateVo;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.goods.vo.UserGoodsListVo;
 import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
 
 import java.util.Collection;
@@ -120,5 +121,5 @@ public interface IGoodsService extends IService<Goods> {
 
     boolean updateGoodsRepair(UpdateGoodsRepairBo bo);
 
-
+    Goods getOneGoods(String code, Long id);
 }

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -81,6 +81,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
@@ -4159,6 +4160,15 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         return true;
     }
 
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public Goods getOneGoods(String code, Long id) {
+        return getOne(new LambdaQueryWrapper<Goods>()
+                .eq(Goods::getCode, code)
+                .eq(Goods::getTenantId,id)
+                .eq(Goods::getStatus, 1).last("limit 1"));
+    }
+
 
     private Long getNewId(Long oldId, Integer type){
         if (ObjectUtils.isNull(oldId) || oldId <= 0L){

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformRemindService.java

@@ -55,4 +55,6 @@ public interface IInformRemindService extends IService<InformRemind> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 	List<CourseUserEducationTypeVo> listGradeService(ClassGradeQueryBo bo);
+
+    InformRemindVo getQueryByName(String name);
 }

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformSysUserService.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.inform.bo.InformSysUserAddBo;
 import com.zhongzheng.modules.inform.bo.InformSysUserEditBo;
 import com.zhongzheng.modules.inform.bo.InformSysUserQueryBo;
-import com.zhongzheng.modules.inform.bo.InformUserEditBo;
 import com.zhongzheng.modules.inform.domain.InformSysUser;
 import com.zhongzheng.modules.inform.vo.InformSysUserVo;
 
@@ -54,4 +53,6 @@ public interface IInformSysUserService extends IService<InformSysUser> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    void insertEntity(InformSysUserAddBo informUserAddBo);
 }

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformRemindServiceImpl.java

@@ -37,6 +37,8 @@ import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.service.IUserUpdateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
 import java.util.List;
@@ -210,6 +212,12 @@ public class InformRemindServiceImpl extends ServiceImpl<InformRemindMapper, Inf
         return courseUserEducationTypeVos;
     }
 
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public InformRemindVo getQueryByName(String name) {
+        return queryByName(name);
+    }
+
     private List<CourseUserEducationTypeVo> entity2EducationVo(Collection<CourseEducationTypeVo> collection) {
         List<CourseUserEducationTypeVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, CourseUserEducationTypeVo.class))

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformSysUserServiceImpl.java

@@ -23,6 +23,8 @@ import com.zhongzheng.modules.order.domain.OrderGoods;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -169,4 +171,10 @@ public class InformSysUserServiceImpl extends ServiceImpl<InformSysUserMapper, I
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public void insertEntity(InformSysUserAddBo informUserAddBo) {
+        insertByAddBo(informUserAddBo);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysRoleService.java

@@ -129,4 +129,6 @@ public interface ISysRoleService extends IService<SysRole> {
      * @return 结果
      */
     public int deleteRoleByIds(Long[] roleIds);
+
+    SysRole getOneSysRole(String sellerAdmin, Long id);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysTenantService.java

@@ -55,4 +55,7 @@ public interface ISysTenantService extends IService<SysTenant> {
     Long createTenantAdmin(SysTenantAdminBo bo);
 
 	Long findTenantId(SysTenantQueryBo bo);
+
+    List<SysTenant> getListSysTenant();
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/ISysUserRoleService.java

@@ -3,10 +3,13 @@ package com.zhongzheng.modules.system.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.system.domain.SysUserRole;
 
+import java.util.List;
+
 /**
  * 角色业务层
  *
  * @author zhongzheng
  */
 public interface ISysUserRoleService extends IService<SysUserRole> {
+    List<SysUserRole> getList(Long roleId, Long id);
 }

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysRoleServiceImpl.java

@@ -25,6 +25,7 @@ import com.zhongzheng.modules.system.service.ISysRoleService;
 import com.zhongzheng.modules.system.vo.SysRoleBusinessVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
@@ -358,4 +359,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, ids));
         return baseMapper.deleteBatchIds(ids);
     }
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    public SysRole getOneSysRole(String sellerAdmin, Long id) {
+        return getOne(new LambdaQueryWrapper<SysRole>()
+                .eq(SysRole::getRoleKey, sellerAdmin)
+                .eq(SysRole::getTenantId,id)
+                .eq(SysRole::getStatus, 1).last("limit 1"));
+    }
 }

+ 14 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/service/impl/SysUserRoleServiceImpl.java

@@ -1,11 +1,16 @@
 package com.zhongzheng.modules.system.service.impl;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.modules.system.domain.SysUserRole;
 import com.zhongzheng.modules.system.mapper.SysUserRoleMapper;
 import com.zhongzheng.modules.system.service.ISysUserRoleService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
 
 /**
  * 角色业务层
@@ -13,6 +18,14 @@ import org.springframework.stereotype.Service;
  * @author zhongzheng
  */
 @Service
-@DS("slave")
 public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    @DS("slave")
+    public List<SysUserRole> getList(Long roleId, Long id) {
+        return list(new LambdaQueryWrapper<SysUserRole>()
+                .eq(SysUserRole::getRoleId, roleId)
+                .eq(SysUserRole::getTenantId, id));
+    }
 }

+ 0 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/domain/DistributionActivityTemplateGoods.java

@@ -32,8 +32,6 @@ private static final long serialVersionUID=1L;
     private Long distributionTempId;
     /** 商品ID */
     private Long goodsId;
-    /** 商品活动价格 */
-    private BigDecimal goodsPrice;
     /** 佣金上限 */
     private BigDecimal profitMax;
     /** 状态:1有效,0无效 */

+ 103 - 31
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/service/impl/DistributionActivityTemplateServiceImpl.java

@@ -12,18 +12,18 @@ import com.zhongzheng.common.core.domain.entity.SysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
-import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateAddBo;
-import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateEditBo;
-import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateQueryBo;
+import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
+import com.zhongzheng.modules.activity.service.IActivityGoodsPriceService;
 import com.zhongzheng.modules.distribution.bo.DistributionStatusEditBo;
-import com.zhongzheng.modules.distribution.domain.*;
-import com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery;
-import com.zhongzheng.modules.top.distribution.mapper.DistributionActivityTempMapper;
-import com.zhongzheng.modules.distribution.service.*;
-import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTemplateGoodsVo;
-import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTemplateVo;
-import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTenantVo;
+import com.zhongzheng.modules.distribution.domain.DistributionActivity;
+import com.zhongzheng.modules.distribution.domain.DistributionActivityGoods;
+import com.zhongzheng.modules.distribution.domain.DistributionActivityPoster;
+import com.zhongzheng.modules.distribution.service.IDistributionActivityGoodsService;
+import com.zhongzheng.modules.distribution.service.IDistributionActivityPosterService;
+import com.zhongzheng.modules.distribution.service.IDistributionActivityService;
+import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
+import com.zhongzheng.modules.distribution.vo.DistributionSellerVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.inform.bo.InformSysUserAddBo;
@@ -35,21 +35,32 @@ import com.zhongzheng.modules.system.domain.SysUserRole;
 import com.zhongzheng.modules.system.service.ISysRoleService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserRoleService;
+import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateAddBo;
+import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateEditBo;
+import com.zhongzheng.modules.top.distribution.bo.DistributionActivityTemplateQueryBo;
+import com.zhongzheng.modules.top.distribution.bo.DistributionSellerQuery;
 import com.zhongzheng.modules.top.distribution.domain.DistributionActivityTemplate;
 import com.zhongzheng.modules.top.distribution.domain.DistributionActivityTemplateGoods;
 import com.zhongzheng.modules.top.distribution.domain.DistributionActivityTemplatePoster;
 import com.zhongzheng.modules.top.distribution.domain.DistributionActivityTemplateRelation;
+import com.zhongzheng.modules.top.distribution.mapper.DistributionActivityTempMapper;
 import com.zhongzheng.modules.top.distribution.service.IDistributionActivityTemplateGoodsService;
 import com.zhongzheng.modules.top.distribution.service.IDistributionActivityTemplatePosterService;
 import com.zhongzheng.modules.top.distribution.service.IDistributionActivityTemplateRelationService;
 import com.zhongzheng.modules.top.distribution.service.IDistributionActivityTemplateService;
+import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTemplateGoodsVo;
+import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTemplateVo;
+import com.zhongzheng.modules.top.distribution.vo.DistributionActivityTenantVo;
+import com.zhongzheng.modules.top.goods.domain.TopActivityGoodsPrice;
 import com.zhongzheng.modules.top.goods.domain.TopGoods;
+import com.zhongzheng.modules.top.goods.service.ITopActivityGoodsPriceService;
 import com.zhongzheng.modules.top.goods.service.ITopGoodsService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -94,6 +105,10 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
     private ITopSysUserService iTopSysUserService;
     @Autowired
     private IDistributionSellerService iDistributionSellerService;
+    @Autowired
+    private ITopActivityGoodsPriceService iTopActivityGoodsPriceService;
+    @Autowired
+    private IActivityGoodsPriceService iActivityGoodsPriceService;
 
     @Override
     public DistributionActivityTemplateVo queryById(Long id){
@@ -132,7 +147,22 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
                 DistributionActivityTemplateGoodsVo goodsVo = BeanUtil.toBean(item, DistributionActivityTemplateGoodsVo.class);
                 TopGoods topGoods = iTopGoodsService.getById(goodsVo.getGoodsId());
                 goodsVo.setGoodsName(topGoods.getGoodsName());
-                goodsVo.setGoodsPrice(topGoods.getStandPrice());
+                if (item.getProfitType() == 1){
+                    //百分比
+                    goodsVo.setProfitMax(item.getProfitMax().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitOne(item.getProfitOne().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitTwo(item.getProfitTwo().multiply(new BigDecimal(100)));
+                    goodsVo.setProfitThree(item.getProfitThree().multiply(new BigDecimal(100)));
+                }
+                TopActivityGoodsPrice price = iTopActivityGoodsPriceService
+                        .getOne(new LambdaQueryWrapper<TopActivityGoodsPrice>()
+                        .eq(TopActivityGoodsPrice::getActivityCode, vo.getCode())
+                        .eq(TopActivityGoodsPrice::getGoodsId, item.getGoodsId())
+                        .eq(TopActivityGoodsPrice::getStatus, 1)
+                        .last("limit 1"));
+                if (ObjectUtils.isNotNull(price)){
+                    goodsVo.setGoodsPrice(price.getGoodsPrice());
+                }
                 return goodsVo;
             }).collect(Collectors.toList());
             vo.setGoodsList(templateGoodsVos);
@@ -182,14 +212,15 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
     }
 
     @Override
-//    @Transactional(rollbackFor = Exception.class)
+    @Transactional(rollbackFor = Exception.class)
     public Boolean insertByAddBo(DistributionActivityTemplateAddBo bo) {
         //活动模板基本信息
         DistributionActivityTemplate add = BeanUtil.toBean(bo, DistributionActivityTemplate.class);
         validEntityBeforeSave(add);
+        add.setCode(ToolsUtils.getRandomString(8));
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        TopSysUser user = iTopSysUserService.getById(bo.getCreateTopSysUserId());
+        TopSysUser user = iTopSysUserService.getTopSysUser(bo.getCreateTopSysUserId());
         if (ObjectUtils.isNotNull(user)){
             add.setCreateBy(user.getUserName());
         }
@@ -229,11 +260,42 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
             List<DistributionActivityTemplateGoods> collect = bo.getGoodsList().stream().map(item -> {
                 DistributionActivityTemplateGoods entity = BeanUtil.toBean(item, DistributionActivityTemplateGoods.class);
                 entity.setDistributionTempId(tempId);
+                if (ObjectUtils.isNotNull(item.getProfitType()) && item.getProfitType() == 1){
+                    //佣金是百分比
+                    entity.setProfitMax(item.getProfitMax().divide(new BigDecimal(100)));
+                    entity.setProfitOne(item.getProfitOne().divide(new BigDecimal(100)));
+                    entity.setProfitTwo(item.getProfitTwo().divide(new BigDecimal(100)));
+                    entity.setProfitThree(item.getProfitThree().divide(new BigDecimal(100)));
+                }
                 entity.setCreateTime(DateUtils.getNowTime());
                 entity.setUpdateTime(DateUtils.getNowTime());
                 return entity;
             }).collect(Collectors.toList());
             iDistributionActivityTemplateGoodsService.saveBatch(collect);
+
+            //商品活动价格
+            DistributionActivityTemplate template = getById(tempId);
+            bo.getGoodsList().forEach(item -> {
+                TopActivityGoodsPrice goodsPrice = iTopActivityGoodsPriceService
+                        .getOne(new LambdaQueryWrapper<TopActivityGoodsPrice>()
+                        .eq(TopActivityGoodsPrice::getActivityCode, template.getCode())
+                        .eq(TopActivityGoodsPrice::getGoodsId, item.getGoodsId())
+                        .last("limit 1"));
+                if (ObjectUtils.isNotNull(goodsPrice)){
+                    goodsPrice.setGoodsPrice(item.getGoodsPrice());
+                    iTopActivityGoodsPriceService.updateById(goodsPrice);
+                }else {
+                    TopActivityGoodsPrice price = new TopActivityGoodsPrice();
+                    price.setGoodsPrice(item.getGoodsPrice());
+                    price.setActivityCode(template.getCode());
+                    price.setStatus(1);
+                    price.setGoodsId(item.getGoodsId());
+                    price.setType(1);
+                    price.setCreateTime(DateUtils.getNowTime());
+                    price.setUpdateTime(DateUtils.getNowTime());
+                    iTopActivityGoodsPriceService.save(price);
+                }
+            });
         }
     }
 
@@ -255,6 +317,8 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
         .eq(DistributionActivityTemplateGoods::getDistributionTempId,bo.getId()));
         iDistributionActivityTemplateRelationService.remove(new LambdaQueryWrapper<DistributionActivityTemplateRelation>()
         .eq(DistributionActivityTemplateRelation::getDistributionTempId,bo.getId()));
+        iTopActivityGoodsPriceService.remove(new LambdaQueryWrapper<TopActivityGoodsPrice>()
+        .eq(TopActivityGoodsPrice::getActivityCode,activityTemp.getCode()));
         DistributionActivityTemplateAddBo addBo = new DistributionActivityTemplateAddBo();
         addBo.setIsAllOrg(bo.getIsAllOrg());
         addBo.setGoodsList(bo.getGoodsList());
@@ -291,6 +355,7 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean publishActivity(Long templateId) {
         DistributionActivityTemplate template = getById(templateId);
         if (ObjectUtils.isNull(template)){
@@ -314,7 +379,7 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
         List<Long> tenantId = new ArrayList<>();
         if (relationList.stream().anyMatch(item -> item.getTenantId() == 0L)){
             //全部机构
-            List<SysTenant> list = iSysTenantService.list(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getStatus, 1));
+            List<SysTenant> list = iSysTenantService.getListSysTenant();
             tenantId = list.stream().map(SysTenant::getTenantId).collect(Collectors.toList());
         }else {
             tenantId = relationList.stream().map(DistributionActivityTemplateRelation::getTenantId).collect(Collectors.toList());
@@ -326,21 +391,19 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
             DistributionActivityPoster poster = BeanUtil.toBean(templatePoster, DistributionActivityPoster.class);
             poster.setUrl(templatePoster.getPosterUrl());
             poster.setTenantId(id);
-            iDistributionActivityPosterService.save(poster);
+            iDistributionActivityPosterService.savePoster(poster);
             DistributionActivity dailyActivity = BeanUtil.toBean(template, DistributionActivity.class);
             dailyActivity.setPosterId(poster.getPosterId());
             dailyActivity.setTempId(template.getId());
             dailyActivity.setTenantId(id);
             dailyActivity.setUseStatus(0);
-            iDistributionActivityService.save(dailyActivity);
+            iDistributionActivityService.saveEntity(dailyActivity);
             //商品
             List<DistributionActivityGoods> activityGoodsList = new ArrayList<>();
+            List<ActivityGoodsPrice> priceList = new ArrayList<>();
             goodsList.forEach(item -> {
                 TopGoods topGoods = iTopGoodsService.getById(item.getGoodsId());
-                Goods goods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
-                        .eq(Goods::getCode, topGoods.getCode())
-                        .eq(Goods::getTenantId,id)
-                        .eq(Goods::getStatus, 1).last("limit 1"));
+                Goods goods = iGoodsService.getOneGoods(topGoods.getCode(),id);
                 if (ObjectUtils.isNotNull(goods)){
                     DistributionActivityGoods activityGoods = BeanUtil.toBean(item, DistributionActivityGoods.class);
                     activityGoods.setId(null);
@@ -348,20 +411,29 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
                     activityGoods.setTenantId(id);
                     activityGoods.setDistributionId(dailyActivity.getDistributionId());
                     activityGoodsList.add(activityGoods);
+
+                    //商品活动价格
+                    TopActivityGoodsPrice goodsPrice = iTopActivityGoodsPriceService
+                                    .getOne(new LambdaQueryWrapper<TopActivityGoodsPrice>()
+                                    .eq(TopActivityGoodsPrice::getActivityCode, template.getCode())
+                                    .eq(TopActivityGoodsPrice::getStatus, 1)
+                                    .eq(TopActivityGoodsPrice::getGoodsId,item.getGoodsId()));
+                    if (ObjectUtils.isNotNull(goodsPrice)){
+                        ActivityGoodsPrice activityGoodsPrice = BeanUtil.toBean(goodsPrice, ActivityGoodsPrice.class);
+                        activityGoodsPrice.setTenantId(id);
+                        activityGoodsPrice.setGoodsId(goods.getGoodsId());
+                        priceList.add(activityGoodsPrice);
+                    }
                 }
             });
-            iDistributionActivityGoodsService.saveBatch(activityGoodsList);
+            iDistributionActivityGoodsService.saveBatchEntity(activityGoodsList);
+            iActivityGoodsPriceService.saveBatchEntity(priceList);
 
             //站内信通知业务员管理员 seller_admin
-            SysRole role = iSysRoleService.getOne(new LambdaQueryWrapper<SysRole>()
-                    .eq(SysRole::getRoleKey, "seller_admin")
-                    .eq(SysRole::getTenantId,id)
-                    .eq(SysRole::getStatus, 1).last("limit 1"));
+            SysRole role = iSysRoleService.getOneSysRole("seller_admin",id);
             if (ObjectUtils.isNotNull(role)){
-                List<SysUserRole> sysUserRoles = iSysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>()
-                        .eq(SysUserRole::getRoleId, role.getRoleId())
-                        .eq(SysUserRole::getTenantId, id));
-                InformRemindVo informRemindVo = informRemindService.queryByName("课程试卷未做完7天提醒");
+                List<SysUserRole> sysUserRoles = iSysUserRoleService.getList(role.getRoleId(),id);
+                InformRemindVo informRemindVo = informRemindService.getQueryByName("课程试卷未做完7天提醒");
                 if (CollectionUtils.isNotEmpty(sysUserRoles) && ObjectUtils.isNotNull(informRemindVo)){
                     sysUserRoles.forEach(item -> {
                         InformSysUserAddBo informUserAddBo = new InformSysUserAddBo();
@@ -375,7 +447,7 @@ public class DistributionActivityTemplateServiceImpl extends ServiceImpl<Distrib
                         informUserAddBo.setPlanId(dailyActivity.getDistributionId());
                         informUserAddBo.setRemind("分销活动提醒");
                         informUserAddBo.setText("有新的分销活动,请查看!");
-                        iInformSysUserService.insertByAddBo(informUserAddBo);
+                        iInformSysUserService.insertEntity(informUserAddBo);
                     });
                 }
             }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/distribution/vo/DistributionActivityTemplateVo.java

@@ -66,6 +66,9 @@ public class DistributionActivityTemplateVo {
 	@ApiModelProperty("创建人")
 	private String createBy;
 
+	@ApiModelProperty("创建时间")
+	private Long createTime;
+
 	@ApiModelProperty("是否所有机构:1是,0否")
 	private Integer isAllOrg;
 

+ 34 - 34
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopCourseBusinessQueryBo.java

@@ -1,16 +1,14 @@
 package com.zhongzheng.modules.top.goods.bo;
 
+import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
 import java.math.BigDecimal;
-import com.zhongzheng.common.core.domain.BaseEntity;
+import java.util.List;
 
 /**
  * 业务层次分页查询对象 top_course_business
@@ -37,29 +35,36 @@ public class TopCourseBusinessQueryBo extends BaseEntity {
 	private String isAsc;
 
 
-	/** 业务名称 */
+	/** 编码YW */
+	@ApiModelProperty("编码YW")
+	private String encoder;
+
+	/** 业务ID */
+	@ApiModelProperty("业务ID")
+	private Long id;
+
+	/** 项目名称 */
 	@ApiModelProperty("业务名称")
 	private String businessName;
 	/** 项目id */
 	@ApiModelProperty("项目id")
-	private Long projectId;
-	/** 编码YW */
-	@ApiModelProperty("编码YW")
-	private String encoder;
+	private Integer projectId;
 	/** 学年 */
 	@ApiModelProperty("学年")
 	private BigDecimal schoolYear;
-	/** 0 未启用 1启用 -1删除 */
-	@ApiModelProperty("0 未启用 1启用 -1删除")
-	private Integer status;
-	/** 下单数据模板选用 */
-	@ApiModelProperty("下单数据模板选用")
+	/**  状态 1正常 0关闭 */
+	@ApiModelProperty(" 状态 1正常 0关闭")
+	private List<Integer> status;
+
+	/** 教育类型id */
+	@ApiModelProperty("教育类型id")
+	private Integer educationId;
+
+	@Excel(name = "模板选用")
+	@ApiModelProperty("模板选用")
 	private Integer templateStatus;
-	/** 1限制章下做卷顺序 0不限制 2限制整个目录顺序 */
-	@ApiModelProperty("1限制章下做卷顺序 0不限制 2限制整个目录顺序")
-	private Integer goodsLearningOrder;
-	/** 审核资料模板用户ID拼接(包含盖章) */
-	@ApiModelProperty("审核资料模板用户ID拼接(包含盖章)")
+	/** 审核资料模板用户ID拼接 */
+	@ApiModelProperty("审核资料模板用户ID拼接")
 	private String profileTpUserIds;
 	/** 学时审核用户ID拼接 */
 	@ApiModelProperty("学时审核用户ID拼接")
@@ -67,25 +72,20 @@ public class TopCourseBusinessQueryBo extends BaseEntity {
 	/** 学时确认审核用户ID拼接 */
 	@ApiModelProperty("学时确认审核用户ID拼接")
 	private String periodConfirmUserIds;
-	/** 退款初审用户ID拼接 */
-	@ApiModelProperty("退款初审用户ID拼接")
-	private String refundUserIds;
-	/** 退款确认审核用户ID拼接 */
-	@ApiModelProperty("退款确认审核用户ID拼接")
-	private String refundConfirmUserIds;
 	/** 排序 */
 	@ApiModelProperty("排序")
 	private Integer sort;
-	/** 商品配置字段JSON */
-	@ApiModelProperty("商品配置字段JSON")
-	private String goodsFieldJson;
-	/** 别名 */
-	@ApiModelProperty("别名")
-	private String aliasName;
-	/** 学时审核类型:1人工,2自动 */
+
 	@ApiModelProperty("学时审核类型:1人工,2自动")
 	private Integer periodType;
-	/** 学时审核层级:1初审,2初审和复审 */
 	@ApiModelProperty("学时审核层级:1初审,2初审和复审")
 	private Integer periodNumber;
+
+	/** 项目名称 */
+	@ApiModelProperty("项目名称")
+	private String projectName;
+
+	/** 教育类型名称 */
+	@ApiModelProperty("教育类型名称")
+	private String educationName;
 }

+ 10 - 9
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopCourseProjectTypeQueryBo.java

@@ -1,15 +1,12 @@
 package com.zhongzheng.modules.top.goods.bo;
 
+import com.zhongzheng.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.zhongzheng.common.core.domain.BaseEntity;
+import java.util.List;
 
 /**
  * 项目类型分页查询对象 top_course_project_type
@@ -36,6 +33,9 @@ public class TopCourseProjectTypeQueryBo extends BaseEntity {
 	private String isAsc;
 
 
+	/** $column.columnComment */
+	@ApiModelProperty("$column.columnComment")
+	private Long id;
 	/** 项目名称 */
 	@ApiModelProperty("项目名称")
 	private String projectName;
@@ -44,10 +44,11 @@ public class TopCourseProjectTypeQueryBo extends BaseEntity {
 	private String encoder;
 	/** 教育类型id */
 	@ApiModelProperty("教育类型id")
-	private Long educationId;
-	/** 0 未启用 1启用 -1删除 */
-	@ApiModelProperty("0 未启用 1启用 -1删除")
-	private Integer status;
+	private Integer educationId;
+	/**  状态 1正常 0关闭 */
+	@ApiModelProperty(" 状态 1正常 0关闭")
+	private List<Integer> status;
+
 	/** 排序 */
 	@ApiModelProperty("排序")
 	private Integer sort;

+ 23 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopMajorQueryBo.java

@@ -1,15 +1,12 @@
 package com.zhongzheng.modules.top.goods.bo;
 
+import com.zhongzheng.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.zhongzheng.common.core.domain.BaseEntity;
+import java.util.List;
 
 /**
  * 专业分页查询对象 top_major
@@ -35,6 +32,9 @@ public class TopMajorQueryBo extends BaseEntity {
 	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
 	private String isAsc;
 
+	/** 分类名称 */
+	@ApiModelProperty("id")
+	private Long id;
 
 	/** 分类名称 */
 	@ApiModelProperty("分类名称")
@@ -47,11 +47,28 @@ public class TopMajorQueryBo extends BaseEntity {
 	private Long labelId;
 	/** 1正常 0关闭 */
 	@ApiModelProperty("1正常 0关闭")
-	private Integer status;
+	private List<Integer> status;
 	/** 编码ZY */
 	@ApiModelProperty("编码ZY")
 	private String encoder;
+
+	/** 教育类型id */
+	@ApiModelProperty("教育类型id")
+	private Long educationId;
+
+	/** 项目id */
+	@ApiModelProperty("项目id")
+	private Long projectId;
+
+	/** 业务层次id */
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
+
 	/** 排序 */
 	@ApiModelProperty("排序")
 	private Integer sort;
+
+	/** 绑定项目id集合 */
+	@ApiModelProperty("绑定项目id集合")
+	private Long[] majorProjects;
 }

+ 24 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/bo/TopSchoolQueryBo.java

@@ -1,15 +1,12 @@
 package com.zhongzheng.modules.top.goods.bo;
 
+import com.zhongzheng.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.zhongzheng.common.core.domain.BaseEntity;
+import java.util.List;
 
 /**
  * 院校分页查询对象 top_school
@@ -36,19 +33,35 @@ public class TopSchoolQueryBo extends BaseEntity {
 	private String isAsc;
 
 
+
+	/**  id */
+	@ApiModelProperty(" id")
+	private Long id;
 	/**  高校名称 */
 	@ApiModelProperty(" 高校名称")
 	private String schoolName;
-	/** 0 未启用 1启用 -1删除 */
-	@ApiModelProperty("0 未启用 1启用 -1删除")
-	private Integer status;
 	/** 编码YX */
 	@ApiModelProperty("编码YX")
 	private String encoder;
-	/** 学校城市 */
-	@ApiModelProperty("学校城市")
-	private Long schoolCityId;
+	/** 状态 1正常 0关闭 */
+	@ApiModelProperty("状态 1正常 0关闭")
+	private List<Integer> status;
 	/** 学校省份 */
 	@ApiModelProperty("学校省份")
 	private Long schoolProvinceId;
+	/** 学校城市 */
+	@ApiModelProperty("学校城市")
+	private Long schoolCityId;
+
+	/** 教育类型id */
+	@ApiModelProperty("教育类型id")
+	private Long educationId;
+
+	/** 项目id */
+	@ApiModelProperty("项目id")
+	private Long projectId;
+
+	/** 业务层次id */
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
 }

+ 48 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/domain/TopActivityGoodsPrice.java

@@ -0,0 +1,48 @@
+package com.zhongzheng.modules.top.goods.domain;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 【活动商品价格】对象 top_certificate
+ *
+ * @author ruoyi
+ * @date 2023-03-15
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("top_activity_goods_price")
+public class TopActivityGoodsPrice implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 商品ID */
+    private Long goodsId;
+    /** 商品价格 */
+    private BigDecimal goodsPrice;
+    /** 活动编码 */
+    private String activityCode;
+    /** 类型 */
+    private Integer type;
+    /**  状态 1正常 0关闭 */
+    private Integer status;
+    /** 创建时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** 更新时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+
+}

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopActivityGoodsPriceMapper.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.top.goods.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.goods.domain.TopActivityGoodsPrice;
+
+/**
+ * 业务层次过滤器Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-03-15
+ */
+public interface TopActivityGoodsPriceMapper extends BaseMapper<TopActivityGoodsPrice> {
+
+}

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopCourseBusinessMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.top.goods.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.goods.bo.TopCourseBusinessQueryBo;
 import com.zhongzheng.modules.top.goods.domain.TopCourseBusiness;
+import com.zhongzheng.modules.top.goods.vo.TopCourseBusinessVo;
+
+import java.util.List;
 
 /**
  * 业务层次Mapper接口
@@ -11,4 +15,5 @@ import com.zhongzheng.modules.top.goods.domain.TopCourseBusiness;
  */
 public interface TopCourseBusinessMapper extends BaseMapper<TopCourseBusiness> {
 
+    List<TopCourseBusinessVo> queryList(TopCourseBusinessQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopMajorMapper.java

@@ -1,8 +1,11 @@
 package com.zhongzheng.modules.top.goods.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.goods.bo.TopMajorQueryBo;
 import com.zhongzheng.modules.top.goods.domain.TopMajor;
 
+import java.util.List;
+
 /**
  * 专业Mapper接口
  *
@@ -11,4 +14,5 @@ import com.zhongzheng.modules.top.goods.domain.TopMajor;
  */
 public interface TopMajorMapper extends BaseMapper<TopMajor> {
 
+    List<TopMajor> queryList(TopMajorQueryBo bo);
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/mapper/TopSchoolMapper.java

@@ -1,7 +1,13 @@
 package com.zhongzheng.modules.top.goods.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.goods.bo.TopCourseProjectTypeQueryBo;
+import com.zhongzheng.modules.top.goods.bo.TopSchoolQueryBo;
 import com.zhongzheng.modules.top.goods.domain.TopSchool;
+import com.zhongzheng.modules.top.goods.vo.TopCourseProjectTypeVo;
+import com.zhongzheng.modules.top.goods.vo.TopSchoolVo;
+
+import java.util.List;
 
 /**
  * 院校Mapper接口
@@ -11,4 +17,7 @@ import com.zhongzheng.modules.top.goods.domain.TopSchool;
  */
 public interface TopSchoolMapper extends BaseMapper<TopSchool> {
 
+    List<TopCourseProjectTypeVo> selectProject(TopCourseProjectTypeQueryBo courseProjectTypeQueryBo);
+
+    List<TopSchoolVo> queryList(TopSchoolQueryBo bo);
 }

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/ITopActivityGoodsPriceService.java

@@ -0,0 +1,13 @@
+package com.zhongzheng.modules.top.goods.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.top.goods.domain.TopActivityGoodsPrice;
+
+/**
+ * 业务层次过滤器Service接口
+ *
+ * @author ruoyi
+ * @date 2023-03-15
+ */
+public interface ITopActivityGoodsPriceService extends IService<TopActivityGoodsPrice> {
+}

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopActivityGoodsPriceServiceImpl.java

@@ -0,0 +1,18 @@
+package com.zhongzheng.modules.top.goods.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhongzheng.modules.top.goods.domain.TopActivityGoodsPrice;
+import com.zhongzheng.modules.top.goods.mapper.TopActivityGoodsPriceMapper;
+import com.zhongzheng.modules.top.goods.service.ITopActivityGoodsPriceService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 业务层次过滤器Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-03-15
+ */
+@Service
+public class TopActivityGoodsPriceServiceImpl extends ServiceImpl<TopActivityGoodsPriceMapper, TopActivityGoodsPrice> implements ITopActivityGoodsPriceService {
+
+}

+ 3 - 24
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopCourseBusinessServiceImpl.java

@@ -1,9 +1,6 @@
 package com.zhongzheng.modules.top.goods.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.utils.DateUtils;
@@ -37,25 +34,7 @@ public class TopCourseBusinessServiceImpl extends ServiceImpl<TopCourseBusinessM
 
     @Override
     public List<TopCourseBusinessVo> queryList(TopCourseBusinessQueryBo bo) {
-        LambdaQueryWrapper<TopCourseBusiness> lqw = Wrappers.lambdaQuery();
-        lqw.like(StrUtil.isNotBlank(bo.getBusinessName()), TopCourseBusiness::getBusinessName, bo.getBusinessName());
-        lqw.eq(bo.getProjectId() != null, TopCourseBusiness::getProjectId, bo.getProjectId());
-        lqw.eq(StrUtil.isNotBlank(bo.getEncoder()), TopCourseBusiness::getEncoder, bo.getEncoder());
-        lqw.eq(bo.getSchoolYear() != null, TopCourseBusiness::getSchoolYear, bo.getSchoolYear());
-        lqw.eq(bo.getStatus() != null, TopCourseBusiness::getStatus, bo.getStatus());
-        lqw.eq(bo.getTemplateStatus() != null, TopCourseBusiness::getTemplateStatus, bo.getTemplateStatus());
-        lqw.eq(bo.getGoodsLearningOrder() != null, TopCourseBusiness::getGoodsLearningOrder, bo.getGoodsLearningOrder());
-        lqw.eq(StrUtil.isNotBlank(bo.getProfileTpUserIds()), TopCourseBusiness::getProfileTpUserIds, bo.getProfileTpUserIds());
-        lqw.eq(StrUtil.isNotBlank(bo.getPeriodUserIds()), TopCourseBusiness::getPeriodUserIds, bo.getPeriodUserIds());
-        lqw.eq(StrUtil.isNotBlank(bo.getPeriodConfirmUserIds()), TopCourseBusiness::getPeriodConfirmUserIds, bo.getPeriodConfirmUserIds());
-        lqw.eq(StrUtil.isNotBlank(bo.getRefundUserIds()), TopCourseBusiness::getRefundUserIds, bo.getRefundUserIds());
-        lqw.eq(StrUtil.isNotBlank(bo.getRefundConfirmUserIds()), TopCourseBusiness::getRefundConfirmUserIds, bo.getRefundConfirmUserIds());
-        lqw.eq(bo.getSort() != null, TopCourseBusiness::getSort, bo.getSort());
-        lqw.eq(StrUtil.isNotBlank(bo.getGoodsFieldJson()), TopCourseBusiness::getGoodsFieldJson, bo.getGoodsFieldJson());
-        lqw.like(StrUtil.isNotBlank(bo.getAliasName()), TopCourseBusiness::getAliasName, bo.getAliasName());
-        lqw.eq(bo.getPeriodType() != null, TopCourseBusiness::getPeriodType, bo.getPeriodType());
-        lqw.eq(bo.getPeriodNumber() != null, TopCourseBusiness::getPeriodNumber, bo.getPeriodNumber());
-        return entity2Vo(this.list(lqw));
+        return entity2Vo(baseMapper.queryList(bo));
     }
 
     /**
@@ -64,12 +43,12 @@ public class TopCourseBusinessServiceImpl extends ServiceImpl<TopCourseBusinessM
     * @param collection 实体类集合
     * @return
     */
-    private List<TopCourseBusinessVo> entity2Vo(Collection<TopCourseBusiness> collection) {
+    private List<TopCourseBusinessVo> entity2Vo(Collection<TopCourseBusinessVo> collection) {
         List<TopCourseBusinessVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, TopCourseBusinessVo.class))
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
-            Page<TopCourseBusiness> page = (Page<TopCourseBusiness>)collection;
+            Page<TopCourseBusinessVo> page = (Page<TopCourseBusinessVo>)collection;
             Page<TopCourseBusinessVo> pageVo = new Page<>();
             BeanUtil.copyProperties(page,pageVo);
             pageVo.addAll(voList);

+ 22 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopCourseEducationTypeServiceImpl.java

@@ -3,6 +3,8 @@ package com.zhongzheng.modules.top.goods.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -10,12 +12,16 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.top.goods.bo.TopCourseEducationTypeAddBo;
 import com.zhongzheng.modules.top.goods.bo.TopCourseEducationTypeEditBo;
 import com.zhongzheng.modules.top.goods.bo.TopCourseEducationTypeQueryBo;
+import com.zhongzheng.modules.top.goods.domain.TopCourseEducationTier;
 import com.zhongzheng.modules.top.goods.domain.TopCourseEducationType;
 import com.zhongzheng.modules.top.goods.mapper.TopCourseEducationTypeMapper;
+import com.zhongzheng.modules.top.goods.service.ITopCourseEducationTierService;
 import com.zhongzheng.modules.top.goods.service.ITopCourseEducationTypeService;
 import com.zhongzheng.modules.top.goods.vo.TopCourseEducationTypeVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -29,6 +35,9 @@ import java.util.stream.Collectors;
 @Service
 public class TopCourseEducationTypeServiceImpl extends ServiceImpl<TopCourseEducationTypeMapper, TopCourseEducationType> implements ITopCourseEducationTypeService {
 
+    @Autowired
+    private ITopCourseEducationTierService iTopCourseEducationTierService;
+
     @Override
     public TopCourseEducationTypeVo queryById(Long id){
         TopCourseEducationType db = this.baseMapper.selectById(id);
@@ -42,7 +51,19 @@ public class TopCourseEducationTypeServiceImpl extends ServiceImpl<TopCourseEduc
         lqw.eq(StrUtil.isNotBlank(bo.getEncoder()), TopCourseEducationType::getEncoder, bo.getEncoder());
         lqw.eq(bo.getStatus() != null, TopCourseEducationType::getStatus, bo.getStatus());
         lqw.eq(bo.getSort() != null, TopCourseEducationType::getSort, bo.getSort());
-        return entity2Vo(this.list(lqw));
+        List<TopCourseEducationTypeVo> topCourseEducationTypeVos = entity2Vo(this.list(lqw));
+        if (CollectionUtils.isEmpty(topCourseEducationTypeVos)){
+            return new ArrayList<>();
+        }
+        topCourseEducationTypeVos.forEach(item -> {
+            TopCourseEducationTier tier = iTopCourseEducationTierService.getOne(new LambdaQueryWrapper<TopCourseEducationTier>()
+                    .eq(TopCourseEducationTier::getEducationId, item.getId())
+                    .last("limit 1"));
+            if (ObjectUtils.isNotNull(tier)){
+                item.setTireStatus(tier.getTireStatus());
+            }
+        });
+        return topCourseEducationTypeVos;
     }
 
     /**

+ 1 - 11
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopMajorServiceImpl.java

@@ -1,9 +1,6 @@
 package com.zhongzheng.modules.top.goods.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.utils.DateUtils;
@@ -37,14 +34,7 @@ public class TopMajorServiceImpl extends ServiceImpl<TopMajorMapper, TopMajor> i
 
     @Override
     public List<TopMajorVo> queryList(TopMajorQueryBo bo) {
-        LambdaQueryWrapper<TopMajor> lqw = Wrappers.lambdaQuery();
-        lqw.like(StrUtil.isNotBlank(bo.getCategoryName()), TopMajor::getCategoryName, bo.getCategoryName());
-        lqw.eq(StrUtil.isNotBlank(bo.getMajorReferral()), TopMajor::getMajorReferral, bo.getMajorReferral());
-        lqw.eq(bo.getLabelId() != null, TopMajor::getLabelId, bo.getLabelId());
-        lqw.eq(bo.getStatus() != null, TopMajor::getStatus, bo.getStatus());
-        lqw.eq(StrUtil.isNotBlank(bo.getEncoder()), TopMajor::getEncoder, bo.getEncoder());
-        lqw.eq(bo.getSort() != null, TopMajor::getSort, bo.getSort());
-        return entity2Vo(this.list(lqw));
+        return entity2Vo(baseMapper.queryList(bo));
     }
 
     /**

+ 20 - 17
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopSchoolServiceImpl.java

@@ -1,21 +1,21 @@
 package com.zhongzheng.modules.top.goods.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.top.goods.bo.TopCourseProjectTypeQueryBo;
 import com.zhongzheng.modules.top.goods.bo.TopSchoolAddBo;
 import com.zhongzheng.modules.top.goods.bo.TopSchoolEditBo;
 import com.zhongzheng.modules.top.goods.bo.TopSchoolQueryBo;
 import com.zhongzheng.modules.top.goods.domain.TopSchool;
 import com.zhongzheng.modules.top.goods.mapper.TopSchoolMapper;
 import com.zhongzheng.modules.top.goods.service.ITopSchoolService;
+import com.zhongzheng.modules.top.goods.vo.TopCourseProjectTypeVo;
 import com.zhongzheng.modules.top.goods.vo.TopSchoolVo;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -37,32 +37,35 @@ public class TopSchoolServiceImpl extends ServiceImpl<TopSchoolMapper, TopSchool
 
     @Override
     public List<TopSchoolVo> queryList(TopSchoolQueryBo bo) {
-        LambdaQueryWrapper<TopSchool> lqw = Wrappers.lambdaQuery();
-        lqw.like(StrUtil.isNotBlank(bo.getSchoolName()), TopSchool::getSchoolName, bo.getSchoolName());
-        lqw.eq(bo.getStatus() != null, TopSchool::getStatus, bo.getStatus());
-        lqw.eq(StrUtil.isNotBlank(bo.getEncoder()), TopSchool::getEncoder, bo.getEncoder());
-        lqw.eq(bo.getSchoolCityId() != null, TopSchool::getSchoolCityId, bo.getSchoolCityId());
-        lqw.eq(bo.getSchoolProvinceId() != null, TopSchool::getSchoolProvinceId, bo.getSchoolProvinceId());
-        return entity2Vo(this.list(lqw));
+        return entity2Vo(baseMapper.queryList(bo));
     }
 
     /**
-    * 实体类转化成视图对象
-    *
-    * @param collection 实体类集合
-    * @return
-    */
-    private List<TopSchoolVo> entity2Vo(Collection<TopSchool> collection) {
+     * 实体类转化成视图对象
+     *
+     * @param collection 实体类集合
+     * @return
+     */
+    private List<TopSchoolVo> entity2Vo(Collection<TopSchoolVo> collection) {
         List<TopSchoolVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, TopSchoolVo.class))
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
-            Page<TopSchool> page = (Page<TopSchool>)collection;
+            Page<TopSchoolVo> page = (Page<TopSchoolVo>)collection;
             Page<TopSchoolVo> pageVo = new Page<>();
             BeanUtil.copyProperties(page,pageVo);
             pageVo.addAll(voList);
             voList = pageVo;
         }
+        for (TopSchoolVo schoolVo : voList) {
+            TopCourseProjectTypeQueryBo courseProjectTypeQueryBo = new TopCourseProjectTypeQueryBo();
+            courseProjectTypeQueryBo.setId(schoolVo.getId());
+            List<Integer> status = new ArrayList<>();
+            status.add(1);
+            courseProjectTypeQueryBo.setStatus(status);
+            List<TopCourseProjectTypeVo> courseProjectTypeVos = baseMapper.selectProject(courseProjectTypeQueryBo);
+            schoolVo.setCourseProjectTypes(courseProjectTypeVos);
+        }
         return voList;
     }
 

+ 12 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseBusinessVo.java

@@ -1,12 +1,11 @@
 package com.zhongzheng.modules.top.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import java.math.BigDecimal;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.util.Date;
+
+import java.math.BigDecimal;
 
 
 
@@ -37,6 +36,16 @@ public class TopCourseBusinessVo {
 	@Excel(name = "项目id")
 	@ApiModelProperty("项目id")
 	private Long projectId;
+	@ApiModelProperty("教育类型id")
+	private Integer businessId;
+	@ApiModelProperty("教育类型名称")
+	private String educationName;
+	@ApiModelProperty("项目名称")
+	private String projectName;
+	@ApiModelProperty("教育类型id")
+	private Integer educationId;
+	@ApiModelProperty("模板选用名称")
+	private String templateName;
 	/** 编码YW */
 	@Excel(name = "编码YW")
 	@ApiModelProperty("编码YW")

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseEducationTypeVo.java

@@ -1,11 +1,9 @@
 package com.zhongzheng.modules.top.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.util.Date;
 
 
 
@@ -44,4 +42,6 @@ public class TopCourseEducationTypeVo {
 	@Excel(name = "排序")
 	@ApiModelProperty("排序")
 	private Integer sort;
+	@ApiModelProperty("")
+	private String tireStatus;
 }

+ 8 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopCourseProjectTypeVo.java

@@ -39,10 +39,14 @@ public class TopCourseProjectTypeVo {
 	/** 教育类型id */
 	@Excel(name = "教育类型id")
 	@ApiModelProperty("教育类型id")
-	private Long educationId;
-	/** 0 未启用 1启用 -1删除 */
-	@Excel(name = "0 未启用 1启用 -1删除")
-	@ApiModelProperty("0 未启用 1启用 -1删除")
+	private Integer educationId;
+	/** 教育类型名称 */
+	@Excel(name = "教育类型名称")
+	@ApiModelProperty("教育类型名称")
+	private String educationName;
+	/** 0 未启用 1启用 */
+	@Excel(name = "0 未启用 1启用")
+	@ApiModelProperty("0 未启用 1启用")
 	private Integer status;
 	/** 排序 */
 	@Excel(name = "排序")

+ 16 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopMajorVo.java

@@ -1,12 +1,11 @@
 package com.zhongzheng.modules.top.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.util.Date;
 
+import java.util.List;
 
 
 /**
@@ -40,6 +39,16 @@ public class TopMajorVo {
 	@Excel(name = "标签ID")
 	@ApiModelProperty("标签ID")
 	private Long labelId;
+
+	/** 标签名称 */
+	@Excel(name = "标签名称")
+	@ApiModelProperty("标签名称")
+	private String labelName;
+
+	/** 标签ID */
+	@Excel(name = "标签编码")
+	@ApiModelProperty("标签编码")
+	private String labelEncoder;
 	/** 1正常 0关闭 */
 	@Excel(name = "1正常 0关闭")
 	@ApiModelProperty("1正常 0关闭")
@@ -48,6 +57,11 @@ public class TopMajorVo {
 	@Excel(name = "编码ZY")
 	@ApiModelProperty("编码ZY")
 	private String encoder;
+
+	/** 专业项目 */
+	@Excel(name = "专业项目")
+	@ApiModelProperty("专业项目")
+	private List<TopCourseProjectTypeVo> courseProjectTypeVo;
 	/** 排序 */
 	@Excel(name = "排序")
 	@ApiModelProperty("排序")

+ 27 - 9
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/vo/TopSchoolVo.java

@@ -1,12 +1,12 @@
 package com.zhongzheng.modules.top.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
-import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.course.vo.CourseProjectTypeVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import java.util.Date;
 
+import java.util.List;
 
 
 /**
@@ -28,24 +28,42 @@ public class TopSchoolVo {
 	@Excel(name = " 高校名称")
 	@ApiModelProperty(" 高校名称")
 	private String schoolName;
-	/** 0 未启用 1启用 -1删除 */
-	@Excel(name = "0 未启用 1启用 -1删除")
-	@ApiModelProperty("0 未启用 1启用 -1删除")
-	private Integer status;
 	/** 编码YX */
 	@Excel(name = "编码YX")
 	@ApiModelProperty("编码YX")
 	private String encoder;
+	/** 状态 1正常 0关闭 */
+	@Excel(name = "状态 1正常 0关闭")
+	@ApiModelProperty("状态 1正常 0关闭")
+	private Integer status;
+	/** 学校省份 */
+	@ApiModelProperty("学校省份")
+	private Long schoolProvinceId;
 	/** 学校城市 */
-	@Excel(name = "学校城市")
 	@ApiModelProperty("学校城市")
 	private Long schoolCityId;
+
 	/** 学校省份 */
-	@Excel(name = "学校省份")
 	@ApiModelProperty("学校省份")
-	private Long schoolProvinceId;
+	private String schoolProvince;
+	/** 学校省份全称 */
+	@ApiModelProperty("学校省份全称")
+	private String schoolProvinceFull;
+
+	/** 学校城市 */
+	@ApiModelProperty("学校城市")
+	private String schoolCity;
+	/** 学校城市 */
+	@ApiModelProperty("学校城市全称")
+	private String schoolCityFull;
 	/** 备注 */
 	@Excel(name = "备注")
 	@ApiModelProperty("备注")
 	private String remark;
+
+	/** 备注 */
+	@Excel(name = "绑定项目类型")
+	@ApiModelProperty("绑定项目类型")
+	private List<TopCourseProjectTypeVo> courseProjectTypes;
+
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/ITopSysUserService.java

@@ -142,4 +142,5 @@ public interface ITopSysUserService extends IService<TopSysUser> {
 	 */
 	 int updateUserStatus(TopSysUser user);
 
+    TopSysUser getTopSysUser(Long createTopSysUserId);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysUserServiceImpl.java

@@ -308,6 +308,11 @@ public class TopSysUserServiceImpl extends ServiceImpl<TopSysUserMapper, TopSysU
         return baseMapper.updateById(user);
     }
 
+    @Override
+    public TopSysUser getTopSysUser(Long createTopSysUserId) {
+        return getById(createTopSysUserId);
+    }
+
 
     /**
      * 新增用户角色信息

+ 71 - 0
zhongzheng-system/src/main/resources/mapper/modules/top/TopCourseBusinessMapper.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.top.goods.mapper.TopCourseBusinessMapper">
+
+    <resultMap type="com.zhongzheng.modules.top.goods.vo.TopCourseBusinessVo" id="TopCourseBusinessVoResult">
+        <result property="id" column="id"/>
+        <result property="businessName" column="business_name"/>
+        <result property="businessId" column="business_id"/>
+        <result property="remark" column="remark"/>
+        <result property="projectId" column="project_id"/>
+        <result property="schoolYear" column="school_year"/>
+        <result property="status" column="status"/>
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="educationId" column="education_id"/>
+        <result property="templateStatus" column="template_status"/>
+        <result property="templateName" column="template_name"/>
+        <result property="goodsLearningOrder" column="goods_learning_order"/>
+        <result property="profileTpUserIds" column="profile_tp_user_ids"/>
+        <result property="periodUserIds" column="period_user_ids"/>
+        <result property="periodConfirmUserIds" column="period_confirm_user_ids"/>
+        <result property="refundUserIds" column="refund_user_ids"/>
+        <result property="refundConfirmUserIds" column="refund_confirm_user_ids"/>
+        <result property="sort" column="sort"/>
+        <result property="goodsFieldJson" column="goods_field_json"/>
+        <result property="aliasName" column="alias_name"/>
+    </resultMap>
+
+
+
+    <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo"  resultMap="TopCourseBusinessVoResult">
+        SELECT
+        b.*,
+        e.education_name,
+        e.id as education_id,
+        p.project_name,
+        t.name as template_name
+        FROM
+        top_course_business b
+        LEFT JOIN top_course_project_type p on b.project_id =p.id
+        LEFT JOIN top_course_education_type e ON p.education_id = e.id
+        LEFT JOIN top_order_input_template t ON b.template_status = t.id
+        where 1=1
+        and p.status != -1
+        and e.status != -1
+        <if test="status != null and status.size()!=0 ">
+            AND b.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="businessName != null and businessName != ''">
+            AND b.business_name = #{businessName}
+        </if>
+        <if test="encoder != null and encoder != ''">
+            AND b.encoder = #{encoder}
+        </if>
+        <if test="projectId != null and projectId != ''">
+            AND p.id = #{projectId}
+        </if>
+        <if test="educationId != null and educationId != ''">
+            AND e.id = #{educationId}
+        </if>
+        <if test="id != null and id != ''">
+            AND b.id = #{id}
+        </if>
+        order by b.sort
+    </select>
+</mapper>

+ 43 - 0
zhongzheng-system/src/main/resources/mapper/modules/top/TopMajorMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.top.goods.mapper.TopMajorMapper">
+
+
+    <select id="queryList" parameterType="com.zhongzheng.modules.top.goods.bo.TopMajorQueryBo"  resultType="com.zhongzheng.modules.top.goods.domain.TopMajor">
+        SELECT
+        m.*
+        FROM
+        top_major m
+        LEFT JOIN top_major_project p ON p.major_id = m.id
+        LEFT JOIN top_course_business b on b.project_id =p.project_id
+        LEFT JOIN top_course_project_type t on p.project_id=t.id
+        LEFT JOIN top_course_education_type e on t.education_id = e.id
+        WHERE
+        1 =1
+        <if test="status != null and status.size()!=0 ">
+            AND m.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="id != null and id!=0 ">
+            AND m.id = #{id}
+        </if>
+        <if test="educationId != null and educationId!=0 ">
+            AND e.id = #{educationId}
+        </if>
+        <if test="projectId != null and projectId!=0 ">
+            AND t.id = #{projectId}
+        </if>
+        <if test="categoryName != null and categoryName!='' ">
+            AND m.category_name like concat('%', #{categoryName}, '%')
+        </if>
+        <if test="businessId != null and businessId!=0 ">
+            AND b.id = #{businessId}
+        </if>
+        group by m.id
+        order by m.sort
+    </select>
+</mapper>

+ 97 - 0
zhongzheng-system/src/main/resources/mapper/modules/top/TopSchoolMapper.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zhongzheng.modules.top.goods.mapper.TopSchoolMapper">
+
+    <resultMap type="com.zhongzheng.modules.top.goods.vo.TopSchoolVo" id="TopSchoolVoResult">
+        <result property="id" column="id"/>
+        <result property="schoolName" column="school_name"/>
+        <result property="encoder" column="encoder"/>
+        <result property="status" column="status"/>
+        <result property="schoolProvinceId" column="school_province_id"/>
+        <result property="schoolCityId" column="school_city_id"/>
+        <result property="schoolProvinceFull" column="school_province_full"/>
+        <result property="schoolProvince" column="school_province"/>
+        <result property="schoolCityFull" column="school_city_full"/>
+        <result property="schoolCityId" column="school_city_id"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.top.goods.vo.TopCourseProjectTypeVo" id="TopCourseProjectTypeVoResult">
+        <result property="id" column="id"/>
+        <result property="projectName" column="project_name"/>
+        <result property="encoder" column="encoder"/>
+        <result property="remark" column="remark"/>
+        <result property="educationId" column="education_id"/>
+        <result property="educationName" column="education_name"/>
+        <result property="status" column="status"/>
+    </resultMap>
+
+    <select id="selectProject" parameterType="com.zhongzheng.modules.top.goods.bo.TopCourseProjectTypeQueryBo"  resultMap="TopCourseProjectTypeVoResult">
+        SELECT
+        p.*,
+        e.education_name
+        FROM
+        top_school_project j
+        LEFT JOIN top_course_project_type p on p.id=j.project_id
+        LEFT JOIN top_course_education_type e ON p.education_id = e.id
+        where 1=1
+        <if test="status != null and status.size()!=0 ">
+            AND p.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="id != null and id != ''">
+            and j.school_id = #{id}
+        </if>
+    </select>
+
+
+    <select id="queryList" parameterType="com.zhongzheng.modules.top.goods.bo.TopSchoolQueryBo"  resultMap="TopSchoolVoResult">
+        SELECT
+        s.*
+        FROM
+        top_school s
+        LEFT JOIN top_school_project p ON p.school_id = s.id
+        LEFT JOIN top_course_business b on b.project_id =p.project_id
+        LEFT JOIN top_course_project_type t on p.project_id=t.id
+        LEFT JOIN top_course_education_type e on t.education_id = e.id
+        where 1=1
+        <if test="status != null and status.size()!=0 ">
+            AND s.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="id != null and id != ''">
+            and s.id = #{id}
+        </if>
+        <if test="schoolProvinceId != null and schoolProvinceId != ''">
+            and s.school_province_id = #{schoolProvinceId}
+        </if>
+        <if test="schoolCityId != null and schoolCityId != ''">
+            and s.school_city_id = #{schoolCityId}
+        </if>
+
+        <if test="encoder != null and encoder != ''">
+            and s.encoder = #{encoder}
+        </if>
+
+        <if test="schoolName != null and schoolName != ''">
+            and s.school_name like concat('%', #{schoolName}, '%')
+        </if>
+        <if test="educationId != null and educationId!=0 ">
+            AND e.id = #{educationId}
+        </if>
+        <if test="projectId != null and projectId!=0 ">
+            AND t.id = #{projectId}
+        </if>
+        <if test="businessId != null and businessId!=0 ">
+            AND b.id = #{businessId}
+        </if>
+        GROUP BY s.id
+        order by s.update_time desc
+    </select>
+</mapper>