Ver Fonte

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

douhl há 10 meses atrás
pai
commit
de3c8cbe8f
43 ficheiros alterados com 24182 adições e 197 exclusões
  1. 2 2
      fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/api.ts
  2. 8 5
      fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/index.vue
  3. 2 2
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/information.vue
  4. 6 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue
  5. 2 2
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/component/information.vue
  6. 12 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/component/products.vue
  7. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/index.vue
  8. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/index.vue
  9. 4 1
      fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/components/attachment.vue
  10. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-06-28.log.gz
  11. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-06-29.log.gz
  12. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-06-30.log.gz
  13. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-07-01.log.gz
  14. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-07-02.log.gz
  15. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-07-03.log.gz
  16. BIN
      fhKeeper/formulahousekeeper/management-crm/crm.2024-07-04.log.gz
  17. 333 0
      fhKeeper/formulahousekeeper/management-crm/hs_err_pid23908.log
  18. 334 0
      fhKeeper/formulahousekeeper/management-crm/hs_err_pid30916.log
  19. 333 0
      fhKeeper/formulahousekeeper/management-crm/hs_err_pid35380.log
  20. 333 0
      fhKeeper/formulahousekeeper/management-crm/hs_err_pid36892.log
  21. 334 0
      fhKeeper/formulahousekeeper/management-crm/hs_err_pid6892.log
  22. 4076 0
      fhKeeper/formulahousekeeper/management-crm/replay_pid23908.log
  23. 4604 0
      fhKeeper/formulahousekeeper/management-crm/replay_pid30916.log
  24. 4441 0
      fhKeeper/formulahousekeeper/management-crm/replay_pid35380.log
  25. 4330 0
      fhKeeper/formulahousekeeper/management-crm/replay_pid36892.log
  26. 4711 0
      fhKeeper/formulahousekeeper/management-crm/replay_pid6892.log
  27. 11 6
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java
  28. 23 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java
  29. 52 12
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java
  30. 2 8
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Information.java
  31. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java
  32. 2 8
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java
  33. 2 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ProductServiceImpl.java
  34. 40 40
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SalesOrderServiceImpl.java
  35. 27 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  36. 8 2
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/CustomMapper.xml
  37. 2 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/DepartmentMapper.java
  38. 86 75
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java
  39. 22 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/DepartmentMapper.xml
  40. 6 4
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  41. 1 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ReportMapper.xml
  42. 13 4
      fhKeeper/formulahousekeeper/timesheet-workshop/src/views/statistic/index.vue
  43. 16 13
      fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/api.ts

