فهرست منبع

新增部门类型

wangys 5 سال پیش
والد
کامیت
a9f16e7b13

+ 124 - 0
.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 4 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/Department.java

@@ -1,6 +1,7 @@
 package cn.efunbox.manage.base.entity;
 
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import lombok.Data;
 import lombok.ToString;
 import org.hibernate.annotations.DynamicInsert;
@@ -38,6 +39,9 @@ public class Department implements Serializable {
     private Long path;
 
     @Enumerated(EnumType.ORDINAL)
+    private DeptTypeEnum type;
+
+    @Enumerated(EnumType.ORDINAL)
     private BaseStatusEnum status;
 
     @Column(name = "sort")

+ 1 - 6
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/Manage.java

@@ -1,7 +1,6 @@
 package cn.efunbox.manage.base.entity;
 
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
-import cn.efunbox.manage.base.enums.CompanyTypeEnum;
 import cn.efunbox.manage.base.enums.IncomeStatusEnum;
 import cn.efunbox.manage.base.enums.ManageTypeEnum;
 import lombok.Data;
@@ -11,10 +10,8 @@ import org.hibernate.annotations.DynamicUpdate;
 
 import javax.persistence.*;
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * Manage
@@ -69,9 +66,6 @@ public class Manage implements Serializable {
 
     @Column(name = "cost_type_id")
     private Long costTypeId;
-//
-//    @Enumerated(EnumType.ORDINAL)
-//    private CompanyTypeEnum companyType;
 
     @Column(name = "remark")
     private String remark;
@@ -117,4 +111,5 @@ public class Manage implements Serializable {
 
     @Transient
     private Double totalAmount;
+
 }

+ 3 - 3
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/enums/CompanyTypeEnum.java

@@ -1,10 +1,10 @@
 package cn.efunbox.manage.base.enums;
 
-public enum CompanyTypeEnum {
+public enum DeptTypeEnum {
 
-    COMPANY("外部"),DEPARTMENT("部门");
+    COMPANY("内部"),OTHERS("第三方公司"),PARTNER("合作伙伴");
     String name;
-    CompanyTypeEnum(String name) {
+    DeptTypeEnum(String name) {
         this.name = name;
     }
 

+ 5 - 3
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/DepartmentRepository.java

@@ -2,8 +2,10 @@ package cn.efunbox.manage.base.repository;
 
 import cn.efunbox.manage.base.entity.Department;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import cn.efunbox.manage.common.data.BasicRepository;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
 
@@ -14,10 +16,10 @@ public interface DepartmentRepository extends BasicRepository<Department> {
 
     List<Department> findByStatusOrderBySortDesc(BaseStatusEnum status);
 
-    @Query(value = "select * from department where status = 0 and id not in ('12345','123456','1234567', '12345678') order by path, code", nativeQuery = true)
-    List<Department> findSelect();
+    @Query(value = "select * from department where status = 0 and type = :type and id not in ('12345','123456','1234567', '12345678') order by path, code", nativeQuery = true)
+    List<Department> findSelect(@Param("type") Integer type);
 
     Department findByName(String name);
 
-    List<Department> findByPathAndStatusInOrderByCodeAsc(Long cid, List<BaseStatusEnum> status);
+    List<Department> findByPathAndTypeAndStatusInOrderByCodeAsc(Long cid, DeptTypeEnum deptTypeEnum, List<BaseStatusEnum> status);
 }

+ 4 - 3
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/DepartmentService.java

@@ -1,11 +1,12 @@
 package cn.efunbox.manage.base.service;
 
 import cn.efunbox.manage.base.entity.Department;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import cn.efunbox.manage.common.result.ApiResult;
 
 public interface DepartmentService {
 
-    ApiResult getDeptTree(Long deptId);
+    ApiResult getDeptTree(Long deptId, DeptTypeEnum deptTypeEnum);
 
     ApiResult save(Department department);
 
@@ -13,9 +14,9 @@ public interface DepartmentService {
 
     ApiResult update(Department department);
 
-    ApiResult getDeptChild(Long deptId);
+    ApiResult getDeptChild(Long deptId, DeptTypeEnum deptTypeEnum);
 
     ApiResult getDeptById(Long deptId);
 
-    ApiResult select();
+    ApiResult select(DeptTypeEnum deptTypeEnum);
 }

+ 13 - 12
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/DepartmentServiceImpl.java

@@ -2,6 +2,7 @@ package cn.efunbox.manage.base.service.impl;
 
 import cn.efunbox.manage.base.entity.Department;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import cn.efunbox.manage.base.repository.DepartmentRepository;
 import cn.efunbox.manage.base.service.DepartmentService;
 import cn.efunbox.manage.base.vo.DeptTreeVO;
@@ -23,12 +24,12 @@ public class DepartmentServiceImpl implements DepartmentService {
     DepartmentRepository departmentRepository;
 
     @Override
-    public ApiResult getDeptTree(Long deptId) {
+    public ApiResult getDeptTree(Long deptId, DeptTypeEnum deptTypeEnum) {
         return ApiResult.ok(recursiveTree(deptId,new ArrayList<BaseStatusEnum>(){{
             add(BaseStatusEnum.NORMAL);
             add(BaseStatusEnum.DEL);
             add(BaseStatusEnum.DISABLE);
-        }}));
+        }}, deptTypeEnum));
     }
 
     @Override
@@ -70,13 +71,13 @@ public class DepartmentServiceImpl implements DepartmentService {
 
 
     @Override
-    public ApiResult getDeptChild(Long deptId) {
+    public ApiResult getDeptChild(Long deptId, DeptTypeEnum deptTypeEnum) {
         List<Department> departments = new ArrayList<>();
         departments = deptChild(deptId,departments,new ArrayList<BaseStatusEnum>(){{
             add(BaseStatusEnum.NORMAL);
             add(BaseStatusEnum.DEL);
             add(BaseStatusEnum.DISABLE);
-        }});
+        }},deptTypeEnum);
         List<Long> deptIds = new ArrayList<>();
         departments.stream().forEach(department -> {
             deptIds.add(department.getPath());
@@ -108,28 +109,28 @@ public class DepartmentServiceImpl implements DepartmentService {
     }
 
     @Override
-    public ApiResult select() {
-        return ApiResult.ok(departmentRepository.findSelect());
+    public ApiResult select(DeptTypeEnum type) {
+        return ApiResult.ok(departmentRepository.findSelect(type.ordinal()));
     }
 
-    private DeptTreeVO recursiveTree(Long cid, List<BaseStatusEnum> status) {
+    private DeptTreeVO recursiveTree(Long cid, List<BaseStatusEnum> status, DeptTypeEnum deptTypeEnum) {
         Department department = departmentRepository.find(cid);
         DeptTreeVO node = new DeptTreeVO();
         node.setLabel(department.getName());
         node.setId(department.getId());
-        List<Department> childTreeNodes = departmentRepository.findByPathAndStatusInOrderByCodeAsc(cid, status);
+        List<Department> childTreeNodes = departmentRepository.findByPathAndTypeAndStatusInOrderByCodeAsc(cid, deptTypeEnum, status);
         for(Department child : childTreeNodes){
-            DeptTreeVO n = recursiveTree(child.getId(), status); //递归
+            DeptTreeVO n = recursiveTree(child.getId(), status, deptTypeEnum); //递归
             node.getChildren().add(n);
         }
         return node;
     }
 
-    private List<Department> deptChild(Long cid, List<Department> departments, List<BaseStatusEnum> status) {
-        List<Department> childTreeNodes = departmentRepository.findByPathAndStatusInOrderByCodeAsc(cid, status);
+    private List<Department> deptChild(Long cid, List<Department> departments, List<BaseStatusEnum> status, DeptTypeEnum deptTypeEnum) {
+        List<Department> childTreeNodes = departmentRepository.findByPathAndTypeAndStatusInOrderByCodeAsc(cid, deptTypeEnum, status);
         departments.addAll(childTreeNodes);
         for(Department child : childTreeNodes){
-            deptChild(child.getId(), departments, status); //递归
+            deptChild(child.getId(), departments, status, deptTypeEnum); //递归
         }
         return departments;
     }

+ 7 - 6
efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/controller/DepartmentController.java

@@ -1,6 +1,7 @@
 package cn.efunbox.manage.base.controller;
 
 import cn.efunbox.manage.base.entity.Department;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import cn.efunbox.manage.base.service.DepartmentService;
 import cn.efunbox.manage.common.result.ApiResult;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,18 +19,18 @@ public class DepartmentController {
     DepartmentService departmentService;
 
     @GetMapping("/tree")
-    public ApiResult tree(Long deptId){
-        return departmentService.getDeptTree(deptId);
+    public ApiResult tree(Long deptId, DeptTypeEnum type){
+        return departmentService.getDeptTree(deptId, type);
     }
 
     @GetMapping("/child")
-    public ApiResult child(Long deptId){
-        return departmentService.getDeptChild(deptId);
+    public ApiResult child(Long deptId, DeptTypeEnum type){
+        return departmentService.getDeptChild(deptId, type);
     }
 
     @GetMapping("/select")
-    public ApiResult select(){
-        return departmentService.select();
+    public ApiResult select(DeptTypeEnum type){
+        return departmentService.select(type);
     }
 
     @GetMapping("/{id}")

+ 1 - 1
efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/controller/ManageController.java

@@ -31,7 +31,7 @@ public class ManageController {
     public ApiResult findManage(@RequestBody ManageVO manageVO){
         List<Long> deptIds = new ArrayList<>();
         if(null == manageVO.getDeptId() || manageVO.getDeptId().size() ==0){
-            ApiResult<List<Department>> deptResult = departmentService.getDeptChild(12345l);
+            ApiResult<List<Department>> deptResult = departmentService.getDeptChild(12345l, DeptTypeEnum.COMPANY);
             deptResult.getData().stream().forEach(department -> {
                 deptIds.add(department.getId());
             });

+ 1 - 1
efunbox-base/efunbox-base-web/src/main/resources/application.properties

@@ -4,6 +4,6 @@ server.port=8059
 #spring.view.prefix=/templates/
 #spring.view.suffix=.jsp
 # 默认激活哪一个环境的配置文件,时也可以在运行动态指定:java -jar myapp.jar --spring.profiles.active=prd
-spring.profiles.active=dev
+spring.profiles.active=prd
 spring.http.multipart.maxFileSize = 10Mb
 spring.http.multipart.maxRequestSize=100Mb