Quellcode durchsuchen

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

Guo1B0 vor 1 Jahr
Ursprung
Commit
c5f1355221
20 geänderte Dateien mit 339 neuen und 234 gelöschten Zeilen
  1. 30 0
      fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/taskFunction.ts
  2. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/type.d.ts
  3. 20 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/analysis/index.vue
  4. 1 0
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/api.ts
  5. 14 0
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/api.ts
  6. 130 30
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue
  7. 8 0
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/type.d.ts
  8. 7 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/api.ts
  9. 24 6
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/index.vue
  10. 2 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/type.d.ts
  11. 0 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/index.vue
  12. 3 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/type.d.ts
  13. 2 2
      fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts
  14. 13 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/tools.ts
  15. 4 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java
  16. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ProductService.java
  17. 50 25
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java
  18. 10 153
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysFormServiceImpl.java
  19. 2 2
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  20. 16 3
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

+ 30 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/taskFunction.ts

@@ -0,0 +1,30 @@
+import { dayjs } from 'element-plus';
+import { post } from "@/utils/request";
+import { getFromValue } from '@/utils/tools';
+import { ADD_TASK } from '@/pages/tasks/api';
+
+// 封装新建任务请求
+export async function createTask(submitData: any, isClose: boolean) : Promise<TaskResponse> {
+    return new Promise((resolve, reject) => {
+        const { executorId, startDate, endDate, repeatEndDate } = submitData;
+        let params = {
+            ...submitData,
+            startDate: startDate && dayjs(startDate).format('YYYY-MM-DD 00:00:00'),
+            endDate: endDate && dayjs(endDate).format('YYYY-MM-DD 23:59:59'),
+            repeatEndDate: repeatEndDate && dayjs(repeatEndDate).format('YYYY-MM-DD 23:59:59')
+        }
+        if (executorId) {
+            params = {
+                ...params,
+                executorId: executorId.join(','),
+                taskLogs: []
+            }
+        }
+
+        post(ADD_TASK, getFromValue(params)).then(() => {
+            resolve({ saveLoading: '3', isClose })
+        }).catch((err) => {
+            reject({ saveLoading: '4', isClose, message: err.message })
+        })
+    })
+}

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

@@ -50,4 +50,4 @@ export interface Emits {
    * @param isClose 是否关闭弹窗
    */
   (event: "submit", submitData: Object, isClose: boolean): void;
-}
+}

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

