Browse Source

Merge branch 'V0.0.1' of http://10.87.10.227:4000/jzyd_yyds/soc into V0.0.1

 Conflicts:
	soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingTaskMapper.xml
zhulu 2 years ago
parent
commit
387778b127
18 changed files with 158 additions and 201 deletions
  1. 11 5
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteFileService.java
  2. 1 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteRoleService.java
  3. 6 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteFileFallbackFactory.java
  4. 20 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/function/RemoteCallHandlerExecutor.java
  5. 3 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/ErrorMsgConstants.java
  6. 1 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/domain/CoreEduTrainingPlan.java
  7. 2 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/vo/CoreEduTrainingPlanDetailVo.java
  8. 8 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/vo/CoreEduTrainingPlanPageVo.java
  9. 0 136
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/BeanHelper.java
  10. 45 16
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java
  11. 32 18
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingTaskServiceImpl.java
  12. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingPlanMapper.xml
  13. 4 4
      soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingTaskMapper.xml
  14. 9 3
      soc-modules/soc-modules-file/src/main/java/com/xunmei/file/controller/SysFileController.java
  15. 3 3
      soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java
  16. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java
  17. 9 8
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeptServiceImpl.java
  18. 2 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

+ 11 - 5
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteFileService.java

@@ -41,12 +41,18 @@ public interface RemoteFileService {
     R<String> generateEduTrainingPdf(@RequestBody Map<String, Object> data);
 
     /**
-     * 生成教育培训登记簿
+     * 获取本地存储路径前缀
+     *
+     * @return 结果
+     */
+    @GetMapping(value = "/file/getLocalPathPrefix")
+    String getLocalPathPrefix();
+
+    /**
+     * 获取nginx静态目录前缀
      *
-     * @param data     文件信息
-     * @param cacheDir 缓存目录
      * @return 结果
      */
-    @GetMapping(value = "/file/getPathPrefix")
-    String getPathPrefix();
+    @GetMapping(value = "/file/getStaticPathPrefix")
+    String getStaticPathPrefix();
 }

+ 1 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteRoleService.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author :LuoWei

+ 6 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteFileFallbackFactory.java

@@ -37,7 +37,12 @@ public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileServ
             }
 
             @Override
-            public String getPathPrefix() {
+            public String getLocalPathPrefix() {
+                return null;
+            }
+
+            @Override
+            public String getStaticPathPrefix() {
                 return null;
             }
         };

+ 20 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/function/RemoteCallHandlerExecutor.java

@@ -1,7 +1,10 @@
 package com.xunmei.system.api.function;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.xunmei.common.core.constant.ErrorMsgConstants;
+import com.xunmei.common.core.domain.R;
 import com.xunmei.common.core.exception.SystemException;
