Browse Source

Merge remote-tracking branch 'origin/master'

guojing 5 years ago
parent
commit
2f20d24e2d

+ 27 - 1
whepi-doc/creatYeWeiHui.sql

@@ -44,4 +44,30 @@ inner join sys_uptown_unit suu on suu.unit_id=suh.unit_id and suu.uptown_id = 12
 
 
 select count(1) FROM sys_uptown_house suh
-inner join sys_uptown_unit suu on suu.unit_id=suh.unit_id and suu.uptown_id = 1238790987234
+inner join sys_uptown_unit suu on suu.unit_id=suh.unit_id and suu.uptown_id = 1238790987234
+
+
+SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
+ALTER DATABASE whepi CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
+
+ALTER TABLE ms_suspected CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+
+
+set character_set_client=utf8mb4;
+
+set character_set_connection=utf8mb4;
+
+set character_set_database=utf8mb4;
+
+set character_set_results=utf8mb4;
+
+set character_set_server=utf8mb4;
+
+set character_set_system=utf8mb4;
+
+ALTER TABLE ms_report CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER TABLE sys_user_open CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER TABLE sys_user_role CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER TABLE sys_uptown CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER TABLE sys_uptown_home CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER TABLE sys_uptown_house CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

+ 119 - 10
whepi-ui/templates/yeweihui/tgPublish.ftl

@@ -8,16 +8,28 @@
     </div>
 
     <div class="weui-btn-area">
-
-        <p class="weui-media-box__desc">求助标题</p>
-        <h4 class="weui-media-box__title">sss</h4>
-        <br>
-        <p class="weui-media-box__desc">求助对象</p>
-        <h4 class="weui-media-box__title">sasa</h4>
-        <br>
-        <p class="weui-media-box__desc">求助内容</p>
-        <h4 class="weui-media-box__title">fda</h4>
-        <br>
+        <p class="weui-media-box__desc">组团标题:</p>
+        <input id="tg_input_title" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">供应商:</p>
+        <input id="tg_input_supplier" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="20" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">套餐:</p>
+        <input id="tg_input_goods" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">单价(元):</p>
+        <input id="tg_input_price" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">最小起订量(份):</p>
+        <input id="tg_input_mixnum" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">截止时间:</p>
+        <input id="tg_input_end_time" type="text" placeholder="请选择时间" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;"/>
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">预计送货时间:</p>
+        <input id="tg_input_deliver_time" type="text" placeholder="请选择时间" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;"/>
+        前
+        <p class="weui-media-box__desc" style="margin-top: 1vh;">服务电话:</p>
+        <input id="tg_input_phone_number" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <div class="weui-btn-area">
+            <a id="tg_publish" class="weui-btn weui-btn_primary" style="width: 30%;">
+                发布
+            </a>
+        </div>
     </div>
 </div>
 
@@ -26,7 +38,104 @@
 <script>
     var userId = ${userId};
 
+    $("#tg_input_end_time").datetimePicker();
+    $("#tg_input_deliver_time").datetimePicker();
+
     function goback() {
         window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
     }
