66 次代碼提交 3d8b47f1b3 ... ac3bafe66d

作者 SHA1 備註 提交日期
  wangys ac3bafe66d 导出bug 5 年之前
  wangys b0282ee310 导出表格去除uid验证 5 年之前
  wangys 34d324ce7d 导出表格去除uid验证 5 年之前
  wangys 06d70980d0 部门下拉排序 5 年之前
  wangys 2ebdc5c6f6 经营数据导出excel 5 年之前
  wangys a8542c73ea 经营数据导出excel 5 年之前
  wangys 7c2bb72303 经营数据导出excel 5 年之前
  wangys df0e9f2617 新增部门类型 5 年之前
  wangys a9f16e7b13 新增部门类型 5 年之前
  wangys 53479406c3 查询数据bug 5 年之前
  wangys eb2c837c36 log输出 5 年之前
  wangys f2d225ce3a 计算求和 5 年之前
  wangys 75af3e8cbc 查询数据部门多选 5 年之前
  wangys c50cb0b3fa 查询数据状态bug 5 年之前
  wangys 9c099db772 配置文件 5 年之前
  wangys 71fe2f0933 增加经营数据状态 5 年之前
  wangys ef2611bcdc 查询多选 5 年之前
  xushengqiang 27f78564ea bug fix 5 年之前
  xushengqiang 9c0505a455 bug fix 5 年之前
  xushengqiang 0b7b73e5bc bug fix 5 年之前
  xushengqiang 48d2fccc15 bug fix 5 年之前
  xushengqiang 05d3ad00e8 bug fix 5 年之前
  xushengqiang 157b150b94 bug fix 5 年之前
  xushengqiang ee459aefc2 bug fix 5 年之前
  xushengqiang f9059f1420 bug fix 5 年之前
  xushengqiang ad949e2d58 bug fix 5 年之前
  wangys 1480439c57 bugfix 5 年之前
  wangys c3e5b63844 bugfix 5 年之前
  wangys a2e10e817f bugfix 5 年之前
  wangys 32f1d37f8b bugfix 5 年之前
  wangys 29984a1d41 Merge branches 'online' and 'test' of http://gogs.efunbox.cn:/wangys/efunbox-manage into online 5 年之前
  wangys 033a4cedd0 uid拦截 5 年之前
  wangys 4978689140 Merge branches 'online' and 'test' of http://gogs.efunbox.cn:/wangys/efunbox-manage into online 5 年之前
  wangys 67f2935227 properties 5 年之前
  wangys 6095a0ec4d bugfix 5 年之前
  wangys c9b3de2568 bugfix 5 年之前
  wangys a67552103b bugfix 5 年之前
  wangys 7a90b75f58 bugfix 5 年之前
  wangys da676a65f5 bugfix 5 年之前
  wangys 819a071948 bugfix 5 年之前
  wangys b122a4dae9 bugfix 5 年之前
  wangys 685660e4aa bugfix 5 年之前
  wangys b8b36b6a22 bugfix 5 年之前
  wangys f091de0102 bugfix 5 年之前
  wangys 52a85e6654 bugfix 5 年之前
  wangys 130da44ad7 bugfix 5 年之前
  wangys 435a8b664b bugfix 5 年之前
  wangys fd045eb8bf bugfix 5 年之前
  wangys 9febec6ef9 bugfix 5 年之前
  wangys 57034ce2dc bugfix 5 年之前
  wangys c87d663e2e bugfix 5 年之前
  wangys 8376ffd6d4 bugfix 5 年之前
  wangys 1afe03da53 bugfix 5 年之前
  wangys 31174496b3 bugfix 5 年之前
  wangys 92cb1fb547 bugfix 5 年之前
  wangys 984a88cd0d bugfix 5 年之前
  wangys 460adf85d6 bugfix 5 年之前
  wangys 48588da3f6 修改接口传参方式 5 年之前
  wangys 86ddf30475 修改接口传参方式 5 年之前
  wangys 39a4e58df9 接口开发 5 年之前
  wangys 41e12cbc74 接口开发 5 年之前
  wangys 43e8418cf3 接口开发 5 年之前
  wangys ed54127f97 打包名称 5 年之前
  wangys 426c879d16 pom依赖 5 年之前
  wangys ef704ab05c 项目结构调整 5 年之前
  wangys 8ba92d895a 第一次提交 5 年之前
共有 27 個文件被更改,包括 840 次插入167 次删除
  1. 124 0
      .idea/uiDesigner.xml
  2. 4 0
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/Department.java
  3. 4 5
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/Manage.java
  4. 3 0
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/User.java
  5. 3 3
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/enums/CompanyTypeEnum.java
  6. 1 1
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/CompanyRepository.java
  7. 3 1
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/CostTypeRepository.java
  8. 7 2
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/DepartmentRepository.java
  9. 3 1
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/ProductRepository.java
  10. 3 1
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/ProjectRepository.java
  11. 4 3
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/DepartmentService.java
  12. 4 0
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/ManageService.java
  13. 7 3
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/CompanyServiceImpl.java
  14. 14 3
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/CostTypeServiceImpl.java
  15. 17 14
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/DepartmentServiceImpl.java
  16. 520 50
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ManageServiceImpl.java
  17. 13 5
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ProductServiceImpl.java
  18. 17 5
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ProjectServiceImpl.java
  19. 22 7
      efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/vo/ManageVO.java
  20. 4 3
      efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/assist/async/AsyncOperationLogHandler.java
  21. 8 7
      efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/controller/DepartmentController.java
  22. 35 6
      efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/controller/ManageController.java
  23. 5 5
      efunbox-base/efunbox-base-web/src/main/resources/application-prd.properties
  24. 4 3
      manage-common/src/main/java/cn/efunbox/manage/common/configuration/FrontConfiguration.java
  25. 8 8
      manage-common/src/main/java/cn/efunbox/manage/common/intercepter/AdminInterceptor.java
  26. 3 31
      manage-common/src/main/java/cn/efunbox/manage/common/result/ApiCode.java
  27. 二進制
      经营数据管理平台数据统计表_2019-04-16.xls

+ 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")

+ 4 - 5
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;
@@ -13,7 +12,6 @@ import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * Manage
@@ -68,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;
@@ -113,4 +108,8 @@ public class Manage implements Serializable {
 
     @Transient
     private Object company;
+
+    @Transient
+    private Double totalAmount;
+
 }

+ 3 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/entity/User.java

@@ -34,6 +34,9 @@ public class User implements Serializable{
     @Column(name = "is_super")
     private CmsUserSuperEnum isSuper;
 
+    @Column(name = "dept_id")
+    private Long deptId;
+
     @Column(name = "gmt_created")
     private String gmtCreated;
 

+ 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;
     }
 

+ 1 - 1
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/CompanyRepository.java

