Przeglądaj źródła

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

QuYueTing 6 miesięcy temu
rodzic
commit
f9b9afe285

+ 56 - 12
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/personnelSearch/personnelSearch.vue

@@ -35,9 +35,9 @@ const getSelectedLabel = computed(() => {
     return item ? item.label : props.placeholder
   }
 
-  if(props.multiple) {
-    if(Array.isArray(selectedValue.value)) {
-      if(selectedValue.value.length <= 0) {
+  if (props.multiple) {
+    if (Array.isArray(selectedValue.value)) {
+      if (selectedValue.value.length <= 0) {
         return props.placeholder
       }
       const item = getPersonnelListItems(selectedValue.value);
@@ -51,7 +51,7 @@ const getSelectedLabel = computed(() => {
 })
 
 function tagClose(_evt: MouseEvent) {
-  if(Array.isArray(selectedValue.value)) {
+  if (Array.isArray(selectedValue.value)) {
     selectedValue.value.shift()
     updateValue(selectedValue.value)
   }
@@ -84,7 +84,7 @@ function filterMethods(val: string) {
   if (val == '') {
     personnelArray.value = personnelList.value
     selectLoading.value = false
-    return
+    return personnelArray.value
   }
   getUserList(val)
 }
@@ -101,17 +101,51 @@ onMounted(() => {
     personnelArray.value = personnelList.value
   }
 })
-
-console.log(props, userInfo.value, '<==== 看看数据')
 </script>
 
 <template>
-  <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
+  <!-- <el-select v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
     :loading="selectLoading" :placeholder="placeholder" :disabled="disabled" clearable filterable collapse-tags
     :style="`width: ${width}`"
     :class="`custom-select ${userInfo.userNameNeedTranslate != 1 && !controlTranslation.visibleFlag ? 'setUpInput' : ''}`"
     @change="updateValue" @visible-change="visibleChange"
     :filter-method="(val: string) => { selectLoading = true, filterMethod(val) }">
+    搜索内容显示
+    <template #prefix v-if="!multiple">
+      <div style="height: 100%;display: flex;align-items: center;">
+        单选
+        <div v-if="!controlTranslation.visibleFlag" class="selectSingleChoice">
+          <template v-if="getSelectedLabel == placeholder">
+            {{ placeholder }}
+          </template>
+<template v-else>
+            <span style="color: #303133;">
+              <TextTranslation translationTypes="userName" :translationValue="getSelectedLabel"></TextTranslation>
+            </span>
+          </template>
+</div>
+</div>
+</template>
+<template #tag v-if="multiple">
+      多选
+      <template v-if="Array.isArray(selectedValue) && selectedValue.length > 0">
+        <el-tag type="info" :size="size" closable @close="tagClose">
+          <TextTranslation translationTypes="userName" :translationValue="getSelectedLabel"></TextTranslation>
+        </el-tag>
+        <el-tag type="info" :size="size" v-if="selectedValue.length > 1">+{{ selectedValue.length }}</el-tag>
+      </template>
+<template v-else>
+        <span style="color: #A8ABB2">{{ placeholder }}</span> 
+      </template>
+</template>
+主题内容显示
+<el-option v-for="item in personnelArray" :key="item.value" :label="item.label" :value="item.value"></el-option>
+</el-select> -->
+  <el-select-v2 v-model="selectedValue" :ref="`selectRef${timeRef}`" :multiple="multiple" :size="size"
+    :loading="selectLoading" :placeholder="placeholder" :disabled="disabled" clearable filterable collapse-tags
+    :style="`width: ${width}`" :options="personnelArray"
+    :class="`custom-select ${!controlTranslation.visibleFlag ? 'setUpInput' : ''}`" @change="updateValue"
+    @visible-change="visibleChange" :filter-method="filterMethod">
     <!-- 搜索内容显示 -->
     <template #prefix v-if="!multiple">
       <div style="height: 100%;display: flex;align-items: center;">
@@ -137,12 +171,16 @@ console.log(props, userInfo.value, '<==== 看看数据')
         <el-tag type="info" :size="size" v-if="selectedValue.length > 1">+{{ selectedValue.length }}</el-tag>
       </template>
       <template v-else>
-        <span style="color: #A8ABB2">{{ placeholder }}</span> 
+        <span style="color: #A8ABB2">{{ placeholder }}</span>
       </template>
     </template>
-    <!-- 主题内容显示 -->
-    <el-option v-for="item in personnelArray" :key="item.value" :label="item.label" :value="item.value"></el-option>
-  </el-select>
+    <!-- 基础 -->
+    <template #default="{ item }">
+      <div class="flex items-center">
+        <TextTranslation translationTypes="userName" :translationValue="item.label"></TextTranslation>
+      </div>
+    </template>
+  </el-select-v2>
   <span class="aabbcc">aabbcc</span>
 </template>
 
@@ -151,16 +189,22 @@ console.log(props, userInfo.value, '<==== 看看数据')
   :deep(.el-select__placeholder.is-transparent) {
     color: transparent !important;
   }
+
   :deep(.el-select__placeholder) {
     span {
       display: none;
     }
   }
+  
+  :deep(.el-select__input) {
+    margin-left: 0;
+  }
 }
 
 .setUpInput :deep(.el-input__inner) {
   color: #fff !important;
 }
+
 .aabbcc {
   color: $modena;
 }

+ 8 - 4
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/textTranslation/textTranslation.vue

@@ -1,9 +1,9 @@
 <template>
-  <template v-if="userInfo.userNameNeedTranslate == 1">
-    <ww-open-data :type='translationTypes' :openid='translationValue'></ww-open-data>
+  <template v-if="!translationVal">
+    {{ translationValue }}
   </template>
   <template v-else>
-    {{ translationValue }}
+    <ww-open-data :type="translationTypes" :openid="translationValue"></ww-open-data>
   </template>
 </template>
 <script lang="ts" setup>
@@ -19,5 +19,9 @@ interface Props {
 const props = defineProps<Props>();
 const { userInfo } = storeToRefs(useStore());
 
-console.log(props, '<==== 看看数据')
+const translationVal = ref(false);
+
+onMounted(() => {
+  translationVal.value = userInfo.value.userNameNeedTranslate == 0 ? false : true;
+})
 </script>

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

@@ -60,7 +60,7 @@ const agentConfig = () => {
             console.log(window, 'window')
             //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
             if (window.WWOpenData) {
-              window.WWOpenData.bind(document.querySelector('TranslationOpenDataText'))
+              window.WWOpenData.bind(document.querySelector('ww-open-data'))
               if (WWOpenData.initCanvas) {
                 WWOpenData.initCanvas()
                 console.log('我企业微信 canvas 应该执行了吧')

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/vite.config.ts

@@ -10,7 +10,13 @@ const target = "http://127.0.0.1:10010";
 // const target = 'http://47.101.180.183:10010';
 
 export default defineConfig({
-  plugins: [vue()],
+  plugins: [vue({
+    template: {
+      compilerOptions: {
+        isCustomElement: (tag) => tag === 'ww-open-data'
+      }
+    }
+  })],
   server: {
     host: '0.0.0.0',
     port: 19123,

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -147,7 +147,7 @@ public class BusinessOpportunityController {
                 }
 
                 if(model.equals("contactsId")){
-                    value = String.valueOf(aClass.getMethod("getContactsName").invoke(data));
+                    value = String.valueOf(aClass.getMethod("getContactsName").invoke(data)).equals("null")?"":String.valueOf(aClass.getMethod("getContactsName").invoke(data));
                 }
                 if(model.equals("customerId")){
                     value = String.valueOf(aClass.getMethod("getCustomerName").invoke(data));

+ 16 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -169,6 +169,8 @@ public class WeiXinCorpController {
     private DepartmentWxMapper departmentWxMapper;
     @Resource
     private SysFormService sysFormService;
+    @Resource
+    private StageService stageService;
 
     public static String SUITE_ACCESS_TOKEN = null;
     public static long suiteTokenExpireTime = 0L;
@@ -1339,6 +1341,9 @@ public class WeiXinCorpController {
                         });
                         sysFormService.saveBatch(baseList);
 
+                        List<Stage> stageList=getStageBaseList(company);
+                        stageService.saveBatch(stageList);
+
                         //生成工作时长
                         TimeType timeType = new TimeType();
                         timeType.setCompanyId(company.getId());
@@ -1475,6 +1480,17 @@ public class WeiXinCorpController {
         }
     }
 
+    private List<Stage> getStageBaseList(Company company) {
+        ArrayList<Stage> stages = new ArrayList<>();
+        Stage stage1 = new Stage().setName("赢单").setPlan("100%").setSeq(4).setIsFinish(1).setCompanyId(company.getId());
+        stages.add(stage1);
+        Stage stage2 = new Stage().setName("输单").setPlan("0%").setSeq(5).setIsFinish(1).setCompanyId(company.getId());
+        stages.add(stage2);
+        Stage stage3 = new Stage().setName("无效").setPlan("0%").setSeq(6).setIsFinish(1).setCompanyId(company.getId());
+        stages.add(stage3);
+        return stages;
+    }
+
 
     private JSONArray getDeptUserSimple(String accessToken, int deptId) {
         String url = GET_DEPARTMENT_USER_SIMPLE_URL.replace("ACCESS_TOKEN", accessToken).replace("DEPARTMENT_ID", ""+deptId);

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

@@ -1930,15 +1930,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             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;
+//            msgResult.put("nextCursor",nextCursor);
+
             if (users.size()!=0){
                 List<User> realUser = userMapper.selectList(new QueryWrapper<User>().in("corpwx_userid", users));
-                msgResult.put("retUser",realUser);
+                msg.data = realUser;
                 return msg;
             }else {
                 ArrayList<User> nullUser = new ArrayList<>();
-                msgResult.put("retUser",nullUser);
+                msg.data = nullUser;
                 return msg;
             }
         }else {

+ 13 - 0
fhKeeper/formulahousekeeper/management-platform/pom.xml

@@ -14,6 +14,19 @@
     <version>3.4.0</version>
 
     <dependencies>
+
+<!--        <dependency>-->
+<!--            <groupId>cn.hutool</groupId>-->
+<!--            <artifactId>hutool-all</artifactId>-->
+<!--            <version>5.8.9</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>commons-codec</groupId>-->
+<!--            <artifactId>commons-codec</artifactId>-->
+<!--            <version>1.10</version>-->
+<!--        </dependency>-->
+
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>

+ 3 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinancialAuditController.java

@@ -2,33 +2,25 @@ package com.management.platform.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.FinancialAudit;
-import com.management.platform.entity.Project;
-import com.management.platform.entity.ProjectStage;
 import com.management.platform.entity.User;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.FinancialAuditService;
-import com.management.platform.service.ProjectStageService;
 import com.management.platform.util.HttpRespMsg;
-import com.management.platform.util.MessageUtils;
-import io.lettuce.core.pubsub.PubSubOutput;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * <p>

+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/WxCorpInfoService.java

@@ -48,7 +48,7 @@ public interface WxCorpInfoService extends IService<WxCorpInfo> {
 
     public String getTranslationMediaId(String fileName) throws Exception;
 
-    public String getTranslationJobId(String fileName,WxCorpInfo wxCorpInfo) throws Exception;
+    public String getTranslationJobId(String fileName,String md5,WxCorpInfo wxCorpInfo) throws Exception;
 
     public String syncTranslation(String authCorpid,String mediaId,String outPutFileName,String outputFileFormat) throws Exception;
 
@@ -87,4 +87,6 @@ public interface WxCorpInfoService extends IService<WxCorpInfo> {
     JSONArray getApprovalInfo(Integer companyId, String startDate, String endDate, String newCursor, JSONArray filterArray) throws Exception;
 
     public String applyEvent(HttpServletRequest request, JSONObject data) throws Exception;
+
+    String getAsyncJobResult(String tmpFileJobId,WxCorpInfo wxCorpInfo)  throws Exception;
 }

+ 18 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExcelExportServiceImpl.java

@@ -13,6 +13,7 @@ import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -82,19 +83,33 @@ public class ExcelExportServiceImpl implements ExcelExportService {
         String resp = ExcelUtil.exportGeneralExcelByTitleAndList(title, list, downloadPath);
         String fileUrlSuffix = title + ".xlsx";
         if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
-//            FileSystemResource fileSystemResource = new FileSystemResource(path+fileUrlSuffix);
-//            Long checkSize = 20L*1024*1024;
+            FileSystemResource fileSystemResource = new FileSystemResource(path+fileUrlSuffix);
+//            String md5 = DigestUtils.md5Hex(FileUtil.readBytes(fileSystemResource.getFile()));
+
+            Long checkSize = 20L*1024*1024;
+            if(fileSystemResource.getFile().length() >= checkSize){
+                httpRespMsg.setError("文件过大,请缩短查询日期范围");
+                return httpRespMsg;
+            }
             String jobId = "";
             String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
             jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
 //            if(fileSystemResource.getFile().length() >= checkSize){
-//                jobId = wxCorpInfoService.getTranslationJobId(fileUrlSuffix,wxCorpInfo);
+//                String tmpFileJobId = wxCorpInfoService.getTranslationJobId(fileUrlSuffix,md5,wxCorpInfo);
+//                if(!StringUtils.isEmpty(tmpFileJobId)){
+//                    String mediaId = wxCorpInfoService.getAsyncJobResult(tmpFileJobId,wxCorpInfo);
+//                    jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+//                }
 //            }else{
 //                String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
 //                jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
 //            }
 
             System.out.println("上传待转译文件到企业微信, jobId==" + jobId);
+//            if(StringUtils.isEmpty(jobId)){
+//                httpRespMsg.setError("转义jobId为空,请联系管理员");
+//                return httpRespMsg;
+//            }
             int i = 0;
             String syncTranslationResult = null;
             /**

+ 66 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -174,6 +174,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     //获取服务商provider_access_token
     @Override
     public String getProviderAccessToken() throws Exception {
+        System.out.println("in getProviderAccessToken  method");
         String access_token="";
         String url = "https://qyapi.weixin.qq.com/cgi-bin/service/get_provider_token";
         HttpHeaders headers = new HttpHeaders();
@@ -192,6 +193,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
             }
             access_token= json.getString("provider_access_token");
         }
+        System.out.println("end getProviderAccessToken  method");
         return access_token;
     }
 
@@ -230,7 +232,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     }
 
     @Override
-    public String getTranslationJobId(String fileName, WxCorpInfo wxCorpInfo) throws Exception {
+    public String getTranslationJobId(String fileName,String md5, WxCorpInfo wxCorpInfo) throws Exception {
         System.out.println("in getTranslationJobId method");
         String jobId="";
         //然后处理文件 通讯录id转译
@@ -240,8 +242,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         params.put("scene",1);
         params.put("type","file");
         params.put("filename",fileName);
-        params.put("url","https://worktime.ttkuaiban.com/upload/"+fileName);
-        params.put("md5","MD5");
+//        params.put("url","https://worktime.ttkuaiban.com/upload/"+fileName);
+        params.put("url","http://47.101.180.183:9097/upload/"+fileName);
+//        System.out.println("uploadJobFileUrl=== "+"http://47.101.180.183:9097/upload/"+fileName);
+        params.put("md5",md5);
         String requestBody = JSONObject.toJSONString(params);
         HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
         String apiUrl = "https://qyapi.weixin.qq.com/cgi-bin/media/upload_by_url?access_token="+getCorpAccessToken(wxCorpInfo);
@@ -253,7 +257,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         Map responseObj = objectMapper.readValue(responseBody, Map.class);
         if (responseEntity.getStatusCode() == HttpStatus.OK){
             if(null != responseObj.get("errcode") && 0 == Integer.parseInt(responseObj.get("errcode").toString())){
-                jobId = responseObj.get("job_id").toString();
+                jobId = responseObj.get("jobid").toString();
             }else{
                 System.out.println("error Trans====== "+responseObj.get("errmsg").toString());
             }
@@ -2574,4 +2578,62 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         }
         return "";
     }
+
+    @Override
+    public String getAsyncJobResult(String tmpFileJobId,WxCorpInfo wxCorpInfo) throws Exception{
+        System.out.println("in getAsyncJobResult method");
+        String mediaId = "";
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        Map<String,Object> params = new HashMap<>();
+        params.put("jobid",tmpFileJobId);
+        String requestBody = JSONObject.toJSONString(params);
+        HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
+        String apiUrl = "https://qyapi.weixin.qq.com/cgi-bin/media/get_upload_by_url_result?access_token="+getCorpAccessToken(wxCorpInfo);
+        
+        int i = 0;
+        while(i < 100){
+            if (i < 10) {
+                Thread.sleep(300);
+            } else if (i < 20){
+                Thread.sleep(1000);
+            } else {
+                Thread.sleep(3000);
+            }
+            System.out.println("i=="+i+", "+LocalDateTime.now());
+            ResponseEntity<String> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
+            String responseBody = responseEntity.getBody();
+            System.out.println("getAsyncJobResult Response from API: " + responseBody);
+            JSONObject jsonRes = JSONObject.parseObject(responseBody);
+            if (responseEntity.getStatusCode() == HttpStatus.OK){
+                if(null != jsonRes.get("errcode") && 0 == Integer.parseInt(jsonRes.get("errcode").toString())){
+                    String status = jsonRes.get("status").toString();
+                    if("1".equals(status)){
+                        //处理中
+                    } else if ("2".equals(status)) {
+                        //已完成
+                        String detailStr = jsonRes.getString("detail");
+                        JSONObject detailJson = JSONObject.parseObject(detailStr);
+                        mediaId = detailJson.getString("media_id");
+                        break;
+                    } else if ("3".equals(status)) {
+                        //报错了
+                        String detailStr = jsonRes.getString("detail");
+                        System.out.println("detailStr==="+detailStr);
+                        JSONObject detailJson = JSONObject.parseObject(detailStr);
+                        System.out.println("企业微信转译报错:"+detailJson.getString("errmsg"));
+                        break;
+                    }
+                }else{
+                    System.out.println("error Trans====== "+jsonRes.get("errmsg").toString());
+                    break;
+                }
+            }
+            i++;
+        }
+
+
+        System.out.println("end getAsyncJobResult method");
+        return mediaId;
+    }
 }