+
+    $("#tg_publish").on('click', function () {
+
+        let title = $("#tg_input_title").val();
+        if (title.length <= 0) {
+            alert("请输入组团标题");
+            return;
+        }
+
+        let supplier = $("#tg_input_supplier").val();
+        if (supplier.length <= 0) {
+            alert("请输入供应商名称");
+            return;
+        }
+
+        let goods = $("#tg_input_goods").val();
+        if (goods.length <= 0) {
+            alert("请输入套餐内容");
+            return;
+        }
+
+        let price = $("#tg_input_price").val();
+        if (price.length <= 0) {
+            alert("请输入套餐单价");
+            return;
+        }
+
+        let mixnum = $("#tg_input_mixnum").val();
+        if (mixnum.length <= 0) {
+            alert("请输入最小起订量");
+            return;
+        }
+
+        let end_time = $("#tg_input_end_time").val();
+        if (end_time.length <= 0) {
+            alert("请选择截止时间");
+            return;
+        }
+
+        let deliver_time = $("#tg_input_deliver_time").val();
+        if (deliver_time.length <= 0) {
+            alert("请选择送货时间");
+            return;
+        }
+
+        let phone_number = $("#tg_input_phone_number").val();
+        if (phone_number.length <= 0) {
+            alert("请输入服务电话");
+            return;
+        }
+
+        console.log(
+            "发布",
+            title + "---" +
+            supplier + "---" +
+            goods + "---" +
+            price + "---" +
+            mixnum + "---" +
+            end_time + "---" +
+            deliver_time + "---" +
+            phone_number
+        );
+
+        let sendData = {
+            userId: userId,
+            tgTitle: title,
+            tgSupplier: supplier,
+            tgGoods: goods,
+            tgPrice: price,
+            tgMinNum: mixnum,
+            endTime: end_time,
+            deliverTime: deliver_time,
+            tgPhoneNumber: phone_number,
+
+        };
+
+        $.ajax({
+            url: '/yeweihui/tgPublish.json',
+            type: 'post',
+            data: sendData,
+            success: function (data) {
+                // console.log(data);
+                if (data.success) {
+                    window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+                }
+                else  {
+                    $.alert(data.data);
+                }
+            },
+            error: function () {
+                $.alert("网络异常");
+            }
+        });
+    })
 </script>

+ 30 - 104
whepi-ui/templates/yeweihui/tuangou.ftl

@@ -31,102 +31,22 @@
                         <div style="width: 15%; text-align: center;">状态</div>
                     </div>
                     <div id="tg_list1" class="weui-panel__bd">
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                            <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                            <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                        </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
+<#--                        <a href="javascript:void(0);" style="color: grey;">-->
+<#--                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">-->
+<#--                            <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>-->
+<#--                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>-->
+<#--                            <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>-->
+<#--                            <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>-->
+<#--                        </div>-->
+<#--                        </a>-->
+<#--                        <a href="javascript:void(0);" style="color: grey;">-->
+<#--                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">-->
+<#--                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>-->
+<#--                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>-->
+<#--                            </div>-->
+<#--                        </a>-->
                     </div>
                     <div class="weui-btn-area">
                         <a id="tg_publish" class="weui-btn weui-btn_primary">
@@ -150,15 +70,21 @@
                 </div>
 
                 <div class="weui-panel weui-panel_access">
+                    <div style="display: flex; flex-direction: row; color: grey; font-size: medium; line-height: 7vh;">
+                        <div style="width: 40%; text-align: center;">标题</div>
+                        <div style="width: 15%; text-align: center;">已团</div>
+                        <div style="width: 30%; text-align: center;">截止时间</div>
+                        <div style="width: 15%; text-align: center;">状态</div>
+                    </div>
                     <div id="tg_list2" class="weui-panel__bd">
-                        <a href="javascript:void(0);" style="color: grey;">
-                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">
-                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>
-                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>
-                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>
-                            </div>
-                        </a>
+<#--                        <a href="javascript:void(0);" style="color: grey;">-->
+<#--                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">-->
+<#--                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">蔬菜套餐,猪肉牛肉金针菇等</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">24/100</div>-->
+<#--                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">02/02 14:30</div>-->
+<#--                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">在团</div>-->
+<#--                            </div>-->
+<#--                        </a>-->
                     </div>
                     <div class="weui-btn-area">
                         <a id="tg_publish" class="weui-btn weui-btn_primary">

+ 120 - 1
whepi-ui/templates/yeweihui/tuangou.js