@@ -104,6 +104,25 @@ const option: EChartsOption = {
         </div>
       </div>
     </section>
-    <nav class="bg-green-200 flex-1 min-w-60 sticky right-0 top-8">222</nav>
+    <nav class="flex-1 min-w-60 sticky right-0 top-9">
+      <div class="border border-gray-200 rounded w-3/4 text-sm text-gray-500">
+        <div class="p-2 bg-sky-100 border-l-2 border-blue-700">仅本人</div>
+        <div class="p-2">本人及下属</div>
+        <div class="p-2">仅本部门</div>
+        <div class="p-2">本部门及下属</div>
+      </div>
+      <div class="border border-gray-200 rounded text-sm text-gray-500 mt-4">
+        <div class="p-2 bg-sky-100 border-l-2 border-blue-700">本月</div>
+        <div class="p-2">本周</div>
+        <div class="p-2">本年</div>
+        <div class="p-2">
+          <div>自定义</div>
+          <el-date-picker
+            type="daterange"
+            class="max-w-full mt-2"
+          ></el-date-picker>
+        </div>
+      </div>
+    </nav>
   </div>
 </template>

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/api.ts

@@ -1,3 +1,4 @@
 export const SENDVCODE = "/user/sendVcode";     //发送验证码
 export const REGISTER = "/user/insertCompany";  //注册
 export const LOGIN = "/user/loginAdmin";        //登录
+export const IMPORTTIMELIST = "/sys-form/getExportTemplate" // 下载模板

+ 14 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/api.ts

@@ -5,9 +5,23 @@ export const GETPERSONNEL = "/user/getSimpleActiveUserList";
 export const GETGENERATEFOEM = `/sys-form/getListByCode${MOD}`
 export const GETBUSINESSLIST = `/business-opportunity/list`
 export const UPDATEINSET = `/business-opportunity/insertAndUpdate`
+export const BUSINESSDETELE = `/business-opportunity/delete`
+export const BATCHTRANSFER = `/business-opportunity/claim`
 
 export const stageStatus = [
     { id: 1, name: "赢单", progress: "100%" },
     { id: 2, name: "输单", progress: "0%" },
     { id: 3, name: "无效", progress: "0%" }
+]
+
+export const tableColumn: businessTableColumnInterface[] = [
+    { prop: "name", label: "商机名称", width: "180", eventName: "toClueTableDetail" },
+    { prop: "customerName", label: "客户名称", width: "180" },
+    { prop: "contactsName", label: "联系人", width: "180", eventName: "showName" },
+    { prop: "amountOfMoney", label: "商机金额", width: "180" },
+    { prop: "stageValue", label: "商机阶段", width: "180" },
+    { prop: "expectedTransactionDate", label: "预计成交", width: "180" },
+    { prop: "inchargerName", label: "负责人", width: "180" },
+    { prop: "creatorName", label: "创建人", width: "180" },
+    { prop: "createTime", label: "创建时间", width: "180" }
 ]

+ 130 - 30
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -48,43 +48,31 @@
       <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
         <div class="flex justify-end pb-3">
           <el-button type="primary" @click="showVisible('newBusinessisible')">新建商机</el-button>
-          <el-button type="primary">批量转移</el-button>
-          <el-button type="primary">批量删除</el-button>
+          <el-button type="primary" @click="showVisible('batchTransferVisible')"
+            :disabled="batchTableData.length <= 0">批量转移</el-button>
+          <el-button type="primary" @click="batchDeteleItem()" :disabled="batchTableData.length <= 0">批量删除</el-button>
           <el-button type="primary">阶段设置</el-button>
           <el-button type="primary">回收站</el-button>
           <el-button type="primary">导入</el-button>
           <el-button type="primary">导出</el-button>
         </div>
         <div class="flex-1 w-full overflow-hidden">
-          <el-table ref="clueTableRef" :data="businessTable" border v-loading="allLoading.businessTableLading"
-            style="width: 100%;height: 100%;">
+          <el-table ref="businessTableRef" :data="businessTable" border v-loading="allLoading.businessTableLading"
+            @selection-change="changeBatch" style="width: 100%;height: 100%;">
             <el-table-column type="selection" width="55" />
-            <el-table-column prop="name" label="商机名称" width="180">
+            <el-table-column v-for="(item, index) in tableColumn" :prop="item.prop" :label="item.label" :key="index" :width="item.width">
               <template #default="scope">
-                <el-button link type="primary" size="large" @click="toBusinessTableDetail(scope.row)">{{
-                  scope.row.name
-                }}</el-button>
+                <el-button link type="primary" size="large" @click="dealWithTableColumn(scope.row, item.eventName)" v-if="item.eventName">{{scope.row[item.prop]}}</el-button>
+                <template v-else>{{scope.row[item.prop]}}</template>
               </template>
             </el-table-column>
-            <el-table-column prop="customerName" label="客户名称" width="180"></el-table-column>
-            <el-table-column prop="contactsName" label="联系人" width="180">
-              <template #default="scope">
-                <el-button link type="primary" size="large">{{
-                  scope.row.contactsName
-                }}</el-button>
-              </template>
-            </el-table-column>
-            <el-table-column prop="amountOfMoney" label="商机金额" width="180"></el-table-column>
-            <el-table-column prop="stageValue" label="商机阶段" width="180"></el-table-column>
-            <el-table-column prop="expectedTransactionDate" label="预计成交" width="180"></el-table-column>
-            <el-table-column prop="inchargerName" label="负责人" width="180"></el-table-column>
-            <el-table-column prop="creatorName" label="创建人" width="180"></el-table-column>
-            <el-table-column prop="createTime" label="创建时间" width="180"></el-table-column>
             <el-table-column label="操作" fixed="right" width="200">
               <template #default="scope">
-                <el-button link type="primary" size="large" @click="editShowVisible('newBusinessisible', scope.row)">编辑</el-button>
-                <el-button link type="primary" size="large">新建任务</el-button>
-                <el-button link type="danger" size="large">删除</el-button>
+                <el-button link type="primary" size="large"
+                  @click="editShowVisible('newBusinessisible', scope.row)">编辑</el-button>
+                <el-button link type="primary" size="large" @click="newTask(scope.row)">新建任务</el-button>
+                <el-button link type="danger" size="large"
+                  @click="businessDeteleItem(scope.row.id, scope.row.name)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -116,24 +104,54 @@
         <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
       </div>
     </el-dialog>
+
+    <!-- 新建任务 -->
+    <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
+      @close="closeVisible('taskModalVisible')" @submit="submitForm" :title="'新建任务'"
+      :disabled-list="['taskType', 'businessOpportunityId']" />
+
+    <!-- 批量转移 -->
+    <el-dialog v-model="allVisible.batchTransferVisible" width="600" :show-close="false" top="10vh">
+      <template #header="{ close, titleId, titleClass }">
+        <div class="flex justify-between items-center border-b pb-3 dialog-header">
+          <h4 :id="titleId">{{ allText.transferText }}</h4>
+          <div>
+            <el-button type="primary" v-loading="allLoading.transferLoading" @click="transferBusiness()">转移</el-button>
+            <el-button @click="allVisible.batchTransferVisible = false">取消</el-button>
+          </div>
+        </div>
+      </template>
+      <div class="scroll-bar m-6">
+        <div class="flex mb-4">
+          <div class="w-20 flex items-center justify-end pr-4">转移至:</div>
+          <el-select v-model="transferPersonnel" placeholder="请选择" class="flex1">
+            <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
+        </div>
+        <div class="pl-3 text-[#e94a4a]">转移后,将看不到此商机</div>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import type { FormInstance, FormRules } from 'element-plus'
+import type { ElTable, FormInstance, FormRules } from 'element-plus'
 import { useRouter, useRoute } from "vue-router";
-import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDATEINSET } from './api'
+import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDATEINSET, BUSINESSDETELE, BATCHTRANSFER, tableColumn } from './api'
 import { GETTABLELIST } from '@/pages/product/api'
 import { post, get } from "@/utils/request";
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate } from '@/utils/tools'
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, createTaskFromType, formatDate, confirmAction } from '@/utils/tools'
+import { createTask } from '@/components/TaskModal/taskFunction'
 import { formatDateTime } from '@/utils/times'
 import { GenerateForm } from '@zmjs/form-design';
 import RelatedProducts from './component/relatedProducts.vue'
+import TaskModal from '@/components/TaskModal/index.vue'
 
 const route = useRoute()
 const router = useRouter()
 const globalPopup = inject<GlobalPopup>('globalPopup')
+const businessTableRef = ref<InstanceType<typeof ElTable>>() // 商机table dom
 const businessTotalTable = ref(0)
 const generateForm = ref<typeof GenerateForm>() // 自定义表单dom
 const relatedProductsRef = ref<typeof RelatedProducts>()
