Browse Source

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

jiawuxian 2 năm trước cách đây
mục cha
commit
7775147eb2

+ 0 - 0
project_data/sql/0.0.2/nacos/nacos.sql


+ 0 - 0
project_data/sql/0.0.2/quartz/quartz.sql


+ 0 - 0
project_data/sql/0.0.2/soc 9月14号11.30 以后的增量部分脚本.sql → project_data/sql/0.0.2/soc/soc 9月14号11.30 以后的增量部分脚本.sql


+ 0 - 0
project_data/sql/0.0.2/soc.sql → project_data/sql/0.0.2/soc/soc.sql


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

@@ -22,6 +22,7 @@ public class SysLearningMaterialsFileListPageDto extends PageRequest {
 
     @ApiModelProperty(value = "学习标题")
     private String title;
+    private String orgPath;
 
     @ApiModelProperty(value = "附件名称")
     private String fileName;

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

@@ -39,6 +39,8 @@ import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Stream;
 
+import static com.xunmei.common.core.constant.Constants.TOP_ORG_PARENT_ID;
+
 /**
  * 学习资料Service业务层处理
  *
@@ -59,7 +61,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
             throw new RuntimeException("机构不存在或机构信息缺失!");
         }
         final List<Long> list = dealParentOrgId(request, sysOrg);
-        boolean isTopOrg = ObjectUtil.equal(sysOrg.getParentId(), Constants.TOP_ORG_PARENT_ID);
+        boolean isTopOrg = ObjectUtil.equal(sysOrg.getParentId(), TOP_ORG_PARENT_ID);
         list.remove(request.getOrgId());
         request.setOrgIdList(list);
         request.setUserId(SecurityUtils.getUserId());
@@ -73,7 +75,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
         for (SysLearningMaterialsPageVo record : page.getRecords()) {
             record.setNo(page.getRecords().indexOf(record));
         }
-       return TableDataInfo.success(page);
+        return TableDataInfo.success(page);
     }
 
     private List<Long> dealParentOrgId(SysLearningMaterialsPageDto request, SysOrg sysOrg) {
@@ -85,14 +87,21 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
         return list;
     }
 
-    private List<Long> dealParentOrgId(Long orgId) {
+    private List<Long> dealParentOrgId(SysLearningMaterialsFileListPageDto request) {
+        Long orgId = request.getOrgId();
         SysOrg sysOrg = remoteOrgService.selectSysOrgById(orgId, SecurityConstants.INNER);
         if (sysOrg == null || ObjectUtil.isEmpty(sysOrg.getPath())) {
             throw new RuntimeException("机构不存在或机构信息缺失!");
         }
-        String[] split = sysOrg.getPath().split("-");
+        request.setOrgPath(sysOrg.getPath());
         List<Long> list = new ArrayList<>();
+        if (Constants.TOP_ORG_PARENT_ID.equals(sysOrg.getParentId())) {
+            list.add(orgId);
+            return list;
+        }
+        String[] split = sysOrg.getPath().split("-");
         Stream.of(split).forEach(s -> list.add(Long.valueOf(s)));
+        list.remove(orgId);
         return list;
     }
 
@@ -153,7 +162,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
         sysLearningMaterials.setUpdateTime(DateUtils.getNowDate());
         sysLearningMaterials.setFileList(null);
         sysLearningMaterials.setFileNames(null);
-        if (ObjectUtil.isNotEmpty(request.getFileList()) ){
+        if (ObjectUtil.isNotEmpty(request.getFileList())) {
             sysLearningMaterials.setFileList(JSON.toJSONString(request.getFileList()));
             ArrayList<String> list1 = new ArrayList<>();
             request.getFileList().forEach(file -> {
@@ -185,7 +194,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
         BeanUtils.copyProperties(request, sysLearningMaterials);
         sysLearningMaterials.setFileList(null);
         sysLearningMaterials.setFileNames(null);
-        if (ObjectUtil.isNotEmpty(request.getFileList()) ){
+        if (ObjectUtil.isNotEmpty(request.getFileList())) {
             sysLearningMaterials.setFileList(JSON.toJSONString(request.getFileList()));
             ArrayList<String> list1 = new ArrayList<>();
             request.getFileList().forEach(file -> {
@@ -237,7 +246,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
 
     @Override
     public TableDataInfo filePageList(SysLearningMaterialsFileListPageDto request) {
-        final List<Long> list = dealParentOrgId(request.getOrgId());
+        final List<Long> list = dealParentOrgId(request);
         request.setOrgIdList(list);
         final IPage<SysLearningMaterialsFileListVo> page = sysLearningMaterialsMapper.selectFilePageList(request.getPageRequest(), request);
         final List<SysLearningMaterialsFileListVo> records = page.getRecords();

+ 89 - 46
soc-modules/soc-modules-core/src/main/resources/mapper/edu/SysLearningMaterialsMapper.xml

@@ -3,7 +3,6 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.core.edu.mapper.SysLearningMaterialsMapper">
-
     <resultMap type="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials" id="SysLearningMaterialsResult">
         <result property="id" column="id"/>
         <result property="title" column="title"/>
@@ -107,7 +106,7 @@
         u.id as createId,
         m.create_time,
         m.update_time as updateTime,
-        m.file_names as  fileNames
+        m.file_names as fileNames
         from sys_learning_materials m
         inner join sys_knowledge k on m.knowledge_id = k.id
         inner join sys_user u on u.id=m.create_by
@@ -116,7 +115,8 @@
         and m.create_by=#{request.userId}
         <include refid="pageRequest"/>
         <if test="request.checkSub==true">
-            or ( m.org_path like concat(#{request.orgPath},'%') and m.is_open = 1 <!--and m.org_path !=#{request.orgPath}-->
+            or ( m.org_path like concat(#{request.orgPath},'%') and m.is_open =
+            1 <!--and m.org_path !=#{request.orgPath}-->
             <include refid="pageRequest"/>)
         </if>
         <if test="request.checkSub==false">
@@ -149,7 +149,7 @@
         u.id as createId,
         m.create_time,
         m.update_time as updateTime,
-        m.file_names as  fileNames
+        m.file_names as fileNames
         from sys_learning_materials m
         inner join sys_knowledge k on m.knowledge_id = k.id
         inner join sys_user u on u.id=m.create_by
@@ -172,69 +172,97 @@
             parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
         insert into sys_learning_materials
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,
+            <if test="id != null">
+                id,
             </if>
-            <if test="title != null">title,
+            <if test="title != null">
+                title,
             </if>
-            <if test="content != null">content,
+            <if test="content != null">
+                content,
             </if>
-            <if test="knowledgeId != null">knowledge_id,
+            <if test="knowledgeId != null">
+                knowledge_id,
             </if>
-            <if test="orgId != null">org_id,
+            <if test="orgId != null">
+                org_id,
             </if>
-            <if test="orgName != null">org_name,
+            <if test="orgName != null">
+                org_name,
             </if>
-            <if test="orgPath != null">org_path,
+            <if test="orgPath != null">
+                org_path,
             </if>
-            <if test="isOpen != null">is_open,
+            <if test="isOpen != null">
+                is_open,
             </if>
             <if test="fileList != null">
                 file_list,
             </if>
-            <if test="remark != null">remark,
+            <if test="remark != null">
+                remark,
             </if>
-            <if test="deleted != null">deleted,
+            <if test="deleted != null">
+                deleted,
             </if>
-            <if test="createBy != null">create_by,
+            <if test="createBy != null">
+                create_by,
             </if>
-            <if test="createTime != null">create_time,
+            <if test="createTime != null">
+                create_time,
             </if>
-            <if test="updateBy != null">update_by,
+            <if test="updateBy != null">
+                update_by,
             </if>
-            <if test="updateTime != null">updateTime,
+            <if test="updateTime != null">
+                updateTime,
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},
+            <if test="id != null">
+                #{id},
             </if>
-            <if test="title != null">#{title},
+            <if test="title != null">
+                #{title},
             </if>
-            <if test="content != null">#{content},
+            <if test="content != null">
+                #{content},
             </if>
-            <if test="knowledgeId != null">#{knowledgeId},
+            <if test="knowledgeId != null">
+                #{knowledgeId},
             </if>
-            <if test="orgId != null">#{orgId},
+            <if test="orgId != null">
+                #{orgId},
             </if>
-            <if test="orgName != null">#{orgName},
+            <if test="orgName != null">
+                #{orgName},
             </if>
-            <if test="orgPath != null">#{orgPath},
+            <if test="orgPath != null">
+                #{orgPath},
             </if>
-            <if test="isOpen != null">#{isOpen},
+            <if test="isOpen != null">
+                #{isOpen},
             </if>
             <if test="fileList != null">
                 #{fileList},
             </if>
-            <if test="remark != null">#{remark},
+            <if test="remark != null">
+                #{remark},
             </if>
-            <if test="deleted != null">#{deleted},
+            <if test="deleted != null">
+                #{deleted},
             </if>
-            <if test="createBy != null">#{createBy},
+            <if test="createBy != null">
+                #{createBy},
             </if>
-            <if test="createTime != null">#{createTime},
+            <if test="createTime != null">
+                #{createTime},
             </if>
-            <if test="updateBy != null">#{updateBy},
+            <if test="updateBy != null">
+                #{updateBy},
             </if>
-            <if test="updateTime != null">#{updateTime},
+            <if test="updateTime != null">
+                #{updateTime},
             </if>
         </trim>
     </insert>
@@ -243,16 +271,20 @@
             parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
         update sys_learning_materials
         <trim prefix="SET" suffixOverrides=",">
-            <if test="title != null">title =
+            <if test="title != null">
+                title =
                 #{title},
             </if>
-            <if test="content != null">content =
+            <if test="content != null">
+                content =
                 #{content},
             </if>
-            <if test="knowledgeId != null">knowledge_id =
+            <if test="knowledgeId != null">
+                knowledge_id =
                 #{knowledgeId},
             </if>
-            <if test="orgId != null">org_id =
+            <if test="orgId != null">
+                org_id =
                 #{orgId},
             </if>
             <if test="orgName != null">
@@ -283,13 +315,16 @@
                 create_by =
                 #{createBy},
             </if>
-            <if test="createTime != null">create_time =
+            <if test="createTime != null">
+                create_time =
                 #{createTime},
             </if>
-            <if test="updateBy != null">update_by =
+            <if test="updateBy != null">
+                update_by =
                 #{updateBy},
             </if>
-            <if test="updateTime != null">updateTime =
+            <if test="updateTime != null">
+                updateTime =
                 #{updateTime},
             </if>
         </trim>
@@ -308,12 +343,7 @@
             #{id}
         </foreach>
     </delete>
-
-    <select id="selectFilePageList" resultType="com.xunmei.common.core.domain.edu.vo.SysLearningMaterialsFileListVo">
-        select id,org_id as orgId,title as title,org_name as orgName,file_list as file
-
-        from sys_learning_materials m
-        where m.deleted = 0
+    <sql id="filePageList">
         and m.is_open = 1
         and m.file_list is not null
         <if test="request.title != null and request.title != '' ">
@@ -322,11 +352,24 @@
         <if test="request.fileName != null and request.fileName != '' ">
             and m.file_names like concat('%', #{request.fileName}, '%')
         </if>
+    </sql>
+
+    <select id="selectFilePageList" resultType="com.xunmei.common.core.domain.edu.vo.SysLearningMaterialsFileListVo">
+        select id,org_id as orgId,title as title,org_name as orgName,file_list as file
+
+        from sys_learning_materials m
+        where m.deleted = 0
+       <include refid="filePageList"/>
+        <if test="request.orgPath != null and request.orgPath != '' ">
+            and m.org_path like concat(#{request.orgPath}, '%')
+        </if>
         <if test="request.orgIdList.size>0">
-            and m.org_id in
+            or ( m.org_id in
             <foreach collection="request.orgIdList" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
+            <include refid="filePageList"/>
+            )
         </if>
         order by m.org_id, m.create_time desc
     </select>

+ 22 - 0
soc-modules/soc-modules-file/pom.xml

@@ -75,6 +75,28 @@
     <build>
         <finalName>${project.artifactId}</finalName>
         <plugins>
+            <!--不加此配置会导致引入的第三方jar包依赖 无法被打进jar包,导致线上报错-->
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                    <compilerArguments>
+                        <extdirs>${project.basedir}/src/main/resources/lib</extdirs>
+                    </compilerArguments>
+                </configuration>
+            </plugin>
+
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>

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

@@ -174,7 +174,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
     @Override
     public String generateEduTrainingPdf(Map<String, Object> data) throws Exception {
         PdfFilePathVo pathVo = getLocalFilePath(localFilePath, "edu", data.get("fileName").toString());
-        log.info("生成教育培训登记簿,当前绝对地址为:{}", pathVo.getAbsolutePath());
+        log.info("开始生成教育培训登记簿,当前绝对地址为:{}", pathVo.getAbsolutePath());
         final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getAbsolutePath(), 6, 10);
         final Document document = pdfTableVo.getDocument();
         final PdfWriter writer = pdfTableVo.getWriter();
@@ -185,6 +185,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         PdfUtil.dealEduBody(document, table, tableFont, data);
         document.close();
         writer.close();
+        log.info("教育培训登记簿生成结束,当前绝对地址为:{}", pathVo.getAbsolutePath());
         //此处返回  /statics/edu/xxx.pdf
         return this.prefix + pathVo.getRelativePath();
     }

+ 1 - 1
soc-modules/soc-modules-sync/src/main/java/com/xunmei/sync/dto/fjnxsync/FJNXOrgDto.java

@@ -27,7 +27,7 @@ public class FJNXOrgDto implements Serializable {
     /*
    机构简称
     */
-    @XmlElement(name = "label")
+    @XmlElement(name = "shortName")
     private String shortName;
 
     /*

+ 0 - 9
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java

@@ -114,15 +114,6 @@ public class SysDeptController extends BaseController {
         if (dept.getParentId().equals(deptId)) {
             return error("修改机构'" + dept.getName() + "'失败,上级机构不能是自己");
         }
-        //获取选择的父机构数据
-        SysOrg byId = orgService.getById(dept.getParentId());
-        //更新机构对应的path
-        if(ObjectUtil.isEmpty(dept.getShortName())){
-            dept.setShortName(dept.getName());
-        }
-        dept.setPath(byId.getPath()+dept.getId()+"-");
-        dept.setTreeShowPath(byId.getTreeShowPath()+dept.getId()+"-");
-        dept.setTreeShowParentId(byId.getId());
 
         dept.setUpdateBy(SecurityUtils.getUsername());
         dept.setUpdateTime(new Date());

+ 60 - 11
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -11,7 +11,6 @@ import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.utils.DateUtils;
-import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.redis.utils.RedisUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
@@ -28,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.PostConstruct;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 【请填写功能名称】Service业务层处理
@@ -295,24 +295,41 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean saveOrUpdateOrg(SysOrg org) {
+        if (ObjectUtil.isEmpty(org.getShortName())) {
+            org.setShortName(org.getName());
+        }
         boolean isOk = false;
         if (org.getId() != null) {
-            if (StringUtils.isEmpty(org.getManagerPhone())) {
-                org.setManagerPhone(org.getPhone());
+            //修改前的原始机构对象
+            final SysOrg originalOrg = getById(org.getId());
+            //仅系统新增的机构可以修改层级,同步到系统的机构不允许修改机构层级
+            if(ObjectUtil.equal(originalOrg.getSource(),0)) {
+                //父级机构发生变化后,修改机构path ,以及下级机构path
+                if(!ObjectUtil.equal(originalOrg.getParentId(),org.getParentId())){
+                    //获取选择的父机构数据
+                    SysOrg parentOrg = getById(org.getParentId());
+                    //更新机构对应的业务path
+                    org.setPath(parentOrg.getPath() + org.getId() + "-");
+                    //更新机构对应的机构树path
+                    org.setTreeShowPath(parentOrg.getTreeShowPath() + org.getId() + "-");
+                    org.setTreeShowParentId(parentOrg.getId());
+
+                    //ToDo 刷新当前机构下所有子机构 path
+                    List<SysOrg> allChildOrgList= reSetOrgAllChildOrgPath(org,originalOrg);
+                    this.saveOrUpdateBatch(allChildOrgList);
+                }
             }
+
             isOk = this.updateById(org);
+
         } else {
-            SysOrg sysOrg = sysOrgMapper.selectById(org.getParentId());
-            org.setParentGuid(sysOrg.getGuid());
+            SysOrg parentOrg = sysOrgMapper.selectById(org.getParentId());
+            org.setParentGuid(parentOrg.getGuid());
             org.setDeleted(0);
             long id = IdWorker.getId();
             org.setId(id);
-            org.setPath(sysOrg.getPath() + id + "-");
-            org.setTreeShowPath(sysOrg.getPath() + id + "-");
-
-            if (StringUtils.isEmpty(org.getManagerPhone())) {
-                org.setManagerPhone(org.getPhone());
-            }
+            org.setPath(parentOrg.getPath() + id + "-");
+            org.setTreeShowPath(parentOrg.getPath() + id + "-");
             isOk = this.save(org);
         }
         /*
@@ -334,6 +351,38 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
         return rel;
     }
 
+    private List<SysOrg> getAllChildOrgList(String path)
+    {
+        return sysOrgMapper.selectList(new LambdaQueryWrapper<SysOrg>()
+                .likeRight(SysOrg::getPath, path)
+                .eq(SysOrg::getDeleted, 0));
+    }
+
+    private List<SysOrg> reSetOrgAllChildOrgPath(SysOrg newOrg,SysOrg originalOrg)
+    {
+        final List<SysOrg> allChildOrgList = getAllChildOrgList(originalOrg.getPath());
+        if(ObjectUtil.isEmpty(allChildOrgList))
+        {
+           return allChildOrgList;
+        }
+        reSetOrgPath(newOrg,allChildOrgList);
+        return allChildOrgList;
+    }
+
+    private void reSetOrgPath(SysOrg parentOrg,List<SysOrg> allChildOrgList)
+    {
+        final List<SysOrg> chillOrgList = allChildOrgList.stream().filter(child -> ObjectUtil.equal(parentOrg.getId(), child.getParentId())).collect(Collectors.toList());
+        if(ObjectUtil.isEmpty(chillOrgList)){
+            return;
+        }
+        chillOrgList.stream().forEach(child->{
+            child.setPath(parentOrg.getPath()+child.getId()+"-");
+            child.setTreeShowPath(parentOrg.getTreeShowPath()+child.getId()+"-");
+            reSetOrgPath(child,allChildOrgList);
+        });
+    }
+
+
     private static List<SysOrg> handleTree(Map<Long, List<SysOrg>> map, Long parentId) {
         List<SysOrg> orgList = map.get(parentId);
         if (ObjectUtil.isNotEmpty(orgList)) {

+ 1 - 3
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -197,15 +197,13 @@
     <select id="selectSyncUserList" parameterType="com.xunmei.system.api.domain.SysUser"
             resultType="com.xunmei.system.api.domain.SysUser">
         select *
-        from sys_user u
-        <where>
+        from sys_user u where deleted=0
             <if test="source != null">
                 AND u.source =#{source}
             </if>
             <if test="orgId != null">
                 AND u.org_id =#{orgId}
             </if>
-        </where>
     </select>
 
     <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">