@@ -2,4 +2,123 @@ function tuangou_init(tt) {
     $('#tg_publish').on('click', function () {
         window.location.href = "/yeweihui/tgPublish.html?userId=" + $('#userId').val();
     });
-};
+
+    $.ajax({
+        url: '/yeweihui/tuangou/list/query.json',
+        type: 'post',
+        data: {
+            userId: $('#userId').val()
+        },
+        success: function (data) {
+            if (data.success) {
+                makeList(data.data);
+            }
+            else  {
+                $.alert("操作失败");
+            }
+        },
+        error: function () {
+            $.alert("网络异常");
+        }
+    });
+
+    $.ajax({
+        url: '/yeweihui/tuangou/mylist/query.json',
+        type: 'post',
+        data: {
+            userId: $('#userId').val()
+        },
+        success: function (data) {
+            if (data.success) {
+                makeMyPublishList(data.data);
+            }
+            else  {
+                $.alert("操作失败");
+            }
+        },
+        error: function () {
+            $.alert("网络异常");
+        }
+    });
+};
+
+function makeList(list) {
+    $('#tg_list1').empty();
+
+    if (list == undefined || list.length <= 0) {
+        $('#tg_list1').append('<div class="weui-loadmore weui-loadmore_line">\n' +
+            '    <span class="weui-loadmore__tips">暂无数据</span>\n' +
+            '</div>');
+        return;
+    }
+
+    for (let i = 0; i < list.length; i++) {
+        let item = list[i];
+        let status = '';
+        if (item.tgStatus == 1) {
+            status = "在团";
+        }
+        else if (item.tgStatus == 2) {
+            status = "发货";
+        }
+        else if (item.tgStatus == 3) {
+            status = "完成";
+        }
+        else if (item.tgStatus == 4) {
+            status = "取消";
+        }
+        $('#tg_list1').append($('<a href="javascript:tgItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
+            '                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
+            '                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '/' + item.tgMinNum + '</div>\n' +
+            '                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgEndTime.toString() + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
+            '                            </div>\n' +
+            '                        </a>'));
+    }
+}
+
+function makeMyPublishList(list) {
+
+    $('#tg_list2').empty();
+
+    if (list == undefined || list.length <= 0) {
+        $('#tg_list2').append('<div class="weui-loadmore weui-loadmore_line">\n' +
+            '    <span class="weui-loadmore__tips">暂无数据</span>\n' +
+            '</div>');
+        return;
+    }
+
+    for (let i = 0; i < list.length; i++) {
+        let item = list[i];
+        let status = '';
+        if (item.tgStatus == 1) {
+            status = "在团";
+        }
+        else if (item.tgStatus == 2) {
+            status = "发货";
+        }
+        else if (item.tgStatus == 3) {
+            status = "完成";
+        }
+        else if (item.tgStatus == 4) {
+            status = "取消";
+        }
+        $('#tg_list2').append($('<a href="javascript:tgMyItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
+            '                            <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
+            '                                <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '/' + item.tgMinNum + '</div>\n' +
+            '                                <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgEndTime.toString() + '</div>\n' +
+            '                                <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
+            '                            </div>\n' +
+            '                        </a>'));
+    }
+}
+
+function tgItemSelect(jmId) {
+    console.log(jmId);
+}
+
+function tgMyItemSelect(jmId) {
+    console.log(jmId);
+}

+ 2 - 0
whepi-web/src/main/java/com/bofeng/StartWhEpi.java

@@ -3,11 +3,13 @@ package com.bofeng;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication(exclude = {
         HibernateJpaAutoConfiguration.class
 })
 //@EnableWeChatConfiguration
