From 799c3039676eb62d64b4757bcda704376f8916de Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 16 四月 2024 09:12:17 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/cstmr/cstmr2.js                                  |    2 
 src/main/webapp/static/js/cstmr/cstmr.js                                   |    2 
 src/main/webapp/static/js/weekly/weekly.js                                 |   15 ++++++-
 src/main/java/com/zy/crm/manager/controller/WeeklyController.java          |   19 +++++++--
 src/main/java/com/zy/crm/manager/controller/WeeklyCostTypesController.java |   10 ++--
 src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java            |    4 ++
 src/main/java/com/zy/crm/common/utils/Synchro.java                         |   38 +++++++++++++++++++
 7 files changed, 76 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/zy/crm/common/utils/Synchro.java b/src/main/java/com/zy/crm/common/utils/Synchro.java
new file mode 100644
index 0000000..ad47b86
--- /dev/null
+++ b/src/main/java/com/zy/crm/common/utils/Synchro.java
@@ -0,0 +1,38 @@
+package com.zy.crm.common.utils;
+
+import com.core.exception.CoolException;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+/**
+ * Created by vincent on 2022/4/1
+ */
+public class Synchro {
+
+    public static void Copy(Object source, Object dest) {
+        try {
+            BeanInfo sourceBean = Introspector.getBeanInfo(source.getClass(),Object.class);
+            PropertyDescriptor[] sourceProperty = sourceBean.getPropertyDescriptors();
+            BeanInfo destBean = Introspector.getBeanInfo(dest.getClass(),Object.class);
+            PropertyDescriptor[] destProperty = destBean.getPropertyDescriptors();
+            for (PropertyDescriptor propertyDescriptor : sourceProperty) {
+                for (PropertyDescriptor descriptor : destProperty) {
+                    if (propertyDescriptor.getName().equals(descriptor.getName()) && propertyDescriptor.getPropertyType() == descriptor.getPropertyType()) {
+                        Method readMethod = propertyDescriptor.getReadMethod();
+                        Method writeMethod = descriptor.getWriteMethod();
+                        if (null != writeMethod && null != readMethod) {
+                            writeMethod.invoke(dest, readMethod.invoke(source));
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CoolException("灞炴�у鍒跺け璐�:" + e.getMessage());
+        }
+    }
+
+}
diff --git a/src/main/java/com/zy/crm/manager/controller/WeeklyController.java b/src/main/java/com/zy/crm/manager/controller/WeeklyController.java
index 4b21846..3c1b096 100644
--- a/src/main/java/com/zy/crm/manager/controller/WeeklyController.java
+++ b/src/main/java/com/zy/crm/manager/controller/WeeklyController.java
@@ -308,6 +308,10 @@
 
                 try{
                     weeklyDailyPlanService.insert(weeklyDailyPlan);
+                    WeeklyDailyReality weeklyDailyReality = new WeeklyDailyReality();
+                    weeklyDailyReality.sync(weeklyDailyPlan);
+                    weeklyDailyRealityService.insert(weeklyDailyReality);
+
                 } catch (Exception e){
                     log.error("鏂板鏃ヨ鍒掑け璐�"+e);
                     throw new CoolException("鏂板鏃ヨ鍒掑け璐�");
@@ -322,7 +326,8 @@
 
         } catch (Exception e){
             log.error("鍒涘缓鍛ㄨ鍒掑紓甯革紝寮傚父淇℃伅锛�"+e);
-            throw new CoolException("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
+            return R.error("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
+//            throw new CoolException("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
         }
 
         return R.ok("鍒涘缓鎴愬姛");
@@ -443,7 +448,8 @@
                 weeklyService.insert(weekly);
             } catch (Exception e) {
                 log.error("鏂板鍛ㄨ鍒掍富琛ㄥけ璐ワ紝寮傚父淇℃伅锛�"+e);
-                throw new CoolException("鏂板鍛ㄨ鍒掍富琛ㄥけ璐�");
+                return R.error("鏂板鍛ㄨ鍒掍富琛ㄥけ璐�");
+//                throw new CoolException("鏂板鍛ㄨ鍒掍富琛ㄥけ璐�");
             }
 
             List<CstmrUtilsParam> cstmrUtilsParamList = new ArrayList<>();
@@ -469,7 +475,8 @@
                     weeklyDailyRealityService.insert(weeklyDailyReality);
                 } catch (Exception e){
                     log.error("鏂板鏃ヨ鍒掑け璐�"+e);
-                    throw new CoolException("鏂板鏃ヨ鍒掑け璐�");
+//                    throw new CoolException("鏂板鏃ヨ鍒掑け璐�");
+                    return R.error("鏂板鏃ヨ鍒掑け璐�");
                 }
             }
 
@@ -481,7 +488,8 @@
 
         } catch (Exception e){
             log.error("鍒涘缓鍛ㄨ鍒掑紓甯革紝寮傚父淇℃伅锛�"+e);
-            throw new CoolException("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
+//            throw new CoolException("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
+            return R.error("鍒涘缓鍛ㄨ鍒掑け璐�==>"+e);
         }
 
         return R.ok("鍒涘缓鎴愬姛");
@@ -568,6 +576,9 @@
 
                     try{
                         weeklyDailyPlanService.insert(weeklyDailyPlan);
+                        WeeklyDailyReality weeklyDailyReality = new WeeklyDailyReality();
+                        weeklyDailyReality.sync(weeklyDailyPlan);
+                        weeklyDailyRealityService.insert(weeklyDailyReality);
                     } catch (Exception e){
                         log.error("鏂板鏃ヨ鍒掑け璐�"+e);
                         throw new CoolException("鏂板鏃ヨ鍒掑け璐�");
diff --git a/src/main/java/com/zy/crm/manager/controller/WeeklyCostTypesController.java b/src/main/java/com/zy/crm/manager/controller/WeeklyCostTypesController.java
index 45ba72a..098848e 100644
--- a/src/main/java/com/zy/crm/manager/controller/WeeklyCostTypesController.java
+++ b/src/main/java/com/zy/crm/manager/controller/WeeklyCostTypesController.java
@@ -7,12 +7,12 @@
 import com.baomidou.mybatisplus.plugins.Page;
 import com.core.common.DateUtils;
 import com.zy.crm.manager.entity.*;
+import com.zy.crm.manager.entity.result.KeyValueVo;
 import com.zy.crm.manager.service.WeeklyCostTypesService;
 import com.core.annotations.ManagerAuth;
 import com.core.common.BaseRes;
 import com.core.common.Cools;
 import com.core.common.R;
-import com.core.domain.KeyValueVo;
 import com.zy.crm.common.web.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -155,10 +155,10 @@
         List<WeeklyCostTypes> weeklyCostTypesList = weeklyCostTypesService.selectPage(new Page<>(1, 30), wrapper).getRecords();
         List<com.zy.crm.manager.entity.result.KeyValueVo> valueVos = new ArrayList<>();
         for (WeeklyCostTypes weeklyCostTypes : weeklyCostTypesList) {
-            com.zy.crm.manager.entity.result.KeyValueVo vo = new com.zy.crm.manager.entity.result.KeyValueVo();
-            vo.setName(weeklyCostTypes.getTypeName());
-            vo.setValue(weeklyCostTypes.getId());
-            valueVos.add(vo);
+            KeyValueVo keyValueVo = new KeyValueVo();
+            keyValueVo.setName(weeklyCostTypes.getTypeName());
+            keyValueVo.setValue(weeklyCostTypes.getId());
+            valueVos.add(keyValueVo);
         }
         return R.ok().add(valueVos);
     }
diff --git a/src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java b/src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java
index aca4910..1c15589 100644
--- a/src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java
+++ b/src/main/java/com/zy/crm/manager/entity/WeeklyDailyReality.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.enums.IdType;
 import com.baomidou.mybatisplus.annotations.TableField;
+import com.zy.crm.common.utils.Synchro;
 import com.zy.crm.manager.service.CstmrService;
 import com.zy.crm.manager.service.WeeklyCostTypesService;
 import com.zy.crm.system.entity.*;
@@ -424,5 +425,8 @@
         return null;
     }
 
+    public void sync(Object source) {
+        Synchro.Copy(source, this);
+    }
 
 }
diff --git a/src/main/webapp/static/js/cstmr/cstmr.js b/src/main/webapp/static/js/cstmr/cstmr.js
index 9ffea77..68ca479 100644
--- a/src/main/webapp/static/js/cstmr/cstmr.js
+++ b/src/main/webapp/static/js/cstmr/cstmr.js
@@ -288,7 +288,7 @@
                                 ,{field: 'dailyTime$',width : 120, align: 'center',title: '鏃ユ湡'}
                                 ,{field: 'workContent', align: 'center', title: '宸ヤ綔鍐呭鍙婄洰鐨�', edit:false}
                                 // ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', edit:false}
-                                ,{field: 'comment', title: '璇勮', edit:false}
+                                // ,{field: 'comment', title: '璇勮', edit:false}
                                 ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」',  edit:false}
                                 // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'}
                                 // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'}
diff --git a/src/main/webapp/static/js/cstmr/cstmr2.js b/src/main/webapp/static/js/cstmr/cstmr2.js
index 2cc7b52..33dd029 100644
--- a/src/main/webapp/static/js/cstmr/cstmr2.js
+++ b/src/main/webapp/static/js/cstmr/cstmr2.js
@@ -301,7 +301,7 @@
                                 ,{field: 'dailyTime$',width : 120, align: 'center',title: '鏃ユ湡'}
                                 ,{field: 'workContent', align: 'center', title: '宸ヤ綔鍐呭鍙婄洰鐨�', edit:false}
                                 // ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', edit:false}
-                                ,{field: 'comment', title: '璇勮', edit:false}
+                                // ,{field: 'comment', title: '璇勮', edit:false}
                                 ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」',  edit:false}
                                 // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'}
                                 // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'}
diff --git a/src/main/webapp/static/js/weekly/weekly.js b/src/main/webapp/static/js/weekly/weekly.js
index 78a073e..8d3a941 100644
--- a/src/main/webapp/static/js/weekly/weekly.js
+++ b/src/main/webapp/static/js/weekly/weekly.js
@@ -644,7 +644,8 @@
                     },
                     done: function (res, curr, count) {
                         $(".layui-table-cell").css('overflow', 'visible');//瑙e喅layui鏁版嵁琛ㄦ牸涓祵濂椾笅鎷夋鏄剧ず闂
-                        $(".laytable-cell-2-0-7").css('color', 'rgba(0, 0, 0, 0)');
+                        $(".laytable-cell-2-0-5").css('color', 'rgba(0, 0, 0, 0)');
+                        $(".layui-layer-setwin").css('display', 'none');
 
                         $(layero).find('.layui-table-view').css('margin', '0');
                         var options = this;
@@ -936,7 +937,11 @@
                         }
                     })
                     location.reload();
