jingyuanchao il y a 2 ans
Parent
commit
c9e26aaa8d

+ 3 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/dto/CoreEduTrainingPlanPageDto.java

@@ -37,4 +37,7 @@ public class CoreEduTrainingPlanPageDto extends PageRequest {
     @ApiModelProperty(value = "计划名称")
     private String planName;
 
+    @ApiModelProperty(value = "计划id")
+    private Long id;
+
 }

+ 0 - 8
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/vo/CoreEduTrainingPlanPageVo.java

@@ -16,7 +16,6 @@ import java.util.List;
 public class CoreEduTrainingPlanPageVo {
     @ApiModelProperty(value = "序号")
     private Integer no;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "id")
     private Long id;
@@ -37,13 +36,6 @@ public class CoreEduTrainingPlanPageVo {
     @ApiModelProperty(value = "培训机构类型")
     private Integer execOrgType;
 
-
-    @ApiModelProperty(value = "计划执行角色")
-    private Long planRoleId;
-
-    @ApiModelProperty(value = "计划执行角色")
-    private String planRoleName;
-
     @ApiModelProperty(value = "计划周期")
     private Integer planCycle;
 

+ 2 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/mapper/CoreEduTrainingPlanMapper.java

@@ -74,4 +74,6 @@ public interface CoreEduTrainingPlanMapper extends BaseMapper<CoreEduTrainingPla
     CoreEduTrainingPlanDataVo getDetailPlanData(@Param("id") Long id);
 
     List<IdName<Long, String>> planList(@Param("path") String path);
+
+    List<CoreEduTrainingPlanPageVo> selectChildrenPlan(@Param("request") CoreEduTrainingPlanPageDto request);
 }

+ 13 - 8
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java

@@ -92,7 +92,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectTopOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
         List<CoreEduTrainingPlanPageVo> records = page.getRecords();
         for (CoreEduTrainingPlanPageVo record : records) {
-            dealData(record, records, sysOrg.getId());
+            dealData(record, records, sysOrg.getId(),request);
         }
         //抓换为TableDataInfo适配前端
         TableDataInfo<CoreEduTrainingPlanPageVo> tableDataInfo = new TableDataInfo();
@@ -105,28 +105,31 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 
     }
 
-    private void dealData(CoreEduTrainingPlanPageVo record, List<CoreEduTrainingPlanPageVo> records, Long orgId) {
+    private void dealData(CoreEduTrainingPlanPageVo record, List<CoreEduTrainingPlanPageVo> records, Long orgId, CoreEduTrainingPlanPageDto request) {
         record.setNo(records.indexOf(record) + 1);
         if (ObjectUtil.equal(record.getCreateOrgId(), orgId)) {
             record.setCreateByTopOrg(1);
         }
         String roleNameList = coreEduTrainingPlanToRoleMapper.selectRoleNameByPlanId(record.getId()).stream().map(CoreEduTrainingPlanRoleVo::getRoleName).collect(Collectors.joining(","));
         record.setPlanRoleNameList(roleNameList);
-        List<CoreEduTrainingPlan> planList = coreEduTrainingPlanMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingPlan>().eq(CoreEduTrainingPlan::getParentId, record.getId()));
-        List<CoreEduTrainingPlanPageVo> children = BeanHelper.copyProperties(planList, CoreEduTrainingPlanPageVo.class);
-        final List<Long> collect = children.stream().map(CoreEduTrainingPlanPageVo::getUpdateBy).map(Long::valueOf).distinct().collect(Collectors.toList());
+
+       /* List<CoreEduTrainingPlan> planList = coreEduTrainingPlanMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingPlan>().eq(CoreEduTrainingPlan::getParentId, record.getId()));
+        List<CoreEduTrainingPlanPageVo> children = BeanHelper.copyProperties(planList, CoreEduTrainingPlanPageVo.class);*/
+        request.setId(record.getId());
+        List<CoreEduTrainingPlanPageVo> children = coreEduTrainingPlanMapper.selectChildrenPlan(request);
+/*        final List<Long> collect = children.stream().map(CoreEduTrainingPlanPageVo::getUpdateBy).map(Long::valueOf).distinct().collect(Collectors.toList());
         final List<IdNameVo> idNameVos = RemoteCallHandlerExecutor.executeRemoteCall(() -> remoteRoleService.getNames(new RoleConditionEto(collect)), ErrorMsgConstants.QUERY_ROLE_DATA_ERROR);
 
         //将idNameVos使用steam转为map
-        final Map<Long, String> idNameMap = idNameVos.stream().collect(Collectors.toMap(IdNameVo::getId, IdNameVo::getName));
+        final Map<Long, String> idNameMap = idNameVos.stream().collect(Collectors.toMap(IdNameVo::getId, IdNameVo::getName));*/
         record.setChildren(children);
         record.setHasChildren(ObjectUtil.isNotEmpty(children));
         for (CoreEduTrainingPlanPageVo child : children) {
             if (ObjectUtil.equal(child.getCreateOrgId(), orgId)) {
                 child.setCreateByTopOrg(1);
             }
-            final String name = idNameMap.get(Long.valueOf(child.getUpdateBy()));
-            child.setUpdateBy(name);
+            /*final String name = idNameMap.get(Long.valueOf(child.getUpdateBy()));
+            child.setUpdateBy(name);*/
             child.setPlanRoleNameList(roleNameList);
         }
     }