@@ -8,5 +8,5 @@ import java.util.List;
 
 public interface CompanyRepository extends BasicRepository<Company> {
 
-    List<Company> findByStatusOrderBySortDesc(BaseStatusEnum status);
+    List<Company> findByStatusOrderByCodeAsc(BaseStatusEnum status);
 }

+ 3 - 1
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/CostTypeRepository.java

@@ -8,5 +8,7 @@ import java.util.List;
 
 public interface CostTypeRepository extends BasicRepository<CostType> {
 
-    List<CostType> findByStatusOrderBySortDesc(BaseStatusEnum status);
+    CostType findByName(String name);
+
+    List<CostType>  findByStatusOrderByCodeAsc(BaseStatusEnum status);
 }

+ 7 - 2
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,7 +16,10 @@ public interface DepartmentRepository extends BasicRepository<Department> {
 
     List<Department> findByStatusOrderBySortDesc(BaseStatusEnum status);
 
-    @Query(value = "select * from department where status = 0 and id != 0 order by path, sort", 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 code", nativeQuery = true)
+    List<Department> findSelect(@Param("type") Integer type);
 
+    Department findByName(String name);
+
+    List<Department> findByPathAndTypeAndStatusInOrderByCodeAsc(Long cid, DeptTypeEnum deptTypeEnum, List<BaseStatusEnum> status);
 }

+ 3 - 1
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/ProductRepository.java

@@ -9,8 +9,10 @@ import java.util.List;
 
 public interface ProductRepository extends BasicRepository<Product> {
 
-    List<Product> findByStatusOrderBySortDesc(BaseStatusEnum status);
+    List<Product> findByStatusOrderByCodeAsc(BaseStatusEnum status);
 
     Product findById(String id);
 
+    Product findByName(String name);
+
 }

+ 3 - 1
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/repository/ProjectRepository.java

@@ -10,7 +10,9 @@ import java.util.List;
 public interface ProjectRepository extends BasicRepository<Project> {
 
 
-    List<Project> findByStatusOrderBySortDesc(BaseStatusEnum status);
+    List<Project> findByStatusOrderByCodeAsc(BaseStatusEnum status);
+
+    Project findByName(String name);
 
     Project findById(String id);
 }

+ 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);
 }

+ 4 - 0
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/ManageService.java

@@ -4,10 +4,14 @@ import cn.efunbox.manage.base.entity.Manage;
 import cn.efunbox.manage.base.vo.ManageVO;
 import cn.efunbox.manage.common.result.ApiResult;
 
