Jelajahi Sumber

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

QuYueTing 6 bulan lalu
induk
melakukan
35f854a84d

+ 13 - 6
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/personnelSearch/personnelSearch.vue

@@ -1,15 +1,21 @@
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject, watchEffect, computed } from 'vue';
 import { storeToRefs } from 'pinia';
-import { Props, Emits, optionsType } from './type';
+import { Emits, optionsType } from './type';
 import { useStore } from '@/store/index'
 import { generateUniqueId } from '@/utils/tools'
 import { post, get, uploadFile } from "@/utils/request";
 
-const props = defineProps<Props>();
+const props = defineProps({
+  modelValue: { type: [String, Number, Array, Object, Boolean], required: true },
+  multiple: { type: Boolean, required: false, default: false },
+  size: { type: String as () => assemblySize, required: true, default: () => 'small' },
+  placeholder: { type: String, required: false, default: () => '请填写' },
+  disabled: { type: Boolean, required: false, default: false },
+  options: { type: Array as () => optionsType, required: false, default: () => [] },
+});
 const emit = defineEmits<Emits>();
 const { userInfo } = storeToRefs(useStore());
-const options = ref<optionsType>([]);
 
 const timeRef = generateUniqueId()
 const controlTranslation = reactive({
@@ -39,10 +45,11 @@ console.log(props, userInfo, '<==== 看看数据')
 </script>
 
 <template>
-  <!-- <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple ? true : false" :size="size ? size : ''" :placeholder="placeholder ? placeholder : '请输入'"
-    :disabled="disabled ? true : false" clearable collapse-tags @change="updateValue" @visible-change="visibleChange">
+  <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
+    :placeholder="placeholder" :disabled="disabled" clearable collapse-tags @change="updateValue"
+    @visible-change="visibleChange">
     <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
-  </el-select> -->
+  </el-select>
 </template>
 
 <style lang="scss" scoped></style>

+ 0 - 9
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/personnelSearch/type.d.ts

@@ -4,15 +4,6 @@ export type optionsType = {
   jobNumber?: string,
 }[]
 
-export interface Props {
-  modelValue: any,
-  size: assemblySize,
-  placeholder: string,
-  disabled?: Boolean,
-  multiple?: Boolean,
-  options?: optionsType, // 使用自定义数据
-}
-
 export interface Emits {
   (event: "change", value: any): void;
   /**

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/analysis/index.vue

@@ -187,7 +187,7 @@ watchEffect(() => {
           </el-select>
         </div>
         <div class="w-40">
-          <personnel-search v-model="selectVal" size="small" :disabled="false" multiple placeholder="你好世界" @change="selectChange"></personnel-search>
+          <personnel-search v-model="selectVal" disabled multiple placeholder="你好世界" @change="selectChange"></personnel-search>
           <el-select
             ref="select1"
             size="small"

+ 60 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/home.vue

@@ -18,11 +18,71 @@
 <script lang="ts" setup>
 import Header from '@/pages/header/header.vue';
 import { nextTick, onMounted, ref } from 'vue';
+import { storeToRefs } from 'pinia';
+import { useStore } from '@/store/index'
+import { post } from "@/utils/request";
+const { userInfo } = storeToRefs(useStore());
+
+declare var wx: any; // wx 小程序对象
+declare var window: Window & { WWOpenData: any }; // 如果是 window.WWOpenData
+declare var WWOpenData: any; // wx 小程序对象
+
 const isLoading = ref(true);
+const agentConfig = () => {
+  var isCorpWX = true
+  var ua = navigator.userAgent.toLowerCase();
+  if (ua.indexOf("wxwork") > 0) {
+    isCorpWX = false;
+  }
+  const curUrl = location.href.split("#")[0];
+  post(`/wxcorp/getCorpWXConfig`, { url: curUrl, token: userInfo.value.id }).then(res => {
+    wx.config({
+      beta: true,
+      debug: isCorpWX, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+      appId: res.data.appid, // 必填,公众号的唯一标识 
+      timestamp: res.data.timestamp, // 必填,生成签名的时间戳 
+      nonceStr: res.data.noncestr, // 必填,生成签名的随机串 
+      signature: res.data.sign, // 必填,签名,见附录1 
+      jsApiList: ['chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'previewFile', 'getLocation', 'agentConfig', 'getLocalImgData']
+    });
+
+    wx.ready(() => {
+      post(`/wxcorp/getCorpWXAgentConfig`, { url: curUrl, token: userInfo.value.id }).then(res => {
+        wx.agentConfig({
+          corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+          agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
+          timestamp: res.data.timestamp, // 必填,生成签名的时间戳
+          nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
+          signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+          jsApiList: ['selectExternalContact', 'selectEnterpriseContact', 'openAppManage'], //必填,传入需要使用的接口名称
+          success: function (result: any) {
+            console.log(result, '请求微信成功')
+            console.log(window, 'window')
+            //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+            if (window.WWOpenData) {
+              window.WWOpenData.bind(document.querySelector('TranslationOpenDataText'))
+              if (WWOpenData.initCanvas) {
+                WWOpenData.initCanvas()
+                console.log('我企业微信 canvas 应该执行了吧')
+              }
+            }
+          },
+          fail: function (res: any) {
+            console.log('查看错误信息', res)
+            if (res.errMsg.indexOf('function not exist') > -1) {
+              alert('版本过低请升级')
+            }
+          },
+        })
+      })
+    })
+  })
+}
 
 onMounted(async () => {
   await nextTick();
   isLoading.value = false;
+  agentConfig()
 });
 </script>
 

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/type.d.ts

@@ -27,7 +27,7 @@ type templateKey = { // 自定义模板键值
 
 type translationType = "userName" | "departmentName" | "deptName"; // 企业微信, 钉钉转译类型,
 
-type assemblySize = "mini" | "medium" | "large" | '' | 'large' | 'default' | 'small';
+type assemblySize = '' | 'large' | 'default' | 'small';
 
 type saveLoadingType = "1" | "2" | "3" | "4"; //1是没有保存, 2是正在保存, 3是保存成功, 4是保存失败
 

+ 5 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/UserController.java

@@ -144,6 +144,11 @@ public class UserController {
         return userService.getSimpleActiveUserList(departmentId,request,keyword,cursor);
     }
 
+    @RequestMapping("/getSimpleActiveUserListNew")
+    public HttpRespMsg getSimpleActiveUserListNew(Integer departmentId,String keyword,String cursor) throws Exception {
+        return userService.getSimpleActiveUserListNew(departmentId,request,keyword,cursor);
+    }
+
     @RequestMapping("/getUserListByRole")
     public HttpRespMsg getUserListByRole(String tableName){
         return userService.getUserListByRole(request,tableName);

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UserMapper.java

@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Update;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -62,4 +63,6 @@ public interface UserMapper extends BaseMapper<User> {
     List<UserVO> getCustomerTotalCount(String startDate, String endDate, String userId, Integer companyId);
 
     List<UserVO> getCustomerTransferRate(String startDate, String endDate, String userId, Integer companyId);
+
+    List<Map<String, Object>> getSimpleActiveUserList(@Param("map") HashMap<String, Object> map);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/UserService.java

@@ -107,4 +107,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg setActiveByIds(String ids, int isActive);
 
     HttpRespMsg deleteUserSalaryById(String id);
+
+    HttpRespMsg getSimpleActiveUserListNew(Integer departmentId, HttpServletRequest request, String keyword, String cursor) throws Exception;
 }

+ 48 - 17
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysRoleServiceImpl.java

@@ -29,12 +29,11 @@ import java.util.stream.Collectors;
 @Transactional
 public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
 
-    public static String[] employeeModules =  {"工时报告","项目报告审核", "专业审核","部门审核","费用报销","待办任务", "项目管理", "请假管理", "导入日报审核"};
-    public static String[] pmModules =  {"工时报告","项目报告审核", "专业审核","部门审核","费用报销","待办任务", "项目管理", "请假管理", "导入日报审核"};
-    public static String[] financeModules =  {"工时成本统计", "财务核算成本", "费用报销", "组织架构", "请假管理"};
-    public static String[] pmoModules =  {"工时报告","项目报告审核","查看全部任务", "费用报销", "待办任务", "项目管理", "客户管理", "工程专业管理","请假管理"};
-    public static String[] corpLeaderModules =  {"工时报告","查看全部任务","工时成本统计","自定义数值统计","财务核算成本","项目报表服务",
-            "费用报销","待办任务","项目管理","请假管理","查看全部报销单", "查看全部请假单"};
+    public static String[] employeeModules =  {"商机","线索", "客户","联系人","任务", "销售订单","产品管理"};
+    public static String[] pmModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
+    public static String[] financeModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
+    public static String[] pmoModules =  {"商机","线索", "客户","联系人","任务","报表服务", "销售订单","产品管理"};
+    public static String[] corpLeaderModules =  {"商机","线索", "客户","联系人","任务","报表服务","数据分析", "销售订单","产品管理","组织架构","系统设置"};
 
     public static final HashMap<String, String[]> moduleMaps = new HashMap();
     static {
@@ -45,14 +44,46 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         moduleMaps.put("公司领导", corpLeaderModules);
     }
 //
-    public static String[] employeeFunctions = {"查看相关人员工时","请假填报","费用填报"};
-    public static String[] pmFunctions = {"新增项目", "查看相关人员工时","请假填报","费用填报","代填日报"};
-    public static String[] financeFunctions = {"人员成本管理", "添加人员", "导出人员", "导入人员", "请假填报","费用填报", "查看全部请假单"};
-    public static String[] pmoFunctions = {"新增项目","查看全部项目","管理全部项目","分类管理","导入项目","代填日报", "请假填报","费用填报",
-            "导出项目","查看资源分配", "基线成本项管理","查看成本基线","校正成本基线","查看合同金额"};
-    public static String[] corpLeaderFunctions = {"查看全公司工时","查看全部项目","导出项目","查看资源分配",
-            "查看成本基线","查看合同金额", "请假填报","费用填报", "查看全部请假单","项目任务报表","项目成本报表","项目收支平衡表","客户项目利润表",
-            "项目阶段工时表", "加班情况统计表"};
+    public static String[] employeeFunctions = {"新增\\编辑商机","导入","导出","编辑","新增"};
+    public static String[] pmFunctions = {"编辑","新增","导入","导出","删除","回收站",
+    "查看负责部门商机","新增\\编辑商机",
+    "查看负责部门线索",
+    "查看负责部门客户",
+    "查看负责部门联系人", "查看负责部门任务",
+            "负责部门线索数据","负责部门商机数据",
+            "负责部门销售数据","负责部门任务数据",
+            "查看负责部门产品数据",
+            "查看负责部门订单"
+    };
+    public static String[] financeFunctions = {
+             "查看全部商机",
+            "查看全部线索",
+            "查看全部客户",
+            "查看全部联系人", "查看全部任务",
+            "全部线索数据","全部商机数据",
+            "全部销售数据","全部任务数据",
+            "查看全部产品数据",
+            "查看全部订单",
+            "角色权限","系统字典","自定义表单"};
+    public static String[] pmoFunctions = {"编辑","新增","导入","导出","删除","回收站",
+            "查看负责部门商机","新增\\编辑商机",
+            "查看负责部门线索",
+            "查看负责部门客户",
+            "查看负责部门联系人", "查看负责部门任务",
+            "负责部门线索数据","负责部门商机数据",
+            "负责部门销售数据","负责部门任务数据",
+            "查看负责部门产品数据",
+            "查看负责部门订单"};
+    public static String[] corpLeaderFunctions = {"编辑","新增","导入","导出","删除","回收站",
+            "查看负责部门商机", "查看全部商机","新增\\编辑商机",
+            "查看负责部门线索","查看全部线索",
+            "查看负责部门客户","查看全部客户",
+            "查看负责部门联系人","查看全部联系人", "查看负责部门任务","查看全部任务",
+            "负责部门线索数据","全部线索数据","负责部门商机数据","全部商机数据",
+            "负责部门销售数据","全部销售数据","负责部门任务数据","全部任务数据",
+            "查看全部产品数据","查看负责部门产品数据",
+            "查看负责部门订单","查看全部订单"
+            };
     public static final HashMap<String, String[]> functionMaps = new HashMap();
     static {
         functionMaps.put("普通员工", employeeFunctions);
@@ -184,9 +215,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
                 generateRole(str, company, modules, functions);
             } else {
                 //其他角色按照过滤的来生成
-                List<SysModule> filteredModules = modules.stream().filter(
-                        m->Arrays.stream(moduleMaps.get(str)).anyMatch(curModule->curModule.equals(m.getName()))
-                ).collect(Collectors.toList());
+                String[] mocules = moduleMaps.get(str);
+                List<SysModule> filteredModules = modules.stream().
+                        filter(m->Arrays.stream(mocules).anyMatch(curModule->curModule.equals(m.getName()))).collect(Collectors.toList());
                 List<SysFunction> filteredFunctions = functions.stream().filter(
                         m->Arrays.stream(functionMaps.get(str)).anyMatch(curModule->curModule.equals(m.getName()))
                 ).collect(Collectors.toList());

+ 11 - 5
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -991,14 +991,20 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     }
                 }
                 else if(model.equals("executorId")){
-                    StringJoiner stringJoiner = new StringJoiner(",");
                     List<String> taskExecutors = tasKVo.getTaskExecutors();
                     if (taskExecutors!=null&&!taskExecutors.isEmpty()){
-                        for (String taskExecutor : taskExecutors) {
-                            stringJoiner.add(taskExecutor);
-                        }
+                        String executorString = taskExecutors.stream()
+                                .map(
+                                t->{
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                return "$userName="+t+"$";}
+                                    else {return t;}
+                                    }
+                                ).collect(Collectors.joining(","));
+                        value =executorString.isEmpty()?"":executorString;
+                    }else {
+                        value="";
                     }
-                    value =stringJoiner.length()==0?"":stringJoiner.toString();
                 }
                 else if(model.equals("startDate")){
                     if (tasKVo.getStartDate()!=null){

+ 49 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -2204,6 +2204,55 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
         return msg;
     }
+
+    @Override
+    public HttpRespMsg getSimpleActiveUserListNew(Integer departmentId, HttpServletRequest request, String keyword, String cursor) throws Exception {
+        HttpRespMsg msg = new HttpRespMsg();
+        String token = request.getHeader("TOKEN");
+        User user = userMapper.selectById(token);
+        String nextCursor = "";
+        //企业微信通讯录搜索功能
+        Integer WXCompanyId = user.getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", WXCompanyId));
+        //当企业开启了微信通讯录的情况下
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(keyword) && wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
+            HashMap<String, List> result = wxCorpInfoService.getOpenId(wxCorpInfo.getCorpid(), keyword, cursor,1,200);
+            HashMap<String, Object> msgResult = new HashMap<>();
+            nextCursor = result.get("nextCursor").get(0).toString();
+            List users = result.get("user");
+            msgResult.put("nextCursor",nextCursor);
+            msg.data = msgResult;
+            if (users.size()!=0){
+                List<User> realUser = userMapper.selectList(new QueryWrapper<User>().in("corpwx_userid", users));
+                msgResult.put("retUser",realUser);
+                return msg;
+            }else {
+                ArrayList<User> nullUser = new ArrayList<>();
+                msgResult.put("retUser",nullUser);
+                return msg;
+            }
+        }else {
+            HashMap<String, Object> hashMap = new HashMap<>();
+            hashMap.put("companyId",user.getCompanyId());
+            hashMap.put("isActive",1);
+            if (!StringUtils.isEmpty(keyword)){
+                hashMap.put("name",keyword);
+            }
+//            QueryWrapper<User> wrapper = new QueryWrapper<User>().select("id, name, phone, job_number, department_id").eq("company_id", user.getCompanyId()).eq("is_active", 1);
+            if (departmentId != null) {
+                //获取全部子部门
+                List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+                List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(departmentId, allDeptList);
+//                wrapper.in("department_id", deptIds);
+                hashMap.put("deptIds",deptIds);
+            }
+
+//            List<User> userList = userMapper.selectList(wrapper);
+            List<Map<String, Object>> userList=userMapper.getSimpleActiveUserList(hashMap);
+            msg.data = userList;
+            return msg;
+        }
+    }
 //
 //    private String getAccessToken(String code) {
 //        String accessToken = "";

+ 20 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/UserMapper.xml

@@ -333,6 +333,26 @@
         </where>
         group by  c.incharger_id
     </select>
+    <select id="getSimpleActiveUserList" resultType="java.util.Map">
+        select id as value, name as label,job_number as jobNumber from user u
+            <where>
+                <if test="map.companyId !=null">
+                    and u.company_id=#{map.companyId}
+                </if>
+                <if test="map.isActive !=null">
+                    and u.is_active=#{map.isActive}
+                </if>
+                <if test="map.name !=null">
+                    and u.name like concat('%',#{map.name},'%')
+                </if>
+                <if test="map.deptIds !=null">
+                    and u.department_id in
+                    <foreach collection="map.deptIds" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+            </where>
+    </select>
 
     <update id="updateActiveByIds">
         update user set is_active=1 WHERE id IN