소스 검색

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

Lijy 2 년 전
부모
커밋
29d66cdccb

+ 81 - 25
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -372,10 +372,11 @@ public class WeiXinCorpController {
                         SysRole defaultRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", companyId).eq("is_default", 1));
                         //通过通讯录secret获取到员工姓名
                         String remoteCorpConcactAccessToken = getRemoteCorpConcactAccessToken(wxCorpInfo);
+                        String curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
                         org.json.JSONArray departmentArray = jsonObject.getJSONArray("department");
                         Integer curUserWXDeptid = departmentArray.getInt(departmentArray.length() - 1);
-                        JSONObject userObj = remoteGetUserDetail(remoteCorpConcactAccessToken, corpWxUserId, curUserWXDeptid);
-                        if (userObj.getInteger("errcode") == 0) {
+                        JSONObject userObj = remoteGetUserDetail(remoteCorpConcactAccessToken, corpWxUserId, curUserWXDeptid, curCorpAccessToken);
+                        if (userObj != null) {
                             //成功获取到通讯录的个人详情
                             Long id = SnowFlake.nextId();
                             JSONArray department = userObj.getJSONArray("department");
@@ -412,22 +413,23 @@ public class WeiXinCorpController {
                     //只有授权通讯录同步的,才有机会更新部门或者上级
                     if (!StringUtils.isEmpty(wxCorpInfo.getContactSecret())) {
                         String remoteCorpConcactAccessToken = getRemoteCorpConcactAccessToken(wxCorpInfo);
+                        String curCorpAccessToken = getCorpAccessToken(wxCorpInfo);
                         Integer curUserWXDeptid = 0;
                         if (jsonObject.has("Department")) {
-                            Object departmentJ = jsonObject.get("Department");
-                            if (departmentJ instanceof String || departmentJ instanceof Integer) {
-                                curUserWXDeptid = jsonObject.getInt("Department");
-                            } else if (departmentJ instanceof org.json.JSONArray) {
-                                org.json.JSONArray departmentArray = jsonObject.getJSONArray("Department");
-                                curUserWXDeptid = getMaxDeptIdFromArray(departmentArray);
+                            String department = jsonObject.getString("Department");
+                            if (department.contains(",")) {
+                                String[] split = department.split(",");
+                                curUserWXDeptid = getMaxDeptIdFromArray(split);
+                            } else {
+                                curUserWXDeptid = Integer.valueOf(department);
                             }
                         } else {
                             //取主部门
                             curUserWXDeptid = jsonObject.getInt("MainDepartment");
                         }
 
-                        JSONObject userObj = remoteGetUserDetail(remoteCorpConcactAccessToken, corpWxUserId, curUserWXDeptid);
-                        if (userObj.getInteger("errcode") == 0) {
+                        JSONObject userObj = remoteGetUserDetail(remoteCorpConcactAccessToken, corpWxUserId, curUserWXDeptid, curCorpAccessToken);
+                        if (userObj != null) {
                             //成功获取到通讯录的个人详情
                             JSONArray department = userObj.getJSONArray("department");
                             curUserWXDeptid = getMaxDeptIdFromArray(department);
@@ -493,7 +495,18 @@ public class WeiXinCorpController {
         }
         return "success";
     }
-
+    private Integer getMaxDeptIdFromArray(String[] arr) {
+        int deptId=0;
+        for (int i=0;i<arr.length; i++) {
+            if (!StringUtils.isEmpty(arr[i])) {
+                int curDeptId = Integer.parseInt(arr[i]);
+                if (deptId < curDeptId) {
+                    deptId = curDeptId;
+                }
+            }
+        }
+        return deptId;
+    }
     private Integer getMaxDeptIdFromArray(JSONArray department) {
         int deptId=0;
         for (int i=0;i<department.size(); i++) {
@@ -1373,6 +1386,11 @@ public class WeiXinCorpController {
                     oldUser.setName(user.getName());
                     userMapper.updateById(oldUser);
                 }
+//                //判断部门是否要更新
+//                if (oldUser.getDepartmentId() != 0) {
+//                    oldUser.setDepartmentId(0);
+//                    userMapper.updateById(oldUser);
+//                }
             }
         }
 
@@ -1500,12 +1518,23 @@ public class WeiXinCorpController {
                         //姓名也不存在,则插入新记录
                         userMapper.insert(user);
                     }
-                } else if (oldUser.getRoleName().equals("超级管理员") && !oldUser.getName().equals(user.getName())){
-                    //姓名不一致,需要更新
-                    System.out.println("===更新超管姓名==="+user.getName());
-                    user.setId(oldUser.getId());
-                    oldUser.setName(user.getName());
-                    userMapper.updateById(oldUser);
+                } else {
+                    boolean shouldUpdate = false;
+                    if (oldUser.getRoleName().equals("超级管理员") && !oldUser.getName().equals(user.getName())) {
+                        //姓名不一致,需要更新
+                        System.out.println("===更新超管姓名==="+user.getName());
+                        user.setId(oldUser.getId());
+                        oldUser.setName(user.getName());
+                        shouldUpdate = true;
+                    }
+                    if (!oldUser.getDepartmentId().equals(user.getDepartmentId())) {
+                        oldUser.setDepartmentId(user.getDepartmentId());
+                        shouldUpdate = true;
+                    }
+                    if (shouldUpdate) {
+                        userMapper.updateById(oldUser);
+                    }
+
                 }
             }
         }
@@ -1815,14 +1844,41 @@ public class WeiXinCorpController {
         return obj;
     }
 
-    private JSONObject remoteGetUserDetail(String accessToken, String userId, Integer deptId) {
-        String url = TRANSMIT_SERVER_GET_USERDETAIL.replace("ACCESS_TOKEN", accessToken).replace("USERID", userId)
-                        .replace("DEPTID", deptId+"");
-        System.out.println("请求URL="+url);
-        String result = restTemplate.getForObject(url, String.class);
-        System.out.println("远程人员详情:"+result);
-        JSONObject obj = JSONObject.parseObject(JSONObject.parseObject(result).getString("data"));
-        return obj;
+    private JSONObject remoteGetUserDetail(String accessToken, String userId, Integer deptId, String curCorpAccessToken) {
+//        String url = TRANSMIT_SERVER_GET_USERDETAIL.replace("ACCESS_TOKEN", accessToken).replace("USERID", userId)
+//                        .replace("DEPTID", deptId+"");
+//        System.out.println("请求URL="+url);
+//        String result = restTemplate.getForObject(url, String.class);
+//        System.out.println("远程人员详情:"+result);
+//        JSONObject obj = JSONObject.parseObject(JSONObject.parseObject(result).getString("data"));
+//        return obj;
+        JSONArray remoteDeptUserList = remoteGetDeptUserDetail(accessToken, deptId);
+        //做id转化
+        List<String> userIds = new ArrayList<>();
+        for (int i=0;i<remoteDeptUserList.size(); i++) {
+            userIds.add(remoteDeptUserList.getJSONObject(i).getString("userid"));
+        }
+        try {
+            JSONArray array = convertUserIdToOpenUserId(curCorpAccessToken, userIds);
+            for (int i=0;i<array.size(); i++) {
+                JSONObject jsonObject = array.getJSONObject(i);
+                String userid = jsonObject.getString("userid");
+                String openUserid = jsonObject.getString("open_userid");
+                if (openUserid.equals(userId)) {
+                    //匹配到了
+                    for (int m=0;m<remoteDeptUserList.size(); m++) {
+                        JSONObject remoteUser = remoteDeptUserList.getJSONObject(m);
+                        if (remoteUser.getString("userid").equals(userid)) {
+                            remoteUser.put("userid", openUserid);
+                            return remoteUser;
+                        }
+                    }
+                }
+            }
+        } catch (Exception exception) {
+            exception.printStackTrace();
+        }
+        return null;
     }
 
     //通过中转服务器,调用通讯录的accessToken

+ 30 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/customer/list.vue

@@ -21,13 +21,13 @@
         </el-col>
 
         <!--列表-->
-        <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="selectionChange">
+        <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="selectionChange" @sort-change="tableSort">
             <el-table-column type="selection" width="60">
                 <!-- <template slot-scope="scope" >
                         {{scope.$index+1+(page-1)*size}}
                     </template> -->
             </el-table-column>
-            <el-table-column prop="customerCode" label="客户编码"  width="120"></el-table-column>
+            <el-table-column prop="customerCode" label="客户编码"  width="120" sortable="custom"></el-table-column>
             <el-table-column prop="customerName" label="客户名称" >
             </el-table-column>
             <el-table-column prop="contactName" label="联系人"  width="120">
@@ -36,7 +36,7 @@
             </el-table-column>
             <el-table-column prop="email" label="邮箱"  width="180">
             </el-table-column>
-            <el-table-column prop="address" label="地址" >
+            <el-table-column prop="address" label="地址" sortable="custom">
             </el-table-column>
             
             <el-table-column label="操作" width="150">
@@ -170,7 +170,9 @@
                 importResultMsg:null,
                 showImportResult:false,
                 selectArr: [],
-                delLoading: false
+                delLoading: false,
+                sortOrder: null,
+                sortProp: ''
             };
         },
         // 过滤器
@@ -442,14 +444,36 @@
                 this.getList();
             },
 
+            tableSort({column, prop, order}){
+                if(prop == 'customerCode' || prop == 'address'){
+                    this.sortOrder = order
+                    this.sortProp = prop
+                    this.getList()
+                }
+            },
+
             //获取项目列表
             getList() {
                 this.listLoading = true;
-                this.http.post('/customer-info/list', {
+                let parameter = {
                     pageIndex: this.page,
                     pageSize: this.size,
                     keyword:this.keyword
-                },
+                }
+                if(this.sortOrder){
+                    if(this.sortProp == 'customerCode'){
+                        parameter.sortProp = 'customer_code'
+                    }else if(this.sortProp == 'address'){
+                        parameter.sortProp = 'address'
+                    }
+
+                    if(this.sortOrder == 'descending'){
+                        parameter.sortOrder = 0
+                    }else if(this.sortOrder == 'ascending'){
+                        parameter.sortOrder = 1
+                    }
+                }
+                this.http.post('/customer-info/list', parameter,
                 res => {
                     this.listLoading = false;
                     if (res.code == "ok") {

+ 5 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -69,7 +69,7 @@
               </el-select>
             </el-form-item>
             <!-- 填报日期 -->
-            <el-form-item label="填报日期" style="position: relative;top: 38px;">
+            <el-form-item label="填报日期" style="position: relative;top: 38px;" prop="createDate">
               <el-col :span="11">
                 <el-date-picker type="date" placeholder="选择日期" v-model="addForm.createDate" value-format="yyyy-MM-dd" style="width: 200px;"></el-date-picker>
               </el-col>
@@ -473,7 +473,10 @@ export default {
       fileList: [],
       muHeight: document.documentElement.clientHeight || document.body.clientHeight,
       imgs: [],
-      addFormRules: {ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }]},      
+      addFormRules: {
+        ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }],
+        createDate: [{ required: true, message: "请选择日期", trigger: "blur" }],
+      },      
       isAuditList: false,
       statusTxt:["审核通过","待审核", "已驳回", "已撤销"],
       user: JSON.parse(sessionStorage.getItem("user")),

+ 18 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/project/project_gantt.vue

@@ -474,6 +474,23 @@ export default {
                                   }
                                 }
                                 this.tasks = {data:res.data};
+                                let taskson = []
+                                for(let m in this.tasks.data){
+                                  this.tasks.data[m].render = null
+                                  if(this.tasks.data[m].time != 0){
+                                    
+                                    if(this.tasks.data[m].id != this.tasks.data[m].userId){
+                                      this.tasks.data[m].render = 'split'
+                                      let item = JSON.parse(JSON.stringify(this.tasks.data[m]))
+                                      item.parent = this.tasks.data[m].id
+                                      item.id = this.tasks.data[m].id + 'son'
+                                      taskson.push(item)
+                                      this.tasks.data[m].time = 0
+                                    }
+                                    
+                                  }
+                                }
+                                this.tasks.data.push.apply(this.tasks.data,taskson) 
                                 for(let i in this.tasks.data){
                                   if(this.tasks.data[i].time == 0){
                                     delete this.tasks.data[i].start_date
@@ -488,6 +505,7 @@ export default {
                                     this.tasks.data[i].end_date = date2.getFullYear() + '-' + (dmonth < 10 ? '0' + dmonth : dmonth) + '-' + (dday < 10 ? '0' + dday : dday)
                                   }
                                 }
+                                console.log('ganttData',this.tasks.data);
                                 this.$nextTick(()=>{
                                   this.updatakey1 += 1
                           })

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -452,7 +452,7 @@
                         }
                         this.projectss = res.data;
                         this.project = res.data;
-                        this.projectss = this.projectss.filter(p=>p.status == 1);
+                        this.projectss = this.projectss.filter(p=>p.status == 1 || p.status == 4);
                         this.proads = res.data
                     } else {
                         this.$toast.fail('获取失败:'+res.msg);