+
                     return false;
+                });
+                $('#cancelBtn').on('click', function () {
+                    location.reload();
                 });
                 // 鏄庣粏琛ㄦ牸
                 var xxDataList = [];
@@ -954,7 +959,7 @@
                         // ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', style: 'color: blue;font-weight: bold', edit:true}
                         ,{field: 'addr', title: '鍦板潃', style: 'color: blue;font-weight: bold', edit:true}
                         // ,{field: 'comment', title: '璇勮', style: 'color: blue;font-weight: bold', edit:false}
-                        ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', style: 'color: blue;font-weight: bold', edit:true}
+                        // ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', style: 'color: blue;font-weight: bold', edit:true}
                         // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'}
                         // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'}
                         // ,{field: 'director', align: 'center',title: '璐熻矗浜�'}
@@ -974,7 +979,8 @@
                     },
                     done: function (res, curr, count) {
                         $(".layui-table-cell").css('overflow', 'visible');//瑙e喅layui鏁版嵁琛ㄦ牸涓祵濂椾笅鎷夋鏄剧ず闂
-                        $(".laytable-cell-2-0-6").css('color', 'rgba(0, 0, 0, 0)');
+                        $(".laytable-cell-2-0-4").css('color', 'rgba(0, 0, 0, 0)');
+                        $(".layui-layer-setwin").css('display', 'none');
 
                         $(layero).find('.layui-table-view').css('margin', '0');
                         var options = this;
@@ -1130,6 +1136,9 @@
                         title: (exp ? '淇敼' : '娣诲姞') + '鏄庣粏',
                         content: $('#matEditDialog').html(),
                         success: function (layero, dIndex) {
+                            if (!exp){
+                                indexDelSign = 1;
+                            }
                             // 鍥炴樉鏁版嵁
                             form.val('matEditForm', exp);
                             // 琛ㄥ崟鎻愪氦浜嬩欢

--
Gitblit v1.9.1