Ver código fonte

后台管理员 加 公司 景区显示

lfj 3 anos atrás
pai
commit
fb6c832246

+ 35 - 10
fjs-scenic-common/src/main/java/com/fjs/scenic/utils/Cons.java

@@ -1,8 +1,14 @@
 package com.fjs.scenic.utils;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 /**
  * This class is used for ...
  * 常量
+ *
  * @author lfj
  * @version 1.0
  * @CreateDate ${date} ${time}
@@ -15,12 +21,12 @@ public class Cons {
     /**
      * session的描述
      */
-    public static final String SESSION_INFO = "wsessionInfo" ;
+    public static final String SESSION_INFO = "wsessionInfo";
 
     /**
      * 管理账号状态
      */
-    public interface MANAGE_STATUS{
+    public interface MANAGE_STATUS {
         /**
          * 正常使用中
          */
@@ -35,7 +41,7 @@ public class Cons {
     /**
      * 普通用户账号状态
      */
-    public interface USER_STATUS{
+    public interface USER_STATUS {
         /**
          * 正常使用中
          */
@@ -50,7 +56,7 @@ public class Cons {
     /**
      * 景区级别
      */
-    public interface SCENIC_GRADE{
+    public interface SCENIC_GRADE {
         /**
          * 3A景区
          */
@@ -65,7 +71,7 @@ public class Cons {
         public static final Byte LEVEL5 = 5;
 
     }
-    
+
     /**
      * token名称
      */
@@ -125,8 +131,10 @@ public class Cons {
          */
         public static final String REFUND_ERROR = "9";
     }
-    
-    /**异常订单状态*/
+
+    /**
+     * 异常订单状态
+     */
     public interface ERROR_ORDER_TYPE {
         /**
          * 出票失败
@@ -142,7 +150,9 @@ public class Cons {
         public static final String PAY_ERROR = "3";
     }
 
-    /**梵净山决策系统权限*/
+    /**
+     * 梵净山决策系统权限
+     */
     public interface DECISION_PERMISSIONS {
         /**
          * 总统计
@@ -182,7 +192,9 @@ public class Cons {
         public static final String WESTSLIVE = "westslive";
     }
 
-    /**梵净山门票暂停、恢复售票*/
+    /**
+     * 梵净山门票暂停、恢复售票
+     */
     public interface SaleTicket_Type {
         /**
          * 暂停售票
@@ -195,7 +207,9 @@ public class Cons {
     }
 
 
-    /**日志类型*/
+    /**
+     * 日志类型
+     */
     public interface LOGS_TYPE {
         /**
          * 系统一般日志
@@ -206,4 +220,15 @@ public class Cons {
          */
         public static final Byte ERROR = 2;
     }
+
+    /**
+     * 公司列表 必须跟前端必须一一对应
+     */
+    public static final List<String> COMPANYS = new ArrayList<>(Arrays.asList("巴拉胡景区管理公司", "芭拉胡公司", "爱莉丝公司", "阿蓬江旅行社公司"));
+
+    /**
+     * 景区列表 必须跟前端必须一一对应
+     */
+    public static final List<String> SCENICS = new ArrayList<>(Arrays.asList("大峡谷景区", "水车坪景区", "濯水景区", "小南海", "十三寨", "水师码头",
+            "神龟峡景区", "官村", "爱莉丝", "阿蓬江旅行社公司"));
 }

+ 23 - 0
fjs-scenic-entity/src/main/java/com/fjs/scenic/dto/ManageListDto.java

@@ -0,0 +1,23 @@
+package com.fjs.scenic.dto;
+
+import com.fjs.scenic.entity.system.Manage;
+import lombok.Data;
+
+/**
+ * @program: fjs-parent
+ * @description: 后台管理员维护页面的list
+ * @author: lfj
+ * @since: 2021-09-28 11:06
+ **/
+
+@Data
+public class ManageListDto extends Manage {
+    /**
+     * 公司
+     */
+    private String company;
+    /**
+     * 景区
+     */
+    private String scenic;
+}

+ 1 - 6
fjs-scenic-manager/src/main/java/com/fjs/scenic/controller/system/ManageController.java

@@ -106,12 +106,7 @@ public class ManageController extends BaseController<Manage> {
 
     @PostMapping("/page1")
     public ReturnResult page1(Manage record, int currentPage, int pageSize) {
-        currentPage = (currentPage == 0) ? 1 : currentPage;
-        pageSize = (pageSize == 0) ? 1 : pageSize;
-        PageHelper.startPage(currentPage, pageSize);
-        List<Manage> manages = manageService.page1(record);
-        PageInfo<Manage> pageInfo = new PageInfo<>(manages);
-        return ReturnResult.ok(pageInfo);
+        return manageService.selfPage(record,currentPage,pageSize);
     }
 
     /**

+ 8 - 8
fjs-scenic-manager/src/main/resources/application.properties

@@ -29,14 +29,14 @@ mybatis.configuration.map-underscore-to-camel-case=true
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.time-zone=GMT+8
 logging.level.com.fjs.scenic.mapper=debug
-spring.datasource.tomcat.max-idle=10
-spring.datasource.tomcat.max-wait=10000
-spring.datasource.tomcat.min-idle=5
-spring.datasource.tomcat.initial-size=5
-spring.datasource.tomcat.validation-query=SELECT 1
-spring.datasource.tomcat.test-on-borrow=false
-spring.datasource.tomcat.test-while-idle=true
-spring.datasource.tomcat.time-between-eviction-runs-millis=18800
+spring.datasource.hikari.maximum-pool-size=60
+spring.datasource.hikari.connection-timeout=60000
+spring.datasource.hikari.idle-timeout=60000
+spring.datasource.hikari.validation-timeout=3000
+spring.datasource.hikari.max-lifetime=60000
+spring.datasource.hikari.login-timeout=5
+spring.datasource.hikari.minimum-idle=10
+
 #FTP
 FTP_ADDRESS=null
 FTP_PORT=0

+ 9 - 5
fjs-scenic-manager/src/main/resources/templates/system/manage.html

@@ -49,6 +49,10 @@
                         </el-table-column>
                         <el-table-column min-width="150px" label="电话" prop="phone">
                         </el-table-column>
+                        <el-table-column min-width="150px" label="公司" prop="company">
+                        </el-table-column>
+                        <el-table-column min-width="150px" label="景区" prop="scenic">
+                        </el-table-column>
                         <el-table-column min-width="150px" label="状态">
                             <template slot-scope="scope">
                                 {{scope.row.status|getEnumVal(MANAGE_STATUS)}}
@@ -189,18 +193,18 @@
                             value: 1,
                             label: '芭拉胡公司',
                             children: [
-                                { value: 0, label: '水师码头' },
-                                { value: 1, label: '神龟峡景区' }]
+                                { value: 5, label: '水师码头' },
+                                { value: 6, label: '神龟峡景区' }]
                         }, {
                             value: 2,
                             label: '爱莉丝公司',
                             children: [
-                                { value: 0, label: '官村' },
-                                { value: 1, label: '爱莉丝' }]
+                                { value: 7, label: '官村' },
+                                { value: 8, label: '爱莉丝' }]
                         }, {
                             value: 3,
                             label: '阿蓬江旅行社公司',
-                            children: [{ value: 0, label: '阿蓬江旅行社公司' }]
+                            children: [{ value: 9, label: '阿蓬江旅行社公司' }]
                         }],
                     con: { currentPage: 1, pageSize: 10, total: 0 },//查询条件
                     tableData: [],

+ 1 - 1
fjs-scenic-service/src/main/java/com/fjs/scenic/service/system/ManageService.java

@@ -21,7 +21,7 @@ public interface ManageService extends BaseService<Manage> {
 
     List<Manage> selectRepet(Manage manage);
 
-    List<Manage> page1(Manage record);
+    ReturnResult selfPage(Manage record, int currentPage, int pageSize);
 
     Manage selectLDJCManage();
 

+ 56 - 12
fjs-scenic-service/src/main/java/com/fjs/scenic/service/system/impl/ManageServiceImpl.java

@@ -1,12 +1,20 @@
 package com.fjs.scenic.service.system.impl;
 
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 //import com.fjs.scenic.utils.UserUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fjs.scenic.dto.ManageListDto;
+import com.fjs.scenic.entity.system.TypeAuthority;
 import com.fjs.scenic.entity.user.UserStatistical;
 import com.fjs.scenic.mapper.user.UserStatisticalMapper;
+import com.fjs.scenic.service.system.TypeAuthorityService;
 import com.fjs.scenic.utils.Md5Utils;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,6 +43,9 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
     private ManageRoleMapper manageRoleMapper;
     @Autowired
     private UserStatisticalMapper userStatisticalMapper;
+    @Autowired
+    private TypeAuthorityService typeAuthorityService;
+
     /**
      * 添加管理员
      *
@@ -115,8 +126,39 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
     }
 
     @Override
-    public List<Manage> page1(Manage record) {
-        return manageMapper.selectAll1(record);
+    public ReturnResult selfPage(Manage record, int currentPage, int pageSize) {
+        currentPage = (currentPage == 0) ? 1 : currentPage;
+        pageSize = (pageSize == 0) ? 10 : pageSize;
+        PageHelper.startPage(currentPage, pageSize);
+        List<Manage> manages = manageMapper.selectAll1(record);
+        PageInfo<Manage> pageInfo = new PageInfo<>(manages);
+        if (pageInfo.getSize() == 0) {
+            return ReturnResult.ok(pageInfo);
+        }
+        List<ManageListDto> manageListDtos = new ArrayList<>();
+        for (Manage m : pageInfo.getList()) {
+            ManageListDto manageListDto = new ManageListDto();
+            BeanUtils.copyProperties(m, manageListDto);
+            List<TypeAuthority> typeAuthorities = typeAuthorityService.list(new LambdaQueryWrapper<TypeAuthority>().eq(TypeAuthority::getManager, m.getId()));
+            if (!typeAuthorities.isEmpty()) {
+                String company = typeAuthorities.stream()
+                        .collect(Collectors.groupingBy(TypeAuthority::getCompany))
+                        .keySet().stream().map(Cons.COMPANYS::get)
+                        .collect(Collectors.joining(","));
+                String scenic = typeAuthorities.stream()
+                        .map(typeAuthority -> Cons.SCENICS.get(typeAuthority.getScenic()))
+                        .collect(Collectors.joining(","));
+                manageListDto.setCompany(company);
+                manageListDto.setScenic(scenic);
+            }
+            manageListDtos.add(manageListDto);
+        }
+
+        PageInfo<ManageListDto> newPageInfo = new PageInfo<>(manageListDtos);
+        newPageInfo.setPageNum(newPageInfo.getPageNum());
+        newPageInfo.setPageSize(newPageInfo.getSize());
+        newPageInfo.setSize(newPageInfo.getSize());
+        return ReturnResult.ok(newPageInfo);
     }
 
     /**
@@ -147,8 +189,9 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
 
     /**
      * 验证密码
+     *
      * @param account
-     * @param oldPWD 要验证的密码
+     * @param oldPWD  要验证的密码
      * @return
      */
     @Override
@@ -161,8 +204,9 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
 
     /**
      * 修改密码
+     *
      * @param account
-     * @param newPWD 新密码
+     * @param newPWD  新密码
      * @return
      */
     @Override
@@ -178,7 +222,7 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
         String[] pids = manage.getPermissions().split(",");
         manage.setPassword(Md5Utils.MD5(manage.getPassword()));
         int add = manageMapper.add(manage);
-        if(add>0){
+        if (add > 0) {
             Integer id = manageMapper.queryByPhone(manage.getPhone());
             for (String permissonId : pids) {
                 UserStatistical us = new UserStatistical();
@@ -202,9 +246,9 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
             userStatisticalMapper.insertSelective(us);
         }
         int update = manageMapper.update(manage);
-        if(null != manage.getPassword()){
-            if(update >0){
-                return manageMapper.updatePwd(id,Md5Utils.MD5(manage.getPassword()));
+        if (null != manage.getPassword()) {
+            if (update > 0) {
+                return manageMapper.updatePwd(id, Md5Utils.MD5(manage.getPassword()));
             }
         }
         return 0;
@@ -232,12 +276,12 @@ public class ManageServiceImpl extends BaseServiceImpl<Manage> implements Manage
 
     @Override
     public int updateStatus1(Integer id, String status) {
-        return manageMapper.updateStatus(id,status);
+        return manageMapper.updateStatus(id, status);
     }
 
     @Override
     public Manage getManeger(String account, String password) {
-        return manageMapper.getManeger(account,password);
+        return manageMapper.getManeger(account, password);
     }
 
     @Override