+import javax.servlet.http.HttpServletResponse;
+
 public interface ManageService {
 
     ApiResult list(ManageVO manageVO);
 
+    void export(ManageVO manageVO, HttpServletResponse response)  throws Exception;
+
     ApiResult save(Manage manage);
 
     ApiResult update(Manage manage);

+ 7 - 3
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/CompanyServiceImpl.java

@@ -4,12 +4,14 @@ import cn.efunbox.manage.base.entity.Company;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
 import cn.efunbox.manage.base.repository.CompanyRepository;
 import cn.efunbox.manage.base.service.CompanyService;
+import cn.efunbox.manage.common.enums.BaseOrderEnum;
+import cn.efunbox.manage.common.helper.SortHelper;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
-import com.sun.xml.internal.rngom.parse.host.Base;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Objects;
 
@@ -26,7 +28,9 @@ public class CompanyServiceImpl implements CompanyService {
 
     @Override
     public ApiResult list(Company company) {
-        List<Company> companies = companyRepository.find(company);
+        List<Company> companies = companyRepository.find(company, SortHelper.sortMap2Sort(new LinkedHashMap<String, BaseOrderEnum>(){{
+            put("code",BaseOrderEnum.ASC);
+        }}));
         if(Objects.nonNull(companies)){
             return ApiResult.ok(companies);
         }
@@ -71,6 +75,6 @@ public class CompanyServiceImpl implements CompanyService {
 
     @Override
     public ApiResult select() {
-        return ApiResult.ok(companyRepository.findByStatusOrderBySortDesc(BaseStatusEnum.NORMAL));
+        return ApiResult.ok(companyRepository.findByStatusOrderByCodeAsc(BaseStatusEnum.NORMAL));
     }
 }

+ 14 - 3
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/CostTypeServiceImpl.java

@@ -4,12 +4,14 @@ import cn.efunbox.manage.base.entity.CostType;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
 import cn.efunbox.manage.base.repository.CostTypeRepository;
 import cn.efunbox.manage.base.service.CostTypeService;
+import cn.efunbox.manage.common.enums.BaseOrderEnum;
+import cn.efunbox.manage.common.helper.SortHelper;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
-import com.sun.xml.internal.rngom.parse.host.Base;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Objects;
 
@@ -25,7 +27,9 @@ public class CostTypeServiceImpl implements CostTypeService {
 
     @Override
     public ApiResult list(CostType costType) {
-        List<CostType> costTypes = costTypeRepository.find(costType);
+        List<CostType> costTypes = costTypeRepository.find(costType, SortHelper.sortMap2Sort(new LinkedHashMap<String,BaseOrderEnum>() {{
+            put("code",BaseOrderEnum.ASC);
+        }}));
         if(Objects.nonNull(costTypes)){
             return ApiResult.ok(costTypes);
         }
@@ -37,6 +41,9 @@ public class CostTypeServiceImpl implements CostTypeService {
         if(costType == null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        if(Objects.nonNull(costTypeRepository.findByName(costType.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         costType = costTypeRepository.save(costType);
         if(Objects.nonNull(costType)){
             return ApiResult.ok(costType);
@@ -49,6 +56,10 @@ public class CostTypeServiceImpl implements CostTypeService {
         if(costType == null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        CostType oldCostType = costTypeRepository.findByName(costType.getName());
+        if(Objects.nonNull(oldCostType) && !Objects.equals(oldCostType.getId(), costType.getId())){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         costType = costTypeRepository.update(costType);
         if(Objects.nonNull(costType)){
             return ApiResult.ok(costType);
@@ -70,6 +81,6 @@ public class CostTypeServiceImpl implements CostTypeService {
 
     @Override
     public ApiResult select(CostType costType) {
-        return ApiResult.ok(costTypeRepository.findByStatusOrderBySortDesc(BaseStatusEnum.NORMAL));
+        return ApiResult.ok(costTypeRepository.findByStatusOrderByCodeAsc(BaseStatusEnum.NORMAL));
     }
 }

+ 17 - 14
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/DepartmentServiceImpl.java

@@ -2,13 +2,12 @@ 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;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
-import cn.efunbox.manage.common.utils.SnowflakeIdUtil;
-import com.sun.xml.internal.rngom.parse.host.Base;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -25,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
@@ -59,6 +58,10 @@ public class DepartmentServiceImpl implements DepartmentService {
         if(department ==null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        Department oldDepartment = departmentRepository.findByName(department.getName());
+        if(Objects.nonNull(oldDepartment) && !Objects.equals(oldDepartment.getId(), department.getId())){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         department = departmentRepository.update(department);
         if(Objects.nonNull(department)){
             return ApiResult.ok(department);
@@ -68,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());
@@ -106,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.findByPathAndStatusInOrderBySortAsc(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.findByPathAndStatusInOrderBySortAsc(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;
     }

+ 520 - 50
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ManageServiceImpl.java

@@ -1,27 +1,39 @@
 package cn.efunbox.manage.base.service.impl;
 
 import cn.efunbox.manage.base.entity.*;
-import cn.efunbox.manage.base.enums.CompanyTypeEnum;
+import cn.efunbox.manage.base.enums.BaseStatusEnum;
+import cn.efunbox.manage.base.enums.IncomeStatusEnum;
 import cn.efunbox.manage.base.enums.ManageTypeEnum;
 import cn.efunbox.manage.base.repository.*;
 import cn.efunbox.manage.base.service.ManageService;
+import cn.efunbox.manage.base.util.TimeUtil;
 import cn.efunbox.manage.base.vo.ManageVO;
+import cn.efunbox.manage.common.enums.BaseOrderEnum;
+import cn.efunbox.manage.common.helper.SortHelper;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.Mapping;
 
 import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
-import static cn.efunbox.manage.base.enums.CompanyTypeEnum.COMPANY;
-
 /**
  * ManageSreviceImpl
  * Created by wangys on 2019/03/08
@@ -49,56 +61,145 @@ public class ManageServiceImpl implements ManageService {
 
     @Override
     public ApiResult list(ManageVO manageVO) {
-        Specification querySpecifi = new Specification<Manage>() {
-            @Override
-            public Predicate toPredicate(Root<Manage> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
+        Pageable pageable = new PageRequest(manageVO.getPageNo() - 1, manageVO.getPageSize(), SortHelper.sortMap2Sort(new LinkedHashMap<String, BaseOrderEnum>(){{put("status", BaseOrderEnum.ASC);put("gmtModified", BaseOrderEnum.DESC);}}));
+//        manageVO.setStatus(BaseStatusEnum.NORMAL);
+        if(!manageVO.getIsEntry()){
+            pageable = new PageRequest(manageVO.getPageNo() - 1,manageVO.getPageSize(), SortHelper.sortMap2Sort(new LinkedHashMap<String, BaseOrderEnum>(){{put("status", BaseOrderEnum.ASC);put("happenTime", BaseOrderEnum.DESC);}}));
+            manageVO.setStatus(BaseStatusEnum.NORMAL);
+        }
+        Specification specification = (Specification<Manage>) (root, criteriaQuery, criteriaBuilder) -> {
 
-                List<Predicate> predicates = new ArrayList<>();
-                if(Objects.nonNull(manageVO.getToProjectId()) && 0 == manageVO.getToProjectId()){
-                    predicates.add(criteriaBuilder.equal(root.get("toProjectId"), manageVO.getToProjectId()));
-                }
-                if(Objects.nonNull(manageVO.getToDeptId()) && 0 == manageVO.getToDeptId()){
-                    predicates.add(criteriaBuilder.equal(root.get("toDeptId"), manageVO.getToProjectId()));
-                }
-                if(Objects.nonNull(manageVO.getProductId()) && 0 == manageVO.getProductId()){
-                    predicates.add(criteriaBuilder.equal(root.get("productId"), manageVO.getProductId()));
-                }
-                if(Objects.nonNull(manageVO.getProductId()) && 0 == manageVO.getProductId()){
-                    predicates.add(criteriaBuilder.equal(root.get("projectId"), manageVO.getProductId()));
-                }
-                if(Objects.nonNull(manageVO.getType())){
-                    predicates.add(criteriaBuilder.equal(root.get("type"), manageVO.getType()));
+            List<Predicate> predicates = new ArrayList<>();
+            if(manageVO.getToProjectId() != null && manageVO.getToProjectId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getToProjectId() != null && manageVO.getToProjectId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("toProjectId"));
+                    for (Long id : manageVO.getToProjectId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
                 }
-                if(Objects.nonNull(manageVO.getCostTypeId()) && 0 == manageVO.getCostTypeId()){
-                    predicates.add(criteriaBuilder.equal(root.get("costTypeId"), manageVO.getCostTypeId()));
+                predicates.addAll(list);
+            }
+//            if(Objects.nonNull(manageVO.getToProjectId()) && 0 != manageVO.getToProjectId()){
+//                predicates.add(criteriaBuilder.equal(root.get("toProjectId"), manageVO.getToProjectId()));
+//            }
+            if(manageVO.getToDeptId() != null && manageVO.getToDeptId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getToDeptId() != null && manageVO.getToDeptId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("toDeptId"));
+                    for (Long id : manageVO.getToDeptId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
                 }
-                if(Objects.nonNull(manageVO.getIncomeStatus())){
-                    predicates.add(criteriaBuilder.equal(root.get("incomeStatus"), manageVO.getIncomeStatus()));
+                predicates.addAll(list);
+            }
+//            if(Objects.nonNull(manageVO.getToDeptId()) && 0 != manageVO.getToDeptId()){
+//                predicates.add(criteriaBuilder.equal(root.get("toDeptId"), manageVO.getToDeptId()));
+//            }
+            if(manageVO.getProductId() != null && manageVO.getProductId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getProductId() != null && manageVO.getProductId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("productId"));
+                    for (Long id : manageVO.getProductId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
                 }
-                if(Objects.nonNull(manageVO.getStatus())){
-                    predicates.add(criteriaBuilder.equal(root.get("status"), manageVO.getStatus()));
+                predicates.addAll(list);
+            }
+//            if(Objects.nonNull(manageVO.getProductId()) && 0 != manageVO.getProductId()){
+//                predicates.add(criteriaBuilder.equal(root.get("productId"), manageVO.getProductId()));
+//            }
+            if(manageVO.getProjectId() != null && manageVO.getProjectId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getProjectId() != null && manageVO.getProjectId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("projectId"));
+                    for (Long id : manageVO.getProjectId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
                 }
-                if(Objects.nonNull(manageVO.getStartTime())){
-                    predicates.add(criteriaBuilder.greaterThanOrEqualTo(root.get("happenTime"), manageVO.getStartTime()));
+                predicates.addAll(list);
+            }
+//            if(Objects.nonNull(manageVO.getProjectId()) && 0 != manageVO.getProjectId()){
+//                predicates.add(criteriaBuilder.equal(root.get("projectId"), manageVO.getProjectId()));
+//            }
+            if(Objects.nonNull(manageVO.getType())){
+                predicates.add(criteriaBuilder.equal(root.get("type"), manageVO.getType()));
+            }
+            if(manageVO.getCostTypeId() != null && manageVO.getCostTypeId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getCostTypeId() != null && manageVO.getCostTypeId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("costTypeId"));
+                    for (Long id : manageVO.getCostTypeId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
                 }
-                if(Objects.nonNull(manageVO.getEndTime())){
-                    predicates.add(criteriaBuilder.lessThanOrEqualTo(root.get("happenTime"), manageVO.getEndTime()));
+                predicates.addAll(list);
+            }
+//                if(Objects.nonNull(manageVO.getCostTypeId()) && 0 != manageVO.getCostTypeId()){
+//                    predicates.add(criteriaBuilder.equal(root.get("costTypeId"), manageVO.getCostTypeId()));
+//                }
+            if(manageVO.getIncomeStatus() != null && manageVO.getIncomeStatus().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getIncomeStatus() != null && manageVO.getIncomeStatus().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("incomeStatus"));
+                    for (IncomeStatusEnum incomeStatus : manageVO.getIncomeStatus()) {
+                        in.value(incomeStatus);
+                    }
+                    list.add(in);
                 }
-                if(manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0){
-                    List<Predicate> list = new ArrayList<>();
-                    if (manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0) {
-                        CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("deptId"));
-                        for (Long id : manageVO.getDeptIds()) {
-                            in.value(id);
-                        }
-                        list.add(in);
+                predicates.addAll(list);
+            }
+//                if(Objects.nonNull(manageVO.getIncomeStatus())){
+//                    predicates.add(criteriaBuilder.equal(root.get("incomeStatus"), manageVO.getIncomeStatus()));
+//                }
+
+            if(Objects.nonNull(manageVO.getStatus())){
+                predicates.add(criteriaBuilder.equal(root.get("status"), manageVO.getStatus()));
+            }
+            if(Objects.nonNull(manageVO.getStartTime())){
+                predicates.add(criteriaBuilder.greaterThanOrEqualTo(root.get("happenTime"), manageVO.getStartTime()));
+            }
+            if(Objects.nonNull(manageVO.getEndTime())){
+                predicates.add(criteriaBuilder.lessThanOrEqualTo(root.get("happenTime"), manageVO.getEndTime()));
+            }
+            if(Objects.nonNull(manageVO.getMinAmount()) && manageVO.getMinAmount() > 0){
+                predicates.add(criteriaBuilder.ge(root.get("amount"), manageVO.getMinAmount()));
+            }
+            if(Objects.nonNull(manageVO.getMaxAmount()) && manageVO.getMaxAmount() > 0){
+                predicates.add(criteriaBuilder.le(root.get("amount"), manageVO.getMaxAmount()));
+            }
+            if(manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("deptId"));
+                    for (Long id : manageVO.getDeptIds()) {
+                        in.value(id);
                     }
-                    predicates.addAll(list);
+                    list.add(in);
                 }
-                return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
+                predicates.addAll(list);
             }
+            return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
         };
-        List<Manage> manages = manageRepository.findAll(querySpecifi);
+        Long count = manageRepository.count(specification);
+        if (count == 0) {
+            return ApiResult.ok(null);
+        }
+        Page<Manage> manages = manageRepository.findAll(specification, pageable);
+        List<Manage> totalManages =  manageRepository.findAll(specification);
+        BigDecimal sum = new BigDecimal("0");
+        for (Manage manage: totalManages) {
+            if (Objects.equals(manage.getType(), ManageTypeEnum.COST)){
+                sum = sum.subtract(new BigDecimal(Double.toString(manage.getAmount())));
+            }else {
+                sum = sum.add(new BigDecimal(Double.toString(manage.getAmount())));
+            }
+        }
         if(Objects.isNull(manages)){
             return ApiResult.error(ApiCode.UNKNOWN_ERROR);
 
@@ -108,7 +209,8 @@ public class ManageServiceImpl implements ManageService {
         List<Long> productIds = new ArrayList<>();
         List<Long> companyIds = new ArrayList<>();
         List<Long> costTypeIds = new ArrayList<>();
-        manages.stream().forEach(m -> {
+        for(Manage m : manages){
+            m.setTotalAmount(sum.doubleValue());
             if(Objects.nonNull(m.getDeptId())){
                 deptIds.add(m.getDeptId());
             }
@@ -150,7 +252,8 @@ public class ManageServiceImpl implements ManageService {
             if(Objects.nonNull(m.getToDeptId())){
                 deptIds.add(m.getToDeptId());
             }
-        });
+        }
+
         //部门
         List<Department> departments = departmentRepository.findByIds(deptIds);
         Map<Long, Department> departmentMap = new HashMap<>();
@@ -182,7 +285,7 @@ public class ManageServiceImpl implements ManageService {
             costTypeMap.put(costType.getId(), costType);
         });
 
-        manages.stream().forEach(m -> {
+        for(Manage m : manages){
             m.setDepartment(departmentMap.get(m.getDeptId()));
             m.setProject(projectMap.get(m.getProjectId()));
             m.setProduct(producMap.get(m.getProductId()));
@@ -207,11 +310,378 @@ public class ManageServiceImpl implements ManageService {
 //                        break;
 //                }
 //            }
-        });
+        };
         return ApiResult.ok(manages);
     }
 
     @Override
+    public void export(ManageVO manageVO, HttpServletResponse response) throws Exception {
+        if(!manageVO.getIsEntry()){
+            manageVO.setStatus(BaseStatusEnum.NORMAL);
+        }
+        Specification specification = (Specification<Manage>) (root, criteriaQuery, criteriaBuilder) -> {
+
+            List<Predicate> predicates = new ArrayList<>();
+            if(manageVO.getToProjectId() != null && manageVO.getToProjectId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getToProjectId() != null && manageVO.getToProjectId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("toProjectId"));
+                    for (Long id : manageVO.getToProjectId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(manageVO.getToDeptId() != null && manageVO.getToDeptId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getToDeptId() != null && manageVO.getToDeptId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("toDeptId"));
+                    for (Long id : manageVO.getToDeptId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(manageVO.getProductId() != null && manageVO.getProductId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getProductId() != null && manageVO.getProductId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("productId"));
+                    for (Long id : manageVO.getProductId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(manageVO.getProjectId() != null && manageVO.getProjectId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getProjectId() != null && manageVO.getProjectId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("projectId"));
+                    for (Long id : manageVO.getProjectId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(Objects.nonNull(manageVO.getType())){
+                predicates.add(criteriaBuilder.equal(root.get("type"), manageVO.getType()));
+            }
+            if(manageVO.getCostTypeId() != null && manageVO.getCostTypeId().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getCostTypeId() != null && manageVO.getCostTypeId().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("costTypeId"));
+                    for (Long id : manageVO.getCostTypeId()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(manageVO.getIncomeStatus() != null && manageVO.getIncomeStatus().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getIncomeStatus() != null && manageVO.getIncomeStatus().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("incomeStatus"));
+                    for (IncomeStatusEnum incomeStatus : manageVO.getIncomeStatus()) {
+                        in.value(incomeStatus);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            if(Objects.nonNull(manageVO.getStatus())){
+                predicates.add(criteriaBuilder.equal(root.get("status"), manageVO.getStatus()));
+            }
+            if(Objects.nonNull(manageVO.getStartTime())){
+                predicates.add(criteriaBuilder.greaterThanOrEqualTo(root.get("happenTime"), manageVO.getStartTime()));
+            }
+            if(Objects.nonNull(manageVO.getEndTime())){
+                predicates.add(criteriaBuilder.lessThanOrEqualTo(root.get("happenTime"), manageVO.getEndTime()));
+            }
+            if(Objects.nonNull(manageVO.getMinAmount()) && manageVO.getMinAmount() > 0){
+                predicates.add(criteriaBuilder.ge(root.get("amount"), manageVO.getMinAmount()));
+            }
+            if(Objects.nonNull(manageVO.getMaxAmount()) && manageVO.getMaxAmount() > 0){
+                predicates.add(criteriaBuilder.le(root.get("amount"), manageVO.getMaxAmount()));
+            }
+            if(manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0){
+                List<Predicate> list = new ArrayList<>();
+                if (manageVO.getDeptIds() != null && manageVO.getDeptIds().size() > 0) {
+                    CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("deptId"));
+                    for (Long id : manageVO.getDeptIds()) {
+                        in.value(id);
+                    }
+                    list.add(in);
+                }
+                predicates.addAll(list);
+            }
+            return criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
+        };
+        Long count = manageRepository.count(specification);
+        if (count == 0) {
+            return;
+        }
+        List<Manage> totalManages =  manageRepository.findAll(specification);
+        BigDecimal sum = new BigDecimal("0");
+        for (Manage manage: totalManages) {
+            if (Objects.equals(manage.getType(), ManageTypeEnum.COST)){
+                sum = sum.subtract(new BigDecimal(Double.toString(manage.getAmount())));
+            }else {
+                sum = sum.add(new BigDecimal(Double.toString(manage.getAmount())));
+            }
+        }
+        if(Objects.isNull(totalManages)){
+            return;
+
+        }
+        List<Long> deptIds = new ArrayList<>();
+        List<Long> projectIds = new ArrayList<>();
+        List<Long> productIds = new ArrayList<>();
+        List<Long> companyIds = new ArrayList<>();
+        List<Long> costTypeIds = new ArrayList<>();
+        for(Manage m : totalManages){
+            m.setTotalAmount(sum.doubleValue());
+            if(Objects.nonNull(m.getDeptId())){
+                deptIds.add(m.getDeptId());
+            }
+            if(Objects.nonNull(m.getProjectId())){
+                projectIds.add(m.getProjectId());
+            }
+            if(Objects.nonNull(m.getToDeptId())){
+                deptIds.add(m.getToDeptId());
+            }
+            if(Objects.nonNull(m.getProductId())){
+                productIds.add(m.getProductId());
+            }
+            if(Objects.nonNull(m.getCostTypeId())){
+                costTypeIds.add(m.getCostTypeId());
+            }
+            if(Objects.nonNull(m.getToProjectId())){
+                projectIds.add(m.getToProjectId());
+            }
+            if(Objects.nonNull(m.getToDeptId())){
+                deptIds.add(m.getToDeptId());
+            }
+        }
+
+        //部门
+        List<Department> departments = departmentRepository.findByIds(deptIds);
+        Map<Long, Department> departmentMap = new HashMap<>();
+        departments.stream().forEach(department -> {
+            departmentMap.put(department.getId(), department);
+        });
+        //项目
+        List<Project> projects = projectRepository.findByIds(projectIds);
+        Map<Long, Project> projectMap = new HashMap<>();
+        projects.stream().forEach(project -> {
+            projectMap.put(project.getId(), project);
+        });
+        //产品
+        List<Product> products = productRepository.findByIds(productIds);
+        Map<Long, Product> producMap = new HashMap<>();
+        products.stream().forEach(product -> {
+            producMap.put(product.getId(), product);
+        });
+        //支出发起人
+        List<Company> companies = companyRepository.findByIds(companyIds);
+        Map<Long, Company> companyMap = new HashMap<>();
+        companies.stream().forEach(company -> {
+            companyMap.put(company.getId(), company);
+        });
+        //成本类型
+        List<CostType> costTypes = costTypeRepository.findByIds(costTypeIds);
+        Map<Long, CostType> costTypeMap = new HashMap<>();
+        costTypes.stream().forEach(costType -> {
+            costTypeMap.put(costType.getId(), costType);
+        });
+
+        for(Manage m : totalManages){
+            m.setDepartment(departmentMap.get(m.getDeptId()));
+            m.setProject(projectMap.get(m.getProjectId()));
+            m.setProduct(producMap.get(m.getProductId()));
+            m.setToProject(projectMap.get(m.getToProjectId()));
+            if(Objects.nonNull(m.getCostTypeId())){
+                m.setCostType(costTypeMap.get(m.getCostTypeId()));
+            }
+            m.setToDepartment(departmentMap.get(m.getToDeptId()));
+        };
+
+
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet("经营数据管理平台数据统计表");
+        createTitle(workbook, sheet, manageVO.getType());
+
+        for (int i = 0; i < totalManages.size(); i++){
+            Manage m = totalManages.get(i);
+            HSSFRow r = sheet.createRow(i + 1);
+            HSSFCell cell;
+            cell = r.createCell(0);
+            cell.setCellValue(m.getHappenTime().toString());
+
+            cell = r.createCell(1);
+            cell.setCellValue(m.getAmount());
+            if(Objects.equals(manageVO.getType(), ManageTypeEnum.INCOME)){
+                cell = r.createCell(2);
+                cell.setCellValue(m.getIncomeStatus().toString());
+
+                cell = r.createCell(3);
+                if(Objects.nonNull(m.getProduct())){
+                    cell.setCellValue(m.getProduct().getName());
+                }
+
+                cell = r.createCell(4);
+                if(Objects.nonNull(m.getProject())){
+                    cell.setCellValue(m.getProject().getName());
+                }
+
+                cell = r.createCell(5);
+                if(Objects.nonNull(m.getDepartment())){
+                    cell.setCellValue(m.getDepartment().getName());
+                }
+
+                cell = r.createCell(6);
+                if(Objects.nonNull(m.getToDepartment())){
+                    cell.setCellValue(m.getToDepartment().getName());
+                }
+
+
+                cell = r.createCell(7);
+                cell.setCellValue(m.getRemark());
+
+                cell = r.createCell(8);
+                cell.setCellValue(m.getGmtModified().toString());
+
+
+            }else {
+                cell = r.createCell(2);
+                if(Objects.nonNull(m.getCostType())){
+                    cell.setCellValue(m.getCostType().getName());
+                }
+
+                cell = r.createCell(3);
+                if(Objects.nonNull(m.getDepartment())){
+                    cell.setCellValue(m.getDepartment().getName());
+                }
+
+                cell = r.createCell(4);
+                if(Objects.nonNull(m.getProject())){
+                    cell.setCellValue(m.getProject().getName());
+                }
+
+                cell = r.createCell(5);
+                if(Objects.nonNull(m.getToDepartment())){
+                    cell.setCellValue(m.getToDepartment().getName());
+                }
+
+                cell = r.createCell(6);
+                cell.setCellValue(m.getRemark());
+
+                cell = r.createCell(7);
+                cell.setCellValue(m.getGmtModified().toString());
+            }
+        }
+        //清空response
+        response.reset();
+        //设置response的Header
+        String fileName = "经营数据管理平台数据统计表_" + TimeUtil.getPreDateStr() + ".xls";
+        response.reset();
+        response.setContentType("contentType=application/vnd.ms-excel");
+        response.setHeader("Content-disposition","attachment;filename="+URLEncoder.encode(fileName,"utf-8"));
+        workbook.write(response.getOutputStream());
+        response.flushBuffer();
+    }
+
+    private void createTitle(HSSFWorkbook workbook, HSSFSheet sheet, ManageTypeEnum type) {
+        HSSFRow row0 = sheet.createRow(0);
+
+        int columnNum = 10;
+        for (int i = 0; i < columnNum; i++) {
+            sheet.setColumnWidth(i, 20 * 256);
+        }
+
+        //设置为居中
+        HSSFCellStyle style = workbook.createCellStyle();
+        HSSFFont font = workbook.createFont();
+        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        style.setFont(font);
+        HSSFCell cell;
+
+        if(Objects.equals(type, ManageTypeEnum.INCOME)){
+            cell = row0.createCell(0);
+            cell.setCellValue("发生日期");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(1);
+            cell.setCellValue("金额");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(2);
+            cell.setCellValue("收入状态");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(3);
+            cell.setCellValue("产品");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(4);
+            cell.setCellValue("归属项目");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(5);
+            cell.setCellValue("归属部门");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(6);
+            cell.setCellValue("客户");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(7);
+            cell.setCellValue("备注");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(8);
+            cell.setCellValue("录入日期");
+            cell.setCellStyle(style);
+        }else {
+            cell = row0.createCell(0);
+            cell.setCellValue("发生日期");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(1);
+            cell.setCellValue("金额");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(2);
+            cell.setCellValue("成本类型");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(3);
+            cell.setCellValue("发生部门");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(4);
+            cell.setCellValue("发生项目/人");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(5);
+            cell.setCellValue("供应商");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(6);
+            cell.setCellValue("备注");
+            cell.setCellStyle(style);
+
+            cell = row0.createCell(7);
+            cell.setCellValue("录入日期");
+            cell.setCellStyle(style);
+        }
+
+
+    }
+
+    @Override
     public ApiResult save(Manage manage) {
         if(Objects.isNull(manage)){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);

+ 13 - 5
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ProductServiceImpl.java

@@ -1,19 +1,21 @@
 package cn.efunbox.manage.base.service.impl;
 
-import cn.efunbox.manage.base.entity.Department;
 import cn.efunbox.manage.base.entity.Product;
-import cn.efunbox.manage.base.entity.Project;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
 import cn.efunbox.manage.base.repository.DepartmentRepository;
 import cn.efunbox.manage.base.repository.ProductRepository;
 import cn.efunbox.manage.base.repository.ProjectRepository;
 import cn.efunbox.manage.base.service.ProductService;
+import cn.efunbox.manage.common.enums.BaseOrderEnum;
+import cn.efunbox.manage.common.helper.SortHelper;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.*;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * ProductServiceImpl
@@ -33,7 +35,9 @@ public class ProductServiceImpl implements ProductService {
 
     @Override
     public ApiResult list(Product product) {
-        List<Product> products = productRepository.find(product);
+        List<Product> products = productRepository.find(product, SortHelper.sortMap2Sort(new LinkedHashMap<String,BaseOrderEnum>(){{
+            put("code",BaseOrderEnum.ASC);
+        }}));
         if(Objects.nonNull(products)){
             return ApiResult.ok(products);
         }
@@ -57,6 +61,10 @@ public class ProductServiceImpl implements ProductService {
         if(product ==null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        Product oldProduct = productRepository.findByName(product.getName());
+        if(Objects.nonNull(oldProduct) && !Objects.equals(oldProduct.getId(), product.getId())){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         product = productRepository.update(product);
         if(Objects.nonNull(product)){
             return ApiResult.ok(product);
@@ -78,6 +86,6 @@ public class ProductServiceImpl implements ProductService {
 
     @Override
     public ApiResult getSelect(){
-        return ApiResult.ok(productRepository.findByStatusOrderBySortDesc(BaseStatusEnum.NORMAL));
+        return ApiResult.ok(productRepository.findByStatusOrderByCodeAsc(BaseStatusEnum.NORMAL));
     }
 }

+ 17 - 5
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/service/impl/ProjectServiceImpl.java

@@ -1,17 +1,20 @@
 package cn.efunbox.manage.base.service.impl;
 
-import cn.efunbox.manage.base.entity.Department;
 import cn.efunbox.manage.base.entity.Project;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
 import cn.efunbox.manage.base.repository.DepartmentRepository;
 import cn.efunbox.manage.base.repository.ProjectRepository;
 import cn.efunbox.manage.base.service.ProjectService;
+import cn.efunbox.manage.common.enums.BaseOrderEnum;
+import cn.efunbox.manage.common.helper.SortHelper;
 import cn.efunbox.manage.common.result.ApiCode;
 import cn.efunbox.manage.common.result.ApiResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.*;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * ProjectServiceImpl
@@ -28,7 +31,9 @@ public class ProjectServiceImpl implements ProjectService {
 
     @Override
     public ApiResult list(Project project) {
-        List<Project> projects = projectRepository.find(project);
+        List<Project> projects = projectRepository.find(project, SortHelper.sortMap2Sort(new LinkedHashMap<String,BaseOrderEnum>(){{
+            put("code",BaseOrderEnum.ASC);
+        }}));
         if(Objects.nonNull(projects)){
             return ApiResult.ok(projects);
         }
@@ -37,9 +42,12 @@ public class ProjectServiceImpl implements ProjectService {
 
     @Override
     public ApiResult save(Project project) {
-        if(project ==null){
+        if(Objects.isNull(project)){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        if(Objects.nonNull(projectRepository.findByName(project.getName()))){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         project = projectRepository.save(project);
         if(Objects.nonNull(project)){
             return ApiResult.ok(project);
@@ -52,6 +60,10 @@ public class ProjectServiceImpl implements ProjectService {
         if(project ==null){
             return ApiResult.error(ApiCode.PARAMETER_ERROR);
         }
+        Project oldProject = projectRepository.findByName(project.getName());
+        if(Objects.nonNull(oldProject) && !Objects.equals(oldProject.getId(), project.getId())){
+            return ApiResult.error(ApiCode.REPETITION_ERROR);
+        }
         project = projectRepository.update(project);
         if(Objects.nonNull(project)){
             return ApiResult.ok(project);
@@ -73,7 +85,7 @@ public class ProjectServiceImpl implements ProjectService {
 
     @Override
     public ApiResult getSelect() {
-        List<Project> projects = projectRepository.findByStatusOrderBySortDesc(BaseStatusEnum.NORMAL);
+        List<Project> projects = projectRepository.findByStatusOrderByCodeAsc(BaseStatusEnum.NORMAL);
         return ApiResult.ok(projects);
     }
 

+ 22 - 7
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/vo/ManageVO.java

@@ -3,7 +3,10 @@ package cn.efunbox.manage.base.vo;
 import cn.efunbox.manage.base.enums.BaseStatusEnum;
 import cn.efunbox.manage.base.enums.IncomeStatusEnum;
 import cn.efunbox.manage.base.enums.ManageTypeEnum;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
@@ -15,29 +18,41 @@ import java.util.List;
 @Data
 public class ManageVO implements Serializable {
 
-    private Long deptId;
+    private List<Long> deptId;
 
     private String deptName;
 
-    private Long productId;
+    private List<Long> productId;
 
-    private Long projectId;
+    private List<Long> projectId;
 
-    private Long toDeptId;
+    private List<Long> toDeptId;
 
-    private Long toProjectId;
+    private List<Long> toProjectId;
 
     private ManageTypeEnum type;
 
-    private IncomeStatusEnum incomeStatus;
+    private List<IncomeStatusEnum> incomeStatus;
 
     private BaseStatusEnum status;
 
-    private Long costTypeId;
+    private List<Long> costTypeId;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date startTime;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date endTime;
 
+    private Double minAmount;
+
+    private Double maxAmount;
+
     private List<Long> deptIds;
+
+    private Boolean isEntry;
+
+    private  Integer pageNo;
+
+    private Integer pageSize;
 }

+ 4 - 3
efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/assist/async/AsyncOperationLogHandler.java

@@ -35,8 +35,8 @@ public class AsyncOperationLogHandler {
             OperationLog operationLog = new OperationLog();
             try {
                 //设置操作用户 信息
-                operationLog.setUserName(loginUser.getNickName());
-                operationLog.setUserId(loginUser.getId()+"");
+                operationLog.setUserName(loginUser.getUserName());
+                operationLog.setUserId(loginUser.getId());
                 //设置 ip
                 operationLog.setIp(IpUtils.getIp(request));
                 //设置 商户类型
@@ -48,8 +48,9 @@ public class AsyncOperationLogHandler {
             } catch (Exception e) {
                 log.error("URL : {} 记录操作日志信息失败  message :{} ", request.getRequestURI(), e);
             }
+            log.info("用户:{} 完成日志切面 url:{}",loginUser.getNickName(),request.getRequestURI());
         }
-        log.info("用户:{} 完成日志切面 url:{}",loginUser.getNickName(),request.getRequestURI());
+
     }
 
     @Async

+ 8 - 7
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;
@@ -11,25 +12,25 @@ import org.springframework.web.bind.annotation.*;
  * Created by wangys on 2019/03/07
  */
 @RestController
-    @RequestMapping("/dept")
+@RequestMapping("/dept")
 public class DepartmentController {
 
     @Autowired
     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}")

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

@@ -2,15 +2,19 @@ package cn.efunbox.manage.base.controller;
 
 import cn.efunbox.manage.base.entity.Department;
 import cn.efunbox.manage.base.entity.Manage;
+import cn.efunbox.manage.base.enums.DeptTypeEnum;
 import cn.efunbox.manage.base.service.DepartmentService;
 import cn.efunbox.manage.base.service.ManageService;
 import cn.efunbox.manage.base.vo.ManageVO;
 import cn.efunbox.manage.common.result.ApiResult;
+import org.apache.http.HttpResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * ManageController
@@ -26,17 +30,42 @@ public class ManageController {
     @Autowired
     DepartmentService departmentService;
 
-    @GetMapping
-    public ApiResult findManage(ManageVO manageVO){
-        ApiResult<List<Department>> deptResult = departmentService.getDeptChild(manageVO.getDeptId() == null ? 0l : manageVO.getDeptId());
+    @PostMapping("/search")
+    public ApiResult findManage(@RequestBody ManageVO manageVO){
         List<Long> deptIds = new ArrayList<>();
-        deptResult.getData().stream().forEach(department -> {
-            deptIds.add(department.getId());
-        });
+        if(null == manageVO.getDeptId() || manageVO.getDeptId().size() ==0){
+            ApiResult<List<Department>> deptResult = departmentService.getDeptChild(12345l, DeptTypeEnum.COMPANY);
+            deptResult.getData().stream().forEach(department -> {
+                deptIds.add(department.getId());
+            });
+        }else {
+            manageVO.getDeptId().stream().forEach(ids -> {
+                deptIds.add(ids);
+            });
+        }
+
         manageVO.setDeptIds(deptIds);
         return manageService.list(manageVO);
     }
 
+    @GetMapping("/export")
+    public void export(ManageVO manageVO, HttpServletResponse response) throws Exception{
+        List<Long> deptIds = new ArrayList<>();
+        if(null == manageVO.getDeptId() || manageVO.getDeptId().size() ==0){
+            ApiResult<List<Department>> deptResult = departmentService.getDeptChild(12345l, DeptTypeEnum.COMPANY);
+            deptResult.getData().stream().forEach(department -> {
+                deptIds.add(department.getId());
+            });
+        }else {
+            manageVO.getDeptId().stream().forEach(ids -> {
+                deptIds.add(ids);
+            });
+        }
+
+        manageVO.setDeptIds(deptIds);
+        manageService.export(manageVO, response);
+    }
+
     @PostMapping
     public ApiResult save(@RequestBody Manage manage){
         return manageService.save(manage);

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

@@ -9,9 +9,9 @@ spring.application.name=efunbox-manage-base
 ### MYSQL基本配置;
 ########################################################
 #prd
-spring.datasource.url=jdbc:mysql://rm-2ze46n5q19ykdk41k.mysql.rds.aliyuncs.com:3306/reader_base?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true
-spring.datasource.username=iaas
-spring.datasource.password=kI5R7u!$CbzrolAD
+spring.datasource.url=jdbc:mysql://rm-2ze9d5b4gpb12aty1490.mysql.rds.aliyuncs.com:3306/efunbox_manage?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true
+spring.datasource.username=efundata
+spring.datasource.password=Efunbox@201704$
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 spring.jpa.properties.hibernate.hbm2ddl.auto=update
 spring.jpa.properties.hibernate.format_sql=true
@@ -25,11 +25,11 @@ schedule.threadPoolAsyncTaskExecutor.thread.size= 16
 # prd Redis数据库索引(默认为0)
 spring.redis.database=0
 # Redis服务器地址
-spring.redis.host=r-2zef44e1d34b39f4.redis.rds.aliyuncs.com
+spring.redis.host=r-2zee62341d4d38f4909.redis.rds.aliyuncs.com
 # Redis服务器连接端口
 spring.redis.port=6379
 # Redis服务器连接密码(默认为空)
-spring.redis.password=!2Ct05VAcPC6
+spring.redis.password=Efun20170407
 
 # 连接池最大连接数(使用负值表示没有限制)
 spring.redis.pool.max-active=8

+ 4 - 3
manage-common/src/main/java/cn/efunbox/manage/common/configuration/FrontConfiguration.java

@@ -59,9 +59,10 @@ public class FrontConfiguration extends WebMvcConfigurerAdapter implements Envir
 
 		registry.addInterceptor(allowOriginInterceptor);
 		registry.addInterceptor(adminInterceptor)
-				.addPathPatterns("/cms/**")
-				.excludePathPatterns("/cms/login")
-				.excludePathPatterns("/cms/logout");
+				.addPathPatterns("/**")
+				.excludePathPatterns("/user/login")
+				.excludePathPatterns("/manage/export")
+				.excludePathPatterns("/user/logout");
 	}
 
     @Override

+ 8 - 8
manage-common/src/main/java/cn/efunbox/manage/common/intercepter/AdminInterceptor.java

@@ -33,19 +33,19 @@ public class AdminInterceptor implements HandlerInterceptor {
             return false;
         }
         ServletOutputStream out = response.getOutputStream();
-        String token = request.getHeader("token");
+        String token = request.getHeader("uid");
         if (StringUtils.isBlank(token)) {
             ApiResult invalidTokenResult = ApiResult.error(ApiCode.INVALID_TOKEN);
             out.write(JSONObject.toJSONString(invalidTokenResult).getBytes("UTF-8"));
             return false;
         }
-        String user = redisTemplate.opsForValue().get(Constants.EFUNBOX_ADMIN_TOKEN_PREFIX + token);
-        if (StringUtils.isBlank(user)) {
-            ApiResult invalidTokenResult = ApiResult.error(ApiCode.INVALID_TOKEN);
-            out.write(JSONObject.toJSONString(invalidTokenResult).getBytes("UTF-8"));
-            return false;
-        }
-        redisTemplate.expire(Constants.EFUNBOX_ADMIN_TOKEN_PREFIX + token, 30, TimeUnit.MINUTES);
+//        String user = redisTemplate.opsForValue().get(Constants.EFUNBOX_ADMIN_TOKEN_PREFIX + token);
+//        if (StringUtils.isBlank(user)) {
+//            ApiResult invalidTokenResult = ApiResult.error(ApiCode.INVALID_TOKEN);
+//            out.write(JSONObject.toJSONString(invalidTokenResult).getBytes("UTF-8"));
+//            return false;
+//        }
+//        redisTemplate.expire(Constants.EFUNBOX_ADMIN_TOKEN_PREFIX + token, 30, TimeUnit.MINUTES);
         return true;
     }
 

+ 3 - 31
manage-common/src/main/java/cn/efunbox/manage/common/result/ApiCode.java

@@ -19,7 +19,7 @@ public class ApiCode extends AbstractApiCode {
     public static final int _C_UNAUTHORIZED = 401;
     public static final ApiCode UNAUTHORIZED = new ApiCode("未认证", _C_UNAUTHORIZED);
     public static final int _C_INVALID_TOKEN = 402;
-    public static final ApiCode INVALID_TOKEN = new ApiCode("无效的Token", _C_INVALID_TOKEN);
+    public static final ApiCode INVALID_TOKEN = new ApiCode("无效的用户id", _C_INVALID_TOKEN);
     public static final int _C_ACCESS_DENIED = 403;
     public static final ApiCode ACCESS_DENIED = new ApiCode("访问被拒绝", _C_ACCESS_DENIED);
     public static final int _C_SIGNATURE_ERROR = 510;
@@ -59,36 +59,8 @@ public class ApiCode extends AbstractApiCode {
     public final static ApiCode DEVICE_ERROR = new ApiCode("没有相关deviceCode信息", _C_DEVICE_ERROR);
     public final static int _C_DATA_ERROR = 701;
     public final static ApiCode DATA_ERROR = new ApiCode("数据异常", _C_DATA_ERROR);
-
-    public final static int _C_UNIONID_ERROR = 703;
-    public final static ApiCode UNIONID_ERROR = new ApiCode(" unionId为空", _C_UNIONID_ERROR);
-
-    public final static int _C_AWARD_ERROR = 706;
-    public final static ApiCode AWARD_ERROR = new ApiCode("自己不能打赏自己", _C_AWARD_ERROR);
-
-    public final static int _C_VIDEO_ERROR = 707;
-    public final static ApiCode VIDEO_ERROR = new ApiCode("视频地址错误", _C_VIDEO_ERROR);
-
-    public final static int _C_BUY_TIME_ERROR = 708;
-    public final static ApiCode BUY_TIME_ERROR = new ApiCode("购买时长不能超过12个月", _C_BUY_TIME_ERROR);
-
-    public final static int _C_JOINED_GROUP_ERROR = 801;
-    public final static ApiCode JOINED_GROUP_ERROR = new ApiCode("你已参加过当前团购", _C_JOINED_GROUP_ERROR);
-
-    public final static int _C_GROUP_STATUS_ERROR = 802;
-    public final static ApiCode GROUP_STATUS_ERROR = new ApiCode("当前团购已关闭", _C_GROUP_STATUS_ERROR);
-
-    public final static int _C_GROUP_EXIST_ERROR = 803;
-    public final static ApiCode GROUP_EXIST_ERROR = new ApiCode("您有未完成的团正在进行中", _C_GROUP_EXIST_ERROR);
-
-    public final static int _C_GROUP_HEADCOUNT_ERROR = 804;
-    public final static ApiCode GROUP_HEADCOUNT_ERROR = new ApiCode("此团参加人数已达上限", _C_GROUP_HEADCOUNT_ERROR);
-
-    public final static int _C_GROUP_CREATE_ERROR = 805;
-    public final static ApiCode GROUP_CREATE_ERROR = new ApiCode("您已购买过当前课文", _C_GROUP_CREATE_ERROR);
-
-    public final static int _C_JOIN_SHARE_ERROR = 806;
-    public final static ApiCode JOIN_SHARE_ERROR = new ApiCode("您当前没有助力资格", _C_JOIN_SHARE_ERROR);
+    public final static int _C_REPETITION_ERROR = 703;
+    public final static ApiCode REPETITION_ERROR = new ApiCode("名称重复", _C_REPETITION_ERROR);
 
     protected ApiCode(String message, int code) {
         super(code, message);

二進制
经营数据管理平台数据统计表_2019-04-16.xls