ソースを参照

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

QuYueTing 4 ヶ月 前
コミット
9b84cf36be
64 ファイル変更2210 行追加699 行削除
  1. 10 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/hooks/useApi.js
  2. 26 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleDetails/index.vue
  3. 27 5
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleList/moduleList.vue
  4. 10 4
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/addEditor.vue
  5. 2 2
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/addEditor.vue
  6. 6 2
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/detail.vue
  7. 4 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/addEditor.vue
  8. 4 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/detail.vue
  9. 3 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/orderInfo.vue
  10. 156 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/paymentCollection.vue
  11. 1 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/newAndModifiedRelatedProducts.vue
  12. 3 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/productInfo.vue
  13. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/addEditor.vue
  14. 107 9
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/detail.vue
  15. 18 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/thread/threadInfo.vue
  16. 15 2
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/customInstructions.js
  17. 7 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java
  18. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java
  19. 23 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java
  20. 8 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java
  21. 6 7
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Information.java
  22. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContractService.java
  23. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/TaskService.java
  24. 3 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessTripServiceImpl.java
  25. 19 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java
  26. 5 5
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ExpenseSheetServiceImpl.java
  27. 3 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/InformationServiceImpl.java
  28. 3 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/LeaveSheetServiceImpl.java
  29. 3 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  30. 53 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  31. 4 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/VisitPlanServiceImpl.java
  32. 3 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/time/VisitPlanTask.java
  33. 3 3
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml
  34. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml
  35. 2 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  36. 165 115
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java
  37. 304 100
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskFilesController.java
  38. 9 10
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java
  39. 50 58
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Task.java
  40. 52 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskFiles.java
  41. 10 6
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java
  42. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/bo/QueryTaskChargePage.java
  43. 14 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ProjectTaskTimeCostVO.java
  44. 12 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ProjectTimeCostVO.java
  45. 26 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/TaskFileChargePageVO.java
  46. 4 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskCommentMapper.java
  47. 10 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskFilesMapper.java
  48. 11 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskMapper.java
  49. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  50. 8 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TaskFilesService.java
  51. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TaskService.java
  52. 15 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java
  53. 49 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
  54. 47 11
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  55. 199 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskFilesServiceImpl.java
  56. 170 126
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  57. 46 57
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java
  58. 7 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskCommentMapper.xml
  59. 34 2
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskFilesMapper.xml
  60. 128 22
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml
  61. 5 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AlertTimeController.java
  62. 248 72
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java
  63. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue
  64. 39 26
      fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

+ 10 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/hooks/useApi.js

@@ -45,8 +45,10 @@ export const CUSTOMER_ADDED_EDITOR = `/custom/insertAndUpdate` // 客户新增
 export const CONTACT_PERSON_ADDITION_EDITOR = `/contacts/addContacts` // 联系人新增编辑
 export const TASK_ADD_EDIT = `/tasks/addTask` // 任务新增
 export const MODIFY_TASK = `/tasks/updateTask` // 任务编辑
+export const TASK_OPERATION = `/tasks/updateTaskStatus` // 任务操作
 export const PRODUCT_ADD_EDITOR = `/product/addOrUpdate` // 产品新增编辑
-export const CONTRACT_ADDITION_EDITING = `/contract/addContract` // 合同新增编辑
+export const CONTRACT_ADDITION_EDITING = `/contract/addContract` // 合同新增
+export const CONTRACT_EDITING = `/contract/editContract` // 合同编辑
 export const ORDER_ADDITION_EDITING = `/order/addOrUpdate` // 订单新增编辑
 export const PLAN_TO_ADD_EDITORS = `/visitPlan/addOrUpdateVisitPlan` // 计划新增编辑
 
@@ -61,8 +63,9 @@ export const GET_ORDER_RELATED_TASKS = `/order/taskWithOrder` // 获取销售订
 export const OBTAIN_ORDER_RELATED_PRODUCTS = `/order/productWithOrder` // 获取销售订单关联产品
 export const OBTAIN_DETAILS_OF_THE_VISIT_PLAN = `/visitPlan/getVisitPlanDetail` // 获取访客计划详情
 export const GET_PRODUCT_DETAILS = `/product/detail` // 获取产品详情
-
+export const GET_TASK_DETAILS = `/tasks/getTaskDetail` // 获取任务详情
 export const SELL_AND_OBTAIN_RELATED_PRODUCTS = `/product/orderWithProduct` // 销售订单关联产品
+export const OBTAIN_CONTRACT_DETAILS = `/contract/getContractDetail` // 获取合同详情
 
 export const GET_CONTACTS_WITH_MORE_I_DS = `/contacts/getAllContacts` // 更具Id获取联系人
 export const CONTACT_PERSON_ASSOCIATED_WITH_BUSINESS_OPPORTUNITY = `/business-opportunity/saveContactsId` // 联系人关联商机
@@ -111,4 +114,8 @@ export const OBTAIN_DATA_SUMMARY = `/order/dataSummary` // 获取数据汇总
 export const STAGE_OF_OBTAINING_BUSINESS_OPPORTUNITIES = `/order/businessOpportunityStage` // 获取商机阶段
 export const ACQUISITION_STAGE = `/business-opportunity/getStage` // 获取阶段
 export const PROMOTION_STAGE = `/business-opportunity/saveStageId` // 推进阶段
-export const STAGE_NOTES = `/business-opportunity/saveReason` // 阶段备注
+export const STAGE_NOTES = `/business-opportunity/saveReason` // 阶段备注
+export const OBTAIN_SALES_ORDER_RECEIPTS = `/order/paymentCollectionList` // 获取销售订单收款列表
+export const NEW_SALES_ORDER_PAYMENT_COLLECTION = `/order/paymentCollection` // 新建销售订单收款
+export const SALES_ORDER_COLLECTION_EDITING = `/order/editPayment` // 编辑销售订单收款
+export const DELETE_SALES_ORDER_PAYMENT_RECORDS = `/order/deletePayment` // 删除销售订单收款记录

+ 26 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleDetails/index.vue

@@ -36,13 +36,21 @@
         </template>
       </div>
     </template>
+
+    <template v-slot:headerRight>
+      <template v-if="currentRoutingInformation?.key == 'tasks'">
+        <div class="themeTextColor" @click="jumpEdit()">编辑</div>
+      </template>
+    </template>
   </Page>
 </template>
 
 <script setup>
 import { ref } from 'vue';
 import { useLifecycle } from '@hooks/useCommon.js';
+import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
 import useRouterStore from "@store/useRouterStore.js";
+import useFixedData from "@store/useFixedData.js"
 
 import Business from "@pages/pageComponents/business/detail.vue"
 import Thread from "@pages/pageComponents/thread/detail.vue"
@@ -53,6 +61,7 @@ import Product from "@pages/pageComponents/product/detail.vue"
 import Contract from "@pages/pageComponents/contract/detail.vue"
 import Order from "@pages/pageComponents/order/detail.vue"
 
+const fixedData = useFixedData()
 const router = useRouterStore()
 const queryParameters = ref({})
 const currentRoutingInformation = ref({})
@@ -62,6 +71,23 @@ function reloadListData(data) {
   currentRoutingInformation.value = JSON.parse(routerInfo)
 }
 