+import com.xunmei.common.core.web.domain.AjaxResult;
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -13,7 +16,23 @@ public class RemoteCallHandlerExecutor {
 
     public static <T> T executeRemoteCall(RemoteCallHandler<T> handler, String errorMessage) {
         try {
-            return handler.handle();
+            final T handle = handler.handle();
+            if (handle instanceof AjaxResult) {
+                final AjaxResult ajaxResult = (AjaxResult) handle;
+                if (!ajaxResult.isSuccess()) {
+                    throw new SystemException(ErrorMsgConstants.REMOTE_CALL_ERROR + errorMessage);
+                }
+            }
+            if (handle instanceof R) {
+                final R result = (R) handle;
+                if (!R.isSuccess(result)) {
+                    throw new SystemException(ErrorMsgConstants.REMOTE_CALL_ERROR + errorMessage);
+                }
+            }
+            if (ObjectUtil.isNull(handle)) {
+                throw new SystemException(ErrorMsgConstants.REMOTE_CALL_ERROR + errorMessage);
+            }
+            return handle;
         } catch (Exception e) {
             throw new SystemException(ErrorMsgConstants.REMOTE_CALL_ERROR + errorMessage);
         }

+ 3 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/ErrorMsgConstants.java

@@ -9,4 +9,7 @@ public class ErrorMsgConstants {
     public static final String QUERY_DICT_DATA_ERROR = "获取字典信息失败!";
     public static final String GENERATE_PDF_ERROR = "生成PDF文件失败!";
     public static final String QUERY_FILE_PATH_ERROR = "获取文件路径失败!";
+    public static final String QUERY_ROLE_DATA_ERROR = "获取角色信息失败!";
+
+    public static final String QUERY_STATICS_SAVE_PATH_ERROR = "获取静态存储路径失败!";
 }

+ 1 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/domain/CoreEduTrainingPlan.java

@@ -105,7 +105,7 @@ public class CoreEduTrainingPlan extends BaseEntity {
 
     @ApiModelProperty(value = "附件")
     @TableField("file_list")
-    private List<String> fileList;
+    private String fileList;
 
     @TableLogic(value = "0", delval = "1")
     @TableField(value = "deleted")

+ 2 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/vo/CoreEduTrainingPlanDetailVo.java

@@ -56,5 +56,6 @@ public class CoreEduTrainingPlanDetailVo {
     @ApiModelProperty(value = "附件")
     private List<String> fileList;
 
-
+    @ApiModelProperty(value = "登记簿url")
+    private String pdfUrl;
 }

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

@@ -1,10 +1,13 @@
 package com.xunmei.common.core.domain.edu.vo;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * @author jingyuanchao
  * @date 2023/8/24 15:30
@@ -12,7 +15,7 @@ import lombok.Data;
 @Data
 public class CoreEduTrainingPlanPageVo {
     @ApiModelProperty(value = "序号")
-    private int no;
+    private Integer no;
 
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "id")
@@ -68,4 +71,8 @@ public class CoreEduTrainingPlanPageVo {
     private int createByTopOrg;
 
     private String planRoleNameList;
+    @JsonIgnore
+    private Boolean hasChildren;
+
+    private List<CoreEduTrainingPlanPageVo> children;
 }

+ 0 - 136
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/utils/BeanHelper.java

@@ -1,136 +0,0 @@
-package com.xunmei.common.core.utils;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeanWrapper;
-import org.springframework.beans.PropertyAccessorFactory;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.util.*;
-
-/**
- * Tkk
- */
-public class BeanHelper {
-
-    /**
-     * 主要过滤 null 值
-     *
-     * @param target
-     * @param source
-     */
-    public static void copyProperties(Object target, Object source) {
-        BeanUtils.copyProperties(source, target, getNullPropertyNames(source));
-    }
-
-    /**
-     * 主要过滤 null 值
-     *
-     * @param oldValue
-     * @param newValue
-     */
-    public static void copyProperties(Object oldValue, Object newValue, String... exclude) {
-        BeanUtils.copyProperties(newValue, oldValue, getNullPropertyNames(newValue, exclude));
-    }
-
-    /**
-     * 忽略为null的数据
-     *
-     * @param source
-     * @return
-     */
-    public static String[] getNullPropertyNames(Object source, String... ignores) {
-        BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(source);
-        PropertyDescriptor[] pds = beanWrapper.getPropertyDescriptors();
-        List<String> ignoreList = new LinkedList<>();
-        for (PropertyDescriptor pd : pds) {
-            if (pd.getWriteMethod() == null) {
-                continue;
-            }
-            Object srcValue = beanWrapper.getPropertyValue(pd.getName());
-            if (srcValue == null) {
-                ignoreList.add(pd.getName());
-            }
-        }
-        String[] result = ignoreList.toArray(new String[ignoreList.size()]);
-        return ignores == null ? result : ArrayUtils.addAll(result, ignores);
-    }
-
-
-    public static void setNullPropertiesDefValue(Object obj) {
-        //获取实体类的所有属性,返回Field数组
-        // Field[] fields = obj.getClass().getDeclaredFields();
-        Field[] fields = getAllFields(obj.getClass());
-        //遍历所有属性
-        for (int j = 0; j < fields.length; j++) {
-            Field field = fields[j];
-            String type = field.getGenericType().toString();
-            field.setAccessible(true);
-            Object value = null;
-            try {
-                value = field.get(obj);
-                if (value != null && StringUtils.isNotBlank(value.toString())) {
-                    continue;
-                }
-                //如果type是类类型,则前面包含"class ",后面跟类名
-                switch (type) {
-                    case "class java.lang.String":
-                        field.set(obj, StringUtils.EMPTY);
-                        break;
-                    case "class java.math.BigDecimal":
-                        field.set(obj, BigDecimal.ZERO);
-                        break;
-                    case "class java.util.Date":
-                        field.set(obj, new Date());
-                        break;
-                    case "class java.lang.Integer":
-                        field.set(obj, 0);
-                        break;
-                    case "class java.lang.Character":
-                        field.set(obj, '0');
-                        break;
-                    case "class java.lang.Short":
-                        field.set(obj, Short.valueOf((short) 0));
-                        break;
-                    case "class java.lang.Byte":
-                        field.set(obj, Byte.valueOf((byte) 0));
-                        break;
-                    case "class java.lang.Double":
-                        field.set(obj, 0D);
-                        break;
-                    case "class java.lang.Float":
-                        field.set(obj, 0F);
-                        break;
-                    case "class java.lang.Long":
-                        field.set(obj, 0L);
-                        break;
-                    case "class java.lang.Boolean":
-                        field.set(obj, false);
-                        break;
-                    default:
-                        break;
-                }
-            } catch (IllegalAccessException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-    /**
-     * 获取本类及其父类的属性的方法
-     *
-     * @param clazz 当前类对象
-     * @return 字段数组
-     */
-    private static Field[] getAllFields(Class<?> clazz) {
-        List<Field> fieldList = new ArrayList<>();
-        while (clazz != null) {
-            fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())));
-            clazz = clazz.getSuperclass();
-        }
-        Field[] fields = new Field[fieldList.size()];
-        return fieldList.toArray(fields);
-    }
-}

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

@@ -3,6 +3,8 @@ package com.xunmei.core.edu.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -21,7 +23,9 @@ import com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanDetailVo;
 import com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanPageVo;
 import com.xunmei.common.core.domain.edu.vo.CoreEduTrainingPlanRoleVo;
 import com.xunmei.common.core.exception.SystemException;
+import com.xunmei.common.core.util.BeanHelper;
 import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.edu.mapper.CoreEduTrainingPlanMapper;
@@ -32,7 +36,9 @@ import com.xunmei.core.edu.service.ICoreEduTrainingPlanService;
 import com.xunmei.core.edu.service.ICoreEduTrainingPlanToExecOrgService;
 import com.xunmei.core.edu.service.ICoreEduTrainingPlanToRoleService;
 import com.xunmei.core.edu.service.ICoreEduTrainingTaskService;
+import com.xunmei.system.api.Eto.RoleConditionEto;
 import com.xunmei.system.api.RemoteOrgService;
+import com.xunmei.system.api.RemoteRoleService;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
 import lombok.extern.slf4j.Slf4j;
@@ -43,10 +49,7 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -74,6 +77,8 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
     private CoreEduTrainingTaskMapper coreEduTrainingTaskMapper;
     @Autowired
     private RemoteOrgService orgService;
+    @Autowired
+    private RemoteRoleService remoteRoleService;
 
     @Override
     public TableDataInfo selectPage(CoreEduTrainingPlanPageDto request) {
@@ -86,17 +91,12 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         //获取数据
         Page<CoreEduTrainingPlanPageVo> page = coreEduTrainingPlanMapper.selectPageData(request.getPage(), request);
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectTopOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
-        for (CoreEduTrainingPlanPageVo record : page.getRecords()) {
-            record.setNo(page.getRecords().indexOf(record) + 1);
-            if (ObjectUtil.equal(record.getCreateOrgId(), sysOrg.getId())) {
-                record.setCreateByTopOrg(1);
-            }
-            String roleNameList = coreEduTrainingPlanToRoleMapper.selectRoleNameByPlanId(record.getId()).stream().map(CoreEduTrainingPlanRoleVo::getRoleName).collect(Collectors.joining(","));
-            record.setPlanRoleNameList(roleNameList);
-
+        List<CoreEduTrainingPlanPageVo> records = page.getRecords();
+        for (CoreEduTrainingPlanPageVo record : records) {
+            dealData(record, records, sysOrg.getId());
         }
         //抓换为TableDataInfo适配前端
-        TableDataInfo tableDataInfo = new TableDataInfo();
+        TableDataInfo<CoreEduTrainingPlanPageVo> tableDataInfo = new TableDataInfo();
         tableDataInfo.setMsg("操作成功");
         tableDataInfo.setCode(200);
         tableDataInfo.setTotal(page.getTotal());
@@ -106,6 +106,32 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 
     }
 
+    private void dealData(CoreEduTrainingPlanPageVo record, List<CoreEduTrainingPlanPageVo> records, Long orgId) {
+        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());
+        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));
+        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);
+            child.setPlanRoleNameList(roleNameList);
+        }
+    }
+
 
     /**
      * 查询教育培训计划
@@ -118,6 +144,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         final CoreEduTrainingPlan plan = coreEduTrainingPlanMapper.selectById(id);
         CoreEduTrainingPlanDetailVo vo = new CoreEduTrainingPlanDetailVo();
         BeanUtils.copyProperties(plan, vo);
+        vo.setFileList(ObjectUtil.isNotEmpty(plan.getFileList()) ? JSON.parseArray(plan.getFileList(), String.class) : null);
         final List<CoreEduTrainingPlanToExecOrg> execOrgList = coreEduTrainingPlanToExecOrgMapper.selectByMap(MapUtil.of("plan_id", id));
         final List<Long> execOrgIdList = execOrgList.stream().map(CoreEduTrainingPlanToExecOrg::getOrgId).collect(Collectors.toList());
         vo.setPlanExecOrgIdList(ObjectUtil.isEmpty(execOrgIdList) ? null : execOrgIdList);
@@ -150,6 +177,9 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         if (ObjectUtil.isAllEmpty(request.getExecOrgType(), request.getPlanExecOrgIdList())) {
             throw new RuntimeException("培训机构类型和执行机构不能同时为空!");
         }
+        if (ObjectUtil.equal(request.getPlanCycle(), 0) && ObjectUtil.hasEmpty(request.getStartDate(), request.getEndDate())) {
+            throw new RuntimeException("当计划为无周期的时候,请填入开始时间和结束时间!");
+        }
         CoreEduTrainingPlan plan = new CoreEduTrainingPlan();
         BeanUtils.copyProperties(request, plan);
         plan.setId(IdWorker.getId());
@@ -167,6 +197,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         plan.setBelongOrgId(orgId);
         plan.setBelongOrgName(r.getName());
         plan.setBelongOrgPath(r.getPath());
+        plan.setFileList(ObjectUtil.isNotEmpty(request.getFileList()) ? JSON.toJSONString(request.getFileList()) : null);
         batchSavePlanToRole(request.getPlanRoleId(), plan.getId());
         batchSavePlanToExecOrg(request.getPlanExecOrgIdList(), plan.getId());
         //省联社或者办事处创建的计划才存在下发
@@ -301,12 +332,10 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         List<CoreEduTrainingPlanToExecOrg> execOrg = coreEduTrainingPlanToExecOrgMapper.selectList(eos);
         if (ObjectUtil.isNotEmpty(execOrg)) {
             final List<Long> list = execOrg.stream().map(CoreEduTrainingPlanToExecOrg::getOrgId).collect(Collectors.toList());
-            orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgByIdList(list, SecurityConstants.INNER), "未能查找到具体的培训机构,请联系管理员!");
+            orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgByIdList(list, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
             return orgList;
         }
-        Assert.notNull(execOrgType, "未能查找到具体的培训机构,请联系管理员!");
         orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectByOrgType(execOrgType, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
-        Assert.notEmpty(orgList, "无法根据培训机构类型找到具体机构,请修改计划内容!");
         return orgList;
     }
 

+ 32 - 18
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingTaskServiceImpl.java

@@ -113,28 +113,39 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
             List<CoreEduTrainingTaskToRole> roleList = taskToRoleMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingTaskToRole>()
                     .in(CoreEduTrainingTaskToRole::getEduTrainingTaskId, idList));
             Map<Long, List<CoreEduTrainingTaskToRole>> listMap = roleList.stream().collect(Collectors.groupingBy(CoreEduTrainingTaskToRole::getEduTrainingTaskId));
-            for (CoreEduTrainingTaskPageVo record : pageData.getRecords()) {
-                record.setNo(pageData.getRecords().indexOf(record) + 1);
-                record.setTypeText(EduTrainingType.getName(record.getType()));
-                record.setStatusText(EduTrainingDoStatus.getName(record.getStatus()));
-                List<CoreEduTrainingTaskToRole> coreEduTrainingTaskToRoles = listMap.get(record.getId());
-                if (ObjectUtil.isEmpty(coreEduTrainingTaskToRoles)) {
-                    continue;
-                }
-                record.setTaskRoleList(coreEduTrainingTaskToRoles);
-                record.setTaskRoleNameList(coreEduTrainingTaskToRoles.stream().map(CoreEduTrainingTaskToRole::getRoleName).collect(Collectors.joining(",")));
-
-                List<CoreEduTrainingTaskToUser> userList = taskToUserMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingTaskToUser>()
-                        .eq(CoreEduTrainingTaskToUser::getEduTrainingTaskId, record.getId()));
-                int signNums = (int) userList.stream().filter(user -> user.getSign() == 1).count();
-                record.setSignNums(signNums + "/" + userList.size());
+            final List<CoreEduTrainingTaskPageVo> records = pageData.getRecords();
+            final String staticPathPrefix = getStaticPathPrefix();
+            for (CoreEduTrainingTaskPageVo record : records) {
+                dealData(record, records, listMap, staticPathPrefix);
             }
         }
-
         //抓换为TableDataInfo适配前端
         return TableDataInfo.build(pageData);
     }
 
+    private String getStaticPathPrefix() {
+        return RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_STATICS_SAVE_PATH_ERROR);
+    }
+
+    private void dealData(CoreEduTrainingTaskPageVo record, List<CoreEduTrainingTaskPageVo> records, Map<Long, List<CoreEduTrainingTaskToRole>> listMap, String staticsPath) {
+        record.setNo(records.indexOf(record) + 1);
+        record.setTypeText(EduTrainingType.getName(record.getType()));
+        record.setStatusText(EduTrainingDoStatus.getName(record.getStatus()));
+        List<CoreEduTrainingTaskToRole> coreEduTrainingTaskToRoles = listMap.get(record.getId());
+        if (ObjectUtil.isEmpty(coreEduTrainingTaskToRoles)) {
+            return;
+        }
+        record.setTaskRoleList(coreEduTrainingTaskToRoles);
+        record.setTaskRoleNameList(coreEduTrainingTaskToRoles.stream().map(CoreEduTrainingTaskToRole::getRoleName).collect(Collectors.joining(",")));
+        List<CoreEduTrainingTaskToUser> userList = taskToUserMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingTaskToUser>()
+                .eq(CoreEduTrainingTaskToUser::getEduTrainingTaskId, record.getId()));
+        int signNums = (int) userList.stream().filter(user -> user.getSign() == 1).count();
+        record.setSignNums(signNums + "/" + userList.size());
+        if (ObjectUtil.isNotEmpty(record.getPdfUrl())) {
+            record.setPdfUrl(staticsPath + File.separator + record.getPdfUrl());
+        }
+    }
+
     @Override
     public List<CoreEduTrainingTaskToUser> signUserList(Long taskId) {
         return taskToUserMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingTaskToUser>()
@@ -154,6 +165,9 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
         if (ObjectUtil.isNotEmpty(userList)) {
             detailVo.setTaskUserList(userList);
         }
+        if (ObjectUtil.isNotEmpty(detailVo.getPdfUrl())) {
+            detailVo.setPdfUrl(getStaticPathPrefix() + detailVo.getPdfUrl());
+        }
         return detailVo;
     }
 
@@ -438,8 +452,8 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
         if (ObjectUtil.isEmpty(taskUserList)) {
             data.put("image", new ArrayList<>());
         } else {
-            String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR);
-            List<String> collect = taskUserList.stream().filter(item -> item.getType() == 1).map(CoreEduTrainingTaskToUser::getSignImage).collect(Collectors.toList());
+            String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR);
+            List<String> collect = taskUserList.stream().filter(item -> item.getType() == 1 && ObjectUtil.isNotEmpty(item.getSignImage())).map(CoreEduTrainingTaskToUser::getSignImage).collect(Collectors.toList());
             List<String> list = new ArrayList<>();
             for (String path : collect) {
                 list.add(prefixPath + path);

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

@@ -403,7 +403,7 @@
             left join (select id from core_edu_training_plan p1 inner join core_edu_training_plan_to_role r1 on p1.id =
             r1.plan_id where r1.role_id = #{request.planRoleId} and p1.deleted=0) t on p.id = t.id and p.deleted=0
         </if>
-        where p.deleted = 0
+        where p.deleted = 0 and p.create_org_id=p.belong_org_id
 
         <if test="request.execOrgType!=null">
             and p.exec_org_type = #{request.execOrgType}

+ 4 - 4
soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingTaskMapper.xml

@@ -83,7 +83,7 @@
         <!--            </if>-->
         <!--        </where>-->
         select t.id, plan_id, t.org_id, t.org_name, title, type, status, host_id,u.name as hostName,
-        start_date, end_date, t.training_start_date_time,t.training_end_date_time,t.pdf_url
+        start_date, end_date, t.training_start_date_time,t.training_end_date_time, t.pdf_url as pdfUrl
         from core_edu_training_task t left join sys_user u on t.host_id=u.id
         <where>
             <choose>
@@ -127,11 +127,11 @@
                training_start_date_time,
                training_end_date_time,
                image_list,
-               file_list,
                t.host_id,
                t.recorder_id,
-               u.name  as hostName,
-               u2.name as recorderName
+               u.name    as hostName,
+               u2.name   as recorderName,
+               t.pdf_url as pdfUrl
         from core_edu_training_task t
                  left join sys_user u on u.id = t.host_id
                  left join sys_user u2 on u2.id = t.recorder_id

+ 9 - 3
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/controller/SysFileController.java

@@ -132,9 +132,15 @@ public class SysFileController {
     void getFileStream(@RequestParam String path, HttpServletResponse response) {
         sysFileService.getFileStream(path, response);
     }
-
-    @GetMapping(value = "/getPathPrefix")
-    String generateEduTrainingPdf() {
+    @ApiOperation(value = "获取本地存储路径前缀")
+    @GetMapping(value = "/getLocalPathPrefix")
+    String getLocalPathPrefix() {
         return this.localFilePath;
     }
+
+    @ApiOperation(value = "获取nginx静态目录前缀")
+    @GetMapping(value = "/getStaticPathPrefix")
+    String getStaticPathPrefix() {
+        return this.prefix;
+    }
 }

+ 3 - 3
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java

@@ -54,8 +54,8 @@ public class LocalSysFileServiceImpl implements ISysFileService {
     @Autowired
     private HttpServletRequest request;
 
-    private static String getLocalFilePath(String localFilePath, String businessType, String fileName) {
-        final String path = localFilePath + File.separator + businessType + File.separator + DateUtil.format(new Date(), "yyyy" + File.separator + "MM" + File.separator + "dd" + File.separator);
+    private static String getLocalFilePath(String prefix, String businessType, String fileName) {
+        final String path = File.separator + businessType + File.separator + DateUtil.format(new Date(), "yyyy" + File.separator + "MM" + File.separator + "dd" + File.separator);
         File desc = new File(path + fileName);
         log.info("当前上传文件地址:{}", desc.getAbsolutePath());
         if (!desc.exists()) {
@@ -186,7 +186,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         document.close();
         writer.close();
 
-        return this.getRelativePath(filePath);
+        return filePath;
     }
 
 }

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java

@@ -97,7 +97,7 @@ public interface ISysOrgService extends IService<SysOrg> {
     /**
      * 缓存机构数据
       */
