liuyc 3 سال پیش
والد
کامیت
1ea8b62177
22فایلهای تغییر یافته به همراه233 افزوده شده و 253 حذف شده
  1. 12 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java
  2. 0 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ProjectInfoController.java
  3. 0 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java
  4. 2 9
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java
  5. 4 6
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java
  6. 1 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ImageClassificationConfigMapper.java
  7. 0 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.java
  8. 0 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsFormElementMapper.java
  9. 0 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsInfoMapper.java
  10. 0 29
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeMapper.java
  11. 0 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java
  12. 0 15
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IProjectInfoService.java
  13. 0 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsInfoService.java
  14. 0 35
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeService.java
  15. 5 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java
  16. 29 11
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  17. 9 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/SaveUserInfoByProjectServiceImpl.java
  18. 64 24
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java
  19. 11 11
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsInfoServiceImpl.java
  20. 6 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  21. 4 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java
  22. 86 38
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

+ 12 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -88,7 +88,7 @@ public class ContractInfoController extends BladeController {
      */
     @GetMapping("/detail2")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "详情", notes = "传入contractInfo")
+    @ApiOperation(value = "详情2", notes = "传入contractInfo")
     public R<ContractInfoVO2> detail2(ContractInfo contractInfo) {
         ContractInfoVO2 detail = contractInfoService.selectByCondition(contractInfo);
         return R.data(detail);
@@ -110,7 +110,7 @@ public class ContractInfoController extends BladeController {
      */
     @GetMapping("/list")
     @ApiOperationSupport(order = 2)
-    @ApiOperation(value = "分页", notes = "传入contractInfo")
+    @ApiOperation(value = "合同段分页", notes = "传入contractInfo")
     public R<IPage<ContractInfoVO>> list(ContractInfo contractInfo, Query query) {
         IPage<ContractInfo> pages = contractInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(contractInfo));
         return R.data(ContractInfoWrapper.build().pageVO(pages));
@@ -121,7 +121,7 @@ public class ContractInfoController extends BladeController {
      */
     @GetMapping("/page")
     @ApiOperationSupport(order = 3)
-    @ApiOperation(value = "自定义分页", notes = "传入contractInfo")
+    @ApiOperation(value = "合同段自定义分页", notes = "传入contractInfo")
     public R<IPage<ContractInfoVO>> page(ContractInfoVO contractInfo, Query query) {
         IPage<ContractInfoVO> pages = contractInfoService.selectContractInfoPage(Condition.getPage(query), contractInfo);
         return R.data(pages);
@@ -322,19 +322,17 @@ public class ContractInfoController extends BladeController {
     @Transactional(rollbackFor = Exception.class)
     public R saveUserInfoByProjectTow(@RequestBody List<SaveUserInfoByProjectDTO> list) {
         if (list.size() > 0) {
-            //判重
             list.forEach((lists) -> {
                 Long row = saveUserInfoByProjectMapper.selectCount(
                         Wrappers.<SaveUserInfoByProjectDTO>query().lambda().
                                 eq(SaveUserInfoByProjectDTO::getProjectId, lists.getProjectId()).
                                 eq(SaveUserInfoByProjectDTO::getContractId, lists.getContractId()).
-                                //eq(SaveUserInfoByProjectDTO::getRoleId, lists.getRoleId()).
-                                        eq(SaveUserInfoByProjectDTO::getUserId, lists.getUserId()));
+                                eq(SaveUserInfoByProjectDTO::getUserId, lists.getUserId()));
                 if (row > 0L) {
                     throw new ServiceException("当前用户类型已存在合同段,请重新选择项目合同段添加");
                 }
             });
-            //添加User-roleId字段
+            //添加userRoleId
             iUserClient.updateUserRoleId(list);
             boolean result = saveUserInfoByProjectService.saveBatch(list);
             if (result) {
@@ -350,20 +348,22 @@ public class ContractInfoController extends BladeController {
      */
     @PostMapping("/removeUsersByIds")
     @ApiOperationSupport(order = 14)
-    @ApiOperation(value = "逻辑删除", notes = "传入当前列表用户的记录ids")
+    @ApiOperation(value = "项目分配用户逻辑删除", notes = "传入当前列表用户的ids")
     @Transactional(rollbackFor = Exception.class)
-    public R removeUsersByIds(@ApiParam(value = "主键id集合", required = true) @RequestParam String ids) {
+    public R removeUsersByIds(@ApiParam(value = "ids", required = true) @RequestParam String ids) {
         if (StringUtils.isEmpty(ids)) {
             throw new ServiceException("请选择要删除的用户");
         }
-        if (Func.toLongList(ids).size() > 1) {//批量删除-合同段分配人员的全部删除按钮
+        if (Func.toLongList(ids).size() > 1) {
+            //全部删除
             List<Long> idsList = Func.toLongList(ids);
             return R.status(saveUserInfoByProjectService.deleteBatchByIdsList(idsList));
-        } else {//单删除
-            //删除当前用户的RoleId
+        } else {
+            //删除
             SaveUserInfoByProjectDTO saveUserInfoByProjectDTO = saveUserInfoByProjectMapper.selectById(ids);
             String userId = saveUserInfoByProjectDTO.getUserId();
             String roleId = saveUserInfoByProjectDTO.getRoleId();
+            //删除用户RoleId
             iUserClient.updateUserRoleIdTwo(userId, roleId);
             return R.status(saveUserInfoByProjectService.deleteLogic(Func.toLongList(ids)));
         }

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ProjectInfoController.java

@@ -182,8 +182,6 @@ public class ProjectInfoController extends BladeController {
 
     /**
      * 查询业务条数
-     *
-     * @return
      */
     @GetMapping("/listContractInfoCount")
     @ApiOperationSupport(order = 8)

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java

@@ -76,7 +76,6 @@ public class WbsFormElementController extends BladeController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "新增", notes = "传入wbsFormElement")
     public R save(@Valid @RequestBody WbsFormElementDTO wbsFormElement) {
-        //新增同步元素字段到实体表
         return wbsFormElementService.saveAndSyn(wbsFormElement, wbsFormElement.getInitTableName());
     }
 
@@ -122,7 +121,6 @@ public class WbsFormElementController extends BladeController {
     @ApiOperation(value = "逻辑删除", notes = "传入ids")
     public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam("ids") String ids,
                     @RequestParam("eKey") String eKey, @RequestParam("initTableName") String initTableName) {
-        //同步删除实体表元素字段
         boolean b = wbsFormElementService.deleteAndSyn(ids, eKey, initTableName);
         if (b) {
             return R.success("操作成功");

+ 2 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java

@@ -136,7 +136,6 @@ public class WbsTreeController extends BladeController {
     public R submit(@Valid @RequestBody WbsTreeDTO WbsTreeDTO) {
         if (wbsTreeService.submit(WbsTreeDTO)) {
             CacheUtil.clear(SYS_CACHE);
-            // 返回懒加载树更新节点所需字段
             Kv kv = Kv.create().set("id", String.valueOf(WbsTreeDTO.getId())).set("tenantId", WbsTreeDTO.getTenantId())
                     .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, WbsTreeDTO.getDeptCategory()));
             return R.data(kv);
@@ -152,12 +151,10 @@ public class WbsTreeController extends BladeController {
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "逻辑删除", notes = "传入节点id")
     public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) {
-        //是否存在子节点、表单
         /*List<WbsTree> wbsTreeList = wbsTreeService.selectByWbsId(id);
         if (wbsTreeList.size() > 0) {
             return R.fail("当前节点下存在子节点或表单,删除失败");
         }*/
-        //是否引用
         List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getStatus, 1)
                 .eq(WbsTreePrivate::getId, id)
@@ -192,21 +189,18 @@ public class WbsTreeController extends BladeController {
     @ApiImplicitParam(name = "id", value = "表单id", required = true)
     public R removeTableById(@RequestParam("id") String id) {
         if (StringUtils.isNotEmpty(id)) {
-            //否有元素
             List<WbsFormElementVO> wbsFormElements = wbsTreeService.selectFormElements(id);
             if (wbsFormElements.size() > 0) {
                 return R.fail("删除失败,请先移除表单中的元素");
             }
-            //是否引用
             List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                     .eq(WbsTreePrivate::getStatus, 1)
                     .eq(WbsTreePrivate::getId, id));
             if (wbsTreePrivates.size() > 0) {
                 return R.fail("该表单已被项目引用,删除失败");
             }
-            //删除表单
-            boolean restul = wbsTreeService.removeTableById(id);
-            if (restul) {
+            boolean result = wbsTreeService.removeTableById(id);
+            if (result) {
                 return R.success("删除成功");
             }
         }
@@ -254,7 +248,6 @@ public class WbsTreeController extends BladeController {
     public R updateBatchElements(@RequestBody List<WbsFormElement> wbsFormElementList, @RequestParam("initTableName") String initTableName) {
         boolean b = wbsFormElementService.updateBatchById(wbsFormElementList);
         if (b) {
-            //同步修改实体表类型字段类型
             String s = wbsFormElementService.updateAndSyn(wbsFormElementList, initTableName);
             switch (s) {
                 case "1":

+ 4 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -51,7 +51,6 @@ public class WbsTreePrivateController extends BladeController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "私有库节点逻辑删除", notes = "传入节点pKeyId")
     public R remove(@ApiParam(value = "主键id", required = true) @RequestParam String pKeyId) {
-        //是否存在子节点、表单
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pKeyId)
                 .eq(WbsTreePrivate::getStatus, 1));
@@ -63,13 +62,14 @@ public class WbsTreePrivateController extends BladeController {
         if (wbsTreePrivate1.size() > 0) {
             return R.fail("当前节点下存在子节点或表单,删除失败");
         }*/
-        //是否被合同段引用
+
         List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getStatus, 1)
                 .eq(WbsTreeContract::getId, wbsTreePrivate.getId())
                 .eq(WbsTreeContract::getProjectId, wbsTreePrivate.getProjectId())
                 .eq(WbsTreeContract::getWbsId, wbsTreePrivate.getWbsId())
         );
+
         if (wbsTreeContracts.size() > 0) {
             return R.fail("当前节点已被项目合同段引用,删除失败");
         }
@@ -89,7 +89,6 @@ public class WbsTreePrivateController extends BladeController {
     public R submit(@Valid @RequestBody WbsTreePrivate wbsTreePrivate) {
         if (wbsTreePrivateService.submit(wbsTreePrivate)) {
             CacheUtil.clear(SYS_CACHE);
-            // 返回懒加载树更新节点所需字段
             Kv kv = Kv.create().set("id", String.valueOf(wbsTreePrivate.getId()));
             return R.data(kv);
         }
@@ -119,9 +118,8 @@ public class WbsTreePrivateController extends BladeController {
     public R removeTableByCondition(@RequestParam("id") String id,
                                     @RequestParam("wbsId") String wbsId,
                                     @RequestParam("projectId") String projectId) {
-        //删除表单
-        boolean restul = wbsTreePrivateService.removeTableByCondition(id, wbsId, projectId);
-        if (restul) {
+        boolean result = wbsTreePrivateService.removeTableByCondition(id, wbsId, projectId);
+        if (result) {
             return R.success("删除成功");
         }
         return R.fail("删除失败");

+ 1 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ImageClassificationConfigMapper.java

@@ -27,18 +27,11 @@ import java.util.List;
 /**
  * 影像分类配置表 Mapper 接口
  *
- * @author BladeX
+ * @author liuyc
  * @since 2022-05-16
  */
 public interface ImageClassificationConfigMapper extends BaseMapper<ImageClassificationConfig> {
 
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param imageClassificationConfig
-	 * @return
-	 */
 	List<ImageClassificationConfigVO> selectImageClassificationConfigPage(IPage page, ImageClassificationConfigVO imageClassificationConfig);
 
 }

+ 0 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.java

@@ -37,16 +37,8 @@ public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
 
 	List<ProjectInfo> selectProjectList(@Param("projectIds") List<String> projectIds);
 
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param projectInfo
-	 * @return
-	 */
 	List<ProjectInfoVO> selectProjectInfoPage(IPage page, ProjectInfoVO projectInfo);
 
-
     void updateTemplateIdById(String projectId, String referencePrivateWbsProjectId,String type);
 
     ProjectInfo selectOneAndWbsTypeById(Long id);

+ 0 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsFormElementMapper.java

@@ -36,16 +36,8 @@ import java.util.List;
  */
 public interface WbsFormElementMapper extends BaseMapper<WbsFormElement> {
 
-    /**
-     * 自定义分页
-     *
-     * @param page
-     * @param wbsFormElement
-     * @return
-     */
     List<WbsFormElementVO> selectWbsFormElementPage(IPage page, WbsFormElementVO wbsFormElement);
 
-
     Integer createTable(@Param("sqlStr") String sqlStr, @Param("newTableName") String newTableName);
 
     int alterAddFiled(@Param("sqlStr") String sqlStr, @Param("tableName") String tableName);

+ 0 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsInfoMapper.java

@@ -32,13 +32,6 @@ import java.util.List;
  */
 public interface WbsInfoMapper extends BaseMapper<WbsInfo> {
 
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param wbsInfo
-	 * @return
-	 */
 	List<WbsInfo> selectWbsInfoPage(IPage page, WbsInfo wbsInfo);
 
     List<WbsInfo> selectAll(Integer type);

+ 0 - 29
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeMapper.java

@@ -37,58 +37,29 @@ import java.util.List;
  */
 public interface WbsTreeMapper extends BaseMapper<WbsTree> {
 
-    /**
-     * 自定义分页
-     */
     List<WbsTreeVO> selectWbsTreePage(IPage page, WbsTreeVO wbsTree);
 
-
-    /**
-     * 懒加载获取树形节点
-     */
     List<WbsTreeVO> lazyTree(@Param("wbsId") String wbsId,
                              @Param("tenantId") String tenantId,
                              @Param("parentId") Long parentId);
 
-    /**
-     * 获取树形节点
-     */
     List<WbsTreeVO> tree(@Param("wbsId") String wbsId, @Param("tenantId") String tenantId, @Param("type") String type);
 
     List<WbsTreeVO2> tree2(@Param("wbsId") String wbsId, @Param("tenantId") String tenantId, @Param("type") String type);
 
-    /**
-     * 表单查询(根据节点ID查询当前表单)
-     */
     List<WbsNodeTableVO> selectByNodeTable(@Param("id") String id);
 
 
     List<WbsNodeTableVO> selectByNodeTableByExcel(@Param("id") String id,@Param("projectid") String projectid);
 
-    /**
-     * 根据Ids查询元素
-     */
     List<String> selectByElementsTotal(@Param("ids") List<String> ids);
 
-    /**
-     * 表单删除
-     */
     Integer removeTableById(@Param("id") String id);
 
-    /**
-     * 表单元素
-     */
     List<WbsFormElementVO> selectFormElements(@Param("id") String id);
 
-
-    /**
-     * 新增表单
-     */
     Integer insertForm(WbsTree wbsTree);
 
-    /**
-     * 新增元素
-     */
     Integer addFormElement(WbsFormElement wbsFormElement);
 
     Integer updateById2(@Param("ancestors") String ancestors, @Param("id") Long id);

+ 0 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java

@@ -22,9 +22,6 @@ import java.util.List;
 public interface WbsTreePrivateMapper extends BaseMapper<WbsTreePrivate> {
     List<WbsTreePrivate> selectAll(Integer wbsType);
 
-    /**
-     * 获取树形节点
-     */
     List<WbsTreePrivateVO> tree(@Param("wbsId") String wbsId,
                                 @Param("projectId") String projectId);
 

+ 0 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IProjectInfoService.java

@@ -36,25 +36,10 @@ public interface IProjectInfoService extends BaseService<ProjectInfo> {
 
 	List<SingPfxManagementVO> singPfxManagementPage(SingPfxManagementVO vo);
 
-	/**
-	 * 客户端首页获取项目列表
-	 * @return 结果集
-	 */
 	List<ProjectInfo> selectProjectList(List<String> projectIds);
 
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param projectInfo
-	 * @return
-	 */
 	IPage<ProjectInfoVO> selectProjectInfoPage(IPage<ProjectInfoVO> page, ProjectInfoVO projectInfo);
 
-	/**
-	 * 查询业务条数
-	 * @return
-	 */
 	List<ContractlnfoCountVO> selectContractInfoCount();
 
 	ProjectInfo getOne(Long id);

+ 0 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsInfoService.java

@@ -33,13 +33,6 @@ import java.util.List;
  */
 public interface IWbsInfoService extends BaseService<WbsInfo> {
 
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param wbsInfo
-	 * @return
-	 */
 	IPage<WbsInfo> selectWbsInfoPage(IPage<WbsInfo> page, WbsInfo wbsInfo);
 
     List<WbsInfo> findByWbsType(String type);

+ 0 - 35
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeService.java

@@ -39,55 +39,20 @@ import java.util.Map;
  */
 public interface IWbsTreeService extends BaseService<WbsTree> {
 
-    /**
-     * 自定义分页
-     *
-     * @param page
-     * @param wbsTree
-     * @return
-     */
     IPage<WbsTreeVO> selectWbsTreePage(IPage<WbsTreeVO> page, WbsTreeVO wbsTree);
 
-    /**
-     * 懒加载树形结构
-     *
-     * @param tenantId
-     * @param parentId
-     * @return
-     */
     List<WbsTreeVO> lazyTree(String wbsId, String tenantId, Long parentId);
 
-    /**
-     * 树形结构
-     *
-     * @param tenantId
-     * @return
-     */
     List<WbsTreeVO2> tree(String wbsId, String tenantId, String type);
 
-    /**
-     * 提交
-     *
-     * @param dept
-     * @return
-     */
     boolean submit(WbsTree dept);
 
-    /**
-     * 表单查询(根据节点ID查询当前表单)
-     */
     List<WbsNodeTableVO> selectByNodeTable(String id);
 
     List<WbsNodeTableVO> selectByNodeTableByExcel(String id,String projectid);
 
-    /**
-     * 删除表单
-     */
     boolean removeTableById(String id);
 
-    /**
-     * 表单元素列表
-     */
     List<WbsFormElementVO> selectFormElements(String id);
 
     boolean importWbsTree(MultipartFile excelFile, WbsTree wbsTreeFu, WbsTree wbsTree1) throws IOException;

+ 5 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java

@@ -174,24 +174,24 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
         archiveTreeDTO.setIsDeleted(BladeConstant.DB_NOT_DELETED);
         archiveTreeDTO.setFullName(archiveTreeDTO.getNodeName());
         if (archiveTreeDTO.getNodeType() == 1) {
-            //如果是电子原生文件,那么默认是存储节点
+            //电子原生文件=默认存储节点
             archiveTreeDTO.setIsStorageNode(1);
         }
 
-        //新增节点默认排序
-        //获取当前同级节点List
+        //新增默认排序
+        //获取同级节点List
         if (archiveTreeDTO.getId() == null) {
             List<ArchiveTree> trees = baseMapper.selectList(Wrappers.<ArchiveTree>query().lambda()
                     .eq(ArchiveTree::getParentId, archiveTreeDTO.getParentId())
             );
-            //判空
+
             List<ArchiveTree> collect = trees.stream().filter(f -> {
                 if (f.getSort() == null) {
                     f.setSort(0);
                 }
                 return true;
             }).collect(Collectors.toList());
-            //获取最大Sort
+            //获取最大sort
             Optional<ArchiveTree> max = collect.stream().max(Comparator.comparingInt(ArchiveTree::getSort));
             Integer sort = 0;
             if (max.isPresent()) {

+ 29 - 11
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -140,7 +140,6 @@ public class ContractInfoServiceImpl
 
     @Override
     public List<WbsTreeContractVO2> treeTwo(String projectId) {
-        //查询当前项目下所有施工合同树根节点
         List<WbsTreeContractVO2> list = wbsTreeContractMapper.selectListByCondition(projectId);
         return list;
     }
@@ -173,7 +172,7 @@ public class ContractInfoServiceImpl
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean saveAndUpdateContract(ContractInfoVO contractInfo) {
-        //新增操作
+        //新增
         if (contractInfo.getId() == null) {
             List<ContractInfo> contractInfos = baseMapper.selectList(Wrappers.<ContractInfo>query().lambda()
                     .eq(ContractInfo::getContractName, contractInfo.getContractName())
@@ -185,15 +184,17 @@ public class ContractInfoServiceImpl
             if (StringUtils.isEmpty(String.valueOf(contractInfo.getContractType()))) {
                 throw new ServiceException("合同类型不能为空");
             }
-            //新增合同段
+
             boolean row = saveOrUpdate(contractInfo);
-            //新增contract_type=2监理或=3指挥部(业主)类型Wbs树
+
+            //新增contract_type =2监理 =3指挥部(业主)类型Wbs树
             if (contractInfo.getContractType().equals(2) || contractInfo.getContractType().equals(3)) {
                 List<WbsTreeContractVO3> infos = contractInfo.getIdList();
                 infos.stream().forEach(info -> {
                     List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
                             .eq(WbsTreeContract::getContractId, info.getContractId())
                     );
+
                     //初始化
                     wbsTreeContracts.stream().forEach(i -> {
                         Long id = SnowFlakeUtil.getId();
@@ -202,14 +203,15 @@ public class ContractInfoServiceImpl
                         i.setContractId(String.valueOf(contractInfo.getId()));
                         i.setContractType(contractInfo.getContractType());
                     });
-                    //新增合同段wbs树
+
                     wbsTreeContractService.saveBatch(wbsTreeContracts);
                 });
             }
+
             return submitContractRelevantInfo(row, contractInfo);
 
         } else {
-            //编辑修改操作
+            //编辑
             List<ContractInfo> contractInfos = baseMapper.selectList(Wrappers.<ContractInfo>query().lambda()
                     .eq(ContractInfo::getContractName, contractInfo.getContractName())
                     .eq(ContractInfo::getPId, contractInfo.getPId())
@@ -223,28 +225,35 @@ public class ContractInfoServiceImpl
             }
             boolean row = saveOrUpdate(contractInfo);
             if (contractInfo.getContractType().equals(2) || contractInfo.getContractType().equals(3)) {
-                List<String> idList1 = new ArrayList<>();  //当前所有入参施工合同根节点合同id
-                List<String> idList2 = new ArrayList<>();  //当前所有已引用监理或业主根节点合同引用id
+                //当前所有入参施工合同根节点合同id
+                List<String> idList1 = new ArrayList<>();
+                //当前所有已引用监理或业主根节点合同引用id
+                List<String> idList2 = new ArrayList<>();
+
                 List<WbsTreeContractVO3> list = contractInfo.getIdList();
                 if (list.size() > 0) {
                     list.stream().forEach(cId -> {
-                        //获取入参根节点id
+                        //入参根节点id
                         String contractId = cId.getContractId();
                         idList1.add(contractId);
                     });
                 }
-                //查询当前所有已引用监理或业主根节点合同引用id
+
+                //获取当前所有已引用监理或业主根节点合同引用id
                 List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
                         .eq(WbsTreeContract::getContractId, contractInfo.getId())
                         .eq(WbsTreeContract::getContractType, contractInfo.getContractType())
                         .eq(WbsTreeContract::getStatus, 1)
                         .eq(WbsTreeContract::getParentId, 0)
                 );
+
                 wbsTreeContracts.stream().forEach(id -> {
                     String contractIdRelation = id.getContractIdRelation();
                     idList2.add(String.valueOf(contractIdRelation));
                 });
+
                 List<String> result = getDiffrent(idList1, idList2);
+
                 if (idList1.size() > idList2.size()) {
                     //新增
                     result.stream().forEach(id -> {
@@ -254,16 +263,20 @@ public class ContractInfoServiceImpl
                                 .eq(WbsTreeContract::getParentId, 0)
                                 .eq(WbsTreeContract::getContractType, 1)
                         );
+
                         WbsTreeContract wbsTreeContractsIsDeleted = wbsTreeContractMapper.selectCondition(contractInfo.getId(), wbsTreeContract.getId(), id, contractInfo.getContractType());
+
                         if (wbsTreeContractsIsDeleted != null) {
                             //修改 通过当前合同id = contractInfo.getId() , 监理或业主关联的合同段id = contractIdRelation
                             wbsTreeContractMapper.updateByCondition2(contractInfo.getId(), wbsTreeContractsIsDeleted.getContractIdRelation());
+
                         } else {
                             //新增 根据施工合同根节点查询当前根节点下的施工合同wbs树+表
                             List<WbsTreeContract> wbsTreeContractsList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
                                     .eq(WbsTreeContract::getContractId, id)
                                     .eq(WbsTreeContract::getContractType, 1)
                             );
+
                             //初始化
                             wbsTreeContractsList.stream().forEach(i -> {
                                 Long id1 = SnowFlakeUtil.getId();
@@ -272,10 +285,12 @@ public class ContractInfoServiceImpl
                                 i.setContractId(String.valueOf(contractInfo.getId()));
                                 i.setContractType(contractInfo.getContractType());
                             });
+
                             wbsTreeContractService.saveBatch(wbsTreeContractsList);
                         }
                     });
                 } else {
+
                     result.stream().forEach(id -> {
                         //根据关联项目id = getContractIdRelation 删除树
                         wbsTreeContractMapper.delete(Wrappers.<WbsTreeContract>update().lambda()
@@ -287,6 +302,7 @@ public class ContractInfoServiceImpl
                     });
                 }
             }
+
             return submitContractRelevantInfo(row, contractInfo);
         }
     }
@@ -305,7 +321,8 @@ public class ContractInfoServiceImpl
                     saveUserInfoByProjectMapper.updateById(i);
                 });
             }
-            //获取位置信息初始化
+
+            //获取初始化位置信息
             String projectPlace = contractInfo.getProjectPlace();
             try {
                 Map<String, Object> addressInfo = BaiduApiUtil.geocoding(projectPlace);
@@ -329,6 +346,7 @@ public class ContractInfoServiceImpl
                 queryWrapper.eq("is_deleted", contractInfo.getIsDeleted());
                 ProjectContractArea projectContractArea1 = projectContractAreaMapper.selectOne(queryWrapper);
                 if (projectContractArea1 == null) {
+                    //初始化
                     int res = projectContractAreaMapper.insert(projectContractArea);
                     return res > 0;
                 }

+ 9 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/SaveUserInfoByProjectServiceImpl.java

@@ -57,18 +57,23 @@ public class SaveUserInfoByProjectServiceImpl
     public boolean deleteBatchByIdsList(List<Long> idsList) {
         //删除项目合同段关联用户信息
         int row = baseMapper.deleteBatchIds(idsList);
-        /*删除用户的RoleId,因当前合同段下每个用户角色只能是一种,即当前合同段下userId不一样,roleId一样的批量删除*/
+
         //获取该idsList信息
         List<SaveUserInfoByProjectDTO> list = baseMapper.selectByIds(idsList);
+
         //获取userIdList
         List<String> userIds = list.stream().map(SaveUserInfoByProjectDTO::getUserId).collect(Collectors.toList());
-        //roleIds可以看做是同一个roleId
+
+        //roleIds可以看作同一个roleId
         List<String> collect = list.stream().map(SaveUserInfoByProjectDTO::getRoleId).collect(Collectors.toList());
+
         String roleIds = "";
         for (String s : collect) {
             roleIds = s;
         }
+
         boolean b = iUserClient.updateUserRoleIdThree(userIds, roleIds);
+
         if (!b || row <= 0) {
             throw new ServiceException("操作异常,请重新尝试");
         }
@@ -96,17 +101,16 @@ public class SaveUserInfoByProjectServiceImpl
         List<SaveUserInfoByProjectDTO> list3 = list1.stream().filter(f -> f.getProjectId().equals(projectId) && f.getUserId().equals(userId)).collect(Collectors.toList());
         List<String> roleIdListCurrent = list3.stream().map(SaveUserInfoByProjectDTO::getRoleId).collect(Collectors.toList());
 
-        //需要保存的roleId
+        //保留的roleId
         List<String> saveRoleIdListReally = new ArrayList<>();
         for (String s : roleIdListAllOther) {
             for (String s1 : roleIdListCurrent) {
-                if (s1.equals(s)) { //需要保留
+                if (s1.equals(s)) {
                     saveRoleIdListReally.add(s);
                 }
             }
         }
         roleIdListAllOther.addAll(saveRoleIdListReally);
-        //去重
         List<String> resultRoleIds = roleIdListAllOther.stream().distinct().collect(Collectors.toList());
 
         //删除关系表中对应的项目信息数据

+ 64 - 24
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java

@@ -131,9 +131,6 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
         return String.valueOf(sbr);
     }
 
-    /**
-     * 判断类型
-     */
     private String judgeDataType(Integer type) {
         switch (type) {
             case 2:
@@ -246,17 +243,19 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             baseMapper.alterAddFiled(sql, tableName);
             return R.data(wbsFormElement, "操作成功");
         }
+
         return R.fail("操作失败");
+
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean deleteAndSyn(String ids, String eKey, String tableName) {
         deleteLogic(Func.toLongList(ids));
-        //删除前判断是否存在该key
+
         int row = baseMapper.judgeFiled(eKey, tableName);
         if (row > 0) {
-            //同步删除实体表字段
+
             baseMapper.deleteTableFiled(eKey, tableName);
         }
         return true;
@@ -288,6 +287,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                 e.printStackTrace();
             }
         }
+
         return "0";
     }
 
@@ -302,10 +302,10 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
         int number = 1;
         for (WbsFormElementDTO2 wbsTree : wbsTreeDTO) {
             wbsTree.setSort(number);
-            //修改sort
             baseMapper.updateSortById(wbsTree.getId(), wbsTree.getSort());
             number++;
         }
+
         return true;
     }
 
@@ -313,6 +313,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
     public WbsFormElementVO getDetailById(WbsFormElement wbsFormElement) {
         WbsFormElementVO detail = baseMapper.selectDetailById(wbsFormElement.getId());
         return detail;
+
     }
 
     @Override
@@ -340,12 +341,14 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             String eKey1 = id.getEKey();
             eKeys.add(eKey1);
         });
+
         int id;
         if (eKeys.size() == 0) {
             id = 0;
         } else {
             id = Integer.parseInt(eKeys.get(eKeys.size() - 1).split("_")[1]);
         }
+
         //新增元素
         List<WbsFormElement> listData = wbsFormElementVO2.getListData();
         for (WbsFormElement listDatum : listData) {
@@ -356,7 +359,9 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             listDatum.setELength(elementLength);
             listDatum.setEKey("key_" + id);
         }
+
         this.saveBatch(listData);
+
         //同步
         return syncDataFiled(wbsFormElementVO2.getInitTableName(), listData);
     }
@@ -364,30 +369,37 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean submitExcelRelationWbsTreeAndElement(FormElementDTO formElementDTO) {
-        //formElementDTO.getId() 当前表id
-        if (formElementDTO.getId() == null) {  //新增-新增元素表,实体表
+        //新增元素表、实体表
+        if (formElementDTO.getId() == null) {
             this.saveFormElement(formElementDTO);
-        } else {  //关联-在已有元素表中新增元素,在实体表中追加字段
+
+        } else {
+            //关联-在已有元素表中新增元素,在实体表中追加字段
             //获取当前元素表中的所有的元素信息
             List<WbsFormElement> wbsFormElements = baseMapper.selectList(Wrappers.<WbsFormElement>query().lambda()
                     .eq(WbsFormElement::getFId, formElementDTO.getId()));
             Collections.reverse(wbsFormElements);
             WbsFormElement firstWbsFormElement = wbsFormElements.stream().findFirst().orElse(wbsFormElements.get(wbsFormElements.size() - 1));
+
             //初始化eKey字段
             int keyNumber = Integer.parseInt(firstWbsFormElement.getEKey().split("_")[1]);
-            //判断
             List<WbsFormElement> newList = formElementDTO.getElementList().stream().filter(a ->
                     !wbsFormElements.stream().map(WbsFormElement::getEName).collect(Collectors.toList()).contains(a.getEName())
             ).collect(Collectors.toList());
+
             final int[] keyNumber1 = {1};
+
             //新增
             newList.stream().forEach(wbsFormElementInfo -> {
                 String key = "key_" + (keyNumber + keyNumber1[0]);
+
                 //新增元素到当前表中
                 wbsFormElementInfo.setEKey(key);
                 wbsFormElementInfo.setFId(String.valueOf(formElementDTO.getId()));
                 wbsFormElementInfo.setStatus(1);
+
                 baseMapper.insert(wbsFormElementInfo);
+
                 //追加实体表字段
                 wbsTreeMapper.alterTableFiled(formElementDTO.getInitTableName(), key,
                         getInitTableFiledType(wbsFormElementInfo.getEType()),
@@ -395,20 +407,26 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                 keyNumber1[0]++;
             });
         }
+
         WbsTree wbsTree = wbsTreeMapper.selectOne(Wrappers.<WbsTree>query().lambda()
                 .eq(WbsTree::getId, formElementDTO.getId()
                 ));
+
         //取消旧关联
         List<WbsTree> wbsTreeList = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
                 .eq(WbsTree::getParentId, wbsTree.getParentId()
                 ));
-        if (wbsTreeList.size() > 1) { //存在2张表以上时取消关联旧表
+
+        //存在2张表以上时取消关联旧表
+        if (wbsTreeList.size() > 1) {
             wbsTreeMapper.updateByParentId(wbsTree.getParentId(), formElementDTO.getId());
         }
+
         //新关联
         wbsTree.setIsLinkTable(2);
-        wbsTreeMapper.updateById(wbsTree);
-        return true;
+        int i = wbsTreeMapper.updateById(wbsTree);
+        return i > 0;
+
     }
 
     private R saveFormElement(FormElementDTO formElementDTO) {
@@ -425,10 +443,11 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                 return R.fail("操作失败,请完整填写元素名称与类型参数");
             }
         }
-        //初始化表名
+        //初始化
         Long id = SnowFlakeUtil.getId();
         String newTableName = "m_wbs_form_" + DateUtil.time() + "_" + id.toString();
         formElementDTO.setInitTableName(newTableName);
+
         //创建元素表
         boolean b1 = submit2(formElementDTO);
 
@@ -440,28 +459,34 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             wbsFormElement.setFId(String.valueOf(formElementDTO.getId()));
             wbsFormElement.setELength(Integer.valueOf(setDefaultElementLength(wbsFormElement.getEType())));
         }
-        //新增元素
+
         boolean b2 = this.saveBatch(elementList);
 
         //找到当前元素表中所有元素
         List<WbsFormElement> list = this.selectElementListByFid(String.valueOf(formElementDTO.getId()));
+
         //初始化实体表
         Boolean b3 = this.initTable(list, newTableName);
+
         if (b1 && b2 && b3) {
             return R.data(formElementDTO, "新增表单、元素、初始化实体表成功");
         } else {
             throw new ServiceException("操作失败");
         }
+
     }
 
     private static String getPinyin(String text, String separator) {
         //text 文本, separator 转换后添加的分隔符
         char[] chars = text.toCharArray();
         HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
+
         // 设置大小写
         format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
+
         // 设置声调表示方法
         format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+
         // 设置字母u表示方法
         format.setVCharType(HanyuPinyinVCharType.WITH_V);
         String[] s;
@@ -477,16 +502,22 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                         continue;
                     }
                 }
+
                 sb.append(chars[i]);
+
                 if ((i + 1 >= chars.length) || String.valueOf(chars[i + 1]).matches("[\\u4E00-\\u9FA5]+")) {
                     sb.append(separator);
                 }
             }
+
             rs = sb.substring(0, sb.length());
         } catch (BadHanyuPinyinOutputFormatCombination e) {
             e.printStackTrace();
+
         }
+
         return rs;
+
     }
 
     private boolean submit2(FormElementDTO dept) {
@@ -505,15 +536,16 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             dept.setTenantId(parent.getTenantId());
             String ancestors = parent.getAncestors() + StringPool.COMMA + dept.getParentId();
             dept.setAncestors(ancestors);
-            //设置表示该父节点下存在表单
+            //初始化否存在表单
             wbsTreeMapper.updateIsExistFormById(parent.getId());
         }
-        //设置类型默认值为 '2' 表单
+
         dept.setType(2);
         dept.setIsDeleted(BladeConstant.DB_NOT_DELETED);
         dept.setDeptCategory(1);
         dept.setStatus(1);
         dept.setIsLinkTable(2);
+
         return wbsTreeMapper.insert(dept) > 0;
 
     }
@@ -525,26 +557,34 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             String eKey = listDatum.getEKey();
             baseMapper.addTableFiled(initTableName, eKey, initTableFiledType, elementLength);
         }
+
         return true;
     }
 
     private String getInitTableFiledType(Integer type) {
         switch (type) {
             case 2:
-                return "bigint"; //整数
+                //整数
+                return "bigint";
             case 3:
-                return "decimal"; //小数
+                //小数
+                return "decimal";
             case 4:
-                return "datetime"; //日期
+                //日期
+                return "datetime";
             case 5:
-                return "decimal";  //数值
+                //数值
+                return "decimal";
             case 6:
-                return "varchar"; //签名
+                //签名
+                return "varchar";
             case 7:
-                return "varchar"; //文件
+                //文件
+                return "varchar";
             case 1:
             default:
-                return "varchar"; //字符串
+                //字符串
+                return "varchar";
         }
     }
 

+ 11 - 11
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsInfoServiceImpl.java

@@ -63,20 +63,21 @@ public class WbsInfoServiceImpl extends BaseServiceImpl<WbsInfoMapper, WbsInfo>
     public boolean submit(WbsInfoDTO wbsInfo) {
         WbsTree wbsTree1 = wbsTreeService.selectGenNodeByWbsId(wbsInfo.getId());
         if (wbsTree1 != null) {
-            //修改WbsInfo树信息
+
             baseMapper.updateById(wbsInfo);
-            //修改WbsTree表的根节点
+
             int row = wbsTreeService.updateByCondition(wbsInfo.getId(), wbsInfo.getWbsName(), wbsInfo.getStatus());
-            if (row > 0) {
-                return true;
-            }
+
+            return row > 0;
+
         } else {
-            //新增wbs树
+
             int row = baseMapper.insert(wbsInfo);
+
             if (row > 0) {
                 Long wbsId = wbsInfo.getId();
                 String nodeName = wbsInfo.getWbsName();
-                //初始化wbs树的根节点
+                //初始化
                 WbsTree wbsTree = new WbsTree();
                 wbsTree.setWbsId(String.valueOf(wbsId));
                 wbsTree.setTenantId(AuthUtil.getTenantId());
@@ -86,12 +87,11 @@ public class WbsInfoServiceImpl extends BaseServiceImpl<WbsInfoMapper, WbsInfo>
                 wbsTree.setDeptName(nodeName);
                 wbsTree.setFullName(nodeName);
                 wbsTree.setType(1);
-                boolean result2 = wbsTreeService.save(wbsTree);
-                if (result2) {
-                    return true;
-                }
+                return wbsTreeService.save(wbsTree);
+
             }
         }
+
         return false;
     }
 

+ 6 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -56,9 +56,12 @@ public class WbsTreeContractServiceImpl
         //获取当前合同段wbs所有节点+表单
         List<WbsTreeContract> list = baseMapper.findAllNodeList2(pawDTO.getProjectId(), pawDTO.getContractId(), pawDTO.getWbsId());
 
-        List<String> collect1 = new ArrayList<>(); //当前合同段所有节点+表单Id
-        List<String> collect3 = new ArrayList<>(); //当前合同段所有节点下表单Id
-        List<String> collect7 = new ArrayList<>(); //当前合同段所有节点Id
+        //当前合同段所有节点+表单Id
+        //List<String> collect1 = new ArrayList<>();
+        //当前合同段所有节点下表单Id
+        List<String> collect3 = new ArrayList<>();
+        //当前合同段所有节点Id
+        List<String> collect7 = new ArrayList<>();
 
         if (list.size() > 0) {
             //所有节点+表单Id
@@ -112,7 +115,6 @@ public class WbsTreeContractServiceImpl
 
         } else {
             //新增
-
             if (idList1.size() > collect7.size()) {
                 List<WbsTreeContract> wbsTreeContractList = new ArrayList<>();
 

+ 4 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -53,14 +53,14 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
     public boolean submit(WbsTreePrivate wbsTreePrivate) {
         if (wbsTreePrivate.getPKeyId() != null && !("").equals(wbsTreePrivate.getPKeyId())) {
             Long pKeyId = wbsTreePrivate.getPKeyId();
-            //修改
             int row = baseMapper.updateByPKeyId(pKeyId, wbsTreePrivate);
+
             if (row > 0) {
                 WbsTreePrivate wbsTreePrivate1 = baseMapper.getByPKeyId(pKeyId);
-                //同步合同段wbs库
                 wbsTreeContractMapper.updateByCondition1(wbsTreePrivate1);
                 return true;
             }
+
         } else {
             wbsTreePrivate.setIsDeleted(0);
             wbsTreePrivate.setStatus(1);
@@ -80,14 +80,14 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                     .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
                     .eq(WbsTreePrivate::getType, 1)
             );
-            //判空
+
             List<WbsTreePrivate> collect = trees.stream().filter(f -> {
                 if (f.getSort() == null) {
                     f.setSort(0);
                 }
                 return true;
             }).collect(Collectors.toList());
-            //获取最大Sort
+            //获取最大sort
             Optional<WbsTreePrivate> max = collect.stream().max(Comparator.comparingInt(WbsTreePrivate::getSort));
             Integer sort = 0;
             if (max.isPresent()) {

+ 86 - 38
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -108,7 +108,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     }
 
     private List<WbsTreeVO2> buildWbsTreeByStream(List<WbsTreeVO2> wbsTreeVO2s) {
-        //构建数据,获取根节点
+        //构建数据
         List<WbsTreeVO2> list = wbsTreeVO2s.stream().filter(f -> f.getParentId() == 0L).collect(Collectors.toList());
         //根节点分组
         Map<Long, List<WbsTreeVO2>> map = wbsTreeVO2s.stream().collect(Collectors.groupingBy(WbsTreeVO2::getParentId));
@@ -148,21 +148,21 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         }
         wbsTree.setStatus(1);
         wbsTree.setIsDeleted(BladeConstant.DB_NOT_DELETED);
-        //新增节点默认排序
+
+        //新增默认排序
         //获取当前同级节点List
         if (wbsTree.getId() == null) {
             List<WbsTree> trees = baseMapper.selectList(Wrappers.<WbsTree>query().lambda()
                     .eq(WbsTree::getParentId, wbsTree.getParentId())
                     .eq(WbsTree::getType, 1)
             );
-            //判空
             List<WbsTree> collect = trees.stream().filter(f -> {
                 if (f.getSort() == null) {
                     f.setSort(0);
                 }
                 return true;
             }).collect(Collectors.toList());
-            //获取最大Sort
+            //获取最大sort
             Optional<WbsTree> max = collect.stream().max(Comparator.comparingInt(WbsTree::getSort));
             Integer sort = 0;
             if (max.isPresent()) {
@@ -170,6 +170,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             }
             wbsTree.setSort(sort + 1);
         }
+
         return saveOrUpdate(wbsTree);
     }
 
@@ -187,18 +188,17 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             fd.setTenantId(parent.getTenantId());
             String ancestors = parent.getAncestors() + StringPool.COMMA + fd.getParentId();
             fd.setAncestors(ancestors);
-            //设置表示该父节点下存在表单
             baseMapper.updateIsExistFormById(parent.getId());
         }
-        //设置类型默认值为 '2' 表单
         fd.setType(2);
         fd.setIsDeleted(BladeConstant.DB_NOT_DELETED);
+
         return saveOrUpdate(fd);
     }
 
     public boolean submit3(WbsTree wbsTree) {
         if (wbsTree.getParentId() > 0) {
-            //设置表示该父节点下存在表单
+
             baseMapper.updateIsExistFormById(wbsTree.getParentId());
         }
         return save(wbsTree);
@@ -213,7 +213,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     public boolean importWbsTreeTableAndForm(MultipartFile excelFile, WbsTree wbsTree) {
         String canonicalPath = null;
         try {
-            //解析
+            //解析excel
             File file = WbsExcelBatchUtil.convert(excelFile);
             canonicalPath = file.getCanonicalPath();
             WbsExcelBatchUtil excelUtil = new WbsExcelBatchUtil();
@@ -222,6 +222,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             List<Map<String, String>> maps = WbsExcelBatchUtil.removeRepeatMapByKey(result, "表名");
             assert maps != null;
             List<WbsTreeBatchImportDTO> list = new ArrayList<>();
+
             //初始化
             wbsTree.setTenantId(wbsTree.getTenantId());
             wbsTree.setDeptCategory(1);
@@ -232,6 +233,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             wbsTree.setType(2);
             wbsTree.setIsDeleted(BladeConstant.DB_NOT_DELETED);
             wbsTree.setStatus(1);
+
             maps.stream().forEach(map -> {
                 String deptName = map.get("表名");
                 wbsTree.setDeptName(deptName);
@@ -240,25 +242,30 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 String initTableName = "m_wbs_form_" + DateUtil.time() + "_" + id.toString();
                 wbsTree.setInitTableName(initTableName);
                 wbsTree.setId(id);
+
                 //新增表单
                 boolean b = submit3(wbsTree);
+
                 if (b) {
                     //新增实体表
                     initTable(initTableName);
-                    //返参
+
                     WbsTreeBatchImportDTO wbsTreeBatchImportDTO = new WbsTreeBatchImportDTO();
                     wbsTreeBatchImportDTO.setId(id);
                     wbsTreeBatchImportDTO.setTableName(deptName);
                     wbsTreeBatchImportDTO.setInitTableName(initTableName);
                     list.add(wbsTreeBatchImportDTO);
+
                 }
             });
+
             //新增元素
             list.stream().forEach(i -> {
                 Long elementTableId = i.getId();
                 String tableName = i.getTableName();
                 String initTableName = i.getInitTableName();
                 final int[] keyNumb = {0};
+
                 result2.stream().forEach(map -> {
                     if (tableName.equals(map.get("表名"))) {
                         keyNumb[0]++;
@@ -272,16 +279,20 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                         wbsFormElement.setEInspectionMethod(map.get("计算公式、方法或数值"));
                         wbsFormElement.setEAllowDeviation(map.get("允许偏差范围"));
                         wbsFormElement.setRemark(map.get("备注"));
+
                         wbsFormElementService.save(wbsFormElement);
+
                         //新增实体字段
                         baseMapper.alterTableFiled(initTableName,
                                 wbsFormElement.getEKey(),
                                 getInitTableFiledType(wbsFormElement.getEType()),
                                 wbsFormElement.getELength());
                     }
+
                 });
             });
             return true;
+
         } catch (
                 IOException | ClassNotFoundException e) {
             throw new ServiceException("操作失败,请上传正确模板内容");
@@ -302,7 +313,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
 
     private Boolean initTable(String tableName) {
-        //建表
         Integer row = baseMapper.createTable(tableName);
         if (row >= 0) {
             return true;
@@ -313,20 +323,27 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     private String getInitTableFiledType(Integer type) {
         switch (type) {
             case 2:
-                return "bigint"; //整数
+                //整数
+                return "bigint";
             case 3:
-                return "decimal"; //小数
+                //小数
+                return "decimal";
             case 4:
-                return "datetime"; //日期
+                //日期
+                return "datetime";
             case 5:
-                return "decimal";  //数值
+                //数值
+                return "decimal";
             case 6:
-                return "varchar"; //签名
+                //签名
+                return "varchar";
             case 7:
-                return "varchar"; //文件
+                //文件
+                return "varchar";
             case 1:
             default:
-                return "varchar"; //字符串
+                //字符串
+                return "varchar";
         }
     }
 
@@ -396,16 +413,12 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
     @Override
     public List<WbsNodeTableVO> selectByNodeTable(String id) {
-        //查询节点下的所有表单
-        List<WbsNodeTableVO> wbsNodeTableVOS = wbsTreeMapper.selectByNodeTable(id);
-        return wbsNodeTableVOS;
+        return wbsTreeMapper.selectByNodeTable(id);
     }
 
     @Override
     public List<WbsNodeTableVO> selectByNodeTableByExcel(String id, String projectid) {
-        //查询节点下的所有表单
-        List<WbsNodeTableVO> wbsNodeTableVOS = wbsTreeMapper.selectByNodeTableByExcel(id, projectid);
-        return wbsNodeTableVOS;
+        return wbsTreeMapper.selectByNodeTableByExcel(id, projectid);
     }
 
     @Override
@@ -450,7 +463,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         WbsTree wbsTree = wbsTreeMapper.selectOne(queryWrapper);
         if (!("").equals(wbsTree) && wbsTree != null) {
             return "-1";
-
         }
         assert wbsTree != null;
         return String.valueOf(wbsTree.getId());
@@ -490,7 +502,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     }
 
     private boolean importExcel(ArrayList<Map<String, String>> result, WbsTree wbsTreeFu, WbsTree wbsTree1) {
-        //解析list-map
+        //解析
         result.stream().forEach(map -> {
             map.forEach((nodeType, nodeName) -> {
                 if (StringUtils.isNotEmpty(nodeName)) {
@@ -587,7 +599,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     //采用批量 默认排序
     private boolean importExcel2(ArrayList<Map<String, String>> result, WbsTree wbsTreeFu, WbsTree wbsTree1) {
         List<WbsTree> allNodeData = new ArrayList<>();
-        //解析list-map
+        //解析
         for (Map<String, String> map : result) {
             for (Map.Entry<String, String> maps : map.entrySet()) {
                 if (StringUtils.isNotEmpty(maps.getValue())) {
@@ -736,8 +748,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
     @Override
     public List<WbsTreeDTO2> findWbsTreeSameLevel(String parentId) {
-        List<WbsTreeDTO2> trees = baseMapper.selectWbsTreeListByParentId(parentId);
-        return trees;
+
+        return baseMapper.selectWbsTreeListByParentId(parentId);
     }
 
     @Override
@@ -766,10 +778,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
     private boolean updateData(String ancestors, Long id) {
         Integer row = baseMapper.updateById2(ancestors, id);
-        if (row > 0) {
-            return true;
-        }
-        return false;
+        return row > 0;
     }
 
 
@@ -784,6 +793,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         List<String> idList = Arrays.asList(ids);
         List<String> idList1 = idList.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());
         List<String> idList2 = new ArrayList<>();
+
         //当前公有引用
         if (pawDTO.getReferenceType().equals("public")) {
             List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
@@ -795,6 +805,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 idList2.add(String.valueOf(wbsTreePrivate.getId()));
             });
         }
+
         //私有引用
         else if (pawDTO.getReferenceType().equals("private")) {
             List<WbsTreePrivate> wbsTreePrivates2 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
@@ -806,7 +817,9 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                 idList2.add(String.valueOf(wbsTreePrivate.getId()));
             });
         }
+
         List<String> diffRent = WbsTreeContractServiceImpl.getDiffrent(idList1, idList2);
+
         //元素表同步
         if (diffRent.size() == 0) {
             if (pawDTO.getReferenceType().equals("public")) {
@@ -824,20 +837,25 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                         wbsTreeListAll.addAll(wbsTreeList);
                     });
                 }
+
                 List<Long> collect1 = wbsTreeListAll.stream().map(WbsTree::getId).collect(Collectors.toList());
                 List<String> collect2 = collect1.stream().map(String::valueOf).collect(Collectors.toList());
+
                 //获取项目私有wbs树下当前所有的元素表
                 List<WbsTreePrivate> wbsTreePrivates1 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                         .eq(WbsTreePrivate::getWbsId, pawDTO.getWbsId())
                         .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
                         .eq(WbsTreePrivate::getType, 2)
                 );
+
                 List<Long> collect3 = wbsTreePrivates1.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
                 List<String> collect4 = collect3.stream().map(String::valueOf).collect(Collectors.toList());
                 List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
+
                 if (diffRent1.size() == 0) {
                     //当wbsTreeIds == "" 时 1.在第一次新增未选择wbs树时  2.同步新增的元素表时
                     throw new ServiceException("请选择需要关联的树或未检测到所对应新增的元素表");
+
                 } else {
                     if (collect2.size() > collect4.size()) {
                         //公有同步元素表
@@ -846,38 +864,48 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                             Long snowId1 = SnowFlakeUtil.getId();
                             wbsTreePrivateMapper.insertCombination1(snowId1, wbsTree, pawDTO.getWbsType(), pawDTO.getProjectId());
                         });
+
                         return "1";
                     }
+
                     //TODO删除
+
                 }
+
             } else if (pawDTO.getReferenceType().equals("private")) {
                 //私有同步新增元素表
                 //获取所私有引用项目的新增的元素表 根据primaryKeyId获取对象信息
                 WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                         .eq(WbsTreePrivate::getPKeyId, pawDTO.getPrimaryKeyId()));
+
                 //获取所私有引用项目的wbs树的全部表单
                 List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                         .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
                         .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
                         .eq(WbsTreePrivate::getType, 2)
                 );
+
                 List<Long> collect1 = wbsTreePrivates.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
                 List<String> collect2 = collect1.stream().map(String::valueOf).collect(Collectors.toList());
+
                 //获取当前项目私有wbs树下当前所有的元素表
                 List<WbsTreePrivate> wbsTreePrivates1 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                         .eq(WbsTreePrivate::getWbsId, pawDTO.getPrimaryKeyId())
                         .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
                         .eq(WbsTreePrivate::getType, 2)
                 );
+
                 List<Long> collect3 = wbsTreePrivates1.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
                 List<String> collect4 = collect3.stream().map(String::valueOf).collect(Collectors.toList());
                 List<String> diffRent1 = WbsTreeContractServiceImpl.getDiffrent(collect2, collect4);
+
                 if (diffRent1.size() == 0) {
                     throw new ServiceException("未检测到引用的私有wbs树下有新增的元素表");
                 } else {
                     if (collect2.size() > collect4.size()) {
                         //私有同步元素表
                         List<WbsTreePrivate> lists = new ArrayList<>();
+
                         diffRent1.stream().forEach(tableId -> {
                             List<WbsTreePrivate> wbsTreePrivates3 = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                                     .eq(WbsTreePrivate::getId, tableId)
@@ -887,15 +915,19 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                             );
                             lists.addAll(wbsTreePrivates3);
                         });
+
                         lists.stream().forEach(list -> {
                             list.setPKeyId(SnowFlakeUtil.getId());
                             list.setWbsId(pawDTO.getPrimaryKeyId());
                             list.setProjectId(pawDTO.getProjectId());
                         });
+
                         wbsTreePrivateService.saveBatch(lists, 10000);
                         return "1";
                     }
+
                     //TODO删除
+
                 }
             }
         }
@@ -910,7 +942,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
                 if (pawDTO.getReferenceType().equals("public")) {
                     //引用公有
-
                     //查询所有公共节点+表 diffRent=新增的节点id
                     List<List<WbsTree>> addListData = new ArrayList<>();
 
@@ -930,7 +961,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
                 } else if (pawDTO.getReferenceType().equals("private")) {
                     //引用私有
-
                     //查询所有私有节点+表 diffRent=新增的节点id
                     List<List<WbsTreePrivate>> addListData = new ArrayList<>();
 
@@ -1103,12 +1133,14 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     @Override
     public WbsTreeAllListVO findWbsTreeList(Integer type) {
         WbsTreeAllListVO wbsTreeAllListVO = new WbsTreeAllListVO();
-        //Wbs总
+        //公有
         List<WbsInfo> wbsInfos = wbsInfoMapper.selectAll(type);
         wbsTreeAllListVO.setWbsInfos(wbsInfos);
-        //项目私有树
+
+        //私有树
         List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectAll(type);
         wbsTreeAllListVO.setWbsTreePrivates(wbsTreePrivates);
+
         return wbsTreeAllListVO;
     }
 
@@ -1118,6 +1150,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         if (formElementDTO.getElementList().size() <= 0) {
             return R.fail("操作失败,请先添加表单元素");
         }
+
         String filedName = "";
         String filedType = "";
         String filedLength = "";
@@ -1126,6 +1159,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             filedType = String.valueOf(wbsFormElement.getEType());
             filedLength = String.valueOf(wbsFormElement.getELength());
         }
+
         if (StringUtils.isEmpty(filedName) || StringUtils.isEmpty(filedType) || StringUtils.isEmpty(filedLength)) {
             return R.fail("操作失败,请完整填写元素参数");
         }
@@ -1133,15 +1167,18 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         if (deptName.length() > 100 || deptName.length() < 1) {
             throw new ServiceException("表名长度错误,输入范围1-100个字符长度");
         }
+
         //初始化表名
         //String realName = getFirstSpell(deptName);
         Long id = SnowFlakeUtil.getId();
         String newTableName = "m_wbs_form_" + DateUtil.time() + "_" + id.toString();
         formElementDTO.setInitTableName(newTableName);
+
         //创建元素表
         boolean b1 = submit2(formElementDTO);
         List<WbsFormElement> elementList = formElementDTO.getElementList();
         int i = 1;
+
         for (WbsFormElement wbsFormElement : elementList) {
             if (wbsFormElement.getEType() == 1 && (wbsFormElement.getELength() > 1000 || wbsFormElement.getELength() < 10)) {
                 throw new ServiceException("请输入正确的字符串长度,范围为10-1000");
@@ -1152,21 +1189,27 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             if (wbsFormElement.getEType() == 3 && (wbsFormElement.getELength() > 65 || wbsFormElement.getELength() < 10)) {
                 throw new ServiceException("请输入正确的小数长度,范围为10-65");
             }
+
             //当前元素表中元素对应实体表唯一key值、fId
             wbsFormElement.setEKey("key_" + i++);
             wbsFormElement.setFId(String.valueOf(formElementDTO.getId()));
         }
+
         //新增元素
         boolean b2 = wbsFormElementService.saveBatch(elementList);
+
         //找到当前元素表中所有元素
         List<WbsFormElement> list = wbsFormElementService.selectElementListByFid(String.valueOf(formElementDTO.getId()));
+
         //初始化实体表
         Boolean b3 = wbsFormElementService.initTable(list, newTableName);
+
         if (b1 && b2 && b3) {
             return R.data(formElementDTO, "新增表单、元素、初始化实体表成功");
         } else {
             throw new ServiceException("操作失败");
         }
+
     }
 
     public static String getFirstSpell(String chinese) {
@@ -1196,10 +1239,13 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         //text 文本, separator 转换后添加的分隔符
         char[] chars = text.toCharArray();
         HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
+
         // 设置大小写
         format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
+
         // 设置声调表示方法
         format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+
         // 设置字母u表示方法
         format.setVCharType(HanyuPinyinVCharType.WITH_V);
         String[] s;
@@ -1215,11 +1261,14 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                         continue;
                     }
                 }
+
                 sb.append(chars[i]);
+
                 if ((i + 1 >= chars.length) || String.valueOf(chars[i + 1]).matches("[\\u4E00-\\u9FA5]+")) {
                     sb.append(separator);
                 }
             }
+
             rs = sb.substring(0, sb.length());
         } catch (BadHanyuPinyinOutputFormatCombination e) {
             e.printStackTrace();
@@ -1228,7 +1277,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
     }
 
     public int updateByCondition(Long id, String wbsName, Integer status) {
-        int row = baseMapper.updateByCondition(id, wbsName, status);
-        return row;
+        return baseMapper.updateByCondition(id, wbsName, status);
     }
 }