@@ -281,6 +284,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
     }
 
     public void batchSavePlanToRole(List<Long> roleIdList, Long planId) {
+        roleIdList.removeIf(Objects::isNull);
         if (ObjectUtil.isEmpty(roleIdList)) {
             return;
         }
@@ -297,6 +301,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
     }
 
     public void batchSavePlanToExecOrg(List<Long> orgIdList, Long planId) {
+        orgIdList.removeIf(Objects::isNull);
         if (ObjectUtil.isEmpty(orgIdList)) {
             return;
         }

+ 110 - 3
soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingPlanMapper.xml

@@ -123,7 +123,50 @@
         <include refid="selectCoreEduTrainingPlanVo"/>
         where id = #{id}
     </select>
-
+<sql id="pageIncludeSP">
+    <if test="request.execOrgType!=null">
+        and sp.exec_org_type = #{request.execOrgType}
+    </if>
+    <if test="request.planCycle!=null">
+        and sp.plan_cycle = #{request.planCycle}
+    </if>
+    <if test="request.planStatus!=null">
+        and sp.plan_status = #{request.planStatus}
+    </if>
+    <if test="request.planName!=null">
+        and sp.plan_name = #{request.planName}
+    </if>
+    <choose>
+        <when test="request.checkSub==true">
+            and sp.belong_org_path like concat(#{request.belongOrgPath},'%')
+        </when>
+        <otherwise>
+            and sp.belong_org_id = #{request.belongOrgId}
+        </otherwise>
+    </choose>
+</sql>
+    <sql id="pageIncludeP">
+        <if test="request.execOrgType!=null">
+            and p.exec_org_type = #{request.execOrgType}
+        </if>
+        <if test="request.planCycle!=null">
+            and p.plan_cycle = #{request.planCycle}
+        </if>
+        <if test="request.planStatus!=null">
+            and p.plan_status = #{request.planStatus}
+        </if>
+        <if test="request.planName!=null">
+            and p.plan_name = #{request.planName}
+        </if>
+        <choose>
+            <when test="request.checkSub==true">
+                and p.belong_org_path like concat(#{request.belongOrgPath},'%')
+            </when>
+            <otherwise>
+                and p.belong_org_id = #{request.belongOrgId}
+            </otherwise>
+        </choose>
+    </sql>
     <insert id="insertCoreEduTrainingPlan" parameterType="com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan"
             useGeneratedKeys="true" keyProperty="id">
         insert into core_edu_training_plan
@@ -382,8 +425,31 @@
             #{id}
         </foreach>
     </delete>
-
     <select id="selectPageData" resultType="com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanPageVo">
+        select
+        p.id as id,
+        p.plan_name,
+        p.create_org_id,
+        p.create_org_name,
+        p.exec_org_type,
+        p.plan_cycle,
+        p.exec_times,
+        p.remark,
+        u.name as updateBy,
+        p.plan_status,
+        p.issue,
+        p.standard,
+        P.belong_org_id,
+        P.belong_org_name from core_edu_training_plan p left join sys_user u on p.update_by=u.id where p.deleted = 0 and p.parent_id is null
+        and p.standard=1 and p.issue=1
+        and p.id in ( select sp.parent_id from core_edu_training_plan sp where sp.deleted = 0 and sp.parent_id is not null  <include refid="pageIncludeSP"/>)
+        <!-- 不是标准计划但是也没下发: 行社自建的计划 -->
+        or ( p.standard=0 and p.issue=0 and p.deleted=0 and p.parent_id is null  <include refid="pageIncludeP"/>)
+        <!-- 是标准计划但是未下发 -->
+        or ( p.standard=1 and p.issue=0 and p.deleted=0 and p.parent_id is null  <include refid="pageIncludeP"/>)
+
+    </select>
+    <select id="selectPageData1" resultType="com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanPageVo">
         select p.id as id,
         p.plan_name,
         p.create_org_id,
@@ -415,7 +481,6 @@
         <if test="request.planStatus!=null">
             and p.plan_status = #{request.planStatus}
         </if>
-
         <if test="request.planName!=null">
             and p.plan_name = #{request.planName}
         </if>
@@ -454,4 +519,46 @@
           and p.standard = 0
           and p.belong_org_path like concat(#{path}, '%')
     </select>
+
+    <select id="selectChildrenPlan" resultType="com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanPageVo">
+        select
+        sp.id as id,
+        sp.plan_name,
+        sp.create_org_id,
+        sp.create_org_name,
+        sp.exec_org_type,
+        sp.plan_cycle,
+        sp.exec_times,
+        sp.remark,
+        sp.plan_status,
+        u.name as updateBy,
+        sp.issue,
+        sp.standard,
+        sp.belong_org_id as belongOrgId,
+        sp.belong_org_name as belongOrgName from core_edu_training_plan sp left join sys_user u on sp.update_by=u.id
+        where sp.deleted = 0 and sp.parent_id is not null
+        <if test="request.id!=null">
+            and sp.parent_id = #{request.id}
+        </if>
+        <if test="request.execOrgType!=null">
+            and sp.exec_org_type = #{request.execOrgType}
+        </if>
+        <if test="request.planCycle!=null">
+            and sp.plan_cycle = #{request.planCycle}
+        </if>
+        <if test="request.planStatus!=null">
+            and sp.plan_status = #{request.planStatus}
+        </if>
+        <if test="request.planName!=null">
+            and sp.plan_name = #{request.planName}
+        </if>
+        <choose>
+            <when test="request.checkSub==true">
+                and sp.belong_org_path like concat(#{request.belongOrgPath},'%')
+            </when>
+            <otherwise>
+                and sp.belong_org_id = #{request.belongOrgId}
+            </otherwise>
+        </choose>
+    </select>
 </mapper>