@@ -23,9 +23,9 @@ export const defalutModalForm = {
 };
 export const PRIORITY = [
   //优先级
-  { label: "高", value: 0 },
+  { label: "高", value: 2 },
   { label: "中", value: 1 },
-  { label: "低", value: 2 },
+  { label: "低", value: 0 },
 ];
 
 export const TASK_TYPE = [

+ 8 - 5
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/TaskModal/index.vue

@@ -62,12 +62,12 @@
           </el-form-item>
           <template v-if="[0, 1, 2, 3].includes(form.repeatType)">
             <el-form-item label="每:" v-if="form.repeatType == 3">
-              <el-input-number v-model="form.repeatDesignSameday" controls-position="right" :min="1" />天
+              <el-input-number v-model="form.repeatDesignSameday" :step="1" :precision="0" controls-position="right" :min="1" />天
             </el-form-item>
             <el-form-item label="结束:">
               <el-radio-group v-model="form.endType" @change="changeEndType">
                 <el-radio :label="1" class="w-full">永不</el-radio>
-                <el-radio :label="2" class="w-full mb-3"><el-input-number v-model="form.repeatEndCount" :min="1"
+                <el-radio :label="2" class="w-full mb-3"><el-input-number v-model="form.repeatEndCount" :precision="0" :step="1" :min="1"
                     controls-position="right" :disabled="form.endType != 2" />
                   次以后
                 </el-radio>
@@ -84,7 +84,7 @@
             <el-form-item v-for="(v, i) in customeDate" class="flex justify-between items-center customeDate">
               <div>
                 第{{ i + 1 }}次重复在
-                <el-input-number :model-value="Number(v)" controls-position="right" @change="changeDate(i, $event)"
+                <el-input-number :model-value="Number(v)" :step="1" :precision="0" controls-position="right" @change="changeDate(i, $event)"
                   :min="1" />
                 天后
               </div>
@@ -244,7 +244,11 @@ function submitForm(formEl: FormInstance | undefined, isClose: boolean) {
     if (!valid) {
       return false as any
     }
-    const repeatDesignDay = customeDate.value.join(",")
+    let numList = []
+    if(customeDate.value) {
+      numList = customeDate.value.filter((item: any) => item)
+    }
+    const repeatDesignDay = numList.join(",")
     generateFormRef.value?.getData().then((res: any) => {
       console.log(`{
         ...form.value,
@@ -364,7 +368,6 @@ function addCustomeDateItem() {
   customeDate.value.push(undefined)
 }
 
-
 </script>
 
 <style lang="scss">

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/component/information.vue

@@ -4,9 +4,9 @@
             <div class="title">基本信息</div>
             <div>
                 <el-button type="primary" @click="associateContact()" v-if="!information.contactsId">关联联系人</el-button>
-                <el-button type="primary" @click="claimBusiness()" v-if="!information.customerId">认领</el-button>
+                <el-button type="primary" @click="claimBusiness()" v-if="!information.inchargerId">认领</el-button>
                 <el-button type="primary" @click="showVisible('transferBusinessVisible')"
-                    v-if="information.customerId">转移</el-button>
+                    v-if="information.inchargerId">转移</el-button>
                 <el-button type="primary" v-permission="['businessAddAnEdit']" @click="showVisible('editBusinessVisible')">编辑</el-button>
             </div>
         </div>

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

@@ -297,7 +297,7 @@ function editNewBusiness(item: any) {
   allLoading.generateFormLading = true
   if (item) {
     editProduct(item)
-    businessTemplateValue.value = item
+    businessTemplateValue.value = editBusinessData(item)
     allText.newBusinessisibleText = '编辑商机'
   }
   if (!item) {
@@ -415,6 +415,11 @@ function editProduct(row: any) {
   })
 }
 
+function editBusinessData(item: any) {
+  const { name, expectedTransactionDate, amountOfMoney = 0, customerId, contactsId, creatorId, stageId, id, inchargerId, remark } = item
+  return { name, expectedTransactionDate, amountOfMoney, customerId, contactsId, creatorId, stageId, id, inchargerId, remark }
+}
+
 function handleSizeChange(val: number) {
   businessOpportunityForm.pageIndex = 1
   businessOpportunityForm.pageFrom = val

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/component/information.vue

@@ -200,8 +200,8 @@ const formItems = reactive([
     { label: '负责人', key: 'inchargerName', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
     { label: '创建人', key: 'creatorName', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
     { label: '创建时间', key: 'createTime', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
-    { label: '客户签约人', key: 'customSigner', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
-    { label: '公司签约人', key: 'companySigner', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
+    { label: '客户签约人', key: 'customSignerName', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
+    { label: '公司签约人', key: 'customSignerName', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '48%' },
     { label: '备注', key: 'remark', value: '', labelClass: 'w-[115px] text-right text-gray-500', width: '100%' },
 ])
 

+ 12 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/order/component/products.vue

@@ -15,7 +15,7 @@
                 </el-table-column>
                 <el-table-column prop="productName" label="产品名称" width="200">
                     <template #default="scope">
-                        <el-button link type="primary" size="large">{{
+                        <el-button link type="primary" size="large" @click="toPath(scope.row)">{{
                             scope.row.productName
                         }}</el-button>
                     </template>
@@ -54,11 +54,13 @@
 import { ref, reactive, onMounted, onUnmounted, defineExpose, inject, watchEffect } from 'vue'
 import { GETGENERATEFOEM, GETTABLELISTPRODUCT, URL_OEDERUPDATE } from '../api';
 import { get, post } from '@/utils/request';
+import { useRouter } from "vue-router";
 import RelatedProducts from '@/components/relatedProducts/relatedProducts.vue'
 import { all } from 'axios';
 import { formatDate } from '@/utils/times';
 import { getTemplateKey } from '@/utils/tools';
 
+const router = useRouter()
 const globalPopup = inject<GlobalPopup>('globalPopup')
 const emits = defineEmits(['refreshData']);
 const props = defineProps<{
@@ -83,6 +85,15 @@ const orderTemplate = ref({
     config: {}
 })
 
+function toPath(item: any) {
+    router.push({
+        path: `/product/detail`,
+        query: {
+            id: item.id
+        }
+    })
+}
+
 function saveOrder() {
     let productTableListData = relatedProductsRef?.value?.returnData()
     const items: any = infoValue.value

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

@@ -166,7 +166,7 @@ const selectData = reactive({ // 下拉数据
   Personnel: [] as personnelInterface[],
   Customer: [] as any[], // 客户名称
   OrderType: [] as any[], // 订单类型
-  RemittanceStatus: [{ id: 0, name: '已回款' }, { id: 1, name: '未回款' }, { id: 2, name: '已完全回款' }] as any[], // 回款状态
+  RemittanceStatus: [{ id: 0, name: '未回款' }, { id: 1, name: '已回款' }, { id: 2, name: '已完全回款' }] as any[], // 回款状态
   AllProduct: [] as any[] // 所有产品
 })
 const formTablePaging = reactive({ // 分页条件

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

@@ -247,7 +247,7 @@ function editProduct(item: any) {
   dialogVisible.editProductVisible = true
   allLoading.generateFormLading = true
   if (item) {
-    genereditForm.value = item
+    genereditForm.value = { ...item, status: String(item.status) }
     allText.editClueText = '编辑产品'
   }
   if (!item) {

+ 4 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/detail/components/attachment.vue

@@ -56,6 +56,7 @@ const emits = defineEmits(['refreshData']);
 const attachmenttable = ref([])
 const transitionVal = ref<any>({})
 const information: any = ref({})
+const uploadRef = <any>ref()
 const renameDialogVisible = ref(false)
 const renameVal = ref('')
 const props = defineProps<{
@@ -109,7 +110,9 @@ async function httpUploadFile(param: UploadRequestOptions) {
     const formData = new FormData();
     formData.append('file', param.file)
     formData.append('id', clueId)
-    const res = await uploadFile(UPLOADFILE, formData)
+    const res = await uploadFile(UPLOADFILE, formData).finally(() => {
+        uploadRef.value.clearFiles()
+    })
     if (res.code == 'ok') {
         globalPopup?.showSuccess(res.msg || '')
         emits('refreshData');

BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-06-28.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-06-29.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-06-30.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-07-01.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-07-02.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-07-03.log.gz


BIN
fhKeeper/formulahousekeeper/management-crm/crm.2024-07-04.log.gz


Diff do ficheiro suprimidas por serem muito extensas
+ 333 - 0
fhKeeper/formulahousekeeper/management-crm/hs_err_pid23908.log


Diff do ficheiro suprimidas por serem muito extensas
+ 334 - 0
fhKeeper/formulahousekeeper/management-crm/hs_err_pid30916.log


Diff do ficheiro suprimidas por serem muito extensas
+ 333 - 0
fhKeeper/formulahousekeeper/management-crm/hs_err_pid35380.log


Diff do ficheiro suprimidas por serem muito extensas
+ 333 - 0
fhKeeper/formulahousekeeper/management-crm/hs_err_pid36892.log


Diff do ficheiro suprimidas por serem muito extensas
+ 334 - 0
fhKeeper/formulahousekeeper/management-crm/hs_err_pid6892.log


Diff do ficheiro suprimidas por serem muito extensas
+ 4076 - 0
fhKeeper/formulahousekeeper/management-crm/replay_pid23908.log


Diff do ficheiro suprimidas por serem muito extensas
+ 4604 - 0
fhKeeper/formulahousekeeper/management-crm/replay_pid30916.log


Diff do ficheiro suprimidas por serem muito extensas
+ 4441 - 0
fhKeeper/formulahousekeeper/management-crm/replay_pid35380.log


Diff do ficheiro suprimidas por serem muito extensas
+ 4330 - 0
fhKeeper/formulahousekeeper/management-crm/replay_pid36892.log


Diff do ficheiro suprimidas por serem muito extensas
+ 4711 - 0
fhKeeper/formulahousekeeper/management-crm/replay_pid6892.log


+ 11 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java

@@ -7,10 +7,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
-import com.management.platform.mapper.ClueMapper;
-import com.management.platform.mapper.CustomMapper;
-import com.management.platform.mapper.SysFormMapper;
-import com.management.platform.mapper.UserMapper;
+import com.management.platform.mapper.*;
 import com.management.platform.service.ContactsService;
 import com.management.platform.service.CustomService;
 import com.management.platform.service.WxCorpInfoService;
@@ -48,10 +45,11 @@ public class CustomController {
     @Autowired
     private CustomMapper customMapper;
     @Autowired
-    private ClueMapper clueMapper;
-    @Autowired
     private UserMapper userMapper;
 
+    @Autowired
+    private SysDictMapper sysDictMapper;
+
     @Resource
     private ExcelExportServiceImpl excelExportService;
     @Resource
@@ -146,6 +144,13 @@ public class CustomController {
                                     value = String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1));
                                 }
                             }
+                            if(model.equals("customSourceValue")){
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                    value = "$userName"+String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1))+"$";
+                                }else {
+                                    value = String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1)).equals("null") ?"" :String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1));
+                                }
+                            }
                             item.add(value);
                         }
                     }

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

@@ -90,7 +90,7 @@ public class SalesOrderController {
         Integer companyId = user.getCompanyId();
         order.setCompanyId(companyId);
         order.setCreatorId(user.getId());
-        if(order.getReceivedPayment()!=null){
+        if(order.getReceivedPayment()!=null&&order.getReceivedPayment().intValue()!=0){
             BigDecimal price = order.getPrice();
             if(order.getPrice().doubleValue()!=order.getReceivedPayment().doubleValue()){
                 order.setReceivedStatus(1);
@@ -100,6 +100,9 @@ public class SalesOrderController {
             order.setUnReceivedPayment(price.subtract(order.getReceivedPayment()));
         }else {
             order.setUnReceivedPayment(order.getPrice());
+            order.setReceivedStatus(0);
+            //修改已退回金额为0 是否要删除所有回款数据
+            salesOrderPaymentService.remove(new LambdaQueryWrapper<SalesOrderPayment>().eq(SalesOrderPayment::getOrderId,order.getId()));
         }
         int countCode;
         int countName;
@@ -410,6 +413,10 @@ public class SalesOrderController {
             msg.setError("回款金额不能大于当前未回款金额");
             return msg;
         }
+        if(money>salesOrder.getPrice().doubleValue()){
+            msg.setError("回款金额不能大于订单金额");
+            return msg;
+        }
         List<SalesOrderPayment> list = salesOrderPaymentService.list(new LambdaQueryWrapper<SalesOrderPayment>().eq(SalesOrderPayment::getOrderId, orderId));
         double sum = list.stream().mapToDouble(i -> i.getMoney().doubleValue()).sum();
         if((sum+money)>salesOrder.getPrice().doubleValue()){
@@ -489,14 +496,27 @@ public class SalesOrderController {
         HttpRespMsg msg=new HttpRespMsg();
         SalesOrderPayment payment = salesOrderPaymentService.getById(paymentId);
         SalesOrder salesOrder = salesOrderService.getById(payment.getOrderId());
-        List<SalesOrderPayment> list = salesOrderPaymentService.list(new LambdaQueryWrapper<SalesOrderPayment>().eq(SalesOrderPayment::getOrderId, salesOrder.getId()).orderByDesc(SalesOrderPayment::getCreateTime));
+        List<SalesOrderPayment> list = salesOrderPaymentService.list(new LambdaQueryWrapper<SalesOrderPayment>().eq(SalesOrderPayment::getOrderId, salesOrder.getId()).orderByAsc(SalesOrderPayment::getCreateTime));
         int i = list.indexOf(payment);
         if(money!=null){
+//            if(money>salesOrder.getUnReceivedPayment().doubleValue()){
+//                msg.setError("回款金额不能大于当前未回款金额");
+//                return msg;
+//            }
+            if(money>salesOrder.getPrice().doubleValue()){
+                msg.setError("回款金额不能大于订单金额");
+                return msg;
+            }
+            double sum = list.stream().mapToDouble(s -> s.getMoney().doubleValue()).sum();
+            if((sum)>salesOrder.getPrice().doubleValue()){
+                msg.setError("总回款金额不能大于订单金额");
+                return msg;
+            }
             //找到原回款数据
             BigDecimal nowMoney = new BigDecimal(money);
             BigDecimal oldMoney = payment.getMoney();
             //离当前回款数据最近一次回款的未回款数据作为依据
-            SalesOrderPayment salesOrderPayment = list.get(i + 1);
+            SalesOrderPayment salesOrderPayment =list.size()>1?list.get(i-1):list.get(i);
             BigDecimal unReceivedPayment = salesOrderPayment.getUnReceivedPayment();
             unReceivedPayment=unReceivedPayment.subtract(nowMoney);
             payment.setMoney(new BigDecimal(money));

+ 52 - 12
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/TaskController.java

@@ -144,12 +144,11 @@ public class TaskController {
     /**
      * 消息提醒
      */
-//    @Scheduled(cron = "0 8 * * * ?")
-    public void InfoMationAlerts(){
-        log.info("定时执行了===========>");
+    @Scheduled(cron = "0 0 9 * * ?")
+    public void InfomationAlerts(){
+        log.info("定时执行了11111===========>");
         QueryWrapper<Task> taskQueryWrapper = new QueryWrapper<>();
-        //应该不用考虑任务的状态
-        taskQueryWrapper.eq("is_delete",0).eq("is_repeat",1);
+        taskQueryWrapper.eq("is_delete",0).eq("is_repeat",1).ne("status",2).isNotNull("executor_id");
         List<Task> list = taskService.list(taskQueryWrapper);
         if (!list.isEmpty()){
             for (Task task : list) {
@@ -164,7 +163,7 @@ public class TaskController {
                 if (task.getRepeatType()!=null&&task.getRepeatType()==0){
                     //获取任务重复结束 重复永不结束   1:勾选
                     if (task.getRepeatEndNever()!=null&&task.getRepeatEndNever()==1){
-                        saveInformationList(executorIdList);
+                        saveInformationList(executorIdList,task);
                     }else if (task.getRepeatEndCount()!=null&&task.getRepeatEndCount()>0){
                         TaskInformation taskInformation = selectTaskInformation(task);
                         int between = task.getRepeatEndCount();
@@ -184,7 +183,7 @@ public class TaskController {
                     //每周一才执行
                     if (LocalDateTime.now().getDayOfWeek().getValue()==1){
                         if (task.getRepeatEndNever()!=null&&task.getRepeatEndNever()==1){
-                            saveInformationList(executorIdList);
+                            saveInformationList(executorIdList,task);
                         }else if (task.getRepeatEndCount()!=null&&task.getRepeatEndCount()>0){
                             TaskInformation taskInformation = selectTaskInformation(task);
                             int between = task.getRepeatEndCount();
@@ -208,7 +207,7 @@ public class TaskController {
                     //每月一号才执行
                     if (LocalDateTime.now().getDayOfMonth()==1){
                         if (task.getRepeatEndNever()!=null&&task.getRepeatEndNever()==1){
-                            saveInformationList(executorIdList);
+                            saveInformationList(executorIdList,task);
                         }else if (task.getRepeatEndCount()!=null&&task.getRepeatEndCount()>0){
                             TaskInformation taskInformation = selectTaskInformation(task);
                             int between = task.getRepeatEndCount();
@@ -226,6 +225,41 @@ public class TaskController {
                         continue;
                     }
                 }
+                //自定义周期
+                else if (task.getRepeatType() != null && task.getRepeatType() == 3 && task.getRepeatDesignSameday()!=null) {
+                    //获取任务重复结束 重复永不结束   1:勾选
+                    //每月一号才执行
+                    int num = (int) ChronoUnit.DAYS.between(LocalDateTime.now(), task.getCreateDate());
+                    if (num%task.getRepeatDesignSameday()==0){
+                        if (task.getRepeatEndNever()!=null&&task.getRepeatEndNever()==1){
+                            saveInformationList(executorIdList,task);
+                        }else if (task.getRepeatEndCount()!=null&&task.getRepeatEndCount()>0){
+                            TaskInformation taskInformation = selectTaskInformation(task);
+                            int between = task.getRepeatEndCount();
+                            saveInformationListWithCount(task, taskInformation, between, executorIdList);
+                        }else if (task.getRepeatEndDate()!=null){
+                            TaskInformation taskInformation = selectTaskInformation(task);
+                            if (LocalDateTime.now().isAfter(task.getRepeatEndDate())){
+                                continue;
+                            }
+                            int between = (int) ChronoUnit.DAYS.between(LocalDateTime.now(), task.getRepeatEndDate());
+                            between=between/task.getRepeatDesignSameday();
+                            saveInformationListWithCount(task, taskInformation, between, executorIdList);
+                        }
+                    }else {
+                        continue;
+                    }
+                }
+                //自定义日期
+                else if (task.getRepeatType() != null && task.getRepeatType() == 4 && !StringUtils.isEmpty(task.getRepeatDesignDay())) {
+                    //获取任务重复结束 重复永不结束   1:勾选
+                    int num = (int) ChronoUnit.DAYS.between(LocalDateTime.now(), task.getCreateDate());
+                    if (task.getRepeatDesignDay().contains(num+"")){
+                        saveInformationList(executorIdList,task);
+                    }else {
+                        continue;
+                    }
+                }
             }
         }
     }
@@ -242,24 +276,30 @@ public class TaskController {
             taskInformationNew.setTaskId(task.getId())
                     .setCompanyId(task.getCompanyId()).setCount(between -1);
             taskInformationService.save(taskInformationNew);
-            saveInformationList(executorIdList);
+            saveInformationList(executorIdList,task);
         }else {
             Integer count = taskInformation.getCount();
             if (count>0){
                 count -= 1;
                 UpdateWrapper<TaskInformation> updateWrapper = new UpdateWrapper<TaskInformation>().set("count", count).eq("id", taskInformation.getId());
                 taskInformationService.update(updateWrapper);
-                saveInformationList(executorIdList);
+                saveInformationList(executorIdList,task);
             }
         }
     }
 
-    private void saveInformationList(List<String> executorIdList) {
+    private void saveInformationList(List<String> executorIdList,Task task) {
         if (!executorIdList.isEmpty()){
             ArrayList<Information> informationArrayList = new ArrayList<>();
+            String msg="你有新的任务:"+task.getTaskName();
+            if (task.getStatus()!=null&&task.getStatus()==1){
+                msg="你有任务:"+task.getTaskName()+"执行中";
+            } else if (task.getStatus() != null && task.getStatus() == 3) {
+                msg="你有任务:"+task.getTaskName()+"已逾期";
+            }
             for (String userId : executorIdList) {
                 Information information = new Information();
-                information.setUserId(userId).setMsg("任务提醒")
+                information.setUserId(userId).setMsg(msg)
                         .setTime(LocalDateTime.now()).setChecked(0);
                 informationArrayList.add(information);
             }

+ 2 - 8
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Information.java

@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -18,7 +16,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2021-05-17
+ * @since 2024-07-05
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -40,7 +38,7 @@ public class Information extends Model<Information> {
     private String userId;
 
     /**
-     * 类型 0-审批未通过或撤销,1-任务待执行, 2-任务有进展
+     * 类型 0-审批未通过或撤销,1-任务待执行, 2-任务有进展,3-费用报销待审核 4-合同被驳回,5-合同审核通过,6-合同待审核
      */
     @TableField("type")
     private Integer type;
@@ -55,7 +53,6 @@ public class Information extends Model<Information> {
      * 时间
      */
     @TableField("time")
-    @JsonFormat(pattern = "MM-dd HH:mm:ss")
     private LocalDateTime time;
 
     /**
@@ -64,9 +61,6 @@ public class Information extends Model<Information> {
     @TableField("checked")
     private Integer checked;
 
-    /**
-     * 通知内容
-     */
     @TableField("msg")
     private String msg;
 

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

@@ -276,7 +276,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
         return msg;
     }
 
-    @Value(value = "${upload.file}")
+    @Value(value = "${upload.path}")
     private String filePath;
 
     @Override
@@ -337,7 +337,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                 e.printStackTrace();
                 // 文件上传失败的响应消息
                 HttpRespMsg msg = new HttpRespMsg();
-                msg.setError("上传成功失败");
+                msg.setError("上传失败");
                 return msg;
             }
         } else {

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

@@ -161,7 +161,7 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
         clueMapper.update(clue, updateWrapper);
     }
 
-    @Value(value = "${upload.file}")
+    @Value(value = "${upload.path}")
     private String path;
 
     @Override
@@ -278,7 +278,6 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
 
         updateWrapper.set("incharger_id", inchargerId);
         clueMapper.update(null, updateWrapper);
-
     }
 
     @Override
@@ -289,15 +288,10 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
     @Override
     public int getTotal2(Clue clue, User user) {
         return clueMapper.getTotal2(clue, user.getId());
-
     }
 
-
-
-
-    @Value(value = "${upload.file}")
+    @Value(value = "${upload.path}")
     private String filePath;
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Object uploadFile(Clue clue, HttpServletRequest request, MultipartFile file) {

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

@@ -98,8 +98,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         if(!hasPriviledgeAll){
             //判断查看负责部门的权限
             if(!hasPriviledgeDept){
-                //都没有就只能看自己创建的
-                queryWrapper.eq(Product::getCreatorId,targetUsr.getId());
+                //都没有就只能看自己创建的或者负责的
+                queryWrapper.and(wrapper->wrapper.eq(Product::getCreatorId,targetUsr.getId()).or().eq(Product::getInchargerId,targetUsr.getId()));
             }else {
                 List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getManagerId, targetUsr.getId()));
                 List<DepartmentOtherManager> otherManagerList = departmentOtherManagerMapper.selectList(new LambdaQueryWrapper<DepartmentOtherManager>().eq(DepartmentOtherManager::getOtherManagerId, targetUsr.getId()));

+ 40 - 40
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/SalesOrderServiceImpl.java

@@ -766,17 +766,17 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
             switch (queryType){
                 case 0:
                     //仅本人
-                    customLambdaQueryWrapper.eq(Custom::getCreatorId,user.getId());
-                    contactsLambdaQueryWrapper.eq(Contacts::getCreatorId,user.getId());
-                    businessOpportunityLambdaQueryWrapper.eq(BusinessOpportunity::getCreatorId,user.getId());
-                    salesOrderLambdaQueryWrapper.eq(SalesOrder::getCreatorId,user.getId());
-                    clueLambdaQueryWrapper.eq(Clue::getCreateId,user.getId());
+                    customLambdaQueryWrapper.eq(Custom::getInchargerId,user.getId());
+                    contactsLambdaQueryWrapper.eq(Contacts::getOwnerId,user.getId());
+                    businessOpportunityLambdaQueryWrapper.eq(BusinessOpportunity::getInchargerId,user.getId());
+                    salesOrderLambdaQueryWrapper.eq(SalesOrder::getInchargerId,user.getId());
+                    clueLambdaQueryWrapper.eq(Clue::getInchargerId,user.getId());
 
-                    customLambdaQueryWrapper1.eq(Custom::getCreatorId,user.getId());
-                    contactsLambdaQueryWrapper1.eq(Contacts::getCreatorId,user.getId());
-                    businessOpportunityLambdaQueryWrapper1.eq(BusinessOpportunity::getCreatorId,user.getId());
-                    salesOrderLambdaQueryWrapper1.eq(SalesOrder::getCreatorId,user.getId());
-                    clueLambdaQueryWrapper1.eq(Clue::getCreateId,user.getId());
+                    customLambdaQueryWrapper1.eq(Custom::getInchargerId,user.getId());
+                    contactsLambdaQueryWrapper1.eq(Contacts::getOwnerId,user.getId());
+                    businessOpportunityLambdaQueryWrapper1.eq(BusinessOpportunity::getInchargerId,user.getId());
+                    salesOrderLambdaQueryWrapper1.eq(SalesOrder::getInchargerId,user.getId());
+                    clueLambdaQueryWrapper1.eq(Clue::getInchargerId,user.getId());
                     break;
                 case 1:
                     //本人及下属
@@ -786,17 +786,17 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
                     List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getDepartmentId, deptIds));
                     List<String> userIds = userList.stream().map(User::getId).distinct().collect(Collectors.toList());
                     userIds.add(user.getId());
-                    customLambdaQueryWrapper.in(Custom::getCreatorId,userIds);
-                    contactsLambdaQueryWrapper.in(Contacts::getCreatorId,userIds);
-                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getCreatorId,userIds);
-                    salesOrderLambdaQueryWrapper.in(SalesOrder::getCreatorId,userIds);
-                    clueLambdaQueryWrapper.in(Clue::getCreateId,userIds);
+                    customLambdaQueryWrapper.in(Custom::getInchargerId,userIds);
+                    contactsLambdaQueryWrapper.in(Contacts::getOwnerId,userIds);
+                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getInchargerId,userIds);
+                    salesOrderLambdaQueryWrapper.in(SalesOrder::getInchargerId,userIds);
+                    clueLambdaQueryWrapper.in(Clue::getInchargerId,userIds);
 
-                    customLambdaQueryWrapper1.in(Custom::getCreatorId,userIds);
-                    contactsLambdaQueryWrapper1.in(Contacts::getCreatorId,userIds);
-                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getCreatorId,userIds);
-                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getCreatorId,userIds);
-                    clueLambdaQueryWrapper1.in(Clue::getCreateId,userIds);
+                    customLambdaQueryWrapper1.in(Custom::getInchargerId,userIds);
+                    contactsLambdaQueryWrapper1.in(Contacts::getOwnerId,userIds);
+                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getInchargerId,userIds);
+                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getInchargerId,userIds);
+                    clueLambdaQueryWrapper1.in(Clue::getInchargerId,userIds);
                     break;
                 case 2:
                     //仅本部门
@@ -804,17 +804,17 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
                     List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getDepartmentId, targetDeptId));
                     List<String> targetUserIds = users.stream().map(User::getId).distinct().collect(Collectors.toList());
                     targetUserIds.add(user.getId());
-                    customLambdaQueryWrapper.in(Custom::getCreatorId,targetUserIds);
-                    contactsLambdaQueryWrapper.in(Contacts::getCreatorId,targetUserIds);
-                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getCreatorId,targetUserIds);
-                    salesOrderLambdaQueryWrapper.in(SalesOrder::getCreatorId,targetUserIds);
-                    clueLambdaQueryWrapper.in(Clue::getCreateId,targetUserIds);
+                    customLambdaQueryWrapper.in(Custom::getInchargerId,targetUserIds);
+                    contactsLambdaQueryWrapper.in(Contacts::getOwnerId,targetUserIds);
+                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getInchargerId,targetUserIds);
+                    salesOrderLambdaQueryWrapper.in(SalesOrder::getInchargerId,targetUserIds);
+                    clueLambdaQueryWrapper.in(Clue::getInchargerId,targetUserIds);
 
-                    customLambdaQueryWrapper1.in(Custom::getCreatorId,targetUserIds);
-                    contactsLambdaQueryWrapper1.in(Contacts::getCreatorId,targetUserIds);
-                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getCreatorId,targetUserIds);
-                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getCreatorId,targetUserIds);
-                    clueLambdaQueryWrapper1.in(Clue::getCreateId,targetUserIds);
+                    customLambdaQueryWrapper1.in(Custom::getInchargerId,targetUserIds);
+                    contactsLambdaQueryWrapper1.in(Contacts::getOwnerId,targetUserIds);
+                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getInchargerId,targetUserIds);
+                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getInchargerId,targetUserIds);
+                    clueLambdaQueryWrapper1.in(Clue::getInchargerId,targetUserIds);
                     break;
                 case 3:
                     //本部门及下属部门
@@ -823,17 +823,17 @@ public class SalesOrderServiceImpl extends ServiceImpl<SalesOrderMapper, SalesOr
                     List<User> users1 = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getDepartmentId, branchDepartment));
                     List<String> targetUserIds1 = users1.stream().map(User::getId).distinct().collect(Collectors.toList());
                     targetUserIds1.add(user.getId());
-                    customLambdaQueryWrapper.in(Custom::getCreatorId,targetUserIds1);
-                    contactsLambdaQueryWrapper.in(Contacts::getCreatorId,targetUserIds1);
-                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getCreatorId,targetUserIds1);
-                    salesOrderLambdaQueryWrapper.in(SalesOrder::getCreatorId,targetUserIds1);
-                    clueLambdaQueryWrapper.in(Clue::getCreateId,targetUserIds1);
+                    customLambdaQueryWrapper.in(Custom::getInchargerId,targetUserIds1);
+                    contactsLambdaQueryWrapper.in(Contacts::getOwnerId,targetUserIds1);
+                    businessOpportunityLambdaQueryWrapper.in(BusinessOpportunity::getInchargerId,targetUserIds1);
+                    salesOrderLambdaQueryWrapper.in(SalesOrder::getInchargerId,targetUserIds1);
+                    clueLambdaQueryWrapper.in(Clue::getInchargerId,targetUserIds1);
 
-                    customLambdaQueryWrapper1.in(Custom::getCreatorId,targetUserIds1);
-                    contactsLambdaQueryWrapper1.in(Contacts::getCreatorId,targetUserIds1);
-                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getCreatorId,targetUserIds1);
-                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getCreatorId,targetUserIds1);
-                    clueLambdaQueryWrapper1.in(Clue::getCreateId,targetUserIds1);
+                    customLambdaQueryWrapper1.in(Custom::getInchargerId,targetUserIds1);
+                    contactsLambdaQueryWrapper1.in(Contacts::getOwnerId,targetUserIds1);
+                    businessOpportunityLambdaQueryWrapper1.in(BusinessOpportunity::getInchargerId,targetUserIds1);
+                    salesOrderLambdaQueryWrapper1.in(SalesOrder::getInchargerId,targetUserIds1);
+                    clueLambdaQueryWrapper1.in(Clue::getInchargerId,targetUserIds1);
                     break;
             }
         }

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

@@ -108,6 +108,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
     @Resource
     private ContactsMapper contactsMapper;
 
+    @Resource
+    private InformationService informationService;
+
 
 
     @Override
@@ -154,7 +157,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 //            taskRepeatDesignMapper.insert(taskRepeatDesign);
 //        }
         //保存任务执行人 //一对多
+        ArrayList<Information> informationArrayList = new ArrayList<>();
         if (StringUtils.isNotEmpty(taskDto.getExecutorId())){
+            Information information = new Information();
             String[] executorIds = taskDto.getExecutorId().split(",");
             for (String executorId : executorIds) {
                 TaskExecutor taskExecutor = new TaskExecutor();
@@ -164,7 +169,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                         .setExecutorName(selectedUser.getName())
                         .setCompanyId(user.getCompanyId());
                 taskExecutorMapper.insert(taskExecutor);
+                information.setUserId(executorId);
             }
+            information.setTime(LocalDateTime.now()).setChecked(0).setMsg("你有新的任务");
+            informationArrayList.add(information);
+            informationService.saveBatch(informationArrayList);
         }
 
         //添加任务编译记录
@@ -665,6 +674,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                                         task.setBusinessOpportunityId(businessOpportunity.getId());
                                         task.setTaskType(1);
                                     }
+                                }else {
+                                    task.setBusinessOpportunityId(businessOpportunity.getId());
+                                    task.setTaskType(1);
                                 }
                             }else {
                                 msg.setError("["+businessName+"]对应的商机不存在");
@@ -694,6 +706,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                                         task.setOrderId(order.getId());
                                         task.setTaskType(2);
                                     }
+                                }else {
+                                    task.setOrderId(order.getId());
+                                    task.setTaskType(2);
                                 }
                             }else {
                                 msg.setError("["+orderName+"]对应的销售订单不存在");
@@ -817,8 +832,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 if(saveOrUpdateBatch(importTaskList)){
                     ArrayList<TaskExecutor> taskExecutors = new ArrayList<>();
                     ArrayList<TaskLog> taskLogs = new ArrayList<>();
+                    ArrayList<Information> informationArrayList = new ArrayList<>();
                     for (Task task : importTaskList) {
                         String executorId = task.getExecutorId();
+                        Information information = new Information();
 
                         if (StringUtils.isNotEmpty(executorId)){
                             String[] split = executorId.split(",");
@@ -829,6 +846,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                                 taskExecutor.setExecutorName(userList.stream().filter(u -> u.getId().equals(userId)).collect(Collectors.toList()).get(0).getName());
                                 taskExecutor.setCompanyId(user.getCompanyId());
                                 taskExecutors.add(taskExecutor);
+
+                                information.setUserId(userList.stream().filter(u -> u.getId().equals(userId)).collect(Collectors.toList()).get(0).getId());
                             }
                         }
                         TaskLog taskLog = new TaskLog();
@@ -838,16 +857,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                         taskLog.setUserId(user.getId());
                         taskLog.setCompanyId(user.getCompanyId());
                         taskLogs.add(taskLog);
+
+
+                        information.setMsg("你有新的任务").setTime(LocalDateTime.now()).setChecked(0);
+                        informationArrayList.add(information);
                     }
 
                     boolean b1 = true;
                     boolean b2 = true;
+                    boolean b3 = true;
                     if (!taskExecutors.isEmpty()) {
                         b1=taskExecutorService.saveOrUpdateBatch(taskExecutors);
                     }if (!taskLogs.isEmpty()){
                         b2=taskLogService.saveOrUpdateBatch(taskLogs);
+                    }if (!informationArrayList.isEmpty()){
+                        b3=informationService.saveBatch(informationArrayList);
                     }
-                    if (b1&&b2){
+                    if (b1&&b2&&b3){
                         return msg;
                     }else {
                         msg.setError("验证失败");

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

@@ -108,7 +108,9 @@
                 c.id DESC
             </otherwise>
         </choose>
+        <if test="pageFrom != null ">
         Limit #{pageIndex},#{pageFrom}
+        </if>
     </select>
     <select id="getTotal" resultType="java.lang.Integer">
         select count(id)
@@ -208,7 +210,9 @@
                 c.id DESC
             </otherwise>
         </choose>
-        Limit #{pageIndex},#{pageFrom}
+        <if test="pageFrom != null ">
+            Limit #{pageIndex},#{pageFrom}
+        </if>
     </select>
     <select id="getTotal1" resultType="java.lang.Integer">
         select count(id)
@@ -295,7 +299,9 @@
             and customer_industry_id = #{customerIndustryId}
         </if>
         ORDER BY id desc
-        Limit #{pageIndex},#{pageFrom}
+        <if test="pageFrom != null ">
+            Limit #{pageIndex},#{pageFrom}
+        </if>
     </select>
     <select id="getTotal2" resultType="java.lang.Integer">
         select count(id)

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/DepartmentMapper.java

@@ -21,6 +21,8 @@ public interface DepartmentMapper extends BaseMapper<Department> {
 
     List<Map<String, Object>> getCostByUser(@Param("departmentIds") List departmentIds, String startDate, String endDate, Integer companyId, List<String> userIds);
 
+    List<Map<String, Object>> getCostByUserSum(@Param("departmentIds") List departmentIds, String startDate, String endDate, Integer companyId);
+
     List<Map<String, Object>> getCustomDataByUser(@Param("departmentIds") List departmentIds, String startDate, String endDate, Integer companyId, List<String> userIds);
     @Update("update department set manager_id = null where department_id = #{departmentId}")
     void updateNullManager(Integer departmentId);

+ 86 - 75
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java

@@ -452,90 +452,101 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
     @Override
     public HttpRespMsg getDepartmentStatistics(Integer parentDeptId, String startDate, String endDate, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        try {
-            User targetUser = userMapper.selectById(request.getHeader("Token"));
-            Integer companyId =targetUser.getCompanyId();
-            //当前用户管理部门
-            List<Integer> deptIds=null;
-            List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
-            List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
-            List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
-            List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
-            List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
-            List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
-            //判断查看权限
-            if(functionAllList.size()==0){
-                deptIds=new ArrayList<>();
-                //是不是要加
-                deptIds.add(-1);
-                if(functionDpartList.size()>0){
-                    if(functionTimeList.size()>0||functionCostList.size()>0){
-                        List<Integer> collect = departmentList.stream().map(dp -> dp.getDepartmentId()).distinct().collect(Collectors.toList());
-                        List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
-                        collect.addAll(otherCollect);
-                        deptIds.addAll(collect);
-                    }
+        User targetUser = userMapper.selectById(request.getHeader("Token"));
+        Integer companyId =targetUser.getCompanyId();
+        //当前用户管理部门
+        List<Integer> deptIds=null;
+        List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
+        List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
+        List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
+        List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
+        List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
+        List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
+        //判断查看权限
+        if(functionAllList.size()==0){
+            deptIds=new ArrayList<>();
+            //是不是要加
+            deptIds.add(-1);
+            if(functionDpartList.size()>0){
+                if(functionTimeList.size()>0||functionCostList.size()>0){
+                    List<Integer> collect = departmentList.stream().map(dp -> dp.getDepartmentId()).distinct().collect(Collectors.toList());
+                    List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
+                    collect.addAll(otherCollect);
+                    deptIds.addAll(collect);
                 }
             }
-            QueryWrapper<Department> queryWrapper = new QueryWrapper<Department>()
-                    .eq("company_id", companyId);
-            if (parentDeptId == null) {
-                if (deptIds == null) {
-                    //查看全公司的
-                    queryWrapper.isNull("superior_id");
-                }else {
-                    queryWrapper.in("department_id",deptIds);
-                }
-            } else {
-                queryWrapper.eq("superior_id", parentDeptId);
+        }
+        QueryWrapper<Department> queryWrapper = new QueryWrapper<Department>()
+                .eq("company_id", companyId);
+        if (parentDeptId == null) {
+            if (deptIds == null) {
+                //查看全公司的
+                queryWrapper.isNull("superior_id");
+            }else {
+                queryWrapper.in("department_id",deptIds);
             }
-            //获取第一级部门
-            System.out.println(deptIds);
-            List<Department> masterList = departmentMapper.selectList(queryWrapper);
-            System.out.println(masterList);
-            Map<String, Object> resultMap = new HashMap<>();
-            List<DepartmentMasterVO> list = new ArrayList<>();
-            BigDecimal totalCostMoney = new BigDecimal(0);
-            List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
-
-            for (Department department : masterList) {
+        } else {
+            queryWrapper.eq("superior_id", parentDeptId);
+        }
+        //获取第一级部门
+        System.out.println(deptIds);
+        List<Department> masterList = departmentMapper.selectList(queryWrapper);
+        Map<String, Object> resultMap = new HashMap<>();
+        List<DepartmentMasterVO> list = new ArrayList<>();
+        BigDecimal totalCostMoney = new BigDecimal(0);
+        List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+
+        for (Department department : masterList) {
+            DepartmentMasterVO departmentMasterVO = new DepartmentMasterVO();
+            BeanUtils.copyProperties(department, departmentMasterVO);
+            Map<String, Object> map = departmentMapper.getCostByDepartment(
+                    getBranchDepartment(department.getDepartmentId(), allDeptList), startDate, endDate);
+            Double time = map == null ? new Double(0) : (Double) map.get("time");
+            BigDecimal money = map == null ? new BigDecimal(0) : (BigDecimal) map.get("money");
+            totalCostMoney = totalCostMoney.add(money);
+            departmentMasterVO.setCostTime(time);
+            departmentMasterVO.setCostMoney(money);
+            departmentMasterVO.setType("departmentName");
+            //检查是否有子部门
+            if (allDeptList.stream().anyMatch(dept->department.getDepartmentId().equals(dept.getSuperiorId()))) {
+                departmentMasterVO.setHasSubDept(true);
+            }
+            list.add(departmentMasterVO);
+        }
+        //当前部门下的直属人员工时统计
+        if (parentDeptId != null) {
+            List<Integer> curDeptIds = new ArrayList<>();
+            curDeptIds.add(parentDeptId);
+            List<Map<String, Object>> userTimeList = departmentMapper.getCostByUserSum(curDeptIds, startDate, endDate, companyId);
+            for (Map<String, Object> map : userTimeList) {
                 DepartmentMasterVO departmentMasterVO = new DepartmentMasterVO();
-                BeanUtils.copyProperties(department, departmentMasterVO);
-                Map<String, Object> map = departmentMapper.getCostByDepartment(
-                        getBranchDepartment(department.getDepartmentId(), allDeptList), startDate, endDate);
-                Double time = map == null ? new Double(0) : (Double) map.get("time");
+                departmentMasterVO.setSeq(0);
+                departmentMasterVO.setDepartmentName((String)map.get("user"));
+                departmentMasterVO.setCostTime((Double)map.get("time"));
                 BigDecimal money = map == null ? new BigDecimal(0) : (BigDecimal) map.get("money");
-                totalCostMoney = totalCostMoney.add(money);
-                departmentMasterVO.setCostTime(time);
                 departmentMasterVO.setCostMoney(money);
-                departmentMasterVO.setType("departmentName");
-                //检查是否有子部门
-                if (allDeptList.stream().anyMatch(dept->department.getDepartmentId().equals(dept.getSuperiorId()))) {
-                    departmentMasterVO.setHasSubDept(true);
-                }
+                departmentMasterVO.setType("userName");
+                departmentMasterVO.setHasSubDept(false);
                 list.add(departmentMasterVO);
+                totalCostMoney = totalCostMoney.add(money);
             }
-            //对部门排序
-            list.sort(Comparator.comparing(l->l.getSeq()));
-            resultMap.put("totalCostMoney", totalCostMoney);
-            resultMap.put("costList", list);
-            if(functionCostList.size()==0){
-                resultMap.put("totalCostMoney",new BigDecimal(0));
-                list.forEach(li->{
-                    li.setCostMoney(new BigDecimal(0));
-                });
-            }
-            if(functionTimeList.size()==0){
-                list.forEach(li->{
-                    li.setCostTime(0.0);
-                });
-            }
-            httpRespMsg.data = resultMap;
-        } catch (NullPointerException e) {
-            //httpRespMsg.setError("验证失败");
-            httpRespMsg.setError(MessageUtils.message("access.verificationError"));
-            return httpRespMsg;
         }
+        //对部门排序
+        list.sort(Comparator.comparing(l->l.getSeq()));
+        resultMap.put("totalCostMoney", totalCostMoney);
+        resultMap.put("costList", list);
+        if(functionCostList.size()==0){
+            resultMap.put("totalCostMoney",new BigDecimal(0));
+            list.forEach(li->{
+                li.setCostMoney(new BigDecimal(0));
+            });
+        }
+        if(functionTimeList.size()==0){
+            list.forEach(li->{
+                li.setCostTime(0.0);
+            });
+        }
+        httpRespMsg.data = resultMap;
         return httpRespMsg;
     }
 

+ 22 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/DepartmentMapper.xml

@@ -68,6 +68,28 @@
         GROUP BY b.project_id, a.id order by a.department_id
     </select>
 
+    <!--根据人员获取成本-->
+    <select id="getCostByUserSum" resultType="java.util.Map">
+        SELECT a.id as id, a.name AS user,a.corpwx_userid as corpwxUserId, a.job_number as jobNumber, ifnull(SUM(b.working_time),0) AS time, ifnull(SUM(b.cost),0) AS
+        money
+        FROM user AS a
+        LEFT JOIN report AS b ON a.id = b.creator_id
+        WHERE b.state = 1
+        <if test="departmentIds != null and departmentIds.size()>0">
+            AND b.dept_id IN
+            <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
+                #{departmentId}
+            </foreach>
+        </if>
+        <if test="companyId != null">
+            AND a.company_id = #{companyId}
+        </if>
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        GROUP BY a.id order by a.department_id
+    </select>
+
     <!-- 根据人员获取自定义的日报数值 -->
     <select id="getCustomDataByUser" resultType="java.util.Map">
         SELECT a.id as id, a.name AS user,a.corpwx_userid as corpwxUserid, a.job_number as jobNumber,c.project_name AS project, IFNULL(SUM(b.custom_data),0) AS cost

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

@@ -4297,10 +4297,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             double tempWorkTime = mapList.stream().filter(mt -> mt.get("tempWorkTime") != null).mapToDouble(mt -> Double.valueOf(String.valueOf(mt.get("tempWorkTime")))).sum();
             BigDecimal tempBigDecimal = new BigDecimal(tempWorkTime);
             double tempCost = mapList.stream().filter(mt -> mt.get("tempCost") != null).mapToDouble(mt -> Double.valueOf(String.valueOf(mt.get("tempCost")))).sum();
-            u.setTotalResult(String.valueOf(bigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", cost) + "元");
-            u.setTotalPlanResult(String.valueOf(planBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", planCost) + "元");
-            u.setTotalSurplusResult(String.valueOf(surplusBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", surplusCost) + "元");
-            u.setTotalTempResult(String.valueOf(tempBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", tempCost) + "元");
+            u.setTotalResult(String.format("%.2f",bigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", cost) + "元");
+            u.setTotalPlanResult(String.format("%.2f",planBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", planCost) + "元");
+            u.setTotalSurplusResult(String.format("%.2f",surplusBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", surplusCost) + "元");
+            u.setTotalTempResult(String.format("%.2f",tempBigDecimal.doubleValue()) + "分钟 " + String.format("%.2f", tempCost) + "元");
         }
         resultMap.put("total",userIPage.getTotal());
         resultMap.put("records",userList);
@@ -4857,6 +4857,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         titleList.add("工长");
         titleList.add("计划件数");
         titleList.add("产品名称");
+        titleList.add("项目名称");
         titleList.add("开始日期");
         titleList.add("完工日期");
         titleList.add("工位");
@@ -4870,6 +4871,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             itemMap.add(String.valueOf(map.get("userName")==null?"":map.get("userName")));
             itemMap.add(String.valueOf(map.get("planNum")==null?"":map.get("planNum")));
             itemMap.add(String.valueOf(map.get("productName")==null?"":map.get("productName")));
+            itemMap.add(String.valueOf(map.get("projectName")==null?"":map.get("projectName")));
             itemMap.add(String.valueOf(map.get("startDate")==null?"":map.get("startDate")));
             itemMap.add(String.valueOf(map.get("endDate")==null?"":map.get("endDate")));
             itemMap.add(String.valueOf(map.get("statinoName")==null?"":map.get("statinoName")));

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ReportMapper.xml

@@ -219,7 +219,7 @@
         FROM prod_procedure_team ppt2
         LEFT JOIN plan_procedure_total ppt ON ppt.id=ppt2.plan_procedure_id
         LEFT JOIN plan ON plan.id=ppt.plan_id
-        LEFT JOIN report r ON r.user_procedure_team_id=ppt2.id
+        LEFT JOIN report r ON r.user_procedure_team_id=ppt2.id AND r.finish_num>0
         LEFT JOIN prod_procedure pp ON ppt.prod_procedure_id=pp.id
         LEFT JOIN product p ON p.id=plan.product_id
         LEFT JOIN user u ON r.checker_id=u.id

+ 13 - 4
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/statistic/index.vue

@@ -100,10 +100,10 @@
                 </el-table-column>
                 <el-table-column align="center" prop="totalResult" label="合计" min-width="180">
                    <template slot-scope="scope" >
-                    <div style="color: black;">平均 {{scope.row.totalPlanResult}}</div>
-                      <div style="color: #02a7f0;"  @click="showReportDetail(scope.row,item,1)">已填 {{scope.row.totalResult}}</div> 
-                      <div style="color: green;"  @click="showTempReportDetail(scope.row,item,1)">临时报工 {{scope.row.totalTempResult}}</div> 
-                      <div style="color: red;">剩余 {{scope.row.totalSurplusResult}}</div>
+                    <div style="color: black;">{{scope.row.totalPlanResult | formatStr('平均') }}</div>
+                      <div style="color: #02a7f0;"  @click="showReportDetail(scope.row,item,1)"> {{scope.row.totalResult | formatStr('已填')}}</div> 
+                      <div style="color: green;"  @click="showTempReportDetail(scope.row,item,1)">{{scope.row.totalTempResult | formatStr('临时报工')}}</div> 
+                      <div style="color: red;">{{scope.row.totalSurplusResult | formatStr('剩余') }}</div>
                   </template>
                 </el-table-column>
             </el-table>
@@ -742,6 +742,13 @@ export default {
       personWorkHoursWorkTime(value) {
         let val = +((value ? value : 0) * 60).toFixed(2) + 0
         return val
+      },
+      formatStr(val, str) {
+        if(!val) {
+          return ''
+        }
+        let relut = val.replace(/\b0\.\d+\S*\s*/g, '')
+        return`${relut ? str : ''} ${relut}`
       }
   },
   methods: {
@@ -1583,6 +1590,8 @@ export default {
     }else{
       this.getUserList()
     }
+    this.page=1
+    this.size=20
     console.log(this.userId,'==============')
     this.getList(true)
     },

+ 16 - 13
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -1082,7 +1082,8 @@
                                         // "value": this.yAxisValue==0 ? list[i].costMoney.toFixed(2) || list[i].costMoney: list[i].costTime.toFixed(1),
                                         "value": this.yAxisValue==0 ? (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0) || list[i].costMoney: (list[i].costTime ? list[i].costTime.toFixed(1) : 0),
                                         "id": list[i].departmentId,
-                                        "hasSubDept": list[i].hasSubDept
+                                        "hasSubDept": list[i].hasSubDept,
+                                        "type": list[i].type
                                     }
                                     if(this.permissions.countCost){
                                         // item.money = list[i].costMoney.toFixed(2)
@@ -1313,19 +1314,21 @@
                                         _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
                                     }
                                 } else if (_this.radio==this.$t('lable.department')) {
-                                    if (_this.params[0].data.hasSubDept) {
-                                        if (_this.parentDeptId != _this.params[0].data.id) {
-                                            _this.parentDeptId = _this.params[0].data.id;
-                                            _this.parentDeptStack.push(_this.parentDeptId);
-                                            _this.jieliu();
-                                        }
-                                        // _this.jieliu();
-                                    } else {
-                                        if (_this.dateRange != null) {
-                                            _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                                +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
+                                    if (_this.params[0].data.type == 'departmentName') {
+                                        if (_this.params[0].data.hasSubDept) {
+                                            if (_this.parentDeptId != _this.params[0].data.id) {
+                                                _this.parentDeptId = _this.params[0].data.id;
+                                                _this.parentDeptStack.push(_this.parentDeptId);
+                                                _this.jieliu();
+                                            }
+                                            // _this.jieliu();
                                         } else {
-                                            _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
+                                            if (_this.dateRange != null) {
+                                                _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
+                                                    +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
+                                            } else {
+                                                _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
+                                            }
                                         }
                                     }
                                 }