-    void loadingOrgCache();
+    List<SysOrg> loadingOrgCache();
 
     /**
      * 清楚机构缓存

+ 9 - 8
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeptServiceImpl.java

@@ -109,22 +109,23 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
      */
     @Override
     public List<SysOrg> selectDeptTreeList(SysOrg dept) {
-        Long s= System.currentTimeMillis();
+        Long s = System.currentTimeMillis();
         Long userId = SecurityUtils.getUserId();
         SysOrg sysOrg = orgMapper.selectSysOrgByUserId(userId);
         if (ObjectUtil.isNull(sysOrg)) {
             throw new ServiceException("当前用户没有部门信息");
         }
-        //List<SysOrg> cacheList = redisService.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
+        List<SysOrg> cacheList = null;
         Boolean isOk = RedisUtils.hasKey(CacheConstants.ORG_CACHE_LIST_KEY);
-        if(!isOk){
-            orgService.loadingOrgCache();
+        if (!isOk) {
+            cacheList = orgService.loadingOrgCache();
+        } else {
+            cacheList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
         }
-        List<SysOrg> cacheList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
         List<SysOrg> orgs = new ArrayList<>();
         for (SysOrg org : cacheList) {
             String path = org.getPath();
-            if(StringUtils.isNotEmpty(path) && path.startsWith(sysOrg.getPath())){
+            if (StringUtils.isNotEmpty(path) && path.startsWith(sysOrg.getPath())) {
                 orgs.add(org);
             }
         }
@@ -139,8 +140,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
         }
         /*List<SysOrg> depts = orgMapper.selectList(wrapper);*/
         final Map<Long, List<SysOrg>> collect = orgs.stream().collect(Collectors.groupingBy(SysOrg::getParentId));
-        List<SysOrg> r= handleTree(collect, parentId);
-        s=System.currentTimeMillis()-s;
+        List<SysOrg> r = handleTree(collect, parentId);
+        s = System.currentTimeMillis() - s;
         return r;
     }
 

+ 2 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -243,13 +243,14 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
     }
 
     @Override
-    public void loadingOrgCache() {
+    public List<SysOrg> loadingOrgCache() {
         QueryWrapper<SysOrg> qw = new QueryWrapper<>();
         qw.lambda().ge(SysOrg::getDeleted, 0);
         List<SysOrg> list = baseMapper.selectList(qw);
         clearOrgCache();
         RedisUtils.setCacheList(CacheConstants.ORG_CACHE_LIST_KEY, list);
         //redisService.setCacheList(CacheConstants.ORG_CACHE_LIST_KEY, list);
+        return list;
     }
 
     @Override