+function jumpEdit() {
+  const formJson = fixedData.formJson[currentRoutingInformation.value.key] || []
+  const formList = resetListData(formJson?.list)
+  const filedObj = getListFieldKey(formList, queryParameters.value)
+  const formVal = { ...queryParameters.value, ...filedObj, id: queryParameters.value.id }
+  console.log(formVal, '<=== formVal')
+  router.navigateTo({
+    pathName: 'addEditor',
+    success: () => {
+      router.emit('addEditorParameter', {
+        routerInfo: JSON.stringify(currentRoutingInformation.value),
+        filedValue: JSON.stringify(formVal)
+      })
+    }
+  })
+}
+
 useLifecycle({
   load: () => {
     router.on('detailParameter', (data) => {

+ 27 - 5
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleList/moduleList.vue

@@ -273,6 +273,8 @@ const listData = ref({
 });
 const excessiveData = ref({});
 const dialogSelection = ref({});
+const timeout = ref(null)
+
 
 // 按钮触发的事件: row 为当前点击的行数据, item 为当前点击的按钮
 function longPress(row, item) {
@@ -457,12 +459,17 @@ async function getListData(flag = false) {
   if (flag) {
     loadingList.value = true
   }
-  const res = await requests.post(url, {
+  let formVal = {
     pageIndex: listData.value.pageIndex,
     pageSize: listData.value.pageSize,
     pageFrom: listData.value.pageSize,
-    [queryParameters.value?.searchFiled?.search]: searchVal.value
-  }).finally(() => {
+    [queryParameters.value?.searchFiled?.search]: searchVal.value,
+  }
+
+  if(queryParameters.value?.key == 'product') {
+    formVal.status = 1
+  }
+  const res = await requests.post(url, { ...formVal }).finally(() => {
     if (flag) {
       loadingList.value = false
     }
@@ -511,14 +518,29 @@ function dialogCloseBefo(val) {
   return true
 }
 
+function chuliReloadListData(data) {
+  clearTimeout(timeout.value);
+  timeout.value = setTimeout(() => {
+    reloadListData(data)
+  }, 100);
+}
+
+function chuliOnRefresh(data) {
+  clearTimeout(timeout.value);
+  timeout.value = setTimeout(() => {
+    onRefresh(true)
+  }, 100);
+}
+
 useLifecycle({
   load: () => {
+    chuliOnRefresh(true)
     router.on('moduleListDetailParameter', (data) => {
-      reloadListData(data)
+      chuliReloadListData(data)
     })
 
     router.eventOn('moduleListRefreshData', (data) => {
-      onRefresh(true)
+      chuliOnRefresh(true)
     })
   }
 });

+ 10 - 4
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/addEditor.vue

@@ -64,10 +64,16 @@ function onSubmit() {
     if(flagVal) {
       return
     }
-    newList.forEach((item) => {
-      item.typeName = item.productType
-      delete item.id
-    })
+
+    for(let i in newList) {
+      if(!newList[i].totalPrice || newList[i].totalPrice == '0') {
+        toastText(`相关产品【${newList[i].productName}】请填写完整`)
+        return
+      }
+      newList[i].typeName = newList[i].productType
+      delete newList[i].id
+    }
+
     const newForm = {
       ...props.formValue,
       ...res.data,

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/addEditor.vue

@@ -17,7 +17,7 @@ import { useLifecycle } from '@hooks/useCommon.js';
 import CustomerForm from '@components/common/formForm/formView.vue'
 import requests from "@common/requests";
 import useToast from "@hooks/useToast"
-import { CONTRACT_ADDITION_EDITING } from "@hooks/useApi"
+import { CONTRACT_ADDITION_EDITING, CONTRACT_EDITING } from "@hooks/useApi"
 import useRouterStore from "@store/useRouterStore.js";
 
 const router = useRouterStore()
@@ -38,7 +38,7 @@ function onSubmit() {
       return
     }
     toastLoading('保存中', 0)
-    requests.post(CONTRACT_ADDITION_EDITING, { ...props.formValue, ...res.data }).then(() => {
+    requests.post(props.formValue?.id ? CONTRACT_EDITING : CONTRACT_ADDITION_EDITING, { ...props.formValue, ...res.data }).then(() => {
       toastSuccess('保存成功')
       setTimeout(() => {
         router.navigateBack({

+ 6 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/detail.vue

@@ -18,6 +18,8 @@
           {{ infoData.payment ? (100 * infoData.payment / infoData.amounts).toFixed(1) + '%' : '0%' }}
         </template>
       </van-cell>
+      <van-cell title="计划开始时间" :value="infoData.startDate" />
+      <van-cell title="计划结束时间" :value="infoData.endDate" />
       <van-cell title="下笔回款日期" :value="infoData.nextPaymentDate">
         <template #default>
           {{ infoData.nextPaymentDate ? infoData.nextPaymentDate : '-' }}
@@ -64,7 +66,7 @@ import requests from "@common/requests";
 import { showConfirmDialog } from 'vant';
 import { useLifecycle } from '@hooks/useCommon.js';
 import { fixedFieldStatusArray } from '@/utility/defaultData.js';
-import { CONTRACT_APPROVED } from '@hooks/useApi'
+import { CONTRACT_APPROVED, OBTAIN_CONTRACT_DETAILS } from '@hooks/useApi'
 import useShowToast from '@hooks/useToast'
 import useInfoStore from '@store/useInfoStore'
 import useRouterStore from "@store/useRouterStore.js";
@@ -183,7 +185,9 @@ function jumpEdit() {
 }
 
 function getDetails(id) {
-  // 获取合同详情
+  requests.post(OBTAIN_CONTRACT_DETAILS, { id }).then((res) => {
+    infoData.value = res.data || {}
+  })
 }
 function processingData(id) {
   clearTimeout(timeout.value);

+ 4 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/addEditor.vue

@@ -67,6 +67,10 @@ function onSubmit() {
     }
     let newList = businessItemProductList.value.filter(item => item.productId)
     for (let i in newList) {
+      if(!newList[i].totalPrice || newList[i].totalPrice == '0') {
+        toastText(`相关产品【${newList[i].productName}】请填写完整`)
+        return
+      }
       newList[i].sealPrice = newList[i].sellingPrice
       newList[i].discount = newList[i].discount
       newList[i].num = newList[i].quantity

+ 4 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/detail.vue

@@ -10,6 +10,9 @@
       <van-tab title="相关产品" name="相关产品">
         <RelatedProducts :infoList="relatedProductsList" />
       </van-tab>
+      <van-tab title="回款" name="回款">
+        <PaymentCollection :info="infoData" />
+      </van-tab> 
     </van-tabs>
   </div>
 </template>
@@ -22,6 +25,7 @@ import requests from "@common/requests";
 import OrderInfo from './orderInfo.vue';
 import RelatedTasks from '../tasks/relatedTasks.vue';
 import RelatedProducts from '../product/relatedProducts.vue';
+import PaymentCollection from './paymentCollection.vue';
 
 const props = defineProps({
   info: {

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/orderInfo.vue

@@ -25,7 +25,7 @@
           <span class="text-[#FF8B32]" v-if="info.unReceivedPayment">¥ {{ info.unReceivedPayment }}</span>
         </template>
       </van-cell>
-      <van-cell title="订单类型" :value="info.type" />
+      <van-cell title="订单类型" :value="info.typeName" />
       <van-cell title="下单时间" :value="info.placeTime" />
       <van-cell title="订单开始时间" :value="info.orderStartDate" />
       <van-cell title="订单结束时间" :value="info.orderEndDate" />
@@ -75,7 +75,7 @@ import { ref } from 'vue';
 import { showConfirmDialog } from 'vant';
 import { useLifecycle } from '@hooks/useCommon.js';
 import { fixedFieldPaymentStatus } from "@utility/defaultData" 
-import { TRANSFER_CLUES } from '@hooks/useApi'
+import { TRANSFER_CLUES, TRANSFER_SALES_ORDERS } from '@hooks/useApi'
 import requests from "@common/requests";
 import useShowToast from '@hooks/useToast'
 import useInfoStore from '@store/useInfoStore'
@@ -154,7 +154,7 @@ function confirmTransfer() {
     return toastText('请选择要转移的人员')
   }
 
-  requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: dialogSelection.value.value }).then((res) => {
+  requests.post(TRANSFER_SALES_ORDERS, { id: props.info.id, userId: dialogSelection.value.value }).then((res) => {
     toastSuccess('转移成功')
     showDialog.value = false
     setTimeout(() => {

+ 156 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/paymentCollection.vue

@@ -0,0 +1,156 @@
+<template>
+  <div class="flex flex-col h-full paymentCollection">
+    <div class="info flex-1 overflow-y-auto cellnormall">
+      <template v-if="paymentPlanList.length">
+        <div class="bg-white py-2 mb-4" v-for="item in paymentPlanList" :key="item.id">
+          <van-cell-group inset>
+            <van-cell title="回款时间" :value="item.createTime" />
+            <van-cell title="操作人">
+              <template #default>
+                <TranslationComponent :openId="item.creatorName"></TranslationComponent>
+              </template>
+            </van-cell>
+            <van-cell title="回款金额" :value="item.money" />
+            <van-cell title="未回款金额" :value="item.unReceivedPayment" />
+            <van-cell title="操作">
+              <template #default>
+                <div class="flex justify-end">
+                  <div class="mr-3 themeTextColor" @click="editPaymentCollection(item)">编辑</div>
+                  <div class="text-[red]" @click="deletePaymentCollection(item)">删除</div>
+                </div>
+              </template>
+            </van-cell>
+          </van-cell-group>
+        </div>
+      </template>
+      <template v-else>
+        <van-empty description="暂无数据" />
+      </template>
+    </div>
+    <div class="bottomButton">
+      <van-button type="primary" class="w-full block" @click="addPaymentCollection">添加回款</van-button>
+    </div>
+
+    <!-- 添加回款 -->
+    <van-dialog v-model:show="showDialog" :title="`${dialogNumberVal.rowId ? '编辑' : '新增'}回款金额`" show-cancel-button
+      @confirm="addEditReceipt" :before-close="dialogCloseBefo">
+      <van-field v-model="dialogNumberVal.val" type="digit" label="回款金额" placeholder="请输入回款金额" />
+    </van-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue';
+import { showConfirmDialog } from 'vant';
+import { useLifecycle } from '@hooks/useCommon.js';
+import { OBTAIN_SALES_ORDER_RECEIPTS, NEW_SALES_ORDER_PAYMENT_COLLECTION, SALES_ORDER_COLLECTION_EDITING, DELETE_SALES_ORDER_PAYMENT_RECORDS } from '@hooks/useApi'
+import requests from "@common/requests";
+import useShowToast from '@hooks/useToast'
+
+const { toastSuccess, toastFail, toastText } = useShowToast()
+const props = defineProps({
+  info: {
+    type: Object,
+    required: true,
+    default: () => ({})
+  }
+})
+const paymentPlanList = ref([])
+const showDialog = ref(false);
+const dialogNumberVal = ref({
+  rowId: null,
+  val: null
+})
+
+watch(() => props.info, (newValue) => {
+  processingData(newValue.id)
+})
+
+function deletePaymentCollection(row) {
+  showConfirmDialog({
+    message: `确定删除该回款记录吗?`,
+  }).then(() => {
+    requests.post(DELETE_SALES_ORDER_PAYMENT_RECORDS, { paymentId: row.id }).then(() => {
+      toastSuccess('操作成功')
+      processingData(props.info.id)
+    }).catch((err) => {
+      toastFail(err.msg ? err.msg : '删除失败')
+    })
+  })
+}
+
+function addEditReceipt() {
+  const { rowId, val } = dialogNumberVal.value
+  if (!val || val <= 0) {
+    toastText('请填写回款金额并且不能为负数')
+    return
+  }
+  const url = rowId ? SALES_ORDER_COLLECTION_EDITING : NEW_SALES_ORDER_PAYMENT_COLLECTION
+  const arrList = paymentPlanList.value.filter(item => item.id !== rowId)
+  const totalMoney = arrList.reduce((acc, item) => acc + item.money, 0);
+  const orderAmount = props.info.price
+  const formVal = {
+    [rowId ? 'paymentId' : 'orderId']: rowId ? rowId : props.info.id,
+    money: val,
+  }
+  if ((+totalMoney + val) > orderAmount) {
+    toastText('回款金额不能大于订单金额')
+    return
+  }
+  requests.post(url, formVal).then(() => {
+    toastSuccess('操作成功')
+    processingData(props.info.id)
+    showDialog.value = false
+  })
+}
+
+function addPaymentCollection() {
+  dialogNumberVal.value = { rowId: null, val: null }
+  showDialog.value = true
+}
+
+function editPaymentCollection(row) {
+  const { id, money } = row
+  dialogNumberVal.value = { rowId: id, val: money }
+  showDialog.value = true
+}
+
+function processingData(id) {
+  requests.post(OBTAIN_SALES_ORDER_RECEIPTS, { orderId: id }).then((res) => {
+    paymentPlanList.value = res.data.reverse()
+  })
+}
+
+function dialogCloseBefo(val) {
+  if (val == 'confirm' && showDialog.value) {
+    return false
+  }
+
+  return true
+}
+
+
+useLifecycle({
+  init: () => {
+    processingData(props.info.id)
+  }
+});
+</script>
+
+<style lang='scss' scoped>
+.paymentCollection {
+  .bottomButton {
+    margin: 0 14px;
+    padding-bottom: 30px;
+
+    :deep(.van-button) {
+      margin-bottom: 20px;
+    }
+  }
+
+  .info {
+    margin: 8px 4px 30px 4px;
+    padding: 10px
+  }
+}
+</style>

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/newAndModifiedRelatedProducts.vue

@@ -71,6 +71,7 @@
       placeholder="请输入"
       :max="form.inventory ? +form.inventory : 0"
       :min="0"
+      @blur="inputNumberChange('quantity')"
       @input="inputNumberChange('quantity')"
     ></van-field>
     <van-field

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/productInfo.vue

@@ -141,13 +141,13 @@ function confirmTransfer() {
 
 function claimAndClaim() {
   showConfirmDialog({
-    title: '认领线索',
-    message: `确定认领【${props.info.clueName}】线索吗?`,
+    title: '认领产品',
+    message: `确定认领【${props.info.productName}】产品吗?`,
   }).then(() => {
     requests.post(TRANSFER_PRODUCTS, { id: props.info.id, userId: userInfo.userInfo.id }).then((res) => {
       toastSuccess('认领成功')
       listReloadData()
-      props.info.inchargerName = userInfo.userInfo.clueName
+      props.info.inchargerName = userInfo.userInfo.name
       showDialog.value = false
     })
   })

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/addEditor.vue

@@ -3,7 +3,7 @@
     <div class="flex-1 overflow-y-auto">
       <van-form ref="vanFormRef" show-error :show-error-message="false" label-align="left" input-align="right"
         class="bg-white" @submit="onSubmit">
-        <van-field v-model="vantFormVal.taskName" name="taskName" rows="2" label="任务名称" maxlength="100" required
+        <van-field v-model.trim="vantFormVal.taskName" name="taskName" rows="2" label="任务名称" maxlength="100" required
           show-word-limit type="textarea" placeholder="请输入" />
         <van-field v-model="vantFormVal.priority" name="priority" label="优先级" placeholder="请选择" is-link readonly
           required @click="showSelectionBox('priority', fixedFieldPriority)">

+ 107 - 9
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/detail.vue

@@ -1,16 +1,58 @@
 <template>
-  <div class="w-full h-full flex-col">
+  <div class="w-full h-full flex flex-col">
     <div class="bg-white info flex-1 overflow-y-auto">
-      <van-cell title="任务名称" :value="''" />
-      <van-cell title="优先级" :value="''" />
+      <van-cell title="任务名称" :value="infoData.taskName" />
+      <van-cell title="优先级">
+        <template #default>
+          {{ fixedFieldPriority.find(subItem => subItem.value == infoData.priority)?.label || '' }}
+        </template>
+      </van-cell>
+      <van-cell title="状态" :value="''">
+        <template #default>
+          <div :style="`color: ${fixedFieldTaskStatus.find(subItem => subItem.value == infoData.status)?.color}`">
+            {{ fixedFieldTaskStatus.find(subItem => subItem.value == infoData.status)?.label || '' }}
+          </div>
+        </template>
+      </van-cell>
+      <van-cell title="执行人">
+        <template #default>
+          <TranslationComponent :openId="infoData.taskExecutors" />
+        </template>
+      </van-cell>
+      <van-cell title="开始时间" :value="infoData.startDate" />
+      <van-cell title="截至时间" :value="infoData.endDate" />
+      <van-cell title="客户名称" :value="infoData.customName" v-if="infoData.customName" />
+      <van-cell title="商机名称" :value="infoData.businessName" v-if="infoData.businessName" />
+      <van-cell title="销售订单" :value="infoData.orderName" v-if="infoData.orderName" />
+      <van-cell title="线索名称" :value="infoData.clueName" v-if="infoData.clueName" />
+      <van-cell title="联系人名称" :value="infoData.contactsName" v-if="!infoData.clueId" />
+      <van-cell title="联系人号码" :value="infoData.contactsPhone" v-if="!infoData.clueId" />
+    </div>
+    <div class="bottomButton">
+      <van-button type="success" class="w-full block" @click="completeTheTask(2)" v-if="infoData.status != 2">完成任务</van-button>
+      <van-button type="primary" class="w-full block" @click="completeTheTask(0)" v-if="infoData.status == 2">重启任务</van-button>
+      <van-button type="danger" class="w-full block" @click="deleteTask">删除任务</van-button>
     </div>
   </div>
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
+import { showConfirmDialog } from 'vant';
 import { useLifecycle } from '@hooks/useCommon.js';
+import { GET_TASK_DETAILS, TASK_OPERATION } from "@hooks/useApi"
+import requests from "@common/requests";
+import { fixedFieldPaymentStatus, fixedFieldPriority, fixedFieldTaskStatus, fixedFieldStatusArray } from "@utility/defaultData"
+import useShowToast from '@hooks/useToast'
+import { routingInfos } from "@utility/generalVariables"
+import useInfoStore from '@store/useInfoStore'
+import useFixedData from "@store/useFixedData.js"
+import useRouterStore from "@store/useRouterStore.js";
 
+const router = useRouterStore()
+const fixedData = useFixedData()
+const userInfo = useInfoStore()
+const { toastSuccess, toastFail, toastText } = useShowToast()
 const props = defineProps({
   info: {
     type: Object,
@@ -18,25 +60,81 @@ const props = defineProps({
     default: () => ({})
   }
 })
+const routingInformation = routingInfos['tasks']
+const infoData = ref(props.info);
+const timeout = ref(null);
+
+watch(() => props.info, (newValue) => {
+  initializeData(newValue.id)
+})
+
+function completeTheTask(status) {
+  const id = infoData.value.id
+  requests.post(TASK_OPERATION, { id, status }).then(({ data }) => {
+    toastSuccess('操作成功')
+    getTaskDetails(id)
+  })
+}
 
-function getTaskDetails() {
-  
+function deleteTask() {
+  const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
+  const row = infoData.value
+  const foemVal = { [routingInformation.key == 'tasks' ? 'taskIds' : 'ids']: row.id }
+  showConfirmDialog({
+    title: `删除${name}`,
+    message: `确定删除【${row[searchFiled?.search]}】${name}吗?`,
+  }).then(() => {
+    requests.post(deteleFiled, { ...foemVal }).then((res) => {
+      toastSuccess('删除成功')
+      router.navigateBack({
+        success: () => {
+          router.emit('moduleListDetailParameter', {
+            row: JSON.stringify(routingInformation)
+          })
+        }
+      })
+    }).catch((err) => {
+      toastFail(err.msg ? err.msg : '删除失败')
+    })
+  })
 }
 
-function initializeData() {
+function getTaskDetails(id) {
+  requests.post(GET_TASK_DETAILS, { id }).then(({ data }) => {
+    infoData.value = data
+  })
+}
 
+function initializeData(id) {
+  clearTimeout(timeout.value);
+  timeout.value = setTimeout(() => {
+    getTaskDetails(id)
+  }, 100);
 }
 
 useLifecycle({
   load: () => {
-    initializeData()
+    initializeData(props.info.id)
   },
   init: () => {
-    initializeData()
+    initializeData(props.info.id)
+  },
+  unLoad: () => {
+    clearTimeout(timeout.value);
   }
 });
 </script>
 
 <style lang='scss' scoped>
+.bottomButton {
+  margin: 0 14px;
+  padding-bottom: 30px;
 
+  :deep(.van-button) {
+    margin-bottom: 20px;
+  }
+}
+.info {
+  margin: 8px 14px 30px 14px;
+}
 </style>

+ 18 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/thread/threadInfo.vue

@@ -16,6 +16,7 @@
       <van-cell title="备注" :value="info.remark" />
     </div>
     <div class="bottomButton">
+      <van-button type="primary" class="w-full block" v-if="info.inchargerName"  @click="transformBusinessOpportunities()">线索转商机</van-button>
       <van-button type="warning" class="w-full block" v-if="info.inchargerName"  @click="showDialogCli()">转移线索</van-button>
       <van-button type="primary" class="w-full block" v-if="!info.inchargerName" @click="claimAndClaim()">认领线索</van-button>
       <van-button type="default" class="w-full block" v-permission="[routingInformation.jurisdiction.edit]" @click="jumpEdit()">编辑线索</van-button>
@@ -70,6 +71,23 @@ const showDialog = ref(false);
 const showSelect = ref(false);
 const dialogSelection = ref({});
 
+function transformBusinessOpportunities() {
+  const InfoJson = routingInfos['business']
+  const formJson = fixedData.formJson[InfoJson.key] || []
+  const formList = resetListData(formJson?.list)
+  const filedObj = getListFieldKey(formList, props.info)
+  const formVal = { ...filedObj, inchargerId: '', name: props.info?.clueName, clueId: props.info?.id }
+  router.redirectTo({
+    pathName: 'addEditor',
+    success: () => {
+      router.emit('addEditorParameter', {
+        routerInfo: JSON.stringify(InfoJson),
+        filedValue: JSON.stringify(formVal)
+      })
+    }
+  })
+}
+
 function deleteRow() {
   const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
   const row = props.info

+ 15 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/customInstructions.js

@@ -1,6 +1,6 @@
 // 权限控制
 const PermissionDirective = { // 数组, 权限 code 和 布尔值,
-    updated(el, binding, vnode ) {
+    updated(el, binding, vnode) {
         const routePath = vnode.ctx.appContext.config.globalProperties.$route.path;
         const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '');
         const authorityCodes = (userInfo?.userInfo?.functionList || []).map(({ code }) => code);
@@ -22,9 +22,22 @@ const PermissionDirective = { // 数组, 权限 code 和 布尔值,
     },
 };
 
+// 去掉输入框首尾空格的指令
+const TrimWhitespaceDirective = {
+    beforeMount(el) {
+        if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') {
+            // 监听输入事件,去掉首尾空格
+            el.addEventListener('input', () => {
+                el.value = el.value.trim();
+            });
+        }
+    }
+};
+
 // 导出的自定义指令
 const customize = [
-    { key: 'permission', directive: PermissionDirective, name: '角色权限' }
+    { key: 'permission', directive: PermissionDirective, name: '角色权限' },
+    { key: 'trim-whitespace', directive: TrimWhitespaceDirective, name: '去除首尾空格' }
 ]
 
 export default customize;

+ 7 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContractController.java

@@ -78,6 +78,13 @@ public class ContractController {
         return contractService.exportContractOneToMany(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId,customerOrg,finishStatus);
     }
 
+
+    @RequestMapping("/getContractDetail")
+    public HttpRespMsg getContractDetail (HttpServletRequest request, Integer id){
+        return contractService.getContractDetail(request,id);
+    }
+
+
     /**
      * 导入合同
      */

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

@@ -167,7 +167,7 @@ public class ProductController {
                 msg.setError("存在已绑定到相关任务的产品,删除失败");
                 return msg;
             }
-            if(orderProductDetailService.count(new LambdaQueryWrapper<OrderProductDetail>().in(OrderProductDetail::getOrderId,idList))>0){
+            if(orderProductDetailService.count(new LambdaQueryWrapper<OrderProductDetail>().in(OrderProductDetail::getProductId,idList))>0){
                 msg.setError("存在关联订单的产品,删除失败");
                 return msg;
             }

+ 23 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java

@@ -235,6 +235,10 @@ public class SalesOrderController {
                 msg.setError("存在关联产品的订单,删除失败");
                 return msg;
             }
+            if(taskService.count(new LambdaQueryWrapper<Task>().eq(Task::getIsDelete,0).in(Task::getOrderId,idList))>0){
+                msg.setError("存在关联任务的订单,删除失败");
+                return msg;
+            }
             orderList.forEach(o->{
                 o.setIsDelete(1);
                 o.setUpdateTime(LocalDateTime.now());
@@ -513,7 +517,17 @@ public class SalesOrderController {
         SalesOrderPayment payment = salesOrderPaymentService.getById(paymentId);
         SalesOrder salesOrder = salesOrderService.getById(payment.getOrderId());
         List<SalesOrderPayment> list = salesOrderPaymentService.list(new LambdaQueryWrapper<SalesOrderPayment>().eq(SalesOrderPayment::getOrderId, salesOrder.getId()).orderByAsc(SalesOrderPayment::getCreateTime));
-        int i = list.indexOf(payment);
+//        int i = list.indexOf(payment);
+        int i = 0;
+        for (SalesOrderPayment salesOrderPayment : list) {
+            if(salesOrderPayment.getId().equals(paymentId)){
+                break;
+            }
+            i++;
+        }
+
+        System.out.println("i==="+i);
+
         if(money!=null){
             if(salesOrder.getReceivedStatus()==2){
                 msg.setError("当前订单已完全回款");
@@ -532,9 +546,14 @@ public class SalesOrderController {
             BigDecimal nowMoney = new BigDecimal(money);
             BigDecimal oldMoney = payment.getMoney();
             //离当前回款数据最近一次回款的未回款数据作为依据
-            SalesOrderPayment salesOrderPayment =list.size()>1?list.get(i-1):list.get(i);
-            BigDecimal unReceivedPayment = salesOrderPayment.getUnReceivedPayment();
-            unReceivedPayment=unReceivedPayment.add(oldMoney).subtract(nowMoney);
+            BigDecimal unReceivedPayment = new BigDecimal(0);
+            if(i ==0){
+                unReceivedPayment = salesOrder.getPrice().subtract(payment.getMoney());
+            }else{
+                SalesOrderPayment salesOrderPayment =list.size()>1?list.get(i-1):list.get(i);
+                unReceivedPayment = salesOrderPayment.getUnReceivedPayment();
+                unReceivedPayment=unReceivedPayment.add(oldMoney).subtract(nowMoney);
+            }
             payment.setMoney(new BigDecimal(money));
             payment.setUnReceivedPayment(unReceivedPayment);
             if(!salesOrderPaymentService.updateById(payment)){

+ 8 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java

@@ -124,6 +124,11 @@ public class TaskController {
         return taskService.updateTaskStatus(taskDto,request);
     }
 
+    @RequestMapping("getTaskDetail")
+    public HttpRespMsg getTaskDetail(Integer id){
+        return taskService.getTaskDetail(id,request);
+    }
+
     /**
      * 定时修改过期的任务状态
      */
@@ -311,7 +316,8 @@ public class TaskController {
             for (String userId : executorIdList) {
                 Information information = new Information();
                 information.setUserId(userId).setMsg(msg)
-                        .setTime(new Date()).setChecked(0);
+                        .setTime(new Date()).setChecked(0)
+                        .setPath("/tasks");
                 informationArrayList.add(information);
             }
             informationService.saveBatch(informationArrayList);
@@ -330,7 +336,7 @@ public class TaskController {
             for (String userId : executorIdList) {
                 Information information = new Information();
                 information.setUserId(userId).setMsg(msg)
-                        .setTime(new Date()).setChecked(0);
+                        .setTime(new Date()).setChecked(0).setPath("/tasks");
                 informationArrayList.add(information);
                 User user = userMapper.selectById(userId);
                 WxCorpInfo corpinfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));

+ 6 - 7
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Information.java

@@ -1,17 +1,16 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.Date;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.util.Date;
+
 /**
  * <p>
  * 提示消息
@@ -66,7 +65,7 @@ public class Information extends Model<Information> {
     @TableField("msg")
     private String msg;
 
-    @TableField(exist = false)
+    @TableField("path")
     private String path;
 
 

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

@@ -44,4 +44,6 @@ public interface ContractService extends IService<Contract> {
     HttpRespMsg pinContract(Contract contract, HttpServletRequest request);
 
     HttpRespMsg undoPin(Contract contract, HttpServletRequest request);
+
+    HttpRespMsg getContractDetail(HttpServletRequest request, Integer id);
 }

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

@@ -40,4 +40,6 @@ public interface TaskService extends IService<Task> {
     HttpRespMsg pinTasks(Task task, HttpServletRequest request);
 
     HttpRespMsg undoPin(Task task, HttpServletRequest request);
+
+    HttpRespMsg getTaskDetail(Integer id, HttpServletRequest request);
 }

+ 3 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessTripServiceImpl.java

@@ -1,17 +1,15 @@
 package com.management.platform.service.impl;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.controller.AuditWorkflowSettingController;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.service.AuditWorkflowSettingService;
 import com.management.platform.service.BusinessTripService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.DepartmentService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.util.ExcelUtil;
@@ -353,6 +351,7 @@ public class BusinessTripServiceImpl extends ServiceImpl<BusinessTripMapper, Bus
                 +(auditor.getCorpwxUserid() != null ? ("$userName="+auditor.getCorpwxUserid()+"$"):auditor.getName()));
         information.setType(5);
         information.setContent(sheet.getId()+"");
+        information.setPath("/business-trip");
         informationMapper.insert(information);
     }
 
@@ -365,6 +364,7 @@ public class BusinessTripServiceImpl extends ServiceImpl<BusinessTripMapper, Bus
         information.setMsg("出差待审核, 申请人:" + (owner.getCorpwxUserid() != null?("$userName="+owner.getCorpwxUserid()+"$"):owner.getName()));
         information.setType(5);
         information.setContent(sheet.getId()+"");
+        information.setPath("/business-trip");
         informationMapper.insert(information);
     }
 

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

@@ -1116,6 +1116,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             information.setUserId(target.getCreatorId());
             information.setType(6);
             information.setMsg("您提交的合同[" + target.getName() + "]由[" + user.getName() + "]审核通过。");
+            information.setPath("/contract");
             informationMapper.insert(information);
         }else if (status.equals(2)){
             contractLog.setType(3);
@@ -1130,6 +1131,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             int i = item.indexOf("原因:");
             String substring = item.substring(i, item.length());
             information.setMsg("您提交的合同[" + target.getName() + "]被[" + user.getName() + "]驳回," + substring + "。");
+            information.setPath("/contract");
             informationMapper.insert(information);
         }
         contractLogMapper.insert(contractLog);
@@ -1672,4 +1674,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         );
         return respMsg;
     }
+
+    @Override
+    public HttpRespMsg getContractDetail(HttpServletRequest request, Integer id) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+        Contract contract = contractMapper.selectById(id);
+        List<ContractCustom> selectedList = contractCustomMapper.selectList(new QueryWrapper<ContractCustom>().eq("contract_id", contract.getId()));
+        if (selectedList != null && !selectedList.isEmpty()) {
+            contract.setCustomData(selectedList.get(0));
+        }
+        List<ContractPayCustomized> payCustomizedList = contractPayCustomizedMapper.selectList(new QueryWrapper<ContractPayCustomized>().eq("contract_id", contract.getId()));
+        if (payCustomizedList != null && !payCustomizedList.isEmpty()) {
+            contract.setPayCustomizedData(payCustomizedList.get(0));
+        }
+        respMsg.setData(contract);
+        return respMsg;
+
+    }
 }

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

@@ -5,11 +5,8 @@ import com.alibaba.fastjson.JSONObject;
 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.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.jayway.jsonpath.internal.function.numeric.Sum;
-import com.management.platform.constant.Constant;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
@@ -20,7 +17,6 @@ import com.management.platform.util.MessageUtils;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.Header;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
@@ -37,7 +33,6 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.time.Instant;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -251,6 +246,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                         information.setMsg("费用报销待审核");
                         information.setType(3);
                         information.setContent(sheet.getCreateDate()+"");
+                        information.setPath("/expense-sheet");
                         informationList.add(information);
                     }
                     informationService.saveBatch(informationList);
@@ -346,6 +342,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                         information.setMsg("费用报销待审核");
                         information.setType(3);
                         information.setContent(sheet.getCreateDate()+"");
+                        information.setPath("/expense-sheet");
                         informationList.add(information);
                     }
                     informationService.saveBatch(informationList);
@@ -398,6 +395,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                 information.setMsg("费用报销待审核");
                 information.setType(3);
                 information.setContent(sheet.getCreateDate()+"");
+                information.setPath("/expense-sheet");
                 informationList.add(information);
             }
             informationService.saveBatch(informationList);
@@ -680,6 +678,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                     information.setMsg("费用报销待审核");
                     information.setType(3);
                     information.setContent(sheet.getCreateDate()+"");
+                    information.setPath("/expense-sheet");
                     informationList.add(information);
                 }
                 informationService.saveBatch(informationList);
@@ -794,6 +793,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                 +(auditor.getCorpwxUserid() != null ? ("$userName="+auditor.getCorpwxUserid()+"$"):auditor.getName()));
         information.setType(3);//费用报销模块
         information.setContent(sheet.getId()+"");
+        information.setPath("/expense-sheet");
         informationMapper.insert(information);
     }
 

+ 3 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/InformationServiceImpl.java

@@ -69,9 +69,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
                 }
             }
 
-            information.forEach(i->{
-                i.setPath("/tasks");
-            });
+//            information.forEach(i->{
+//                i.setPath("/tasks");
+//            });
             httpRespMsg.data = information;
         } catch (NullPointerException e) {
             //httpRespMsg.setError("验证失败");

+ 3 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/LeaveSheetServiceImpl.java

@@ -5,13 +5,12 @@ import com.alibaba.fastjson.JSONObject;
 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.controller.AuditWorkflowSettingController;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import com.management.platform.util.WorkDayCalculateUtils;
@@ -19,15 +18,11 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import javax.xml.transform.Source;
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -214,6 +209,7 @@ public class LeaveSheetServiceImpl extends ServiceImpl<LeaveSheetMapper, LeaveSh
                 +(auditor.getCorpwxUserid() != null ? ("$userName="+auditor.getCorpwxUserid()+"$"):auditor.getName()));
         information.setType(4);
         information.setContent(sheet.getId()+"");
+        information.setPath("/leave-sheet");
         informationMapper.insert(information);
     }
 
@@ -226,6 +222,7 @@ public class LeaveSheetServiceImpl extends ServiceImpl<LeaveSheetMapper, LeaveSh
         information.setMsg("请假待审核, 请假人:" + (owner.getCorpwxUserid() != null?("$userName="+owner.getCorpwxUserid()+"$"):owner.getName()));
         information.setType(4);
         information.setContent(sheet.getId()+"");
+        information.setPath("/leave-sheet");
         informationMapper.insert(information);
     }
 

+ 3 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -2598,6 +2598,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             information.setContent(format);//日报的日期
             //information.setMsg(projectName+"项目,日报审批通过");
             information.setMsg(projectName + MessageUtils.message("other.proDailyRep"));
+            information.setPath("/report");
             informationList.add(information);
 
             userIdList.add(n.getUserId());
@@ -2819,7 +2820,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             fillUserId = oneReport.getCreatorId();
         }
 
-        informationMapper.insert(new Information().setType(0).setContent(date).setUserId(fillUserId).setMsg(str));
+        informationMapper.insert(new Information().setType(0).setContent(date).setUserId(fillUserId).setMsg(str).setPath("/report"));
         //对导入审核,添加记录
         int channel = oldState == -1 ? 0 : 1; //0-导入审核, 项目报告审核
         ReportAuditLog log = new ReportAuditLog();
@@ -6259,7 +6260,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             String str = MessageUtils.message("report.dailyReject", createDate, pNames, user.getName(), reason);
             String fillUserId = oneReport.getCreatorId();
 
-            informationMapper.insert(new Information().setType(0).setContent(createDate).setUserId(fillUserId).setMsg(str));
+            informationMapper.insert(new Information().setType(0).setContent(createDate).setUserId(fillUserId).setMsg(str).setPath("/report"));
 
             //发送企业微信通知消息
             User reporter = userMapper.selectById(fillUserId);

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

@@ -170,7 +170,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 taskExecutorMapper.insert(taskExecutor);
                 information.setUserId(executorId);
             }
-            information.setTime(new Date()).setChecked(0).setMsg("你有新的任务");
+            information.setTime(new Date()).setChecked(0).setMsg("你有新的任务").setPath("/tasks");
             informationArrayList.add(information);
             informationService.saveBatch(informationArrayList);
             if (wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
@@ -864,7 +864,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
                                 Information information = new Information();
                                 information.setUserId(userList.stream().filter(u -> u.getId().equals(userId)).collect(Collectors.toList()).get(0).getId());
-                                information.setMsg("你有新的任务").setTime(new Date()).setChecked(0);
+                                information.setMsg("你有新的任务").setTime(new Date()).setChecked(0).setPath("/tasks");
                                 informationArrayList.add(information);
                             }
                         }
@@ -1290,6 +1290,57 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         return respMsg;
     }
 
+    @Override
+    public HttpRespMsg getTaskDetail(Integer id, HttpServletRequest request) {
+        HttpRespMsg respMsg = new HttpRespMsg();
+        TasKVo tasKVo = new TasKVo();
+        Task task = taskMapper.selectById(id);
+        if (task!=null){
+            BeanUtils.copyProperties(task,tasKVo);
+            if (task.getContactsId()!=null){
+                Contacts contacts = contactsMapper.selectById(task.getContactsId());
+                if (contacts!=null){
+                    tasKVo.setContactsName(contacts.getName());
+                }
+            }
+            if (task.getClueId()!=null){
+                Clue clue = clueMapper.selectById(task.getClueId());
+                if (clue!=null){
+                    tasKVo.setClueName(clue.getClueName());
+                }
+            }
+            if (task.getCustomId()!=null){
+                Custom custom = customMapper.selectById(task.getCustomId());
+                if (custom!=null){
+                    tasKVo.setCustomName(custom.getCustomName());
+                }
+            }
+            if (task.getBusinessOpportunityId()!=null){
+                BusinessOpportunity businessOpportunity = businessOpportunityMapper.selectById(task.getBusinessOpportunityId());
+                if (businessOpportunity!=null){
+                    tasKVo.setBusinessName(businessOpportunity.getName());
+                }
+            }
+            if (task.getOrderId()!=null){
+                SalesOrder salesOrder = salesOrderMapper.selectById(task.getOrderId());
+                if (salesOrder!=null){
+                    tasKVo.setOrderName(salesOrder.getOrderName());
+                }
+            }
+            List<TaskExecutor> executorList = taskExecutorService.list(new QueryWrapper<TaskExecutor>().eq("task_id", id));
+            if (!executorList.isEmpty()){
+                List<String> collect = executorList.stream().map(TaskExecutor::getExecutorName).collect(Collectors.toList());
+                tasKVo.setTaskExecutors(collect);
+            }
+            List<TaskLog> taskLogList = taskLogService.list(new QueryWrapper<TaskLog>().eq("task_id", id));
+            if (!taskLogList.isEmpty()){
+                tasKVo.setTaskLogs(taskLogList);
+            }
+        }
+        respMsg.setData(tasKVo);
+        return respMsg;
+    }
+
     public void updateTaskRepeatConfigure(Task task){
         task.setRepeatType(null).setRepeatEndNever(null).setRepeatEndCount(null)
                 .setRepeatEndDate(null).setRepeatDesignDay(null).setRepeatDesignSameday(null)

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

@@ -244,10 +244,10 @@ public class VisitPlanServiceImpl extends ServiceImpl<VisitPlanMapper, VisitPlan
             return httpRespMsg;
         }
         VisitPlan taskPlan = visitPlanMapper.selectById(planId);
-        if(1 == taskPlan.getFinishState()){
-            httpRespMsg.setError("无法修改已完成的计划");
-            return httpRespMsg;
-        }
+//        if(1 == taskPlan.getFinishState()){
+//            httpRespMsg.setError("无法修改已完成的计划");
+//            return httpRespMsg;
+//        }
         Date oldVisitTime = taskPlan.getVisitTime();
         long milliCosts = oldVisitTime.getTime() - now.getTime();
         if(milliCosts <= 30 * 60 * 1000 && milliCosts > 0){

+ 3 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/time/VisitPlanTask.java

@@ -15,6 +15,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -41,6 +42,7 @@ public class VisitPlanTask {
     public void checkRemindMessage() {
         Date now = new Date();
         System.out.println("===开始检查该分钟需提醒的访客计划==="+now);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         List<VisitPlan> visitPlans = visitPlanMapper.getMinuteVisitPlans(now);
         System.out.println("需提醒计划数量为: "+visitPlans.size());
         List<WxCorpInfo> wxCorpInfos = wxCorpInfoMapper.selectList(null);
@@ -65,6 +67,7 @@ public class VisitPlanTask {
                 String join = StringUtils.join(wxIds, '|');
                 if (wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&StringUtils.isNotBlank(join)){
                     // getCorpwxUserid  以 | 隔开 可分割开放
+                    System.out.println("公司:"+companyId+"在时刻"+sdf.format(now)+"的访客ids=== "+entry.getValue().stream().map(VisitPlan::getId).collect(Collectors.toList()));
                     wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,join,"访客计划提醒",null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_VISIT_PLAN);
                 }
 

+ 3 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -518,13 +518,13 @@
         </if>
         order by c.need_pin desc,c.pin_time desc
         <choose>
-            <when test="isDesc == null">
+            <when test="clue.isDesc == null">
                 ,c.id DESC
             </when>
-            <when test="isDesc == 0">
+            <when test="clue.isDesc == 0">
                 ,sd.seq ASC, c.id DESC
             </when>
-            <when test="isDesc == 1">
+            <when test="clue.isDesc == 1">
                 ,sd.seq DESC, c.id DESC
             </when>
             <otherwise>

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml

@@ -547,7 +547,7 @@
         incharger_id,
         (select `name` from `user` where id = incharger_id) inchargerName,
         creator_id,
-        (select `name` from `user` where id = creator_id) creatorName,c.need_pin,c.pin_time
+        (select `name` from `user` where id = creator_id) creatorName,need_pin,pin_time
         from custom
         where company_id = #{companyId}
         and is_delete =#{isDelete}

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -3028,8 +3028,8 @@ public class ReportController {
     }
 
     @RequestMapping("/getReportTimeLessThanCardTimeList")
-    public HttpRespMsg getReportTimeLessThanCardTimeList(String date) {
-        return reportService.getReportTimeLessThanCardTimeList(date);
+    public HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId) {
+        return reportService.getReportTimeLessThanCardTimeList(date, deptId, userId);
     }
 
 

+ 165 - 115
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -112,23 +112,21 @@ public class TaskController {
     @Value(value = "${upload.path}")
     private String path;
 
-    //用于控制线程锁
-    public static HashMap<String, CorpwxJobResult> corpwxJobCenter = new HashMap();
-    public static HashMap<String, Integer> corpddJobCenter = new HashMap();
-    @Autowired
-    private ProjectCategoryMapper projectCategoryMapper;
-
     @Resource
-    private TimeTypeMapper timeTypeMapper;
+    private TaskFilesMapper taskFilesMapper;
 
     @Resource
-    private DepartmentMapper departmentMapper;
-    @Autowired
-    private TaskFilesMapper taskFilesMapper;
+    private TimeTypeMapper timeTypeMapper;
 
     @Resource
     private WxCorpInfoMapper wxCorpInfoMapper;
 
+    //用于控制线程锁
+    public static HashMap<String, CorpwxJobResult> corpwxJobCenter = new HashMap();
+    public static HashMap<String, Integer> corpddJobCenter = new HashMap();
+    @Autowired
+    private ProjectCategoryMapper projectCategoryMapper;
+
     @PostMapping("/getTaskChargePage")
     public HttpRespMsg getTaskChargePage(
             QueryTaskChargePage queryBO, HttpServletRequest request) {
@@ -145,23 +143,23 @@ public class TaskController {
     }
 
 
-    /***
-     * 文件审核
-     * @param taskId 任务id
-     * @param projectId 项目id
-     * @param auditStatus 审核状态 1通过 2驳回
-     * @param reason 驳回理由
-     * @param request
-     * @return
-     */
-    @PostMapping("/auditFile")
-    public HttpRespMsg auditFile(@RequestParam("taskId")Integer taskId
-            ,@RequestParam("projectId")String projectId
-            ,@RequestParam("auditStatus")Integer auditStatus
-            ,@RequestParam(value = "reason",required = false)String reason
-            ,HttpServletRequest request) {
-        return taskService.auditFile(taskId,projectId,auditStatus,reason,request);
-    }
+//    /***
+//     * 文件审核
+//     * @param taskId 任务id
+//     * @param projectId 项目id
+//     * @param auditStatus 审核状态 1通过 2驳回
+//     * @param reason 驳回理由
+//     * @param request
+//     * @return
+//     */
+//    @PostMapping("/auditFile")
+//    public HttpRespMsg auditFile(@RequestParam("taskId")Integer taskId
+//            ,@RequestParam("projectId")String projectId
+//            ,@RequestParam("auditStatus")Integer auditStatus
+//            ,@RequestParam(value = "reason",required = false)String reason
+//            ,HttpServletRequest request) {
+//        return taskService.auditFile(taskId,projectId,auditStatus,reason,request);
+//    }
 
     @RequestMapping("/save")
     @Transactional
@@ -180,24 +178,24 @@ public class TaskController {
             task.setCreaterName(user.getName());
             task.setCreatorColor(user.getColor());
             task.setCompanyId(user.getCompanyId());
-            TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-            Integer taskFileCharge = timeType.getTaskFileCharge();
-            if(1 == taskFileCharge){
-                //主管: 员工所在部门[department]的manager_id 阶段一
-                //项目经理:project表的in_charge_id 阶段二
-                Department department = departmentMapper.selectById(user.getDepartmentId());
-                Project project = projectMapper.selectById(task.getProjectId());
-                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
-                    msg.setError("员工所在部门无负责人,请重新设置");
-                    return msg;
-                }
-                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
-                    msg.setError("该项目未设置项目经理,请重新设置");
-                    return msg;
-                }
-                task.setChargeOneId(department.getManagerId());
-                task.setChargeTwoId(project.getInchargerId());
-            }
+//            TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+//            Integer taskFileCharge = timeType.getTaskFileCharge();
+//            if(1 == taskFileCharge){
+//                //主管: 员工所在部门[department]的manager_id 阶段一
+//                //项目经理:project表的in_charge_id 阶段二
+//                Department department = departmentMapper.selectById(user.getDepartmentId());
+//                Project project = projectMapper.selectById(task.getProjectId());
+//                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+//                    msg.setError("员工所在部门无负责人,请重新设置");
+//                    return msg;
+//                }
+//                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+//                    msg.setError("该项目未设置项目经理,请重新设置");
+//                    return msg;
+//                }
+//                task.setChargeOneId(department.getManagerId());
+//                task.setChargeTwoId(project.getInchargerId());
+//            }
         }
         if (!StringUtils.isEmpty(executorListStr)) {
             List<User> allUsers = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
@@ -332,15 +330,15 @@ public class TaskController {
                 needRecalculateProgress = true;
             }
         } else {
-            task.setChargeOneId(null);
-            task.setChargeStage(null);
-            task.setChargeOneStatus(null);
-            task.setChargeOneTime(null);
-            task.setChargeTwoId(null);
-            task.setChargeTwoStatus(null);
-            task.setChargeTwoTime(null);
-            task.setFinalChargeStatus(null);
-            task.setFileRejectReason(null);
+//            task.setChargeOneId(null);
+//            task.setChargeStage(null);
+//            task.setChargeOneStatus(null);
+//            task.setChargeOneTime(null);
+//            task.setChargeTwoId(null);
+//            task.setChargeTwoStatus(null);
+//            task.setChargeTwoTime(null);
+//            task.setFinalChargeStatus(null);
+//            task.setFileRejectReason(null);
             //更新的情况,需要对比是否修改了任务标题,更新子任务的parentTname
             Task oldTask = taskService.getById(task.getId());
             if (!oldTask.getName().equals(task.getName())) {
@@ -1368,77 +1366,129 @@ public class TaskController {
         List<Integer> collect = list.stream().map(l -> l.getId()).distinct().collect(Collectors.toList());
         collect.add(-1);
         List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
-        List<TaskFiles> taskFilesList = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>().in(TaskFiles::getTaskId, collect));
+        List<TaskFiles> taskFilesList = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>().eq(TaskFiles::getNeedFileCharge,1).in(TaskFiles::getTaskId, collect));
         List<Integer> pids = list.stream().map(Task::getProjectId).collect(Collectors.toList());
         pids.add(-1);
         List<Project> projectList = projectService.list(new QueryWrapper<Project>().in("id", pids));
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
-        CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
+//        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
+//        CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
         if(1 == timeType.getTaskFileCharge()){
-            List<String> userIds = new ArrayList<>();
-            List<String> chargeOneIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
-                    .map(Task::getChargeOneId).collect(Collectors.toList());
-            List<String> chargeTwoIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
-                    .map(Task::getChargeTwoId).collect(Collectors.toList());
-            userIds.addAll(chargeOneIds);
-            userIds.addAll(chargeTwoIds);
-
-            Map<String, User> userIdMap = new HashMap<>();
-            if(CollectionUtils.isNotEmpty(userIds)){
-                userIds = userIds.stream().distinct().collect(Collectors.toList());
-                List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
-                                .select(User::getId,User::getName)
-                        .in(User::getId, userIds)
-                );
-                userIdMap = users.stream().collect(Collectors.toMap(User::getId, t->t));
-            }
-            Map<Integer, List<TaskFiles>> taskFilesMap = new HashMap<>();
-            if(CollectionUtils.isNotEmpty(taskFilesList)){
-                taskFilesMap  = taskFilesList.stream().collect(Collectors.groupingBy(TaskFiles::getTaskId));
-            }
+            //根据该任务下的文件所处的状态判断
             for (Task task : list) {
-                List<TaskFiles> tmp = taskFilesMap.get(task.getId());
-                if(CollectionUtils.isEmpty(tmp)){
-                    continue;
-                }
-                if(org.apache.commons.lang3.StringUtils.isBlank(task.getChargeOneId()) || org.apache.commons.lang3.StringUtils.isBlank(task.getChargeTwoId())){
-                    continue;
-                }
-                if(1 == task.getFinalChargeStatus()){
-                    task.setFinalChargeStatusText("审核通过");
-                    task.setFileChargeStatus(1);
-                } else if (0 == task.getFinalChargeStatus()) {
-                    String name = "";
-                    String statusText = "";
-                    String userWxId = "";
-                    String fileChargeStatusText = "";
-                    int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
-                    String tmpUserId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
-                    User chargeUser = userIdMap.get(tmpUserId);
-                    if(null != chargeUser){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            userWxId = chargeUser.getCorpwxRealUserid();
-                        }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
-                            userWxId = chargeUser.getDingdingUserid();
-                        }
-                        name = chargeUser.getName();
-                    }
-                    switch (finalStatus)
-                    {
-                        case 0:  statusText = "待审核"; task.setFileChargeStatus(0);break;
-                        case 1:  statusText = "通过";break;
-                        case 2:  statusText = "驳回"; task.setFileChargeStatus(2);break;
-                    }
-                    if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
-                        fileChargeStatusText = statusText+"("+name+")";
-                    }else{
-                        fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
+                /**
+                 * 1、是否存在驳回文件
+                 *      过滤出上传人为当前登录人或审核人为当前登录人的任务文件
+                 *      若存在驳回文件,则显示存在驳回文件
+                 * 2、审核通过
+                 *      过滤出上传人为当前登录人或审核人为当前登录人的任务文件
+                 *      若都审核通过,则显示审核通过
+                 * 3、待审核
+                 *      过滤出上传人为当前登录人或审核人为当前登录人的任务文件
+                 *      若都是待审核或部分审核通过状态,则显示审核中
+                 **/
+                List<TaskFiles> currentTaskFiles = taskFilesList.stream().filter(tmp -> tmp.getTaskId().equals(task.getId()))
+                        .filter(t->{
+                            if(userId.equals(t.getCreatorId())){
+                                return true;
+                            } else if (userId.equals(t.getChargeOneId())) {
+                                return true;
+                            } else if (userId.equals(t.getChargeTwoId())) {
+                                return true;
+                            }else {
+                                return false;
+                            }
+                        })
+                        .collect(Collectors.toList());
+                if(CollectionUtils.isNotEmpty(currentTaskFiles)){
+                    //是否存在驳回
+                    long rejectCount = currentTaskFiles.stream().filter(tmp -> {
+                                if (2 == tmp.getChargeOneStatus() || 2 == tmp.getChargeTwoStatus()) {
+                                    return true;
+                                } else {
+                                    return false;
+                                }
+                            }).count();
+                    //是否都是全部通过
+                    long allPassCount = currentTaskFiles.stream().filter(tmp -> 1 == tmp.getFinalChargeStatus()).count();
+                    if(rejectCount > 0 ){
+                        task.setFileChargeStatus(2);
+                        task.setFinalChargeStatusText("存在驳回文件");
+                    } else if (allPassCount == currentTaskFiles.size()) {
+                        task.setFileChargeStatus(3);
+                        task.setFinalChargeStatusText("审核通过");
+                    }else {
+                        task.setFileChargeStatus(1);
+                        task.setFinalChargeStatusText("审核中");
                     }
-                    task.setFinalChargeStatusText(fileChargeStatusText);
+
                 }
+
             }
+
         }
+//            List<String> userIds = new ArrayList<>();
+//            List<String> chargeOneIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
+//                    .map(Task::getChargeOneId).collect(Collectors.toList());
+//            List<String> chargeTwoIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
+//                    .map(Task::getChargeTwoId).collect(Collectors.toList());
+//            userIds.addAll(chargeOneIds);
+//            userIds.addAll(chargeTwoIds);
+//            Map<String, User> userIdMap = new HashMap<>();
+//            if(CollectionUtils.isNotEmpty(userIds)){
+//                userIds = userIds.stream().distinct().collect(Collectors.toList());
+//                List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
+//                                .select(User::getId,User::getName)
+//                        .in(User::getId, userIds)
+//                );
+//                userIdMap = users.stream().collect(Collectors.toMap(User::getId, t->t));
+//            }
+//            Map<Integer, List<TaskFiles>> taskFilesMap = new HashMap<>();
+//            if(CollectionUtils.isNotEmpty(taskFilesList)){
+//                taskFilesMap  = taskFilesList.stream().collect(Collectors.groupingBy(TaskFiles::getTaskId));
+//            }
+//            for (Task task : list) {
+//                List<TaskFiles> tmp = taskFilesMap.get(task.getId());
+//                if(CollectionUtils.isEmpty(tmp)){
+//                    continue;
+//                }
+//                if(org.apache.commons.lang3.StringUtils.isBlank(task.getChargeOneId()) || org.apache.commons.lang3.StringUtils.isBlank(task.getChargeTwoId())){
+//                    continue;
+//                }
+//                if(1 == task.getFinalChargeStatus()){
+//                    task.setFinalChargeStatusText("审核通过");
+//                    task.setFileChargeStatus(1);
+//                } else if (0 == task.getFinalChargeStatus()) {
+//                    String name = "";
+//                    String statusText = "";
+//                    String userWxId = "";
+//                    String fileChargeStatusText = "";
+//                    int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
+//                    String tmpUserId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
+//                    User chargeUser = userIdMap.get(tmpUserId);
+//                    if(null != chargeUser){
+//                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+//                            userWxId = chargeUser.getCorpwxRealUserid();
+//                        }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+//                            userWxId = chargeUser.getDingdingUserid();
+//                        }
+//                        name = chargeUser.getName();
+//                    }
+//                    switch (finalStatus)
+//                    {
+//                        case 0:  statusText = "待审核"; task.setFileChargeStatus(0);break;
+//                        case 1:  statusText = "通过";break;
+//                        case 2:  statusText = "驳回"; task.setFileChargeStatus(2);break;
+//                    }
+//                    if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
+//                        fileChargeStatusText = statusText+"("+name+")";
+//                    }else{
+//                        fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
+//                    }
+//                    task.setFinalChargeStatusText(fileChargeStatusText);
+//                }
+//            }
+//        }
         list.forEach(l->{
             List<TaskExecutor> executorList = taskExecutorList.stream().filter(tl -> tl.getTaskId().equals(l.getId())&&tl.getExecutorId()!=null).collect(Collectors.toList());
             l.setExecutorList(executorList);

+ 304 - 100
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskFilesController.java

@@ -3,11 +3,11 @@ 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.conditions.update.LambdaUpdateWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.CompanyDingdingService;
 import com.management.platform.service.ProjectDocumentService;
+import com.management.platform.service.TaskFilesService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.task.SFTPAsyncUploader;
 import com.management.platform.util.DocumentTypeUtil;
@@ -18,6 +18,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -29,8 +30,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
 import java.time.LocalDateTime;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -75,6 +76,154 @@ public class TaskFilesController {
     @Resource
     private CompanyDingdingService companyDingdingService;
 
+    @Resource
+    private DepartmentMapper departmentMapper;
+
+    @Resource
+    private ProjectMapper projectMapper;
+
+    @Resource
+    private TaskFilesService taskFilesService;
+
+    @PostMapping("/reUploadFile")
+    public HttpRespMsg reUploadFile(@RequestParam Integer projectId,
+                                    @RequestParam Integer taskId,
+                                    @RequestParam Integer taskFileId,
+                                    @RequestParam("file") MultipartFile file,
+                                    HttpServletRequest request) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("Token"));
+        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+        Department department = departmentMapper.selectById(user.getDepartmentId());
+        Project project = projectMapper.selectById(projectId);
+        TaskFiles oldTaskFile = taskFilesMapper.selectById(taskFileId);
+
+        if(!oldTaskFile.getCreatorId().equals(user.getId())){
+            msg.setError("您非文件上传人,无法重新上传");
+            return msg;
+        }
+        if (oldTaskFile.getDocumentId() == null) {
+            //仅当前任务上传的,需要把文件删掉
+            File dir = new File(uploadPath);
+            File targetFile = new File(dir, oldTaskFile.getServerName());
+            if (targetFile.exists()) {
+                targetFile.delete();
+            }
+        }
+
+//        StringBuilder fileNames = new StringBuilder();
+        TaskFiles record = new TaskFiles();
+        record.setId(taskFileId);
+        record.setCreatorId(user.getId());
+        record.setCreatorName(user.getName());
+        record.setDocumentName(file.getOriginalFilename());
+        record.setTaskId(taskId);
+        record.setProjectId(projectId);
+        if(1 == timeType.getTaskFileCharge()){
+            record.setNeedFileCharge(1);
+            if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                msg.setError("员工所在部门无负责人,请重新设置");
+                return msg;
+            }
+            if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                msg.setError("该项目未设置项目经理,请重新设置");
+                return msg;
+            }
+            record.setChargeOneId(department.getManagerId());
+            record.setChargeTwoId(project.getInchargerId());
+            //根据老阶段重置任务状态
+            record.setFinalChargeStatus(0);
+            if(1 == oldTaskFile.getChargeStage()){
+                record.setChargeOneStatus(0);
+            }else if(2 == oldTaskFile.getChargeStage()){
+                record.setChargeTwoStatus(0);
+            } else if (3 == oldTaskFile.getChargeStage()) {
+                record.setChargeStage(1);
+                record.setChargeOneStatus(0);
+                record.setChargeTwoStatus(0);
+            }
+        }
+        if (file != null && !file.isEmpty()) {
+            //截取文件后缀
+            String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
+            record.setDocumentType(DocumentTypeUtil.DocumentType(fileSuffix));
+            //处理文件
+            File dir = new File(uploadPath);
+            if (!dir.exists()) {
+                dir.mkdir();
+            }
+            String fileName= "";
+            if (file!=null && !file.isEmpty()) {
+                fileName = file.getOriginalFilename();
+
+                int pos = fileName.lastIndexOf(".");
+                String suffix = fileName.substring(pos).toLowerCase();
+                //用uuid替换原始的文件名
+                String purFName = UUID.randomUUID().toString().replaceAll("-", "");
+                fileName = purFName + suffix;
+                File saveFile = new File(dir, fileName);
+                try {
+                    saveFile.createNewFile();
+                    file.transferTo(saveFile);
+                    //异步上传到备份服务器
+                    sftpAsyncUploader.uploadFileAsync(saveFile);
+                    //计算文件大小
+                    long fileSize = saveFile.length();
+                    String fileLength = FileUtil.getReadableFileSize(fileSize);
+                    record.setServerName(uploadPath + fileName);
+                    record.setSize(fileLength);
+                    String pathPrefix = "/upload/";
+                    record.setUrl(pathPrefix + fileName);
+
+                    taskFilesMapper.updateById(record);
+                    //生成原文件名称与服务器文件名称对应
+                    msg.data = record;
+
+
+                    //添加动态消息
+                    Task task = taskMapper.selectById(taskId);
+                    String content = user.getName()+"在任务【"+task.getName()+"】中重新上传了文件【"+file.getOriginalFilename()+"】";
+                    TaskComment comment =  new TaskComment();
+                    comment.setTaskId(taskId);
+                    comment.setUserId(user.getId());
+                    comment.setContent(content);
+                    comment.setCreateTime(LocalDateTime.now());
+                    comment.setUserColor(user.getColor());
+                    comment.setUserName(user.getName());
+                    taskCommentMapper.insert(comment);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    fileName = null;
+                    msg.setError(e.getMessage()+", path="+dir.getAbsolutePath());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    fileName = null;
+                    msg.setError(e.getMessage()+", path="+dir.getAbsolutePath());
+                }
+            } else {
+                //msg.setError("文件不存在");
+                msg.setError(MessageUtils.message("file.nonExistentError"));
+            }
+        }
+
+        return msg;
+
+    }
+
+
+    @PostMapping("/approveFile")
+    public HttpRespMsg approveFile(@RequestParam("taskFileIds")String taskFileIds
+            ,HttpServletRequest request) {
+        return taskFilesService.approveFile(taskFileIds,request);
+    }
+
+    @PostMapping("/rejectFile")
+    public HttpRespMsg rejectFile(@RequestParam("taskFileIds")String taskFileIds
+            ,@RequestParam(value = "reason",required = false)String reason
+            ,HttpServletRequest request) {
+        return taskFilesService.rejectFile(taskFileIds,reason,request);
+    }
+
     /**
      * 获取该项目下的所有有效的文件列表
      * @param keyword
@@ -114,17 +263,32 @@ public class TaskFilesController {
         record.setSize(document.getSize());
         record.setServerName(document.getServerName());
         record.setUrl(document.getUrl());
-        taskFilesMapper.insert(record);
-
-        //判断文件阶段做回退处理
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
         if(1 == timeType.getTaskFileCharge()){
-            this.resetTaskChargeStatus(taskId);
+            record.setNeedFileCharge(1);
+            Department department = departmentMapper.selectById(user.getDepartmentId());
+            Project project = projectMapper.selectById(taskId);
+            if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                msg.setError("员工所在部门无负责人,请重新设置");
+                return msg;
+            }
+            if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                msg.setError("该项目未设置项目经理,请重新设置");
+                return msg;
+            }
+            record.setChargeOneId(department.getManagerId());
+            record.setChargeTwoId(project.getInchargerId());
         }
+        taskFilesMapper.insert(record);
+
+//        //判断文件阶段做回退处理[修改为对文件,废弃]
+//        if(1 == timeType.getTaskFileCharge()){
+//            this.resetTaskChargeStatus(taskId);
+//        }
 
         //添加动态消息
         Task task = taskMapper.selectById(taskId);
-        String content = user.getName()+"在任务:"+task.getName()+"中关联了文件:"+document.getDocumentName();
+        String content = user.getName()+"在任务【"+task.getName()+"】中关联了文件【"+document.getDocumentName()+"】";
         TaskComment comment =  new TaskComment();
         comment.setTaskId(taskId);
         comment.setUserId(user.getId());
@@ -164,6 +328,9 @@ public class TaskFilesController {
             HttpServletResponse response) throws Exception {
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("Token"));
+        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+        Department department = departmentMapper.selectById(user.getDepartmentId());
+        Project project = projectMapper.selectById(projectId);
         StringBuilder fileNames = new StringBuilder();
         for (MultipartFile file : files) {
             TaskFiles record = new TaskFiles();
@@ -173,6 +340,19 @@ public class TaskFilesController {
             fileNames.append(file.getOriginalFilename()).append(",");
             record.setTaskId(taskId);
             record.setProjectId(projectId);
+            if(1 == timeType.getTaskFileCharge()){
+                record.setNeedFileCharge(1);
+                if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
+                    msg.setError("员工所在部门无负责人,请重新设置");
+                    return msg;
+                }
+                if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
+                    msg.setError("该项目未设置项目经理,请重新设置");
+                    return msg;
+                }
+                record.setChargeOneId(department.getManagerId());
+                record.setChargeTwoId(project.getInchargerId());
+            }
             if (file != null && !file.isEmpty()) {
                 //截取文件后缀
                 String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
@@ -244,16 +424,16 @@ public class TaskFilesController {
             }
         }
 
-        //判断文件阶段做回退处理
-        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-        if(1 == timeType.getTaskFileCharge()){
-            this.resetTaskChargeStatus(taskId);
-        }
+        //判断文件阶段做回退处理[修改为对文件,废弃]
+//        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+//        if(1 == timeType.getTaskFileCharge()){
+//            this.resetTaskChargeStatus(taskId);
+//        }
 
         //添加动态消息
         String resFileNames = fileNames.deleteCharAt(fileNames.length() - 1).toString();
         Task task = taskMapper.selectById(taskId);
-        String content = user.getName()+"在任务:"+task.getName()+"中上传了文件:"+resFileNames;
+        String content = user.getName()+"在任务【"+task.getName()+"】中上传了文件【"+resFileNames+"】";
         TaskComment comment =  new TaskComment();
         comment.setTaskId(taskId);
         comment.setUserId(user.getId());
@@ -294,16 +474,15 @@ public class TaskFilesController {
         }
         taskFilesMapper.deleteById(id);
 
-        //判断文件阶段做回退处理
-
-        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-        if(1 == timeType.getTaskFileCharge()){
-            this.resetTaskChargeStatus(taskFiles.getTaskId());
-        }
+        //判断文件阶段做回退处理[修改为对文件,废弃]
+//        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+//        if(1 == timeType.getTaskFileCharge()){
+//            this.resetTaskChargeStatus(taskFiles.getTaskId());
+//        }
 
         //添加动态消息
         Task task = taskMapper.selectById(taskFiles.getTaskId());
-        String content = user.getName()+"删除了任务:"+task.getName()+"中的文件:"+taskFiles.getDocumentName();
+        String content = user.getName()+"删除了任务【"+task.getName()+"】中的文件【"+taskFiles.getDocumentName()+"】";
         TaskComment comment =  new TaskComment();
         comment.setTaskId(taskFiles.getTaskId());
         comment.setUserId(user.getId());
@@ -350,53 +529,72 @@ public class TaskFilesController {
     @RequestMapping(value="getTaskFiles")
     public HttpRespMsg getTaskFiles(Integer taskId,HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("Token"));
-        Task task = taskMapper.selectById(taskId);
+//        Task task = taskMapper.selectById(taskId);
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
         CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
-        String fileChargeStatusText = "";
-        int fileChargeStatus = 0;
-        if(1 == timeType.getTaskFileCharge()){
-            if(org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeOneId())
-                    &&org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeTwoId())){
-                if(1 == task.getFinalChargeStatus()){
-                    fileChargeStatusText = "审核通过";
-                    fileChargeStatus = 1;
-                } else if (0 == task.getFinalChargeStatus()) {
-                    String name = "";
-                    String statusText = "";
-                    String userWxId = "";
-                    int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
-                    String userId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
-                    User chargeUser = userMapper.selectById(userId);
-                    if(null != chargeUser){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            userWxId = chargeUser.getCorpwxRealUserid();
-                        }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
-                            userWxId = chargeUser.getDingdingUserid();
-                        }
-                        name = chargeUser.getName();
-                    }
-                    switch (finalStatus)
-                    {
-                        case 0:  statusText = "待审核";fileChargeStatus = 0;break;
-                        case 1:  statusText = "通过";break;
-                        case 2:  statusText = "驳回";fileChargeStatus = 2;break;
-                    }
-                    if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
-                        fileChargeStatusText = statusText+"("+name+")";
-                    }else{
-                        fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
-                    }
 
-                }
+        //审核通过的  或者是老文件 所有人都能看到
+        //审核不通过的需要判断 登录人 是否是 文件上传人/审核人一、二中的一个 ,能则可以看到
+        List<TaskFiles> list = taskFilesMapper.getTaskFiles(taskId,user.getId());
+
+        List<String> allIds = new ArrayList<>();
+        List<String> chargeOneIds = list.stream().filter(t -> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
+                .map(TaskFiles::getChargeOneId).collect(Collectors.toList());
+        List<String> chargeTwoIds = list.stream().filter(t -> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
+                .map(TaskFiles::getChargeTwoId).collect(Collectors.toList());
+        allIds.addAll(chargeOneIds);
+        allIds.addAll(chargeTwoIds);
+        Map<String,User> userIdMap = new HashMap<>();
+        if(CollectionUtils.isNotEmpty(allIds)){
+            List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, allIds));
+            if(CollectionUtils.isNotEmpty(users)){
+                userIdMap = users.stream().collect(Collectors.toMap(User::getId,t->t));
             }
         }
-        List<TaskFiles> list = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
-                .eq(TaskFiles::getTaskId,taskId)
-        );
         if(CollectionUtils.isNotEmpty(list)){
             for (TaskFiles taskFiles : list) {
+                String fileChargeStatusText = "";
+                int fileChargeStatus = 0;
+                if(1 == timeType.getTaskFileCharge()){
+                    if(0 == taskFiles.getNeedFileCharge()){
+                        fileChargeStatusText = "无审核状态";
+                        fileChargeStatus = 3;
+                    }else{
+                        if(1 == taskFiles.getFinalChargeStatus()){
+                            fileChargeStatusText = "审核通过";
+                            fileChargeStatus = 1;
+                        } else if (0 == taskFiles.getFinalChargeStatus()) {
+                            String name = "";
+                            String statusText = "";
+                            String userWxId = "";
+                            int finalStatus = 1==taskFiles.getChargeStage()?taskFiles.getChargeOneStatus():taskFiles.getChargeTwoStatus();
+                            String userId = 1==taskFiles.getChargeStage()?taskFiles.getChargeOneId():taskFiles.getChargeTwoId();
+                            User chargeUser = userIdMap.get(userId);
+                            if(null != chargeUser){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                    userWxId = chargeUser.getCorpwxRealUserid();
+                                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+                                    userWxId = chargeUser.getDingdingUserid();
+                                }
+                                name = chargeUser.getName();
+                            }
+                            switch (finalStatus)
+                            {
+                                case 0:  statusText = "待审核";fileChargeStatus = 0;break;
+                                case 1:  statusText = "通过";break;
+                                case 2:  statusText = "驳回";fileChargeStatus = 2;break;
+                            }
+                            if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
+                                fileChargeStatusText = statusText+"("+name+")";
+                            }else{
+                                fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
+                            }
+
+                        }
+                    }
+
+                }
                 taskFiles.setFileChargeStatusText(fileChargeStatusText);
                 taskFiles.setFileChargeStatus(fileChargeStatus);
             }
@@ -407,47 +605,53 @@ public class TaskFilesController {
     }
 
 
-    public void resetTaskChargeStatus(Integer taskId){
-        Task task = taskMapper.selectById(taskId);
-        if(1 == task.getFinalChargeStatus()){
-            //重置阶段一、二的时间、状态、理由
-            //重置 文件审核阶段为 1 阶段一  最终审核状态为 0未通过
-            taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                    .set(Task::getFinalChargeStatus, 0)
-                    .set(Task::getChargeStage,1)
-                    .set(Task::getChargeOneStatus,0)
-                    .set(Task::getChargeTwoStatus,0)
-                    .set(Task::getChargeOneTime,null)
-                    .set(Task::getChargeTwoTime,null)
-                    .set(Task::getFileRejectReason,null)
-//                    .set(Task::getChargeOneReason,null)
-//                    .set(Task::getChargeTwoReason,null)
-                    .eq(Task::getId,task.getId())
-            );
-        } else if (0 == task.getFinalChargeStatus()) {
-            //判断当前阶段
-            if(1==task.getChargeStage()){
-                //重置阶段一的时间、状态、理由
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getChargeOneStatus,0)
-                        .set(Task::getChargeOneTime,null)
-                        .set(Task::getFileRejectReason,null)
-                        .eq(Task::getId,task.getId())
-                );
-            } else if (2 == task.getChargeStage()) {
-                //重置阶段二的时间、状态、理由
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getChargeStage,1)
-                        .set(Task::getChargeOneStatus,0)
-                        .set(Task::getChargeOneTime,null)
-                        .set(Task::getChargeTwoStatus,0)
-                        .set(Task::getChargeTwoTime,null)
-                        .set(Task::getFileRejectReason,null)
-                        .eq(Task::getId,task.getId())
-                );
-            }
-        }
+
+    @RequestMapping(value = "/getUnChargedFilesByTaskId")
+    public HttpRespMsg getUnChargedFilesByTaskId(Integer taskId,HttpServletRequest request){
+        return taskFilesService.getUnChargedFilesByTaskId(taskId,request);
     }
 
+//    public void resetTaskChargeStatus(Integer taskId){
+//        Task task = taskMapper.selectById(taskId);
+//        if(1 == task.getFinalChargeStatus()){
+//            //重置阶段一、二的时间、状态、理由
+//            //重置 文件审核阶段为 1 阶段一  最终审核状态为 0未通过
+//            taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                    .set(Task::getFinalChargeStatus, 0)
+//                    .set(Task::getChargeStage,1)
+//                    .set(Task::getChargeOneStatus,0)
+//                    .set(Task::getChargeTwoStatus,0)
+//                    .set(Task::getChargeOneTime,null)
+//                    .set(Task::getChargeTwoTime,null)
+//                    .set(Task::getFileRejectReason,null)
+////                    .set(Task::getChargeOneReason,null)
+////                    .set(Task::getChargeTwoReason,null)
+//                    .eq(Task::getId,task.getId())
+//            );
+//        } else if (0 == task.getFinalChargeStatus()) {
+//            //判断当前阶段
+//            if(1==task.getChargeStage()){
+//                //重置阶段一的时间、状态、理由
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getChargeOneStatus,0)
+//                        .set(Task::getChargeOneTime,null)
+//                        .set(Task::getFileRejectReason,null)
+//                        .eq(Task::getId,task.getId())
+//                );
+//            } else if (2 == task.getChargeStage()) {
+//                //重置阶段二的时间、状态、理由
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getChargeStage,1)
+//                        .set(Task::getChargeOneStatus,0)
+//                        .set(Task::getChargeOneTime,null)
+//                        .set(Task::getChargeTwoStatus,0)
+//                        .set(Task::getChargeTwoTime,null)
+//                        .set(Task::getFileRejectReason,null)
+//                        .eq(Task::getId,task.getId())
+//                );
+//            }
+//        }
+//    }
+
 }
 

+ 9 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java

@@ -1,17 +1,9 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-
-import java.math.BigDecimal;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.management.platform.config.PropertyMsg;
@@ -21,6 +13,13 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 

+ 50 - 58
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Task.java

@@ -15,6 +15,11 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
 /**
  * <p>
  * 
@@ -213,63 +218,47 @@ public class Task extends Model<Task> {
     @TableField("sap_task_code")
     private String sapTaskCode;
 
-    /**
-     * 文件审核人一id
-     */
-    @TableField("charge_one_id")
-    private String chargeOneId;
-
-    /**
-     * 文件审核人一的审核状态 0待审核 1通过 2驳回
-     */
-    @TableField("charge_one_status")
-    private Integer chargeOneStatus;
-
-    /**
-     * 文件审核人一的审核时间
-     */
-    @TableField("charge_one_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime chargeOneTime;
-
-    /**
-     * 文件审核人二id
-     */
-    @TableField("charge_two_id")
-    private String chargeTwoId;
-
-    /**
-     * 文件审核人二的审核状态 0待审核 1通过 2驳回
-     */
-    @TableField("charge_two_status")
-    private Integer chargeTwoStatus;
-
-    /**
-     * 文件审核人二的审核时间
-     */
-    @TableField("charge_two_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime chargeTwoTime;
-
-    /**
-     * 文件最终审核状态 0未通过 1通过
-     */
-    @TableField("final_charge_status")
-    private Integer finalChargeStatus;
-
-    /**
-     * 文件审核阶段 1审核人一 2审核人二 3都审核通过
-     */
-    @TableField("charge_stage")
-    private Integer chargeStage;
-
-    /**
-     * 文件审核驳回原因
-     */
-    @TableField("file_reject_reason")
-    private String fileRejectReason;
+//    /**文件审核人一[部门负责人]id*/
+//    @TableField("charge_one_id")
+//    private String chargeOneId;
+//
+//
+//    /**文件审核人一的审核状态 0待审核 1通过 2驳回*/
+//    @TableField("charge_one_status")
+//    private Integer chargeOneStatus;
+//
+//    /**文件审核人一的审核时间*/
+//    @TableField("charge_one_time")
+//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+//    private Date chargeOneTime;
+//
+//    /**文件审核人二[项目审核人]id*/
+//    @TableField("charge_two_id")
+//    private String chargeTwoId;
+//
+//
+//    /**文件审核人二的审核状态 0待审核 1通过 2驳回*/
+//    @TableField("charge_two_status")
+//    private Integer chargeTwoStatus;
+//
+//    /**文件审核人二的审核时间*/
+//    @TableField("charge_two_time")
+//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+//    private Date chargeTwoTime;
+//
+//    /**文件审核阶段 1审核人一 2审核人二 3都审核通过*/
+//    @TableField("charge_stage")
+//    private Integer chargeStage;
+//
+//    /**文件最终审核状态  0未通过 1通过*/
+//    @TableField("final_charge_status")
+//    private Integer finalChargeStatus;
+//
+//    /**文件审核驳回原因*/
+//    @TableField("file_reject_reason")
+//    private String fileRejectReason;
 
     /**
      * 任务预估成本
@@ -311,7 +300,10 @@ public class Task extends Model<Task> {
     private List<User> userList;
 
     @TableField(exist = false)
-    /**0 待审核 1通过 2驳回*/
+    /**0 待审核 1通过 2驳回
+     * 2025-01-03 修改为
+     * 任务的外置状态显示 1审核中[待审核+(审核通过)] 2驳回[存在驳回文件]  3审核通过[全部审核通过]
+     * */
     private int fileChargeStatus;
 
     @Override

+ 52 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskFiles.java

@@ -78,10 +78,61 @@ public class TaskFiles extends Model<TaskFiles> {
     @TableField(exist = false)
     private String fileChargeStatusText;
 
-    /**0 待审核 1通过 2驳回*/
+    /**0 待审核 1通过 2驳回 3老文件无审核状态 前端用*/
     @TableField(exist = false)
     private Integer fileChargeStatus;
 
+    /**创建文件时是否开启审核功能 0否1是*/
+    @TableField("need_file_charge")
+    private Integer needFileCharge;
+
+    /**文件审核人一[部门负责人]id*/
+    @TableField("charge_one_id")
+    private String chargeOneId;
+
+    /**部门主管的审核状态 0待审核 1通过 2驳回*/
+    @TableField("charge_one_status")
+    private Integer chargeOneStatus;
+
+    /**部门主管的审核时间*/
+    @TableField("charge_one_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date chargeOneTime;
+
+    /**文件审核人二[项目审核人]id*/
+    @TableField("charge_two_id")
+    private String chargeTwoId;
+
+    /**项目经理的审核状态 0待审核 1通过 2驳回*/
+    @TableField("charge_two_status")
+    private Integer chargeTwoStatus;
+
+    /**项目经理的审核时间*/
+    @TableField("charge_two_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date chargeTwoTime;
+
+    /**文件审核阶段 1审核人一 2审核人二/项目经理 3都审核通过*/
+    @TableField("charge_stage")
+    private Integer chargeStage;
+
+    /**文件最终审核状态  0未通过 1通过*/
+    @TableField("final_charge_status")
+    private Integer finalChargeStatus;
+
+    /**文件审核驳回原因*/
+    @TableField("file_reject_reason")
+    private String fileRejectReason;
+
+
+    @TableField(exist = false)
+    private Integer companyId;
+
+    @TableField(exist = false)
+    private String taskName;
+
 
     @Override
     protected Serializable pkVal() {

+ 10 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -1,16 +1,16 @@
 package com.management.platform.entity;
 
-import java.math.BigDecimal;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.List;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * <p>
  * 
@@ -632,6 +632,10 @@ public class TimeType extends Model<TimeType> {
     @TableField("task_plan_cost")
     private Integer taskPlanCost;
 
+    /**项目进度判断依据,0-默认字段,1-根据任务工时*/
+    @TableField("project_progress_check")
+    private Integer projectProgressCheck;
+
 
     @TableField(exist = false)
     private List<User> userList;

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/bo/QueryTaskChargePage.java

@@ -11,4 +11,5 @@ public class QueryTaskChargePage {
     private Integer pageIndex = 1;
     private Integer pageSize;
     private String userId;
+    private Integer companyId;
 }

+ 14 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ProjectTaskTimeCostVO.java

@@ -0,0 +1,14 @@
+package com.management.platform.entity.vo;
+
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ProjectTaskTimeCostVO {
+    private Integer taskId;
+    private String executorId;
+    private Integer planHours;
+    private BigDecimal realHours;
+}

+ 12 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ProjectTimeCostVO.java

@@ -0,0 +1,12 @@
+package com.management.platform.entity.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ProjectTimeCostVO {
+    private Integer projectId;
+    private BigDecimal planHoursSum;
+    private BigDecimal realHoursSum;
+}

+ 26 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/TaskFileChargePageVO.java

@@ -0,0 +1,26 @@
+package com.management.platform.entity.vo;
+
+import com.management.platform.entity.TaskExecutor;
+import com.management.platform.entity.TaskFiles;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TaskFileChargePageVO {
+    private Integer taskId;
+    private String taskName;
+    private Integer projectId;
+    private String projectName;
+    private String executorId;//执行人id 多个
+    private List<TaskExecutor> executorList;
+    private Integer groupId;
+//    private String finalChargeId;
+//    private String finalChargeName;
+
+    /**任务的外置状态显示 1审核中[待审核+(审核通过)] 2驳回[存在驳回文件]  3审核通过[全部审核通过]*/
+//    private Integer taskChargeStatus;
+
+    private List<TaskFiles> childFiles;
+
+}

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskCommentMapper.java

@@ -2,6 +2,9 @@ package com.management.platform.mapper;
 
 import com.management.platform.entity.TaskComment;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface TaskCommentMapper extends BaseMapper<TaskComment> {
 
+    void insertBatch(@Param("commentList") List<TaskComment> commentList);
 }

+ 10 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskFilesMapper.java

@@ -2,6 +2,7 @@ package com.management.platform.mapper;
 
 import com.management.platform.entity.TaskFiles;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,5 +16,13 @@ import java.util.List;
  */
 public interface TaskFilesMapper extends BaseMapper<TaskFiles> {
 
-    List<Integer> getAllTaskIds();
+    List<Integer> getAllNeedChargeTaskIds();
+
+    List<TaskFiles> getTaskFiles(@Param("taskId") Integer taskId, @Param("userId") String userId);
+
+    List<TaskFiles> getAllNeedChargeTaskFiles();
+
+    List<TaskFiles> getUnChargedFilesByTaskId(@Param("taskId") Integer taskId, @Param("userId") String userId);
+
+    List<Integer> getTaskFilesByCreatorDeptId(@Param("departmentId") Integer departmentId);
 }

+ 11 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskMapper.java

@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.management.platform.entity.Task;
 import com.management.platform.entity.TimeTask;
 import com.management.platform.entity.bo.QueryTaskChargePage;
+import com.management.platform.entity.vo.ProjectTaskTimeCostVO;
+import com.management.platform.entity.vo.ProjectTimeCostVO;
 import com.management.platform.entity.vo.TaskChargePageVO;
+import com.management.platform.entity.vo.TaskFileChargePageVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
@@ -75,4 +78,12 @@ public interface TaskMapper extends BaseMapper<Task> {
 
     int getTaskPlanRealCount(Integer companyId, Integer projectId, Integer taskType, List<Integer> inchagerIds);
 
+
+    List<TaskFileChargePageVO> getTaskFileChargePage(@Param("queryBO") QueryTaskChargePage queryBO, @Param("deptIds")List<Integer> branchDepartment);
+
+    int getTaskFileChargePageTotal(@Param("queryBO") QueryTaskChargePage queryBO, @Param("deptIds")List<Integer> branchDepartment);
+
+    List<ProjectTaskTimeCostVO> getProjectAllTaskTimeCost(@Param("projectId") Integer projectId);
+
+    List<ProjectTimeCostVO> getProjectTaskTimeCostByIds(@Param("projectIds")List<Integer> projectIds);
 }

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

@@ -172,5 +172,5 @@ public interface ReportService extends IService<Report> {
 
     HttpRespMsg getCurAuditNode(String date, String userId);
 
-    HttpRespMsg getReportTimeLessThanCardTimeList(String date);
+    HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId);
 }

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TaskFilesService.java

@@ -2,6 +2,9 @@ package com.management.platform.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.TaskFiles;
+import com.management.platform.util.HttpRespMsg;
+
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>
@@ -13,4 +16,9 @@ import com.management.platform.entity.TaskFiles;
  */
 public interface TaskFilesService extends IService<TaskFiles> {
 
+    HttpRespMsg approveFile(String taskFileIds,HttpServletRequest request);
+
+    HttpRespMsg rejectFile(String taskFileIds,String reason, HttpServletRequest request);
+
+    HttpRespMsg getUnChargedFilesByTaskId(Integer taskId, HttpServletRequest request);
 }

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

@@ -55,7 +55,7 @@ public interface TaskService extends IService<Task> {
 
     HttpRespMsg getTaskByUserId(String startDate, String endDate, String userId, Integer pageIndex, Integer pageSize);
 
-    HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request);
+//    HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request);
 
     HttpRespMsg getFileRejectReason(String taskId, HttpServletRequest request);
 

+ 15 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java

@@ -1,8 +1,7 @@
 package com.management.platform.service.impl;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.DepartmentMasterVO;
@@ -12,16 +11,15 @@ import com.management.platform.mapper.*;
 import com.management.platform.service.DepartmentService;
 import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.WxCorpInfoService;
-import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.ListUtil;
 import com.management.platform.util.MessageUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.*;
 import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -82,6 +80,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     private String corpId;
     @Value("${providerSecret}")
     private String providerSecret;
+    @Autowired
+    private TaskFilesMapper taskFilesMapper;
+
     //新增部门
     @Override
     public HttpRespMsg insertDepartment(String departmentName, Integer superiorId, String managerId, String reportAuditUserid,String otherManagerIds,  HttpServletRequest request) {
@@ -243,6 +244,15 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                         departmentOtherManagerMapper.delete(new QueryWrapper<DepartmentOtherManager>().eq("department_id",departmentId));
                     }
                 }
+
+                //修改任务文件审核人
+                List<Integer> taskFileIds = taskFilesMapper.getTaskFilesByCreatorDeptId(departmentId);
+                if(CollectionUtils.isNotEmpty(taskFileIds)){
+                    taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                            .set(TaskFiles::getChargeOneId,managerId)
+                            .in(TaskFiles::getId,taskFileIds)
+                    );
+                }
             }
         } catch (NullPointerException e) {
             e.printStackTrace();

+ 49 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -11,12 +11,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.ImmutableMap;
 import com.management.platform.entity.*;
-import com.management.platform.entity.Task;
 import com.management.platform.entity.vo.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.util.*;
-import com.management.platform.webservice.po.*;
+import com.management.platform.webservice.po.ProjectQueryResponse;
+import com.management.platform.webservice.po.ProjectTask;
+import com.management.platform.webservice.po.ServiceProduct;
+import com.management.platform.webservice.po.XmlResponseData;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
@@ -30,7 +33,6 @@ import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.ss.formula.functions.T;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.streaming.SXSSFCell;
@@ -55,7 +57,9 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
 import java.sql.Timestamp;
-import java.text.*;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
 import java.time.*;
 import java.time.chrono.ChronoLocalDate;
 import java.time.format.DateTimeFormatter;
@@ -1584,6 +1588,28 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }
             }
 
+            //以里程碑完成度来算还是按任务工时完成度
+            if(1== timeType.getProjectProgressCheck()){
+                List<ProjectTimeCostVO> projectTimeCostList = taskMapper.getProjectTaskTimeCostByIds(projectIds);
+                if(CollectionUtils.isNotEmpty(projectTimeCostList)){
+                    Map<Integer, ProjectTimeCostVO> projectTimeMap = projectTimeCostList.stream()
+                            .collect(Collectors.toMap(ProjectTimeCostVO::getProjectId, t -> t));
+                    for (ProjectVO projectVO : list) {
+                        ProjectTimeCostVO tmpVO = projectTimeMap.get(projectVO.getId());
+                        if(null != tmpVO){
+                            int percentRes = 0;
+                            if(tmpVO.getPlanHoursSum().compareTo(new BigDecimal(0)) > 0){
+                                percentRes = tmpVO.getRealHoursSum().multiply(new BigDecimal(100))
+                                        .divide(tmpVO.getPlanHoursSum(),RoundingMode.HALF_UP).intValue();
+                            }
+                            projectVO.setProgress(percentRes);
+                        }
+                    }
+
+                }
+            }
+
+
             //stringList.add("未分类");
             stringList.add(MessageUtils.message("excel.unclassified"));
             Long total = projectIPage.getTotal();
@@ -3258,6 +3284,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         Integer companyId = user.getCompanyId();
         TimeType timeType = timeTypeMapper.selectById(companyId);
         Project project = projectMapper.selectById(id);
+
+        //以里程碑完成度来算还是按任务工时完成度
+        if(1 == timeType.getProjectProgressCheck()){
+            List<ProjectTaskTimeCostVO> allTaskCosts = taskMapper.getProjectAllTaskTimeCost(id);
+            if(CollectionUtils.isNotEmpty(allTaskCosts)){
+                BigDecimal planHourSum = new BigDecimal(0);
+                BigDecimal realHourSum = new BigDecimal(0);
+                for (ProjectTaskTimeCostVO taskCost : allTaskCosts) {
+                    planHourSum = planHourSum.add(new BigDecimal(String.valueOf(taskCost.getPlanHours())));
+                    realHourSum = realHourSum.add(new BigDecimal(String.valueOf(taskCost.getRealHours())));
+                }
+                int percentRes = 0;
+                if(planHourSum.compareTo(new BigDecimal(0)) > 0){
+                    percentRes = realHourSum.multiply(new BigDecimal(100)).divide(planHourSum,RoundingMode.HALF_UP).intValue();
+                }
+                project.setProgress(percentRes);
+            }
+        }
+
         List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
         if (project.getInchargerId() != null) {
             User incharger = userMapper.selectById(project.getInchargerId());

+ 47 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -10380,12 +10380,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     }
 
     @Override
-    public HttpRespMsg getReportTimeLessThanCardTimeList(String date) {
+    public HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId) {
         //获取自己的考勤未填满的记录
         User user = userMapper.selectById(request.getHeader("token"));
         Integer companyId = user.getCompanyId();
         //获取考勤表记录
-        List<UserCorpwxTime> userCorpwxTimeList = null;
+        List<UserCorpwxTime> userCorpwxTimeList = new ArrayList<>();
         //date格式为2024-09, 需要获取该月的第一天和最后一天
         LocalDate firstDay = LocalDate.parse(date + "-01");
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
@@ -10393,15 +10393,45 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         boolean canViewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全公司工时");
         List<User> manageUserList = new ArrayList<>();
         if (canViewAll) {
-            userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
-            manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            if (!StringUtils.isEmpty(userId)) {
+                User findUser = userMapper.selectById(userId);
+                if (findUser != null) {
+                    userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", findUser.getCorpwxUserid()).between("create_date", firstDay, lastDay));
+                    manageUserList.add(findUser);
+                }
+            } else  if (deptId != null) {
+                //按部门过滤
+                List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+                manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
+                if (manageUserList.size() > 0) {
+                    List<String> collect = manageUserList.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
+                    userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", collect).between("create_date", firstDay, lastDay));
+                }
+            } else {
+                userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
+                manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            }
         } else {
             //是否是部门负责人
             List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
             if (allDeptIds.size() > 0) {
-                //有部门工时的查看权限
-                //取部门的人员
-                manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
+                if (!StringUtils.isEmpty(userId)) {
+                    User findUser = userMapper.selectById(userId);
+                    if (findUser != null) {
+                        manageUserList.add(findUser);
+                    }
+                } else if (deptId != null) {
+                    //按部门过滤
+                    if (allDeptIds.contains(deptId)) {
+                        List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                        List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+                        manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
+                    }
+                } else {
+                    //取部门的人员
+                    manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
+                }
                 //如果自己不在manageUserList中,加进去
                 if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
                     manageUserList.add(user);
@@ -10429,13 +10459,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
         //获取填报工时记录表
         List<Report> reportList = new ArrayList<>();
-        if (canViewAll) {
+        if (canViewAll && StringUtils.isEmpty(userId) && deptId == null) {
+            //查看全公司的
             reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("company_id", companyId).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
         } else if (manageUserList.size() > 0) {
             List<String> userIdList = manageUserList.stream().map(User::getId).collect(Collectors.toList());
-            reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").in("creator_id", userIdList).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
-        } else {
-            reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("creator_id", user.getId()).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+            if (userIdList.size() > 0) {
+                if (userIdList.size() == 1) {
+                    //按单个人匹配
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("creator_id", userIdList.get(0)).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+                } else {
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").in("creator_id", userIdList).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+                }
+            }
         }
         //比对userCorpwxTimeList和reportList,找出工时未填满的记录
         List<Map<String, Object>> resultList = new ArrayList<>();

+ 199 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskFilesServiceImpl.java

@@ -1,10 +1,27 @@
 package com.management.platform.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.management.platform.entity.TaskFiles;
+import com.management.platform.entity.*;
+import com.management.platform.mapper.TaskCommentMapper;
 import com.management.platform.mapper.TaskFilesMapper;
+import com.management.platform.mapper.UserMapper;
+import com.management.platform.mapper.WxCorpInfoMapper;
+import com.management.platform.service.CompanyDingdingService;
 import com.management.platform.service.TaskFilesService;
+import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.util.HttpRespMsg;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +34,185 @@ import org.springframework.stereotype.Service;
 @Service
 public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles> implements TaskFilesService {
 
+    @Resource
+    private TaskFilesMapper taskFilesMapper;
+
+    @Resource
+    private WxCorpInfoMapper wxCorpInfoMapper;
+
+    @Resource
+    private UserMapper userMapper;
+
+    @Resource
+    private WxCorpInfoService wxCorpInfoService;
+
+    @Resource
+    private TaskCommentMapper taskCommentMapper;
+
+    @Resource
+    private CompanyDingdingService companyDingdingService;
+
+
+    @Override
+    @Transactional
+    public HttpRespMsg approveFile(String taskFileIds,HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("Token"));
+        String[] array = taskFileIds.split(",");
+        if(0 != array.length){
+            List<String> ids = Arrays.stream(array).collect(Collectors.toList());
+            //审核文件
+            List<TaskFiles> taskFilesList = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
+                            .eq(TaskFiles::getFinalChargeStatus,0)
+                            .eq(TaskFiles::getNeedFileCharge,1)
+                    .in(TaskFiles::getId,ids));
+            //通过
+            List<Integer> stageOneToUpdateList = new ArrayList<>();
+            List<Integer> stageTwoToUpdateList = new ArrayList<>();
+            List<TaskComment> commentList = new ArrayList<>();
+            for (TaskFiles taskFiles : taskFilesList) {
+                //判断所处阶段
+                if(1 == taskFiles.getChargeStage()){
+                    stageOneToUpdateList.add(taskFiles.getId());
+                } else if (2 == taskFiles.getChargeStage()) {
+                    stageTwoToUpdateList.add(taskFiles.getId());
+                }
+                String content = user.getName()+"审核通过了任务文件【"+taskFiles.getDocumentName()+"】";
+                TaskComment comment =  new TaskComment();
+                comment.setTaskId(taskFiles.getTaskId());
+                comment.setUserId(user.getId());
+                comment.setContent(content);
+                comment.setCreateTime(LocalDateTime.now());
+                comment.setUserColor(user.getColor());
+                comment.setUserName(user.getName());
+                commentList.add(comment);
+            }
+            if(CollectionUtils.isNotEmpty(stageOneToUpdateList)){
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getChargeStage,2)
+                        .set(TaskFiles::getChargeOneStatus,1)
+                        .set(TaskFiles::getChargeOneTime,new Date())
+                        .set(TaskFiles::getFileRejectReason,null)
+                        .in(TaskFiles::getId,stageOneToUpdateList)
+                );
+            }
+            if(CollectionUtils.isNotEmpty(stageTwoToUpdateList)){
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getChargeStage,3)
+                        .set(TaskFiles::getFinalChargeStatus,1)
+                        .set(TaskFiles::getChargeTwoStatus,1)
+                        .set(TaskFiles::getChargeTwoTime,new Date())
+                        .set(TaskFiles::getFileRejectReason,null)
+                        .in(TaskFiles::getId,stageTwoToUpdateList)
+                );
+            }
+            if(CollectionUtils.isNotEmpty(commentList)){
+                taskCommentMapper.insertBatch(commentList);
+            }
+        }
+
+        return httpRespMsg;
+    }
+
+    @Override
+    @Transactional
+    public HttpRespMsg rejectFile(String taskFileIds,String reason, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("Token"));
+        String[] array = taskFileIds.split(",");
+        if(0 != array.length){
+            List<String> ids = Arrays.stream(array).collect(Collectors.toList());
+            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+//            CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
+            List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
+            Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
+
+            List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
+                    .eq(TaskFiles::getNeedFileCharge,1)
+                    .eq(TaskFiles::getFinalChargeStatus,0)
+                    .in(TaskFiles::getId,ids)
+            );
+            List<Integer> stageOneToUpdateList = new ArrayList<>();
+            List<Integer> stageTwoToUpdateList = new ArrayList<>();
+//            StringBuilder userNames = new StringBuilder();
+            Map<String,String> remindMap = new HashMap<>();
+            List<TaskComment> commentList = new ArrayList<>();
+            for (TaskFiles taskFile : taskFiles) {
+                if(1 == taskFile.getChargeStage()){
+                    //阶段一,更新阶段一状态
+                    stageOneToUpdateList.add(taskFile.getId());
+                } else if (2 == taskFile.getChargeStage()) {
+                    stageTwoToUpdateList.add(taskFile.getId());
+                }
+                User tmpUser = companyUserMap.get(taskFile.getCreatorId());
+//                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+//                    userNames.append("$userName=").append(tmpUser.getCorpwxRealUserid()).append("$,");
+//                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+//                    userNames.append("$userName=").append(tmpUser.getDingdingUserid()).append("$,");
+//                }else{
+//                    userNames.append(tmpUser.getName()).append(",");
+//                }
+                remindMap.put(tmpUser.getCorpwxUserid(),"任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理");
+                String content = user.getName()+"审核驳回了任务文件【"+taskFile.getDocumentName()+"】";
+                TaskComment comment =  new TaskComment();
+                comment.setTaskId(taskFile.getTaskId());
+                comment.setUserId(user.getId());
+                comment.setContent(content);
+                comment.setCreateTime(LocalDateTime.now());
+                comment.setUserColor(user.getColor());
+                comment.setUserName(user.getName());
+                commentList.add(comment);
+            }
+            if(CollectionUtils.isNotEmpty(stageOneToUpdateList)){
+                //阶段一,更新阶段一状态
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getFileRejectReason,reason)
+                        .set(TaskFiles::getChargeOneTime,new Date())
+                        .set(TaskFiles::getChargeOneStatus,2)
+                        .in(TaskFiles::getId,stageOneToUpdateList)
+                );
+            }
+            if(CollectionUtils.isNotEmpty(stageTwoToUpdateList)){
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getFileRejectReason,reason)
+                        .set(TaskFiles::getChargeTwoTime,new Date())
+                        .set(TaskFiles::getChargeTwoStatus,2)
+                        .in(TaskFiles::getId,stageTwoToUpdateList)
+                );
+            }
+
+            if(CollectionUtils.isNotEmpty(commentList)){
+                taskCommentMapper.insertBatch(commentList);
+            }
+
+//            String names = userNames.deleteCharAt(userNames.length() - 1).toString();
+//            String content = user.getName()+"因【"+reason+"】驳回了【"+names+"】的任务文件";
+//            TaskComment comment =  new TaskComment();
+//            comment.setTaskId(taskFiles.get(0).getTaskId());
+//            comment.setUserId(user.getId());
+//            comment.setContent(content);
+//            comment.setCreateTime(LocalDateTime.now());
+//            comment.setUserColor(user.getColor());
+//            comment.setUserName(user.getName());
+//            taskCommentMapper.insert(comment);
+
+            for (Map.Entry<String, String> entry : remindMap.entrySet()) {
+                wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,entry.getKey(),entry.getValue(),null
+                        , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_REJECT);
+            }
+
+        }
+
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg getUnChargedFilesByTaskId(Integer taskId, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("Token"));
+        //状态为待审核、负责人为当前登录人
+        List<TaskFiles> taskFiles = taskFilesMapper.getUnChargedFilesByTaskId(taskId,user.getId());
+        httpRespMsg.setData(taskFiles);
+        return httpRespMsg;
+    }
 }

+ 170 - 126
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -5,19 +5,17 @@ import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.util.StringUtil;
 import com.management.platform.entity.*;
 import com.management.platform.entity.bo.QueryTaskChargePage;
-import com.management.platform.entity.vo.TaskChargePageVO;
+import com.management.platform.entity.vo.TaskFileChargePageVO;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.util.ExcelUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.xssf.usermodel.XSSFCell;
@@ -36,7 +34,6 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -781,109 +778,130 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         return msg;
     }
 
-    @Override
-    @Transactional
-    public HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request) {
-        HttpRespMsg msg = new HttpRespMsg();
-        User user = userMapper.selectById(request.getHeader("Token"));
-        //获取该任务的文件审核阶段
-        Task task = taskMapper.selectById(taskId);
-        if(1 == auditStatus){
-            //通过
-            if(1 == task.getChargeStage()){
-                //阶段一,更新阶段一状态
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getChargeStage,2)
-                        .set(Task::getChargeOneStatus,1)
-                        .set(Task::getChargeOneTime,new Date())
-                        .eq(Task::getId,taskId)
-                );
-            } else if (2 == task.getChargeStage()) {
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getChargeStage,3)
-                        .set(Task::getFinalChargeStatus,1)
-                        .set(Task::getChargeTwoStatus,1)
-                        .set(Task::getChargeTwoTime,new Date())
-                        .eq(Task::getId,taskId)
-                );
-            }
-            //添加动态消息
-            String content = user.getName()+"审核通过了任务:"+task.getName();
-            TaskComment comment =  new TaskComment();
-            comment.setTaskId(taskId);
-            comment.setUserId(user.getId());
-            comment.setContent(content);
-            comment.setCreateTime(LocalDateTime.now());
-            comment.setUserColor(user.getColor());
-            comment.setUserName(user.getName());
-            taskCommentMapper.insert(comment);
-
-        } else if (2 == auditStatus) {
-            //驳回
-            WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
-            if(1 == task.getChargeStage()){
-                //阶段一,更新阶段一状态
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getFileRejectReason,reason)
-                        .set(Task::getChargeOneTime,new Date())
-                        .set(Task::getChargeOneStatus,2)
-                        .eq(Task::getId,taskId)
-                );
-            } else if (2 == task.getChargeStage()) {
-                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
-                        .set(Task::getFileRejectReason,reason)
-                        .set(Task::getChargeTwoTime,new Date())
-                        .set(Task::getChargeTwoStatus,2)
-                        .eq(Task::getId,taskId)
-                );
-            }
-            List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
-                    .eq(TaskFiles::getTaskId, task.getId())
-            );
-            List<String> creatorIds = taskFiles.stream().filter(t -> StringUtils.isNotBlank(t.getCreatorId()))
-                    .map(TaskFiles::getCreatorId).collect(Collectors.toList());
-            if(CollectionUtils.isNotEmpty(creatorIds)){
-                List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
-                        .eq(User::getIsActive, 1)
-                        .in(User::getId, creatorIds)
-                );
-                if(CollectionUtils.isNotEmpty(users)){
-                    List<String> wxCorpIds = users.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid()))
-                            .map(User::getCorpwxUserid).collect(Collectors.toList());
-                    if(CollectionUtils.isNotEmpty(wxCorpIds)){
-                        String join = StringUtils.join(wxCorpIds, ",");
-                        wxCorpInfoService.sendWXCorpMsg(info,join,"任务:"+task.getName()+"的文件因【"+reason+"】被驳回,请及时处理",null
-                                , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_REJECT);
-                    }
-                }
-            }
-            String content = user.getName()+"审核驳回了任务:"+task.getName();
-            TaskComment comment =  new TaskComment();
-            comment.setTaskId(taskId);
-            comment.setUserId(user.getId());
-            comment.setContent(content);
-            comment.setCreateTime(LocalDateTime.now());
-            comment.setUserColor(user.getColor());
-            comment.setUserName(user.getName());
-            taskCommentMapper.insert(comment);
-        }
-
-        return msg;
-    }
+//    @Override
+//    @Transactional
+//    public HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request) {
+//        HttpRespMsg msg = new HttpRespMsg();
+//        User user = userMapper.selectById(request.getHeader("Token"));
+//        //获取该任务的文件审核阶段
+//        Task task = taskMapper.selectById(taskId);
+//        if(1 == auditStatus){
+//            //通过
+//            if(1 == task.getChargeStage()){
+//                //阶段一,更新阶段一状态
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getChargeStage,2)
+//                        .set(Task::getChargeOneStatus,1)
+//                        .set(Task::getChargeOneTime,new Date())
+//                        .eq(Task::getId,taskId)
+//                );
+//            } else if (2 == task.getChargeStage()) {
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getChargeStage,3)
+//                        .set(Task::getFinalChargeStatus,1)
+//                        .set(Task::getChargeTwoStatus,1)
+//                        .set(Task::getChargeTwoTime,new Date())
+//                        .eq(Task::getId,taskId)
+//                );
+//            }
+//            //添加动态消息
+//            String content = user.getName()+"审核通过了任务:"+task.getName();
+//            TaskComment comment =  new TaskComment();
+//            comment.setTaskId(taskId);
+//            comment.setUserId(user.getId());
+//            comment.setContent(content);
+//            comment.setCreateTime(LocalDateTime.now());
+//            comment.setUserColor(user.getColor());
+//            comment.setUserName(user.getName());
+//            taskCommentMapper.insert(comment);
+//
+//        } else if (2 == auditStatus) {
+//            //驳回
+//            WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+//            if(1 == task.getChargeStage()){
+//                //阶段一,更新阶段一状态
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getFileRejectReason,reason)
+//                        .set(Task::getChargeOneTime,new Date())
+//                        .set(Task::getChargeOneStatus,2)
+//                        .eq(Task::getId,taskId)
+//                );
+//            } else if (2 == task.getChargeStage()) {
+//                taskMapper.update(null,new LambdaUpdateWrapper<Task>()
+//                        .set(Task::getFileRejectReason,reason)
+//                        .set(Task::getChargeTwoTime,new Date())
+//                        .set(Task::getChargeTwoStatus,2)
+//                        .eq(Task::getId,taskId)
+//                );
+//            }
+//            List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
+//                    .eq(TaskFiles::getTaskId, task.getId())
+//            );
+//            List<String> creatorIds = taskFiles.stream().filter(t -> StringUtils.isNotBlank(t.getCreatorId()))
+//                    .map(TaskFiles::getCreatorId).collect(Collectors.toList());
+//            if(CollectionUtils.isNotEmpty(creatorIds)){
+//                List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
+//                        .eq(User::getIsActive, 1)
+//                        .in(User::getId, creatorIds)
+//                );
+//                if(CollectionUtils.isNotEmpty(users)){
+//                    List<String> wxCorpIds = users.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid()))
+//                            .map(User::getCorpwxUserid).collect(Collectors.toList());
+//                    if(CollectionUtils.isNotEmpty(wxCorpIds)){
+//                        String join = StringUtils.join(wxCorpIds, ",");
+//                        wxCorpInfoService.sendWXCorpMsg(info,join,"任务:"+task.getName()+"的文件因【"+reason+"】被驳回,请及时处理",null
+//                                , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_REJECT);
+//                    }
+//                }
+//            }
+//            String content = user.getName()+"审核驳回了任务:"+task.getName();
+//            TaskComment comment =  new TaskComment();
+//            comment.setTaskId(taskId);
+//            comment.setUserId(user.getId());
+//            comment.setContent(content);
+//            comment.setCreateTime(LocalDateTime.now());
+//            comment.setUserColor(user.getColor());
+//            comment.setUserName(user.getName());
+//            taskCommentMapper.insert(comment);
+//        }
+//
+//        return msg;
+//    }
 
     @Override
     public HttpRespMsg getFileRejectReason(String taskId, HttpServletRequest request) {
         HttpRespMsg msg=new HttpRespMsg();
-        Task task = taskMapper.selectById(taskId);
-        String reason = "";
-        if(null != task){
-            reason = task.getFileRejectReason();
-        }
-//        switch (task.getChargeStage()){
-//            case 1 : reason = task.getChargeOneReason();break;
-//            case 2 : reason = task.getChargeTwoReason();break;
+        User user = userMapper.selectById(request.getHeader("Token"));
+        //文件创建人、审核人为自己
+        //文件开启审核功能、最终审核状态为未通过
+        List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
+                .eq(TaskFiles::getTaskId, taskId)
+                .eq(TaskFiles::getNeedFileCharge, 1)
+                .eq(TaskFiles::getFinalChargeStatus, 0)
+                .and(wrapper -> wrapper.eq(TaskFiles::getCreatorId, user.getId())
+                        .or().eq(TaskFiles::getChargeOneId, user.getId())
+                        .or().eq(TaskFiles::getChargeTwoId, user.getId()))
+        );
+        List<TaskFiles> collect = taskFiles.stream().filter(t -> {
+            if (1 == t.getChargeStage()) {
+                return 2 == t.getChargeOneStatus();
+            } else if (2 == t.getChargeStage()) {
+                return 2 == t.getChargeTwoStatus();
+            }else {
+                return false;
+            }
+        }).collect(Collectors.toList());
+        msg.setData(collect);
+//        Task task = taskMapper.selectById(taskId);
+//        String reason = "";
+//        if(null != task){
+//            reason = task.getFileRejectReason();
 //        }
-        msg.setData(reason);
+////        switch (task.getChargeStage()){
+////            case 1 : reason = task.getChargeOneReason();break;
+////            case 2 : reason = task.getChargeTwoReason();break;
+////        }
+//        msg.setData(reason);
         return msg;
     }
 
@@ -894,6 +912,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         User user = userMapper.selectById(userId);
         Integer companyId = user.getCompanyId();
         queryBO.setUserId(userId);
+        queryBO.setCompanyId(companyId);
 
         queryBO.setPageIndex((queryBO.getPageIndex()-1)*queryBO.getPageSize());
 
@@ -903,41 +922,66 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
             branchDepartment= getBranchDepartment(queryBO.getDeptId(), departmentList);
         }
 
-        List<TaskChargePageVO> taskChargePage = taskMapper.getTaskChargePage(queryBO, branchDepartment);
-        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
-        CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
-        List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
-        Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
+        //文件处于审核阶段,且该阶段审核人为当前登录人
+//        List<TaskChargePageVO> taskChargePage = taskMapper.getTaskChargePage(queryBO, branchDepartment);
 
-        if(CollectionUtils.isNotEmpty(taskChargePage)){
-            List<Integer> collect = taskChargePage.stream()
-                    .map(TaskChargePageVO::getTaskId).distinct().collect(Collectors.toList());
+        List<TaskFileChargePageVO> taskFileChargePageList = taskMapper.getTaskFileChargePage(queryBO,branchDepartment);
+
+//        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
+//        CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
+//        List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
+//        Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
+
+        if(CollectionUtils.isNotEmpty(taskFileChargePageList)){
+            List<Integer> collect = taskFileChargePageList.stream()
+                    .map(TaskFileChargePageVO::getTaskId).distinct().collect(Collectors.toList());
 
             List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
 
-            taskChargePage.forEach(t->{
+            taskFileChargePageList.forEach(t->{
                 List<TaskExecutor> executorList = taskExecutorList.stream()
                         .filter(te -> te.getTaskId().equals(t.getTaskId())&&te.getExecutorId()!=null).collect(Collectors.toList());
                 t.setExecutorList(executorList);
-                String userWxId = "";
-                User tmpUser = companyUserMap.get(t.getFinalChargeId());
-                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                    userWxId = tmpUser.getCorpwxRealUserid();
-                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
-                    userWxId = tmpUser.getDingdingUserid();
-                }
-                if(StringUtils.isNotBlank(userWxId)){
-                    t.setFinalChargeName("$userName=" + userWxId + "$");
-                }
-                int finalStatus = 1==t.getChargeStage()?t.getChargeOneStatus():t.getChargeTwoStatus();
-                t.setFileChargeStatus(finalStatus);
+//                String userWxId = "";
+//                User tmpUser = companyUserMap.get(t.getFinalChargeId());
+//                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+//                    userWxId = tmpUser.getCorpwxRealUserid();
+//                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+//                    userWxId = tmpUser.getDingdingUserid();
+//                }
+//                if(StringUtils.isNotBlank(userWxId)){
+//                    t.setFinalChargeName("$userName=" + userWxId + "$");
+//                }else{
+//                    t.setFinalChargeName(tmpUser.getName());
+//                }
+//                List<TaskFiles> childFiles = t.getChildFiles();
+//                //是否存在驳回
+//                long rejectCount = childFiles.stream().filter(tmp -> {
+//                    if (2 == tmp.getChargeOneStatus() || 2 == tmp.getChargeTwoStatus()) {
+//                        return true;
+//                    } else {
+//                        return false;
+//                    }
+//                }).count();
+//                //是否都是全部通过
+//                long allPassCount = childFiles.stream().filter(tmp -> 1 == tmp.getFinalChargeStatus()).count();
+//                if(rejectCount > 0 ){
+//                    t.setTaskChargeStatus(2);
+//                } else if (allPassCount == childFiles.size()) {
+//                    t.setTaskChargeStatus(3);
+//                }else {
+//                    t.setTaskChargeStatus(1);
+//                }
+
+//                int finalStatus = 1==t.getChargeStage()?t.getChargeOneStatus():t.getChargeTwoStatus();
+//                t.setFileChargeStatus(finalStatus);
             });
         }
 
-
-        int total = taskMapper.getTaskChargePageTotal(queryBO,branchDepartment);
+//        int total = taskMapper.getTaskChargePageTotal(queryBO,branchDepartment);
+        int total = taskMapper.getTaskFileChargePageTotal(queryBO,branchDepartment);
         Map<String, Object> map = new HashMap<>();
-        map.put("records", taskChargePage);
+        map.put("records", taskFileChargePageList);
         map.put("total", total);
         msg.data = map;
         return msg;

+ 46 - 57
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -1543,8 +1543,8 @@ public class TimingTask {
                         userList = reportService.getNotFullReportUserList(company.getId(), startDate, lastDay);
                     } else {
                         LocalDate startDate = localDate.minusDays(7);
-                        //从2023-11-10号以后开始算
-                        if (startDate.isAfter(LocalDate.parse("2023-11-05"))) {
+                        //针对物奇,从2023-11-10号以后开始算,上周漏填的也要提醒
+                        if (startDate.isAfter(LocalDate.parse("2023-11-05")) && company.getId() == 1071) {
                             //检查上周日报是否漏填
                             LocalDate lastSunday = localDate.with(DayOfWeek.SUNDAY).minusWeeks(1);
                             LocalDate lastMonday = lastSunday.minusDays(6);
@@ -1626,9 +1626,6 @@ public class TimingTask {
                         if (u.get("corpwxUserid") != null){
                             //推送到企业微信
                             String corpUid = (String) u.get("corpwxUserid");
-                            if ("woy9TkCAAAyVAc5oXhGwCO-DFWF8SfKg".equals(corpUid)){
-                                System.out.println("发送给 【顾焕峰】漏填提醒");
-                            }
                             JSONObject json=new JSONObject();
                             JSONArray dataJson = new JSONArray();
                             JSONObject jsonObj = new JSONObject();
@@ -2316,10 +2313,12 @@ public class TimingTask {
         }
     }
 
-    @Scheduled(cron = "0 30 9 ? * *")
+    @Scheduled(cron = "0 30 09 ? * *")
     public void remindTaskFile(){
-        List<Integer> taskIds =  taskFilesMapper.getAllTaskIds();
-        if(CollectionUtils.isNotEmpty(taskIds)){
+//        List<Integer> taskIds =  taskFilesMapper.getAllNeedChargeTaskIds();
+        List<TaskFiles> taskFiles = taskFilesMapper.getAllNeedChargeTaskFiles();
+        if(CollectionUtils.isNotEmpty(taskFiles)){
+            Map<Integer, List<TaskFiles>> companyTaskFileMap = taskFiles.stream().collect(Collectors.groupingBy(TaskFiles::getCompanyId));
             List<WxCorpInfo> wxCorpInfos = wxCorpInfoMapper.selectList(new LambdaQueryWrapper<WxCorpInfo>()
                     .eq(WxCorpInfo::getSaasSyncContact,1)
             );
@@ -2333,60 +2332,50 @@ public class TimingTask {
             if(CollectionUtils.isNotEmpty(timeTypes)){
                 companyTimeTypeMap = timeTypes.stream().collect(Collectors.toMap(TimeType::getCompanyId,t->t));
             }
-
-            List<Task> tasks = taskMapper.selectList(new LambdaQueryWrapper<Task>()
-                    .eq(Task::getTaskStatus, 0)
-                    .eq(Task::getFinalChargeStatus,0)
-                    .isNotNull(Task::getChargeOneId)
-                    .ne(Task::getChargeStage,3)
-                    .in(Task::getId, taskIds)
-            );
-            if(CollectionUtils.isNotEmpty(tasks)){
-                Map<Integer, List<Task>> companyTaskMap = tasks.stream().collect(Collectors.groupingBy(Task::getCompanyId));
-                for (Map.Entry<Integer, List<Task>> entry : companyTaskMap.entrySet()) {
-                    if(0 == companyTimeTypeMap.get(entry.getKey()).getTaskFileCharge()){
-                        continue;
-                    }
-                    WxCorpInfo wxCorpInfo = companyWXCorpMap.get(entry.getKey());
-                    List<Task> companyTasks = entry.getValue();
-                    List<String> userIds = new ArrayList<>();
-                    List<String> chargeOneIds = companyTasks.stream().map(Task::getChargeOneId).collect(Collectors.toList());
-                    List<String> chargeTwoIds = companyTasks.stream().filter(t -> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
-                            .map(Task::getChargeTwoId).collect(Collectors.toList());
-                    userIds.addAll(chargeOneIds);
-                    userIds.addAll(chargeTwoIds);
-                    Map<String, String> userIdCorpWxMap = new HashMap<>();
-                    if(CollectionUtils.isNotEmpty(userIds)){
-                        userIds = userIds.stream().distinct().collect(Collectors.toList());
-                        List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
-                                .select(User::getId,User::getCorpwxUserid)
-                                .in(User::getId, userIds)
-                        );
-                        userIdCorpWxMap = users.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getCorpwxUserid()))
-                                .collect(Collectors.toMap(User::getId, User::getCorpwxUserid));
-                    }
-                    if(null != wxCorpInfo){
-                        for (Task companyTask : companyTasks) {
-                            if(1==companyTask.getChargeStage()){
-                                //阶段一的审核人提示
-                                String corpWxId = userIdCorpWxMap.get(companyTask.getChargeOneId());
-                                if(org.apache.commons.lang3.StringUtils.isNotBlank(corpWxId)){
-                                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,corpWxId,"任务:"+companyTask.getName()+"的文件需审核,请及时处理",null
-                                            , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_UPDATE);
-                                }
-                            } else if (2 == companyTask.getChargeStage()) {
-                                //阶段二的审核人提示
-                                String corpWxId = userIdCorpWxMap.get(companyTask.getChargeTwoId());
-                                if(org.apache.commons.lang3.StringUtils.isNotBlank(corpWxId)){
-                                    wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,corpWxId,"任务:"+companyTask.getName()+"的文件需审核,请及时处理",null
-                                            , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_UPDATE);
-                                }
+            for (Map.Entry<Integer, List<TaskFiles>> entry : companyTaskFileMap.entrySet()) {
+                if(0 == companyTimeTypeMap.get(entry.getKey()).getTaskFileCharge()){
+                    continue;
+                }
+                List<TaskFiles> companyTaskFiles = entry.getValue();
+                WxCorpInfo wxCorpInfo = companyWXCorpMap.get(entry.getKey());
+                List<String> userIds = new ArrayList<>();
+                List<String> chargeOneIds = companyTaskFiles.stream().filter(t -> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
+                        .map(TaskFiles::getChargeOneId).collect(Collectors.toList());
+                List<String> chargeTwoIds = companyTaskFiles.stream().filter(t -> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
+                        .map(TaskFiles::getChargeTwoId).collect(Collectors.toList());
+                userIds.addAll(chargeOneIds);
+                userIds.addAll(chargeTwoIds);
+                Map<String, String> userIdCorpWxMap = new HashMap<>();
+                if(CollectionUtils.isNotEmpty(userIds)){
+                    userIds = userIds.stream().distinct().collect(Collectors.toList());
+                    List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
+                            .select(User::getId,User::getCorpwxUserid)
+                            .in(User::getId, userIds)
+                    );
+                    userIdCorpWxMap = users.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getCorpwxUserid()))
+                            .collect(Collectors.toMap(User::getId, User::getCorpwxUserid));
+                }
+                if(null != wxCorpInfo){
+                    for (TaskFiles companyTaskFile : companyTaskFiles) {
+                        if(1==companyTaskFile.getChargeStage()){
+                            //阶段一的审核人提示
+                            String corpWxId = userIdCorpWxMap.get(companyTaskFile.getChargeOneId());
+                            if(org.apache.commons.lang3.StringUtils.isNotBlank(corpWxId)){
+                                wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,corpWxId,"任务:"+companyTaskFile.getTaskName()+"的文件需审核,请及时处理",null
+                                        , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_UPDATE);
+                            }
+                        } else if (2 == companyTaskFile.getChargeStage()) {
+                            //阶段二的审核人提示
+                            String corpWxId = userIdCorpWxMap.get(companyTaskFile.getChargeTwoId());
+                            if(org.apache.commons.lang3.StringUtils.isNotBlank(corpWxId)){
+                                wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,corpWxId,"任务:"+companyTaskFile.getTaskName()+"的文件需审核,请及时处理",null
+                                        , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_UPDATE);
                             }
                         }
-
                     }
                 }
             }
+
         }
     }
 }

+ 7 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskCommentMapper.xml

@@ -18,5 +18,12 @@
     <sql id="Base_Column_List">
         id, task_id, user_id, user_name, content, create_time, user_color, type
     </sql>
+    <insert id="insertBatch">
+        insert into task_comment(task_id, user_id, user_name, content, create_time, user_color)
+        VALUES
+            <foreach collection="commentList" item="comment" separator=",">
+            (#{comment.taskId},#{comment.userId},#{comment.userName},#{comment.content},#{comment.createTime},#{comment.userColor})
+            </foreach>
+    </insert>
 
 </mapper>

+ 34 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskFilesMapper.xml

@@ -22,11 +22,43 @@
     <sql id="Base_Column_List">
         id, task_id, project_id, document_name, server_name, url, indate, size, document_type, creator_id, creator_name, document_id
     </sql>
-    <select id="getAllTaskIds" resultType="java.lang.Integer">
+    <select id="getAllNeedChargeTaskIds" resultType="java.lang.Integer">
         select task_id
         from task_files
-        where task_id is not null
+        where task_id is not null and need_file_charge = 1 and final_charge_status = 0
         group by task_id
     </select>
+    <select id="getTaskFiles" resultType="com.management.platform.entity.TaskFiles">
+        select *
+        from task_files
+        where task_id = #{taskId}
+          and (
+            charge_one_id = #{userId} or charge_two_id = #{userId} or creator_id = #{userId}
+                or need_file_charge = 0
+                or final_charge_status = 1
+            )
+        ORDER BY indate desc
+    </select>
+    <select id="getAllNeedChargeTaskFiles" resultType="com.management.platform.entity.TaskFiles">
+        select task_files.*,task.company_id,task.name as taskName
+        from task_files
+                 left join task on task_files.task_id = task.id
+        where task_files.task_id is not null and task_files.need_file_charge = 1 and task_files.final_charge_status = 0
+    </select>
+    <select id="getUnChargedFilesByTaskId" resultType="com.management.platform.entity.TaskFiles">
+        select *
+        from task_files
+        where task_id = #{taskId} and need_file_charge = 1 and final_charge_status = 0
+          and case charge_stage
+                  when 1 then charge_one_id = #{userId} and charge_one_status = 0
+                  when 2 then charge_two_id = #{userId} and charge_two_status = 0
+            end
+    </select>
+    <select id="getTaskFilesByCreatorDeptId" resultType="com.management.platform.entity.TaskFiles">
+        select tf.id
+        from task_files tf
+                 left join user on tf.creator_id = user.id
+        where user.department_id = #{departmentId}
+    </select>
 
 </mapper>

+ 128 - 22
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -32,15 +32,6 @@
         <result column="meeting_id" property="meetingId" />
         <result column="ahead_tid" property="aheadTid" />
         <result column="sap_task_code" property="sapTaskCode" />
-        <result column="charge_one_id" property="chargeOneId" />
-        <result column="charge_one_status" property="chargeOneStatus" />
-        <result column="charge_one_time" property="chargeOneTime" />
-        <result column="charge_two_id" property="chargeTwoId" />
-        <result column="charge_two_status" property="chargeTwoStatus" />
-        <result column="charge_two_time" property="chargeTwoTime" />
-        <result column="final_charge_status" property="finalChargeStatus" />
-        <result column="charge_stage" property="chargeStage" />
-        <result column="file_reject_reason" property="fileRejectReason" />
         <result column="plan_cost" property="planCost" />
     </resultMap>
     <resultMap id="timeResultMap" type="com.management.platform.entity.TimeTask" >
@@ -107,19 +98,19 @@
         <result column="stages_name" property="stagesName" />
         <result column="department_name" property="departmentName" />
 
-        <result column="charge_one_id" property="chargeOneId" />
-        <result column="charge_one_status" property="chargeOneStatus" />
-        <result column="charge_one_time" property="chargeOneTime" />
-        <result column="charge_two_id" property="chargeTwoId" />
-        <result column="charge_two_status" property="chargeTwoStatus" />
-        <result column="charge_two_time" property="chargeTwoTime" />
-        <result column="charge_stage" property="chargeStage" />
-        <result column="final_charge_status" property="finalChargeStatus" />
-        <result column="reject_reason" property="rejectReason"></result>
+<!--        <result column="charge_one_id" property="chargeOneId" />-->
+<!--        <result column="charge_one_status" property="chargeOneStatus" />-->
+<!--        <result column="charge_one_time" property="chargeOneTime" />-->
+<!--        <result column="charge_two_id" property="chargeTwoId" />-->
+<!--        <result column="charge_two_status" property="chargeTwoStatus" />-->
+<!--        <result column="charge_two_time" property="chargeTwoTime" />-->
+<!--        <result column="charge_stage" property="chargeStage" />-->
+<!--        <result column="final_charge_status" property="finalChargeStatus" />-->
+<!--        <result column="file_reject_reason" property="fileRejectReason"></result>-->
     </resultMap>
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, task_desc, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date, start_date, meeting_id, ahead_tid, sap_task_code, charge_one_id, charge_one_status, charge_one_time, charge_two_id, charge_two_status, charge_two_time, final_charge_status, charge_stage, file_reject_reason, plan_cost
+        id, name, task_desc, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date, start_date, meeting_id, ahead_tid, sap_task_code, plan_cost
     </sql>
     <select id="simpleList" resultMap="BaseResultMap">
         select id, name, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date, start_date
@@ -243,7 +234,7 @@
         </if>
     </select>
     <select id="getTaskPlanRealData" resultType="java.util.Map">
-        SELECT task.id,task.`name`,task_executor.id as teId, DATE_FORMAT(task.`end_date`, '%Y-%m-%d') as endDate, task.`plan_hours` as planHours,task.plan_cost as planCost,
+        SELECT task.id,task.`name`,task_executor.id as teId, DATE_FORMAT(task.`end_date`, '%Y-%m-%d') as endDate, task_executor.`plan_hours` as planHours,task.plan_cost as planCost,
         (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1) AS realHours,
         task_executor.executor_id as executorId,task_executor.executor_name AS executorName,
         IF(task_executor.real_cost = 0, task.plan_cost, task_executor.real_cost) AS realCost,
@@ -290,7 +281,7 @@
     <select id="getTaskWithProjectName" resultMap="RichResultMap">
         SELECT task.id, task.project_id, task.name, task.executor_name, task.start_date, task.`end_date`,task.create_date, task.`creater_id`, task.`creater_name`, task.group_id,
         task.plan_hours, task.task_type, task.task_level, task.task_status, task.`finish_date`, project.`project_name`, stages.stages_name,department.department_name
-        ,task.charge_one_id,task.charge_one_status,task.charge_two_id,task.charge_two_status,task.charge_stage,task.final_charge_status
+        <!-- ,task.charge_one_id,task.charge_one_status,task.charge_two_id,task.charge_two_status,task.charge_stage,task.final_charge_status -->
         FROM task LEFT JOIN project ON project.id = task.`project_id`
         left join stages on stages.id = task.stages_id
         left join department on department.department_id=project.dept_id
@@ -428,7 +419,7 @@
     <select id="getTaskWithProjectNameWithCharge" resultMap="RichResultMap">
         SELECT task.id, task.project_id, task.name, task.executor_name, task.start_date, task.`end_date`,task.create_date, task.`creater_id`, task.`creater_name`, task.group_id,
         task.plan_hours, task.task_type, task.task_level, task.task_status, task.`finish_date`, project.`project_name`, stages.stages_name,department.department_name
-        ,task.charge_one_id,task.charge_one_status,task.charge_two_id,task.charge_two_status,task.charge_stage,task.final_charge_status
+        <!-- ,task.charge_one_id,task.charge_one_status,task.charge_two_id,task.charge_two_status,task.charge_stage,task.final_charge_status-->
         FROM task LEFT JOIN project ON project.id = task.`project_id`
         left join stages on stages.id = task.stages_id
         left join department on department.department_id=project.dept_id
@@ -628,4 +619,119 @@
         group by tmp1.task_id
         )tmpAll
     </select>
+
+    <resultMap id="taskFileChargeMap" type="com.management.platform.entity.vo.TaskFileChargePageVO">
+        <result property="taskId" column="task_id"></result>
+        <result property="taskName" column="taskName"></result>
+        <result property="groupId" column="group_id"></result>
+        <result property="executorId" column="executor_id"></result>
+        <result property="projectId" column="projectId"></result>
+        <result property="projectName" column="project_name"></result>
+        <collection property="childFiles" ofType="com.management.platform.entity.TaskFiles">
+            <result property="id" column="id"></result>
+            <result property="documentName" column="document_name"></result>
+            <result property="creatorId" column="creator_id"></result>
+            <result property="creatorName" column="creator_name"></result>
+            <result property="chargeOneId" column="charge_one_id"></result>
+            <result property="chargeOneStatus" column="charge_one_status"></result>
+            <result property="chargeOneTime" column="charge_one_time"></result>
+            <result property="chargeTwoId" column="charge_two_id"></result>
+            <result property="chargeTwoStatus" column="charge_two_status"></result>
+            <result property="chargeTwoTime" column="charge_two_time"></result>
+            <result property="chargeStage" column="charge_stage"></result>
+            <result property="finalChargeStatus" column="final_charge_status"></result>
+            <result property="fileRejectReason" column="file_reject_reason"></result>
+            <result property="needFileCharge" column="need_file_charge"></result>
+        </collection>
+    </resultMap>
+
+    <select id="getTaskFileChargePage" resultMap="taskFileChargeMap">
+        select tf.task_id,task.name as taskName,task.group_id,task.executor_id
+        ,p.id as projectId,p.project_name
+        from task_files tf
+        left join task on tf.task_id = task.id
+        left join project p on task.project_id = p.id
+        <where>
+            tf.need_file_charge = 1
+            and tf.final_charge_status = 0
+            and task.task_status = 0
+            and task.company_id = #{queryBO.companyId}
+            and case tf.charge_stage
+            when 1 then tf.charge_one_id = #{queryBO.userId} and tf.charge_one_status = 0
+            when 2 then tf.charge_two_id = #{queryBO.userId} and tf.charge_two_status = 0
+            end
+            <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                and task.name like concat('%',#{queryBO.taskName},'%')
+            </if>
+            <if test="deptIds!=null and deptIds.size()>0">
+                and p.dept_id in
+                <foreach collection="deptIds" open="(" close=")" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        group by tf.task_id
+        ORDER BY tf.task_id desc
+        <if test="queryBO.pageIndex != null and queryBO.pageSize != null">
+            limit #{queryBO.pageIndex}, #{queryBO.pageSize}
+        </if>
+    </select>
+    <select id="getTaskFileChargePageTotal" resultType="java.lang.Integer">
+        select count(*)
+        from
+            (
+                select tf.task_id
+                from task_files tf
+                         left join task on tf.task_id = task.id
+                         left join project p on task.project_id = p.id
+                <where>
+                    tf.need_file_charge = 1
+                    and tf.final_charge_status = 0
+                    and task.task_status = 0
+                    and task.company_id = #{queryBO.companyId}
+                    and case tf.charge_stage
+                    when 1 then tf.charge_one_id = #{queryBO.userId} and tf.charge_one_status = 0
+                    when 2 then tf.charge_two_id = #{queryBO.userId} and tf.charge_two_status = 0
+                    end
+                    <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                        and task.name like concat('%',#{queryBO.taskName},'%')
+                    </if>
+                    <if test="deptIds!=null and deptIds.size()>0">
+                        and p.dept_id in
+                        <foreach collection="deptIds" open="(" close=")" separator="," item="item">
+                            #{item}
+                        </foreach>
+                    </if>
+                </where>
+                group by tf.task_id
+            )tmp1
+    </select>
+    <select id="getProjectAllTaskTimeCost"
+            resultType="com.management.platform.entity.vo.ProjectTaskTimeCostVO">
+        SELECT task.id as taskId,ifnull(task_executor.`plan_hours`,0) as planHours,
+        (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1) AS realHours,
+        task_executor.executor_id as executorId
+        FROM task
+        LEFT JOIN project ON project.id = task.`project_id`
+        left join task_executor on task_executor.task_id=task.id
+        WHERE task.project_id = #{projectId}
+          and project.id = #{projectId}
+    </select>
+    <select id="getProjectTaskTimeCostByIds" resultType="com.management.platform.entity.vo.ProjectTimeCostVO">
+        select project_id,sum(planHours) as planHoursSum,sum(realHours) as realHoursSum
+        from
+            (
+                SELECT task.project_id,task.id as taskId,ifnull(task_executor.`plan_hours`,0) as planHours,
+                       (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1) AS realHours,
+                       task_executor.executor_id as executorId
+                FROM task
+                         LEFT JOIN project ON project.id = task.`project_id`
+                         left join task_executor on task_executor.task_id=task.id
+                WHERE task.project_id in
+                      <foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
+                            #{projectId}
+                        </foreach>
+            )tmp1
+        group by project_id
+    </select>
 </mapper>

+ 5 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AlertTimeController.java

@@ -35,6 +35,11 @@ public class AlertTimeController {
         timingTask.getTemporaryJobApplicationNew();
         return new HttpRespMsg();
     }
+    @RequestMapping("/getTemporaryJobApplicationOnlyString")
+    public HttpRespMsg getTemporaryJobApplicationOnlyString() throws Exception {
+        timingTask.getTemporaryJobApplicationOnlyString();
+        return new HttpRespMsg();
+    }
 
 }
 

ファイルの差分が大きいため隠しています
+ 248 - 72
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java


+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -587,7 +587,7 @@
                     </el-form-item>
                     <!-- 增加合同金额字段 -->
                     <el-form-item  :label="$t('contractamount')" v-if="(user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0))">
-                        <el-input id="contractAmount" v-model="addForm.contractAmount" :disabled="canOnlyModParticipator" style="width:32%;" @input="contractAmountChange(addForm.contractAmount)" :placeholder="$t('zheng-shu')" clearable  @keyup.native="restrictNumber('contractAmount')"></el-input><span style="margin-left:10px;position:absolute;">{{ $t('yuan') }}</span>
+                        <el-input id="contractAmount" v-model="addForm.contractAmount" :disabled="canOnlyModParticipator" style="width:32%;" @input="contractAmountChange(addForm.contractAmount)" :placeholder="$t('zheng-shu')" clearable maxlength="9"  @keyup.native="restrictNumber('contractAmount')"></el-input><span style="margin-left:10px;position:absolute;">{{ $t('yuan') }}</span>
                         <template v-if="title == $t('modifytheproject') && contractAmountReasonShow">
                             <span style="margin-left:63px;margin-right:10px;">{{ $t('modifythereason') }}</span>
                             <el-input v-model="addForm.changeContractReason" style="width:33%" clearable :placeholder="$t('contractamountasd')"></el-input>

+ 39 - 26
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -1615,17 +1615,6 @@
           </el-table>
           <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isFlag" :title="$t('message.loading')+'...'" type="success" center :closable="false" show-icon></el-alert>
           <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isMore" :title="$t('message.noMoreData')" type="warning" center show-icon></el-alert>
-
-          <!-- <div slot="title" class="dialog-title selectworktime_title">
-            <label style="font-size: 16px">员工每日已填报工时数</label>
-            <el-link
-              type="primary"
-              style="float: right; margin-right: 60px"
-              @click="exportMembWorkHours()"
-              >导出已填报数据</el-link
-            > -->
-          <!-- <el-button >导出</el-button> -->
-          <!-- </div> -->
         </el-tab-pane>
 
         <el-tab-pane :label="$t('weiTiJiaoRenYuanLieBiao')" name="second" >
@@ -1735,11 +1724,19 @@
             </div>
             <div>
                 <div style="margin-top:10px;">
+                    <el-cascader v-if="user.userNameNeedTranslate != 1" :size="'small'" v-model="deptIdForHasReport" :placeholder="$t('qing-xuan-ze-bu-men')" :options="departmentList" :props="{ checkStrictly: true, value: 'id' }" clearable style="width: 200px;" @change="showReportTimeLessThanCardTimeList()"></el-cascader>
+                    <vueCascader :size="'small'" :widthStr="'200'" :clearable="true" :subject="trandepartmentList" :radios="true" :distinction="'17'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1" :selectNameChuan="$t('other.allDepartments')"></vueCascader>
+                    <el-input style="width:200px;margin-left: 15px" v-if="user.userNameNeedTranslate != '1'" @keyup.enter.native="searchScreen(2)" v-model="searchKeyword" class="input-with-select" :placeholder="$t('defaultText.pleaseEnterNametoSearch')" clearable="true" size="small">
+                        <el-button slot="append" @click="searchScreen(2)" icon="el-icon-search"></el-button>
+                    </el-input>
+                    <selectCat v-if="user.userNameNeedTranslate == '1'" :filterable="true" :searchBoxTop="'1'" :size="'small'" :subject="usersList" :subjectId="usersListId" :distinction="'15'" :clearable="true" @selectCal="selectCal"></selectCat>
+
                     <!-- <el-link
                         type="primary"
                         style="float: right; vertical-align: middle;height:32px"
                         @click="exportMembNotWorkHours()"
-                        >{{$t('export.exportData')}}</el-link> -->
+                        >{{$t('export.exportData')}}</el-link
+                    > -->
                 </div>
             </div>
             
@@ -2299,6 +2296,8 @@
         },
         data() {
             return {
+                notFullData:[],
+                notFullOriginList:[],
                 singleDate:1,
                 subFillProjectList:[],
                 curAuditNode: 1,
@@ -2760,12 +2759,15 @@
                 this.http.post(
                     "/report/getReportTimeLessThanCardTimeList",
                     {
-                    date: this.notfullSelectDateMonth
+                    date: this.notfullSelectDateMonth,
+                    deptId: this.deptIdForHasReport.length>0?this.deptIdForHasReport[this.deptIdForHasReport.length-1]:null,
+                    userId: this.usersListId
                     },
                     (res) => {
                     if (res.code == "ok") {
                         this.tbload = false
                         this.notFullData = res.data;
+                        this.notFullOriginList = res.data;
                     }
                     },
                     (error) => {
@@ -3433,7 +3435,7 @@
                 }
             },
             searchScreen(e){
-                if(e){
+                if(e == 1){
                     this.monthNotWorkDateS1 = []
                     for (let i = 0; i < this.monthNotWorkDate.length; i++) {
                         if(this.monthNotWorkDate[i].name.indexOf(this.searchKeyword) != -1){
@@ -3445,12 +3447,7 @@
                     }else{
                         this.monthNotWorkDateS = this.monthNotWorkDateS1 
                     }
-                    // if (this.monthNotWorkDateS1.length > 0) {
-                    //     setTimeout(() => {
-                    //         this.tableListenernot()
-                    //     }, 1000);
-                    // }
-                }else{
+                } else if (e == 0) {
                     this.monthWorkDataS1 = []
                     for (let i = 0; i < this.monthWorkData.length; i++) {
                         if(this.monthWorkData[i].name.indexOf(this.searchKeyword) != -1){
@@ -3462,11 +3459,18 @@
                     }else{
                         this.monthWorkDataS = this.monthWorkDataS1 
                     }
-                    // if (this.monthWorkDataS1.length > 0) {
-                    //     setTimeout(() => {
-                    //         this.tableListener()
-                    //     }, 1000);
-                    // }
+                } else if (e == 2) {
+                    this.monthWorkDataS1 = []
+                    for (let i = 0; i < this.notFullOriginList.length; i++) {
+                        if(this.notFullOriginList[i].name.indexOf(this.searchKeyword) != -1){
+                            this.monthWorkDataS1.push(this.notFullOriginList[i])
+                        }
+                    }
+                    if (this.monthWorkDataS1.length > 50) {
+                        this.notFullData = this.monthWorkDataS1.slice(0,50);
+                    }else{
+                        this.notFullData = this.monthWorkDataS1 
+                    }
                 }
             },
             addUpload(data) {
@@ -8876,6 +8880,12 @@
                     this.deptIdForReminder = arr
                     this.showMonthWorkTimeReminder()
                 }
+                if(obj.distinction == '17' && obj) {
+                    let arr = []
+                    arr.push(obj.id)
+                    this.deptIdForHasReport = arr
+                    this.showReportTimeLessThanCardTimeList();
+                }
             },
             //分页
             handleCurrentChange(val) {
@@ -9104,7 +9114,10 @@
                         this.searchKeyword = ''
                     }
                     this.searchScreen(1)
-                }
+                } else if(obj.distinction == '15') {
+                    this.usersListId = obj.id
+                    this.showReportTimeLessThanCardTimeList();
+                } 
             }
         },
         created() {