添加 管理员与公司关联关系
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
index a3e7b84..890c38a 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
@@ -10,6 +10,7 @@
     private String email;

     private String realname;

     private String regionid;

+    private String companyId;

 

     public String getOperid() {

         return operid;

@@ -82,4 +83,12 @@
     public void setRegionid(String regionid) {

         this.regionid = regionid;

     }

+

+    public String getCompanyId() {

+        return companyId;

+    }

+

+    public void setCompanyId(String companyId) {

+        this.companyId = companyId;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
index d503ff5..d4015ad 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
@@ -16,6 +16,8 @@
     private String status;

     private String regionid;

     private String regionname;

+    private String companyid;

+    private String companyname;

     private String mobile;

     private String email;

     private String foperid;

@@ -123,4 +125,20 @@
     public void setFoperid(String foperid) {

         this.foperid = foperid;

     }

+

+    public String getCompanyid() {

+        return companyid;

+    }

+

+    public void setCompanyid(String companyid) {

+        this.companyid = companyid;

+    }

+

+    public String getCompanyname() {

+        return companyname;

+    }

+

+    public void setCompanyname(String companyname) {

+        this.companyname = companyname;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/CompanyController.java b/src/main/java/com/supwisdom/dlpay/system/controller/CompanyController.java
index 5d6c0b5..fb22901 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/CompanyController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/CompanyController.java
@@ -138,6 +138,8 @@
                 map.put("errStr", "公司名称已经存在,请修改!");

                 return map;

             }

+

+

             TCompany company = companyService.getCompanyAllStatusById(postData.getCompanyId());

             company.setCompanyName(postData.getCompanyName());

             company.setLicenseId(postData.getLicenseId());

@@ -147,8 +149,7 @@
             company.setLegalPeopleCardId(postData.getLegalPeopleCardId());

             company.setCompanyPhone(postData.getCompanyPhone());

             company.setRemarks(postData.getRemarks());

-            //修改可把注销状态变为待定 需要再次审核

-            company.setStatus("2");

+            //修改时 公司状态为原始状态 审核失败后返回原始状态

 

             //编辑时,如公司原来注册审核未通过,则审核标志依然为注册--0

             if (!company.getCheckFlag().equals("0")){

@@ -190,7 +191,7 @@
             }

             TCompany company = companyService.getCompanyAllStatusById(companyId);

             //公司删除 需进行审核

-            company.setStatus("2");

+

             company.setCheckFlag("2");//审核删除

             company.setCheckStatus("0");//待审核

             company.setCheckMessage("");//上次审核结果置为空

@@ -360,8 +361,7 @@
                 map.put("errStr", "该公司不需要审核或不存在!");

                 return map;

             }

-            //审核驳回实质 修改公司状态为待定--2,审核状态为驳回--2,审核标志为空

-            company.setStatus("2");

+            //审核驳回实质 返回公司原状态 审核状态为驳回--2,审核标志为空

             company.setCheckStatus("2");

             //如果审核标志为注册 则驳回是 标志不置空

             if (!company.getCheckFlag().equals("0")) {

@@ -399,7 +399,6 @@
                 String companyId = checkBean.getCompanyId();

                 TCompany company = companyService.getCheckCompanyById(companyId);

                 if (company != null) {

-                    company.setStatus("2");

                     company.setCheckStatus("2");

                     //如果审核标志为注册 则驳回是 标志不置空

                     if (!company.getCheckFlag().equals("0")) {

diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
index 4c2df29..a000030 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
@@ -8,13 +8,11 @@
 import com.supwisdom.dlpay.system.bean.LogBean;
 import com.supwisdom.dlpay.system.bean.OperatorBean;
 import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
+import com.supwisdom.dlpay.system.domain.TCompany;
 import com.supwisdom.dlpay.system.domain.TDictionaryId;
 import com.supwisdom.dlpay.system.domain.TRegion;
 import com.supwisdom.dlpay.system.page.Pagination;
-import com.supwisdom.dlpay.system.service.ManagerService;
-import com.supwisdom.dlpay.system.service.OperatorService;
-import com.supwisdom.dlpay.system.service.RoleService;
-import com.supwisdom.dlpay.system.service.SystemService;
+import com.supwisdom.dlpay.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
@@ -38,6 +36,8 @@
     private OperatorService operatorService;
     @Autowired
     private RoleService roleService;
+    @Autowired
+    private CompanyService companyService;
 
     @GetMapping("/index")
     //@PreAuthorize("hasPermission('/operator/index','')")
@@ -339,6 +339,11 @@
                 regions = systemService.getRegionListById(operUser.getRegionid());
                 map.put("regions", regions);
             }
+
+            List<TCompany> companys = null;
+            companys = companyService.getValidCompanyList();
+            map.put("companys", companys);
+
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -381,6 +386,7 @@
             operator.setRealname(postData.getRealname());
             operator.setFoperid(operUser.getOperid());
             operator.setRegionid(postData.getRegionid());
+            operator.setCompanyId(postData.getCompanyId());
 
             managerService.saveOperator(operator);
 
@@ -423,6 +429,7 @@
             operator.setRealname(postData.getRealname());
             operator.setFoperid(operUser.getOperid());
             operator.setRegionid(postData.getRegionid());
+            operator.setCompanyId(postData.getCompanyId());
 
             TOperRole operRole = managerService.getTOperRoleByOperid(postData.getOperid());
             operRole.setRoleId(postData.getRoleid());
diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/CompanyDao.java b/src/main/java/com/supwisdom/dlpay/system/dao/CompanyDao.java
index b4217f5..419f52b 100644
--- a/src/main/java/com/supwisdom/dlpay/system/dao/CompanyDao.java
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/CompanyDao.java
@@ -27,4 +27,6 @@
     public Pagination getCheckCompanyList(String companyName,int pageNo,int pageSize);

 

     public TCompany getCheckCompanyById(String companyId);

+

+    public List<TCompany> getValidCompanyList();

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/impl/CompanyDaoImpl.java b/src/main/java/com/supwisdom/dlpay/system/dao/impl/CompanyDaoImpl.java
index 4bb78c4..4196ef8 100644
--- a/src/main/java/com/supwisdom/dlpay/system/dao/impl/CompanyDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/impl/CompanyDaoImpl.java
@@ -203,7 +203,7 @@
         String sql = " select a.companyid,a.companyname,a.licenseid,a.companyaddress,a.legalpeople,a.legalpeoplecardtype," +

                 " a.legalpeoplecardid,a.companyphone,a.status,a.remarks,a.checkstatus,a.checkmessage,a.checkoperid," +

                 " case when a.checkflag='0' then '注册' when a.checkflag='1' then '修改' when a.checkflag='2' then '删除' else '无' end checkflag " +

-                " from tb_company a where a.status='2' and a.checkstatus='0' ";

+                " from tb_company a where a.checkstatus='0' ";

         if (!StringUtil.isEmpty(companyName)){

             sql += " and a.companyName like :companyName ";

         }

@@ -228,7 +228,7 @@
     }

 

     private int getCheckCompanyListCount(String companyName){

-        String sql = "select count(*) from TB_Company a where a.status='2' and a.checkstatus='0' ";

+        String sql = "select count(*) from TB_Company a where a.checkstatus='0' ";

         if (!StringUtil.isEmpty(companyName)){

             sql += " and companyName like :companyName ";

         }

@@ -247,7 +247,7 @@
     @Transactional

     @Override

     public TCompany getCheckCompanyById(String companyId) {

-        String sql = "select a from TCompany a where a.companyId=:companyId and a.status='2' and a.checkStatus='0' ";

+        String sql = "select a from TCompany a where a.companyId=:companyId and a.checkStatus='0' ";

         TypedQuery<TCompany> query = entityManager.createQuery(sql, TCompany.class);

         query.setParameter("companyId", companyId);

         List<TCompany> list = query.getResultList();

@@ -256,4 +256,16 @@
         }

         return null;

     }

+

+    @Transactional

+    @Override

+    public List<TCompany> getValidCompanyList() {

+        String sql = " select a from TCompany a where a.status='1' and a.checkStatus <> '0' ";

+        TypedQuery<TCompany> query = entityManager.createQuery(sql, TCompany.class);

+        List<TCompany> list = query.getResultList();

+        if (list!=null && list.size()>0){

+            return list;

+        }

+        return null;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java b/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
index dfff005..31b5177 100644
--- a/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
@@ -27,11 +27,12 @@
     public Pagination getOperatorList(String operid, String realname, int pageNo, int pageSize) {

         String sql = "select a.operid,a.opername,a.opercode,case when a.opertype='P' then '超级管理员' when a.opertype='S' then '系统管理员' " +

                 " when a.opertype='H' then '区域管理员' when a.opertype='L' then '楼栋管理员' else a.opertype end opertype," +

-                "a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname " +

+                "a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname,a.companyId,e.companyName " +

                 " from Tb_Operator a " +

                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

+                " left join tb_company e on a.companyid = e.companyid " +

                 " where 1>0  ";

         if (!StringUtil.isEmpty(operid)){

             sql += " and a.operid = :operid ";

@@ -70,6 +71,7 @@
                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

+                " left join tb_company e on a.companyid = e.companyid " +

                 "where 1>0 ";

 

         if (!StringUtil.isEmpty(operid)){

@@ -100,11 +102,13 @@
     @Override

     public Pagination getOperOperatorList(String operatorOperid, String operid, String realname, int pageNo, int pageSize) {

         String sql = "select a.operid,a.opername,a.opercode,case when a.opertype='P' then '超级管理员' when a.opertype='S' then '系统管理员' " +

-                " when a.opertype='H' then '区域管理员' when a.opertype='L' then '楼栋管理员' else a.opertype end opertype,a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname " +

+                " when a.opertype='H' then '区域管理员' when a.opertype='L' then '楼栋管理员' else a.opertype end opertype,a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname, " +

+                " a.companyid,e.companyName "+

                 " from Tb_Operator a " +

                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

+                " left join tb_company e on a.companyid = e.companyid " +

                 " where 1>0 and   a.foperid=:operatorOperid ";

         if (!StringUtil.isEmpty(operid)){

             sql += " and a.operid = :operid ";

@@ -142,6 +146,7 @@
                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

+                " left join tb_company e on a.companyid = e.companyid " +

                 "where   a.foperid=:operatorOperid ";

 

         if (!StringUtil.isEmpty(operid)){

diff --git a/src/main/java/com/supwisdom/dlpay/system/service/CompanyService.java b/src/main/java/com/supwisdom/dlpay/system/service/CompanyService.java
index e8f07fc..c9c90ba 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/CompanyService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/CompanyService.java
@@ -49,4 +49,8 @@
     //根据公司id获取需审核的公司

     @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})

     public TCompany getCheckCompanyById(String companyId);

+

+    //获取所有不需要审核且有效的公司

+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})

+    public List<TCompany> getValidCompanyList();

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/CompanyServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/CompanyServiceImpl.java
index 408229a..109de81 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/CompanyServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/CompanyServiceImpl.java
@@ -65,4 +65,9 @@
     public TCompany getCheckCompanyById(String companyId) {

         return companyDao.getCheckCompanyById(companyId);

     }

+

+    @Override

+    public List<TCompany> getValidCompanyList() {

+        return companyDao.getValidCompanyList();

+    }

 }

diff --git a/src/main/resources/templates/system/company.html b/src/main/resources/templates/system/company.html
index 0a58e85..3c55712 100644
--- a/src/main/resources/templates/system/company.html
+++ b/src/main/resources/templates/system/company.html
@@ -64,9 +64,12 @@
                             label="状态"
                             width="90">
                         <template scope="scope">
-                            <el-tag :type="scope.row.status === '有效' ? 'success' : 'danger'" close-transition>
+                            <el-tag type="success" v-if="scope.row.status=='有效'">{{scope.row.status}}</el-tag>
+                            <el-tag type="warning" v-if="scope.row.status=='待定'">{{scope.row.status}}</el-tag>
+                            <el-tag type="danger" v-if="scope.row.status=='注销'">{{scope.row.status}}</el-tag>
+                            <!--<el-tag :type="scope.row.status === '有效' ? 'success' : 'danger'" close-transition>
                                 {{scope.row.status}}
-                            </el-tag>
+                            </el-tag>-->
                         </template>
                     </el-table-column>
                     <el-table-column
diff --git a/src/main/resources/templates/system/companyCheck.html b/src/main/resources/templates/system/companyCheck.html
index fd37a37..b09ebd8 100644
--- a/src/main/resources/templates/system/companyCheck.html
+++ b/src/main/resources/templates/system/companyCheck.html
@@ -100,6 +100,7 @@
                             label="操作"
                             width="130">
                         <template scope="scope">
+                            <button type="button" class="btn btn-info btn-xs" title="查看详情" @click="details(scope.row.companyId)" >查看详情</button>
                             <button type="button" class="btn btn-success btn-xs" title="审核通过" @click="checkPass(scope.row.companyId)" >审核通过</button>
                             <button type="button" class="btn btn-danger btn-xs" title="审核驳回" @click="checkFail(scope.row.companyId)" >审核驳回</button>
                         </template>
diff --git a/src/main/resources/templates/system/operator.html b/src/main/resources/templates/system/operator.html
index 13ff459..7de43bd 100644
--- a/src/main/resources/templates/system/operator.html
+++ b/src/main/resources/templates/system/operator.html
@@ -106,6 +106,11 @@
                             width="180">
                     </el-table-column>
                     <el-table-column
+                            prop="companyname"
+                            label="所属公司"
+                            width="180">
+                    </el-table-column>
+                    <el-table-column
                             prop="email"
                             label="邮箱"
                             width="180">
@@ -120,8 +125,8 @@
                             label="操作"
                             width="179">
                         <template scope="scope">
-                            <button type="button" class="btn btn-info btn-xs" title="编辑操作员" @click="editOperator(scope.row.operid)">编辑</button>
-                            <button type="button" class="btn btn-success btn-xs" title="重置密码" @click="resetPwd(scope.row.operid)">重置</button>
+                            <button type="button" class="btn btn-info btn-xs" title="编辑操作员" @click="editOperator(scope.row.operid)" v-if="scope.row.opertype!='系统管理员'">编辑</button>
+                            <button type="button" class="btn btn-success btn-xs" title="重置密码" @click="resetPwd(scope.row.operid)" v-if="scope.row.opertype!='系统管理员'" >重置</button>
                             <button type="button" class="btn btn-danger btn-xs" title="删除操作员" @click="delOperator(scope.row.operid)" v-if="scope.row.opertype!='系统管理员' && scope.row.opertype!='超级管理员' && scope.row.status=='有效'">删除</button>
                             <button type="button" class="btn btn-info btn-xs" title="分配楼栋"
                                     @click="allotBuilding(scope.row.operid,scope.row.opername)" v-if="scope.row.opertype=='楼栋管理员'">分配楼栋
@@ -246,6 +251,21 @@
                         </el-col>
                     </el-form-item>
 
+                    <el-form-item label="所属公司:" prop="companyId">
+                        <el-col :span="18">
+                            <el-select v-model="operatorDiaForm.companyId" style="width: 187px;"
+                                       filterable
+                                       placeholder="请选择">
+                                <el-option
+                                        v-for="companyId in companys"
+                                        :key="companyId.value"
+                                        :label="companyId.label"
+                                        :value="companyId.value">
+                                </el-option>
+                            </el-select>
+                        </el-col>
+                    </el-form-item>
+
                 </el-form>
                 <div slot="footer" class="dialog-footer">
                     <el-button @click="resetForm('operatorDiaForm') ">取 消</el-button>
@@ -336,6 +356,7 @@
             dialogFormVisible: false,
             regions:[],
             opertypes:[],
+            companys:[],
             operatorDiaForm:{
                 operid:'',
                 opercode:'',
@@ -345,7 +366,8 @@
                 regionid:'',
                 mobile:'',
                 email:'',
-                realname:''
+                realname:'',
+                companyId:''
             },
             buildingTitle:'',
             dlgAllotBuildingVisible:false,
@@ -387,7 +409,10 @@
                 ],
                 email:[
                     {validator: oper_validateEmail, trigger: 'blur'}
-                ]
+                ],
+                companyId: [
+                    {required: true, message: '请选择所属公司', trigger: 'blur'}
+                ],
 
             },
             operatortitile:'添加操作员(默认密码为123456)',
@@ -594,6 +619,7 @@
                     _self.operatorDiaForm.email = ret.operator.email;
                     _self.operatorDiaForm.realname = ret.operator.realname;
                     _self.operatorDiaForm.regionid = ret.operator.regionid;
+                    _self.operatorDiaForm.companyId = ret.operator.companyId;
                     if (ret.operator.opertype == 'H') {
                         _self.regionDis = false;
                     }
@@ -618,6 +644,19 @@
                     });
                 }
                 _self.regions = regionlist;
+
+
+                var companylist = [];
+                var companys = ret.companys;
+                console.log(companys);
+                for (var k=0;k<companys.length;k++){
+                    companylist.push({
+                        value:companys[k]["companyId"],
+                        label:companys[k]["companyName"]
+                    });
+                }
+                console.log(companylist);
+                _self.companys = companylist;
             }
         })
     }