@@ -146,15 +164,24 @@ const allLoading = reactive({
   businessTableLading: false,
   businessSaveLading: false,
   newBusinessSaveLading: false,
+  transferLoading: false
 })
 const allVisible = reactive({
   newBusinessisible: false,
   recycleVisible: false,
+  taskModalVisible: false,
+  batchTransferVisible: false
 })
 const allText = reactive({
-  newBusinessisibleText: '新建商机'
+  newBusinessisibleText: '新建商机',
+  transferText: '转移商机'
 }) // 所有文本
 
+const taskModalForm = ref({}) // 任务弹窗表单
+const taskLoading = ref<saveLoadingType>("1");
+const batchTableData = ref([]) // 批量数据
+const transferPersonnel = ref('') // 转移人
+
 const businessOpportunityForm = reactive<businessOpportunityFormType>({
   name: '',
   stageId: '',
@@ -201,6 +228,71 @@ function editShowVisible(type: keyof typeof allVisible, item: any) {
   showVisible(type)
 }
 
+function newTask(item: any) {
+  const { id } = item
+  taskModalForm.value = { ...createTaskFromType(1), businessOpportunityId: id, }
+  showVisible('taskModalVisible')
+}
+
+function submitForm(submitData: any, isClose: boolean) { // 任务提交
+  taskLoading.value = '2'
+  createTask(submitData, isClose).then((res) => {
+    const { saveLoading, isClose } = res
+    taskLoading.value = saveLoading
+    allVisible.taskModalVisible = isClose
+    globalPopup?.showSuccess('新增成功')
+  }).catch((err) => {
+    const { saveLoading, isClose, message } = err
+    taskLoading.value = saveLoading
+    allVisible.taskModalVisible = isClose
+    globalPopup?.showError(message)
+  })
+}
+
+function transferBusiness() {
+  const ids = batchTableData.value.map((item: any) => item.id).join(',')
+  allLoading.transferLoading = true
+  post(BATCHTRANSFER, { ids, inchargerId: transferPersonnel.value }).then(() => {
+    transferPersonnel.value = ''
+    globalPopup?.showSuccess('转移成功')
+    closeVisible('batchTransferVisible')
+    getBusinessTableList()
+  }).finally(() => {
+    allLoading.transferLoading = false
+  })
+}
+
+function batchDeteleItem() {
+  const value = batchTableData.value.map((item: any) => item.id).join(',')
+  const label = batchTableData.value.map((item: any) => item.name).join(',')
+  businessDeteleItem(value, label, true)
+}
+
+function businessDeteleItem(value: string | number, label: string, batch: boolean = false) {
+  confirmAction(`确定${batch ? '批量' : ''}删除【${label}】商机吗?`).then(() => {
+    post(BUSINESSDETELE, { ids: value }).then(res => {
+      if (res.code != 'ok') {
+        globalPopup?.showError(res.msg)
+        return
+      }
+      globalPopup?.showSuccess('删除成功')
+      changeBatch(false)
+      getBusinessTableList()
+    }).catch((err) => {
+      globalPopup?.showError(err.message)
+    })
+  })
+}
+
+function changeBatch(flag: boolean = true) {
+  if (flag) {
+    batchTableData.value = businessTableRef.value && businessTableRef.value.getSelectionRows()
+  } else {
+    batchTableData.value = []
+    businessTableRef.value && businessTableRef.value.clearSelection()
+  }
+}
+
 function showVisible(type: keyof typeof allVisible) { // 显示弹窗
   allVisible[type] = true
 }
@@ -215,6 +307,7 @@ function handleClose(done: () => void) {
 
 function getBusinessTableList() {
   const formValue = getFromValue(businessOpportunityForm)
+  allLoading.businessTableLading = true
   post(GETBUSINESSLIST, { ...formValue }).then((res) => {
     const { data, total } = res.data
     businessTable.value = data.map((item: any) => {
@@ -224,6 +317,8 @@ function getBusinessTableList() {
       }
     })
     businessTotalTable.value = total
+  }).finally(() => {
+    allLoading.businessTableLading = false
   })
 }
 
@@ -263,13 +358,18 @@ async function getSystemField() {
 }
 
 function toBusinessTableDetail(row: any) {
-  console.log('点击跳转详情')
   router.push({
     path: `${MOD}/detail`,
     query: { id: row.id }
   })
 }
 
+function dealWithTableColumn(row: any, eventName: string) {
+  if(eventName == 'toClueTableDetail') {
+    toBusinessTableDetail(row)
+  }
+}
+
 function getProductTableList() {
   post(GETTABLELIST, { pageIndex: -1, pageSize: -1 }).then((res) => {
     if (res.code == 'ok') {

+ 8 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/type.d.ts

@@ -26,3 +26,11 @@ interface personnelInterface {
   phone: string;
   jobNumber: string;
 }
+
+interface businessTableColumnInterface {
+  prop: string;
+  label: string;
+  width: string;
+  eventName?: string;
+  event?: () => void;
+}

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/api.ts

@@ -16,8 +16,14 @@ export const GETDETAIL = `${prefix}/detail`
 export const GETINCHARGER = `${prefix}/transferIncharger`
 export const GETBUSINESS = `${prefix}/businessListWithProduct`
 export const GETORDER = `${prefix}/orderWithProduct`
+export const EXPORTTIME = `${prefix}/exportData`
 export const UPLOADATTACHMENT = `/attachment/uploadAttachment`
 export const GETCENTERLIST = `/audit-log-center/list`
 export const GETATTACHMENT = `/attachment/attachmentList`
 export const FILEDETELE = `/attachment/delete`
-export const FILERENAME = `/attachment/rename`
+export const FILERENAME = `/attachment/rename`
+
+export const SELECTSTATUS = [
+    { value: 1, label: '上架' },
+    { value: 0, label: '下架' } 
+]

+ 24 - 6
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/index.vue

@@ -15,6 +15,11 @@
                 <el-option v-for="item in fixedData.ProductType" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
+            <el-form-item label="状态">
+              <el-select v-model="filterProductForm.status" placeholder="请选择">
+                <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
+              </el-select>
+            </el-form-item>
             <el-form-item label="负责人">
               <el-select v-model="filterProductForm.userId" placeholder="请选择">
                 <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
@@ -43,7 +48,7 @@
           <el-button type="primary" @click="batchDelete()">批量删除</el-button>
           <el-button type="primary" @click="showDeteleProduct(true)">回收站</el-button>
           <el-button type="primary" @click="dialogVisible.importVisible = true">导入</el-button>
-          <el-button type="primary">导出</el-button>
+          <el-button type="primary" @click="exportProductTableList()" :loading="allLoading.exoprtLoading">导出</el-button>
         </div>
         <div class="flex-1 w-full overflow-hidden">
           <el-table ref="productTableRef" :data="productTableList" border v-loading="allLoading.productTableLading"
@@ -118,7 +123,7 @@
       </template>
       <div class="p-8">
         <div class="ml-4 mr-4">
-          <div class="flex items-center">1、点击下载 <el-link type="primary">产品导入模板.xlsx</el-link></div>
+          <div class="flex items-center">1、点击下载 <el-link type="primary" @click="downloadTemplate(MODUCODE, '产品导入模板.xlsx')">产品导入模板.xlsx</el-link></div>
           <div class="mt-4">2、填写excel文件、产品编号、产品名称、产品类别、标准价格、库存、状态必填</div>
         </div>
       </div>
@@ -131,8 +136,8 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { GETSYSFILED, MOD, GETPERSONNEL, GETTEMPLATE, GETTABLELIST, ADDPRODUCT, ALLDETELE, UPLOADFILE } from './api'
-import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, createTaskFromType, confirmAction } from '@/utils/tools'
+import { GETSYSFILED, MOD, MODUCODE, GETPERSONNEL, GETTEMPLATE, GETTABLELIST, ADDPRODUCT, ALLDETELE, UPLOADFILE, EXPORTTIME } from './api'
+import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, downloadFile, formatDate, createTaskFromType, confirmAction, downloadTemplate } from '@/utils/tools'
 import { FormInstance, FormRules, ElMessageBox, ElTable, UploadRequestOptions } from 'element-plus'
 import { post, get, uploadFile } from "@/utils/request";
 import { useRouter, useRoute } from "vue-router";
@@ -151,12 +156,14 @@ const filterProductForm = reactive<filterProductFormType>({ // 筛选条件form
   pageSize: 10,
   id: '',
   type: '',
+  status: '',
 })
 const allLoading = reactive({
   productTableLading: false,
   generateFormLading: false,
   saveLoading: false,
-  importLoading: false
+  importLoading: false,
+  exoprtLoading: false
 })
 const dialogVisible = reactive({
   editProductVisible: false,
@@ -272,12 +279,23 @@ async function importProducts(param: UploadRequestOptions) {
   const res = await uploadFile(UPLOADFILE, formData)
   allLoading.importLoading = false
   if (res.code == 'ok') {
-    globalPopup?.showSuccess(res.msg || '')
+    globalPopup?.showSuccess('导入成功' || '')
+    getProductTableList()
     return
   }
   globalPopup?.showError(res.msg || '')
 }
 
+function exportProductTableList() {
+  allLoading.exoprtLoading = true
+  let valueForm = getFromValue(filterProductForm)
+  post(EXPORTTIME, {...valueForm}).then((res) => {
+    downloadFile(res.data, '产品表导出.xlsx')
+  }).finally(() => {
+    allLoading.exoprtLoading = false
+  })
+}
+
 function handleSizeChange(val: number) {
   filterProductForm.pageIndex = 1
   filterProductForm.pageSize = val

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

@@ -7,5 +7,6 @@ interface filterProductFormType {
     type: string | number,
     id: string | number,
     startTime: string,
-    endTime: string
+    endTime: string,
+    status: any
 }

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

@@ -359,7 +359,6 @@ function batchDeletes() {
 }
 
 function toClueTableDetail(row: any) {
-  console.log('点击跳转详情')
   router.push({
     path: `${MOD}/detail`,
     query: { id: row.id }

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

@@ -26,4 +26,6 @@ type saveLoadingType = "1" | "2" | "3" | "4"; //1是没有保存, 2是正在保
 type TASK_VALUE_TYPE = 0 | 1 | 2 | 3; //0是客户, 1是商机, 2是销售订单 ,3是线索
 type REPEAT_VALUE_TYPE = 0 | 1 | 2 | 3 | 4; //0是每天, 1是每周, 2是每月, 3是自定义周期, 4是自定义日期
 
-type componentType = "success" | "info" | "warning" | "error"
+type componentType = "success" | "info" | "warning" | "error"
+
+type TaskResponse = { saveLoading: saveLoadingType, isClose: boolean, message?: string }

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/request.ts

@@ -30,10 +30,10 @@ instance.interceptors.request.use(
 instance.interceptors.response.use(
   (response: AxiosResponse) => {
     // 对响应数据进行处理
-    if (response.status != 200) {
+    if (response.status !== 200 || response.data.code === 'error') {
       ElNotification.closeAll()
       ElNotification({
-        message: showMessage(response.status), // 传入响应码,匹配响应码对应信息,
+        message: response.status !== 200 ? showMessage(response.status) : response.data.msg,
         type: "error",
       });
     }

+ 13 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/tools.ts

@@ -1,6 +1,7 @@
 import { defalutModalForm } from "@/components/TaskModal/api";
 import { ElMessageBox } from "element-plus";
-import { get } from "./request";
+import { IMPORTTIMELIST } from '../pages/api'
+import { get, post } from "./request";
 /**
  * 判断值是否为空
  * @param value 值
@@ -203,3 +204,14 @@ export function confirmAction(
 export function backPath() {
   window.history.go(-1);
 }
+
+/**
+ * 下载模板
+ * @param mod 模块名称(模板链接)
+ * @param fileName 下载的文件名称
+ */
+export function downloadTemplate(mod: any, fileName: string) {
+  post(`${IMPORTTIMELIST}`, { code: mod }).then((res: any) => {
+    downloadFile(res.data, fileName)
+  });
+}

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

@@ -64,9 +64,9 @@ public class ProductController {
     * @Date: 2024/5/21
     */
     @RequestMapping("/list")
-    public HttpRespMsg list(String userId,String productName,String productCode,Integer productType,Integer status,Integer pageIndex,Integer pageSize){
+    public HttpRespMsg list(String userId,String productName,String productCode,Integer productType,Integer status,String startTime,String endTime,Integer pageIndex,Integer pageSize){
         Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
-        return productService.getList(companyId,userId,productName,productCode,productType,status,pageIndex,pageSize);
+        return productService.getList(companyId,userId,productName,productCode,productType,status,startTime,endTime,pageIndex,pageSize);
     }
 
     /**
@@ -197,8 +197,8 @@ public class ProductController {
     * @Date: 2024/5/21
     */
     @RequestMapping("/exportData")
-    public HttpRespMsg exportData(String userId,String productName,String productCode,Integer productType,Integer status) throws Exception {
-        return productService.exportData(userId,productName,productCode,productType,status);
+    public HttpRespMsg exportData(String userId,String productName,String productCode,Integer productType,Integer status,String startTime,String endTime) throws Exception {
+        return productService.exportData(userId,productName,productCode,productType,status,startTime,endTime);
     }
 
     /**

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

@@ -17,11 +17,11 @@ import java.lang.reflect.InvocationTargetException;
  */
 public interface ProductService extends IService<Product> {
 
-    HttpRespMsg getList(Integer companyId,String userId, String productName, String productCode,Integer productType,Integer status, Integer pageIndex, Integer pageSize);
+    HttpRespMsg getList(Integer companyId,String userId, String productName, String productCode,Integer productType,Integer status,String startDate,String endDate, Integer pageIndex, Integer pageSize);
 
     HttpRespMsg importData(MultipartFile multipartFile);
 
-    HttpRespMsg exportData(String userId, String productName, String productCode,Integer productType,Integer status) throws Exception;
+    HttpRespMsg exportData(String userId, String productName, String productCode,Integer productType,Integer status,String startDate,String endDate) throws Exception;
 
     HttpRespMsg getDetail(Integer id);
 

+ 50 - 25
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java

@@ -19,6 +19,11 @@ 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.ss.usermodel.CellType;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -30,7 +35,9 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.math.BigDecimal;
 import java.time.DateTimeException;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
@@ -75,7 +82,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
     private AttachmentCenterMapper attachmentCenterMapper;
 
     @Override
-    public HttpRespMsg getList(Integer companyId,String userId, String productName, String productCode,Integer productType,Integer status, Integer pageIndex, Integer pageSize) {
+    public HttpRespMsg getList(Integer companyId,String userId, String productName, String productCode,Integer productType,Integer status,String startDate,String endDate, Integer pageIndex, Integer pageSize) {
         HttpRespMsg msg=new HttpRespMsg();
         User targetUsr = userMapper.selectById(request.getHeader("token"));
         List<Department> departments = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
@@ -133,6 +140,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         if(status!=null){
             queryWrapper.eq(Product::getStatus,status);
         }
+        if(startDate!=null && endDate!=null){
+            DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            LocalDateTime start = LocalDate.parse(startDate, df).atTime(LocalTime.MIN);
+            LocalDateTime end = LocalDate.parse(endDate, df).atTime(LocalTime.MAX);
+            queryWrapper.between(Product::getCreateTime,start,end);
+        }
         if(pageIndex==null&&pageSize==null){
             pageIndex=-1;
             pageSize=-1;
@@ -189,9 +202,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             inputStream.close();
             outputStream.close();
             //解析表格
-            HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
+            XSSFWorkbook workbook = new XSSFWorkbook(file);
             //我们只需要第一个sheet
-            HSSFSheet sheet = workbook.getSheetAt(0);
+            XSSFSheet sheet = workbook.getSheetAt(0);
             //由于第一行需要指明列对应的标题
             int rowNum = sheet.getLastRowNum();
             //获取当前表单模板 校验规则
@@ -207,7 +220,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             List<String> userNameList=new ArrayList<>();
             HttpRespMsg respMsg=new HttpRespMsg();
             for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
-                HSSFRow row = sheet.getRow(rowIndex);
+                XSSFRow row = sheet.getRow(rowIndex);
                 if (row == null) {
                     continue;
                 }
@@ -220,7 +233,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                 for (int i = 0; i < cellNum; i++) {
                     JSONObject item = configObJSONArray.getJSONObject(i);
                     String modelName = item.getString("model");
-                    HSSFCell cell = row.getCell(i);
+                    XSSFCell cell = row.getCell(i);
                     if(cell!=null){
                         switch (item.getString("type")){
                             case "time":cell.setCellType(CellType.NUMERIC);
@@ -245,8 +258,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                 }
             }
             List<User> targetUserList= (List<User>) respMsg.data;
-            for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
-                HSSFRow row = sheet.getRow(rowIndex);
+            //直接忽略空行 从row1开始
+            for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
+                XSSFRow row = sheet.getRow(rowIndex);
                 if (row == null) {
                     continue;
                 }
@@ -265,7 +279,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                     String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
                     String getter="get"+className;
                     String setter="set"+className;
-                    HSSFCell cell = row.getCell(i);
+                    XSSFCell cell = row.getCell(i);
                     if(cell!=null){
                         switch (item.getString("type")){
                             case "time":cell.setCellType(CellType.NUMERIC);
@@ -274,8 +288,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                         }
                     }
 //                    Class<?> productClass = Class.forName("com.management.platform.entity.Product");
-                    Class<Product> productClass = Product.class;
-                    Method method = productClass.getMethod(setter, String.class);
                     //校验当前列是否为必填
                     JSONObject options = item.getJSONObject("options");
                     JSONObject rules = options.getJSONObject("rules");
@@ -293,9 +305,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                             if(first.isPresent()){
                                 product.setId(first.get().getId());
                             }
+                            product.setProductCode(cell.getStringCellValue());
                         }
-                    }
-                    if(modelName.equals("inchargerId")){
+                    }else if(modelName.equals("inchargerId")){
                         if(!StringUtils.isEmpty(cell.getStringCellValue())){
                             String userName = cell.getStringCellValue();
                             Optional<User> first;
@@ -308,11 +320,11 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                             if (first.isPresent()) {
                                 product.setInchargerId(first.get().getId());
                             } else {
-                                throw new Exception("["+userName+"]在系统中不存在");
+                                msg.setError("["+userName+"]在系统中不存在");
+                                return msg;
                             }
                         }
-                    }
-                    if(modelName.equals("status")){
+                    }else if(modelName.equals("status")){
                         if(!StringUtils.isEmpty(cell.getStringCellValue())){
                             switch (cell.getStringCellValue()){
                                 case "下架":product.setStatus(0);
@@ -321,18 +333,25 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                                 break;
                             }
                         }
-                    }
-                    if(modelName.equals("type")){
+                    }else if(modelName.equals("price")){
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            product.setPrice(new BigDecimal(cell.getStringCellValue()));
+                        }
+                    }else if(modelName.equals("inventory")){
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            product.setInventory(new BigDecimal(cell.getStringCellValue()).intValue());
+                        }
+                    }else if(modelName.equals("type")){
                         if(!StringUtils.isEmpty(cell.getStringCellValue())){
                             Optional<SysDict> first = sysDictOfProductType.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
                             if(first.isPresent()){
                                 product.setType(first.get().getId());
                             }else {
-                                throw new Exception("产品类型["+cell.getStringCellValue()+"不存在,请在系统字典中增加");
+                                msg.setError("产品类型["+cell.getStringCellValue()+"]不存在,请在系统字典中增加");
+                                return msg;
                             }
                         }
-                    }
-                    if(modelName.equals("unit")){
+                    } else if(modelName.equals("unit")){
                         if(!StringUtils.isEmpty(cell.getStringCellValue())){
                             Optional<SysDict> first = sysDictOfProductUnit.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
                             if(first.isPresent()){
@@ -341,10 +360,14 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                                 throw new Exception("产品单位["+cell.getStringCellValue()+"不存在,请在系统字典中增加");
                             }
                         }
+                    }else {
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            Class<Product> productClass = Product.class;
+                            Method method = productClass.getMethod(setter,String.class);
+                            method.invoke(product,cell.getStringCellValue());
+                        }
                     }
-                    if(!StringUtils.isEmpty(cell.getStringCellValue())){
-                        method.invoke(product,cell.getStringCellValue());
-                    }
+
                 }
                 importProductList.add(product);
             }
@@ -362,12 +385,14 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             e.printStackTrace();
         } catch (Exception e) {
             e.printStackTrace();
+            msg.setError("验证失败");
+            return msg;
         }
         return msg;
     }
 
     @Override
-    public HttpRespMsg exportData(String userId, String productName, String productCode,Integer productType,Integer status) throws Exception {
+    public HttpRespMsg exportData(String userId, String productName, String productCode,Integer productType,Integer status,String startDate,String endDate) throws Exception {
         User user = userMapper.selectById(request.getHeader("token"));
         SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCompanyId, user.getCompanyId()).eq(SysForm::getCode, "Product").eq(SysForm::getIsCurrent, 1));
         WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, user.getCompanyId()));
@@ -381,7 +406,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             titleList.add(item.getString("label"));
         }
         dataList.add(titleList);
-        HttpRespMsg respMsg = getList(user.getCompanyId(), userId, productName, productCode,productType,status, null, null);
+        HttpRespMsg respMsg = getList(user.getCompanyId(), userId, productName, productCode,productType,status,startDate,endDate, null, null);
         Map<String, Object> msgData = (Map<String, Object>) respMsg.getData();
         List<Product> productList = (List<Product>) msgData.get("record");
         for (Product product : productList) {

+ 10 - 153
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SysFormServiceImpl.java

@@ -11,11 +11,17 @@ import com.management.platform.mapper.SysFormMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.SysFormService;
 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 org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddressList;
+import org.apache.poi.xssf.streaming.SXSSFCell;
+import org.apache.poi.xssf.streaming.SXSSFRow;
+import org.apache.poi.xssf.streaming.SXSSFSheet;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFColor;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -89,164 +95,15 @@ public class SysFormServiceImpl extends ServiceImpl<SysFormMapper, SysForm> impl
             default:title="";
         }
         String result=MessageUtils.message("file.excelScu");
-        String fileName= title+".xls";
         try {
-//            response.reset();
-//            response.setHeader("Content-disposition",
-//                "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
-//            //设置文件头编码格式
-//            response.setContentType("APPLICATION/OCTET-STREAM;charset=UTF-8");//设置类型
-//            response.setHeader("Cache-Control","no-cache");//设置头
-//            response.setDateHeader("Expires", 0);//设置日期头
-            // 创建工作簿
-            HSSFWorkbook workBook = new HSSFWorkbook();
-            // 创建工作类
-            HSSFSheet sheet = workBook.createSheet();
-            //设置首行冻结
-            sheet.createFreezePane(0, 1);
-            sheet.setDefaultColumnWidth(16);
-            //设置字体样式
-            HSSFFont headFont = workBook.createFont();
-            headFont.setBold(true);
-            headFont.setFontHeightInPoints((short) 10);
-            headFont.setFontName("黑体");
-
-            HSSFFont titleFont = workBook.createFont();
-            titleFont.setBold(true);
-            titleFont.setFontHeightInPoints((short) 10);
-            titleFont.setFontName("黑体");
-
-            HSSFFont font = workBook.createFont();
-            font.setFontHeightInPoints((short) 10);
-            font.setFontName("宋体");
-
-            //设置单元格样式
-            CellStyle headStyle = workBook.createCellStyle();
-            headStyle.setFont(headFont);
-            headStyle.setAlignment(HorizontalAlignment.CENTER);
-            headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
-            headStyle.setWrapText(true);
-            headStyle.setBorderBottom(BorderStyle.THIN); //下边框
-            headStyle.setBorderLeft(BorderStyle.THIN);//左边框
-            headStyle.setBorderTop(BorderStyle.THIN);//上边框
-            headStyle.setBorderRight(BorderStyle.THIN);//右边框
-
-            String color = "c0c0c0";    //此处得到的color为16进制的字符串
-            //转为RGB码
-            int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
-            int g = Integer.parseInt((color.substring(2,4)),16);
-            int b = Integer.parseInt((color.substring(4,6)),16);
-
-            //自定义cell颜色
-            HSSFPalette palette = workBook.getCustomPalette();
-            //这里的9是索引
-            palette.setColorAtIndex((short)9, (byte) r, (byte) g, (byte) b);
-
-            CellStyle titleStyle = workBook.createCellStyle();
-            titleStyle.setFont(titleFont);
-            titleStyle.setAlignment(HorizontalAlignment.CENTER);
-            titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
-            titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
-            titleStyle.setFillForegroundColor((short)9);    //填色
-            titleStyle.setWrapText(true);
-            titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
-            titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
-            titleStyle.setBorderTop(BorderStyle.THIN);//上边框
-            titleStyle.setBorderRight(BorderStyle.THIN);//右边框
-
-            CellStyle cellStyle = workBook.createCellStyle();
-            cellStyle.setFont(font);
-            cellStyle.setAlignment(HorizontalAlignment.CENTER);
-            cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
-            cellStyle.setWrapText(true);
-            cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
-            cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
-            cellStyle.setBorderTop(BorderStyle.THIN);//上边框
-            cellStyle.setBorderRight(BorderStyle.THIN);//右边框
-            cellStyle.setDataFormat(workBook.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"));
-            if(allList.size() > 0) {
-                int start = 0;
-                for(List<String> rowList : allList) {
-                    HSSFRow row = sheet.createRow(start);
-                    row.setHeightInPoints(24);
-                    for(int i = 0; i < rowList.size(); i++) {
-                        HSSFCell cell = row.createCell(i);
-                        ClientAnchor anchor = new HSSFClientAnchor();
-                        if(start == 0) {
-                            cell.setCellStyle(titleStyle);
-                            // 关键修改
-                            anchor.setDx1(0);
-                            anchor.setDx2(0);
-                            anchor.setDy1(0);
-                            anchor.setDy2(0);
-                            anchor.setCol1(cell.getColumnIndex());
-                            anchor.setRow1(cell.getRowIndex());
-                            anchor.setCol2(cell.getColumnIndex() + 5);
-                            anchor.setRow2(cell.getRowIndex() + 6);
-                            // 结束
-                            Drawing drawing = sheet.createDrawingPatriarch();
-                            Comment comment = null;
-                            String[] textList=null;
-                            DVConstraint constraint =null;
-                            CellRangeAddressList regions =null;
-                            HSSFDataValidation data_validation_list =null;
-//                            switch (rowList.get(i)){
-//                                case "是否为公共项目":
-//                                case "Whether it is a public project":
-//                                    // 加载下拉列表内容
-//                                    //textList= new String[]{"是", "否"};
-//                                    textList= new String[]{MessageUtils.message("excel.yes"), MessageUtils.message("excel.no")};
-//                                    constraint = DVConstraint
-//                                            .createExplicitListConstraint(textList);
-//                                    // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
-//                                    regions = new CellRangeAddressList(1,
-//                                            1000, i, i);
-//                                    // 数据有效性对象
-//                                    data_validation_list = new HSSFDataValidation(
-//                                            regions, constraint);
-//                                    sheet.addValidationData(data_validation_list);
-//                                    comment = drawing.createCellComment(anchor);
-//                                    // 输入批注信息
-//                                    //comment.setString(new HSSFRichTextString("是否为公共项目\n" +
-//                                    //"是:公共项目\n" +
-//                                    //"否:普通项目"));
-//                                    comment.setString(new HSSFRichTextString(MessageUtils.message("excel.publicProject")+"\n" +
-//                                            MessageUtils.message("excel.yesPublic")+"\n" +
-//                                            MessageUtils.message("excel.noPublic")));
-//                                    cell.setCellComment(comment);
-//                                    break;
-//                            }
-                        }else {
-                            cell.setCellStyle(cellStyle);
-                        }
-                        cell.setCellValue(rowList.get(i));
-                    }
-                    start++;
-                }
-            }
-            //用于非传统ajax;
-//            String headStr = "attachment; filename=\"" + fileName + "\"";
-//            response.setContentType("APPLICATION/OCTET-STREAM");//返回格式为流
-//            response.setHeader("Content-Disposition", headStr);
-//            //普通下载不需要以上三行,注掉即可
-//            OutputStream os = response.getOutputStream();//在线下载
-            File dir = null;
-            dir = new File(path);
-            // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
-            if (!dir.exists()) {
-                dir.mkdirs();
-            }
-            FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
-            workBook.write(os);
-            os.flush();
-            os.close();
+            String resp = ExcelUtil.exportGeneralExcelByTitleAndList(title, allList, path);
+            msg.setData(resp);
+            return msg;
         }catch(Exception e) {
             e.printStackTrace();
             //msg.setError("已存在模板名称为["+fileName+"]的文件,请删除后重新下载");
-            msg.setError(MessageUtils.message("file.duplicateTemplate",fileName));
+            msg.setError(MessageUtils.message("file.duplicateTemplate",title));
             return msg;
         }
-        msg.data= "/upload/"+fileName;
-        return msg;
     }
 }

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

@@ -1926,7 +1926,7 @@
         left join task t on t.id=te.task_id
         left join project p on p.id=t.project_id
         left join project_category pc on pc.id=p.category
-        where u.company_id=#{companyId} and te.project_id is not null  and pc.name in ('报价项目','售后报价项目','售后工程项目','工程项目')
+        where u.company_id=#{companyId} and te.project_id is not null  and pc.name not in ('报价项目','售后报价项目','研发项目')
         <if test="projectId!=null">
             and p.id=#{projectId}
         </if>
@@ -1957,7 +1957,7 @@
         left join task t on t.id=te.task_id
         left join project p on p.id=t.project_id
         left join project_category pc on pc.id=p.category
-        where u.company_id=#{companyId} and te.project_id is not null  and pc.name in ('报价项目','售后报价项目','售后工程项目','工程项目')
+        where u.company_id=#{companyId} and te.project_id is not null  and pc.name not in ('报价项目','售后报价项目','研发项目')
         <if test="projectId!=null">
             and p.id=#{projectId}
         </if>

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

@@ -35,6 +35,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.Bidi;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
@@ -275,7 +276,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             workingTime = 0.0;
         }
         planProcedureTotal.setTotalFillTime(workingTime);
-        planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
+        BigDecimal bigDecimal = new BigDecimal(workingTime);
+        bigDecimal=bigDecimal.divide(new BigDecimal(planProcedureTotal.getTotalWorkingHours()));
+        bigDecimal=bigDecimal.multiply(new BigDecimal(100)).setScale(0,RoundingMode.HALF_UP);
+        planProcedureTotal.setTotalProgress(bigDecimal.intValue());
+//            planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
         planProcedureTotalMapper.updateById(planProcedureTotal);
         //检查该计划下的所有工序是否都已经完成
         List<PlanProcedureTotal> planProcedureTotalList = planProcedureTotalMapper.selectList(new QueryWrapper<PlanProcedureTotal>().eq("plan_id", planProcedureTotal.getPlanId()));
@@ -4799,7 +4804,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 workingTime = curReportSumItem.getWorkingTime();
             }
             planProcedureTotal.setTotalFillTime(workingTime);
-            planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
+            BigDecimal bigDecimal = new BigDecimal(workingTime);
+            bigDecimal=bigDecimal.divide(new BigDecimal(planProcedureTotal.getTotalWorkingHours()));
+            bigDecimal=bigDecimal.multiply(new BigDecimal(100)).setScale(0,RoundingMode.HALF_UP);
+            planProcedureTotal.setTotalProgress(bigDecimal.intValue());
+//            planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
             System.out.println("planProcedureTotal.getId()=="+planProcedureTotal.getId()+"--进度 2 workingTime:"+workingTime+" totalWorkingHours:"+planProcedureTotal.getTotalWorkingHours()+" totalProgress:"+planProcedureTotal.getTotalProgress());
             planProcedureTotalMapper.updateById(planProcedureTotal);
             return new HttpRespMsg();
@@ -4846,7 +4855,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     workingTime = curReportSumItem.getWorkingTime();
                 }
                 planProcedureTotal.setTotalFillTime(workingTime);
-                planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
+                BigDecimal bigDecimal = new BigDecimal(workingTime);
+                bigDecimal=bigDecimal.divide(new BigDecimal(planProcedureTotal.getTotalWorkingHours()));
+                bigDecimal=bigDecimal.multiply(new BigDecimal(100)).setScale(0,RoundingMode.HALF_UP);
+                planProcedureTotal.setTotalProgress(bigDecimal.intValue());
+//            planProcedureTotal.setTotalProgress((int)((workingTime / planProcedureTotal.getTotalWorkingHours()) * 100));
                 System.out.println("planProcedureTotal.getId()=="+planProcedureTotal.getId()+"--进度 3 workingTime:"+workingTime+" totalWorkingHours:"+planProcedureTotal.getTotalWorkingHours()+" totalProgress:"+planProcedureTotal.getTotalProgress());
                 planProcedureTotalMapper.updateById(planProcedureTotal);
             }