+@EnableScheduling
 public class StartWhEpi {
 
     public static void main(String[] args) {

+ 29 - 0
whepi-web/src/main/java/com/bofeng/controller/EpiAdminController.java

@@ -1,15 +1,20 @@
 package com.bofeng.controller;
 
 import com.bofeng.dao.UptownHomeMapper;
+import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.dao.UserRoleMapper;
 import com.bofeng.entity.UptownHome;
+import com.bofeng.entity.UserOpen;
 import com.bofeng.entity.UserRole;
 import com.bofeng.service.EpiAdminService;
+import com.bofeng.service.EpiTemplateMessageService;
+import com.bofeng.service.TemplateMessageService;
 import com.yvan.ModelOps;
 import com.yvan.mvc.Pd;
 import com.yvan.platform.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -25,6 +30,10 @@ public class EpiAdminController {
     private UptownHomeMapper uptownHomeMapper;
     @Autowired
     private UserRoleMapper userRoleMapper;
+    @Autowired
+    private EpiTemplateMessageService epiTemplateMessageService;
+    @Autowired
+    private UserOpenMapper userOpenMapper;
 
     @ApiOperation("升级业委会角色")
     @PostMapping("/whepi/epi/admin/addRole")
@@ -44,4 +53,24 @@ public class EpiAdminController {
         return null;
     }
 
+//    @Scheduled(cron = "0 44 12 * * ?") //每天19点执行一次
+    @Scheduled(cron = "0 0 19 * * ?") //每天19点执行一次
+    public void scheduledTaskByFixedDelay() {
+        System.out.println("==============执行定时任务开始================");
+        Long start = 0L, count = 100L;
+        while (true) {
+            List<UserOpen> userOpens = userOpenMapper.getOpenUser(start, count);
+            int re = 0;
+            for (UserOpen userOpen : userOpens) {
+                re += epiTemplateMessageService.systemSendRemindMessage(userOpen.getUserId(), userOpen.getOpenId());
+            }
+            System.out.println("==============执行定时任务"+re+"================");
+            start += count;
+            if (userOpens == null || userOpens.size()<count) {
+                break;
+            }
+        }
+
+        System.out.println("==============执行定时任务完毕================");
+    }
 }

+ 23 - 0
whepi-web/src/main/java/com/bofeng/dao/JmTuangouDao.java

@@ -0,0 +1,23 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.JmTuangou;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface JmTuangouDao extends BaseMapper<JmTuangou> {
+
+    List<JmTuangou> queryTuangouListByUptownId (@Param("uptownId") Long uptownId);
+
+    List<JmTuangou> queryTuangouListByUptownIdAndTitle (@Param("uptownId") Long uptownId, @Param("title") String title);
+
+    List<JmTuangou> queryTuangouListByUserId (@Param("userId") Long userId);
+
+    List<JmTuangou> queryTuangouListByUserIdAndTitle (@Param("userId") Long userId, @Param("title") String title);
+
+}

+ 7 - 0
whepi-web/src/main/java/com/bofeng/dao/UptownHomeMapper.java

@@ -21,4 +21,11 @@ public interface UptownHomeMapper extends BaseMapper<UptownHome> {
 
     @Select("select ur.user_id from sys_uptown_home uh left join sys_user_role ur on ur.property_id = uh.house_id where uh.phone = #{phone} and uh.status = 1")
     Long getUserIdByPhone(@Param("phone") String phone);
+
+    @Select(
+            "select uh.* from sys_uptown_home uh\n" +
+                    "        left join sys_user_role  ur on uh.house_id= ur.property_id\n" +
+                    "        where ur.user_id = #{userId}"
+    )
+    List<UptownHome> getUptownHomeByUserId(@Param("userId") Long userId);
 }

+ 6 - 0
whepi-web/src/main/java/com/bofeng/dao/UserOpenMapper.java

@@ -5,6 +5,7 @@ import com.bofeng.entity.User;
 import com.bofeng.entity.UserOpen;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -23,4 +24,9 @@ public interface UserOpenMapper extends BaseMapper<UserOpen> {
     UserOpen selectByOpenId(@Param("openId") String openId);
 
     List<UserOpen> getAllUser();
+
+    @Select(
+            "select user_id as userId, open_id as openId, nick_name as nickName from sys_user_open limit #{start}, #{count}"
+    )
+    List<UserOpen> getOpenUser(@Param("start") Long start, @Param("count") Long count);
 }

+ 13 - 0
whepi-web/src/main/java/com/bofeng/entity/JmTuangou.java

@@ -1,5 +1,7 @@
 package com.bofeng.entity;
 
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -51,16 +53,27 @@ public class JmTuangou implements Serializable {
      */
     private Integer tgMinNum;
 
+    @TableField(exist = false)
+    private Integer currentNum;
+
     /**
      * 团购截止时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     private Date tgEndTime;
 
+    @TableField(exist = false)
+    private String endTime;
+
     /**
      * 预计送货时间
      */
+    @JsonFormat(pattern = "MM-dd HH:mm", timezone = "GMT+8")
     private Date tgDeliverTime;
 
+    @TableField(exist = false)
+    private String deliverTime;
+
     /**
      * 联系人电话
      */

+ 7 - 0
whepi-web/src/main/java/com/bofeng/entity/UserOpen.java

@@ -8,6 +8,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.io.UnsupportedEncodingException;
+
 @Getter
 @Setter
 @TableName("sys_user_open")
@@ -25,6 +27,11 @@ public class UserOpen {
     @ExcelProperty(value = "昵称", index = 0)
     @TableField("nick_name")
     private String nickName;
+    private String getNicName() throws UnsupportedEncodingException {
+        byte[] utf8Bytes = nickName.getBytes("UTF-8");
+        String nickName = new String(utf8Bytes, "UTF-8");
+        return nickName;
+    }
 
     @ExcelProperty(value = "性别", index = 1)
     @TableField("sex_desc")

+ 31 - 15
whepi-web/src/main/java/com/bofeng/service/EpiTemplateMessageService.java

@@ -1,14 +1,18 @@
 package com.bofeng.service;
 
 import com.bofeng.dao.RbMapper;
+import com.bofeng.dao.UptownHomeMapper;
 import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.entity.Uptown;
+import com.bofeng.entity.UptownHome;
 import com.bofeng.entity.UserOpen;
 import com.google.common.collect.Maps;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -21,6 +25,8 @@ public class EpiTemplateMessageService {
     @Autowired
     private TemplateMessageService templateMessageService;
     @Autowired
+    private UptownHomeMapper uptownHomeMapper;
+    @Autowired
     private RbMapper rbMapper;
 
     public int sendUserMessage(Long userId) {
@@ -47,23 +53,33 @@ public class EpiTemplateMessageService {
 
         return 1;
     }
-    //    {{first.DATA}}
-//    项目名称:{{keyword1.DATA}}
-//    任务名称:{{keyword2.DATA}}
-//    完成日期:{{keyword3.DATA}}
-//    指引与文档模版:{{keyword4.DATA}}
-//    指派人:{{keyword5.DATA}}
-//    {{remark.DATA}}
-    public int systemSendRemindMessage(Long userId) {
 
-        UserOpen userOpen = userOpenMapper.selectByUserId(userId);
+    //    {{first.DATA}}
+//    项目名称:{{keyword1.DATA}}                马兵 先生/女士,
+//    任务名称:{{keyword2.DATA}}                项目名称:家园互助平台
+//    完成日期:{{keyword3.DATA}}                任务名称:健康日报 上报
+//    指引与文档模版:{{keyword4.DATA}}           指引与文档模板:无
+//    指派人:{{keyword5.DATA}}                 指派人:系统
+//    {{remark.DATA}}                            家园互助平台提醒您,请及时提交今天的健康日报。
+    public int systemSendRemindMessage(Long userId, String openId) {
+        int re = 0;
         Map<String, String> map = Maps.newHashMap();
-        List<Uptown> uptownList = rbMapper.selectUptown(userId);
-
-        map.put("uptownName", uptownList.get(0).getUptownName());
-        map.put("tagName", "家人");
-//        templateMessageService.sendSysRemindMessage();
-        return 1;
+        List<UptownHome> uptownHomeList = uptownHomeMapper.getUptownHomeByUserId(userId);
+        if (uptownHomeList != null && uptownHomeList.size()>0) {
+            map.put("first", "尊敬的 "+uptownHomeList.get(0).getLinkman()+" 先生/女士,");
+            map.put("keyword1", "家园互助平台");
+            map.put("keyword2", "健康日报 上报");
+            SimpleDateFormat sdf1 =new SimpleDateFormat("yyyy-MM-dd" );
+            Date d1= new Date();
+            String str1 = sdf1.format(d1);
+            map.put("keyword3", str1);
+            map.put("keyword4", "无");
+            map.put("keyword5", "系统");
+            map.put("remark", "    家园互助平台提醒您,请及时提交今天的健康日报。");
+            re = 1;
+        }
+        templateMessageService.sendSysRemindMessage(openId, "", map);
+        return re;
     }
 
 }

+ 78 - 0
whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java

@@ -0,0 +1,78 @@
+package com.bofeng.service;
+
+import com.baomidou.mybatisplus.toolkit.IdWorker;
+import com.bofeng.dao.JmTuangouDao;
+import com.bofeng.dao.YeweihuiSysOwnerMapper;
+import com.bofeng.dao.YeweihuiUserRoleMapper;
+import com.bofeng.entity.JmTuangou;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Service
+@Transactional(readOnly = true)
+public class JmTuangouService {
+
+    @Autowired
+    private JmTuangouDao jmTuangouDao;
+
+    @Autowired
+    private YeweihuiUserRoleMapper yeweihuiUserRoleMapper;
+
+    @Autowired
+    private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
+
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public Integer tuangouPublish(JmTuangou jmTuangou) {
+
+        jmTuangou.setJmId(IdWorker.getId());
+
+        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(jmTuangou.getUserId());
+        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+        jmTuangou.setUptownId(uptownId);
+
+        jmTuangou.setTgStatus(1);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+        Date tgEndTime = new Date();
+        Date tgDeliverTime = new Date();
+        try {
+            tgEndTime = sdf.parse(jmTuangou.getEndTime());
+            tgDeliverTime = sdf.parse(jmTuangou.getDeliverTime());
+        }
+        catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        jmTuangou.setTgEndTime(tgEndTime);
+        jmTuangou.setTgDeliverTime(tgDeliverTime);
+
+        return jmTuangouDao.insert(jmTuangou);
+    }
+
+    public List<JmTuangou> queryTuangouListByTitle(Long userId, String title) {
+
+        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(userId);
+        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+
+        if (title.equals("")) {
+            return jmTuangouDao.queryTuangouListByUptownId(uptownId);
+        }
+        return jmTuangouDao.queryTuangouListByUptownIdAndTitle(uptownId, title);
+    }
+
+    public List<JmTuangou> queryTuangouMyListByTitle(Long userId, String title) {
+
+        if (title.equals("")) {
+            return jmTuangouDao.queryTuangouListByUserId(userId);
+        }
+        return jmTuangouDao.queryTuangouListByUserIdAndTitle(userId, title);
+    }
+}

+ 5 - 1
whepi-web/src/main/java/com/bofeng/wx/controller/MsReportController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -33,12 +34,15 @@ public class MsReportController {
 
     //添加家人
     @PostMapping("/home/addRibao")
-    public MsReport saveUser(HttpServletRequest request) {
+    public MsReport saveUser(HttpServletRequest request) throws UnsupportedEncodingException {
 
         //初始化今日日报
         Long suspectedId = Conv.NL(request.getParameter("suspectedId"));
         Long userCreate = Conv.NL(request.getParameter("userCreate"));
         String userName = request.getParameter("userName").trim();
+        byte[] utf8Bytes = userName.getBytes("UTF-8");
+        userName = new String(utf8Bytes, "UTF-8");
+
         Integer grender = Conv.NI(request.getParameter("grender"));
         Integer age = Conv.NI(request.getParameter("age"));
         Integer familyStatus = Conv.NI(request.getParameter("familyStatus"));

+ 35 - 7
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -4,10 +4,7 @@ import com.bofeng.dao.RbMapper;
 import com.bofeng.dao.UptownMapper;
 import com.bofeng.entity.*;
 import com.bofeng.excel.ExcelUtils;
-import com.bofeng.service.HomeService;
-import com.bofeng.service.QzTaskReplyService;
-import com.bofeng.service.QzTaskService;
-import com.bofeng.service.RbService;
+import com.bofeng.service.*;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -48,13 +45,16 @@ public class YeWeiHuiController {
     private HomeService homeService;
 
     @Autowired
+    private JmTuangouService jmTuangouService;
+
+    @Autowired
     private UptownMapper uptownMapper;
 
     @Autowired
     private RbMapper rbMapper;
 
     @GetMapping("/yeweihui/home.html")
-    public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "showQZ", required = false, defaultValue = "-") String showQZ) {
+    public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
 
 //        List<QzTask> taskList = qzTaskService.selectAll(1225321682867105793L);
 //        List<sysUptownUnit> rbList = rbService.selectAll(1225321682867105793L);
@@ -63,7 +63,7 @@ public class YeWeiHuiController {
         model.put("taskList", YvanUtil.toJsonPretty(taskList));
         model.put("rbList", YvanUtil.toJsonPretty(rbList));
         model.put("user_id", "\""+userId+"\"");
-        model.put("showQZ", "\""+showQZ+"\"");
+        model.put("show", "\""+show+"\"");
 
         return new ModelAndView("/yeweihui/home.ftl", model);
     }
@@ -268,12 +268,40 @@ public class YeWeiHuiController {
     }
 
     @GetMapping("/yeweihui/tgPublish.html")
-    public ModelAndView tuangouPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+    public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
         model.put("userId", "\""+userId+"\"");
 
         return new ModelAndView("/yeweihui/tgPublish.ftl", model);
     }
 
+    @PostMapping("/yeweihui/tgPublish.json")
+    public Model tuangouPublish(JmTuangou jmTuangou) {
+
+        Integer success = jmTuangouService.tuangouPublish(jmTuangou);
+        if (success == 1) {
+            return Model.newSuccess("操作成功");
+        }
+        else {
+            return Model.newFail("操作失败");
+        }
+    }
+
+    @PostMapping("/yeweihui/tuangou/list/query.json")
+    public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
+
+        return Model.newSuccess(list);
+    }
+
+    @PostMapping("/yeweihui/tuangou/mylist/query.json")
+    public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
+
+        return Model.newSuccess(myList);
+    }
+
     @PostMapping("/whepi/getAllUptown")
     public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
         return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));

+ 1 - 0
whepi-web/src/main/resources/application.yml

@@ -64,6 +64,7 @@ spring:
   http:
     encoding:
       charset: utf-8
+      enabled: true
       force: true
     multipart:
        maxFileSize: 2Mb

+ 28 - 0
whepi-web/src/main/resources/mapper/JmTuangouMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.bofeng.dao.JmTuangouDao">
+
+    <select id="queryTuangouListByUptownId" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where uptown_id=#{uptownId}
+    </select>
+
+    <select id="queryTuangouListByUptownIdAndTitle" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where uptown_id=#{uptownId} and tg_title like concat('%', #{title}, '%')
+    </select>
+
+    <select id="queryTuangouListByUserId" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where user_id=#{userId}
+    </select>
+
+    <select id="queryTuangouListByUserIdAndTitle" resultType="com.bofeng.entity.JmTuangou">
+        select a.*, (select count(1) from jm_buy where jm_id=a.jm_id) as currentNum
+        from jm_tuangou a
+        where user_id=#{userId} and tg_title like concat('%', #{title}, '%')
+    </select>
+</mapper>