Quellcode durchsuchen

Merge branch 'master' of http://git.yvanui.com/hust/wuhan_epi

lange vor 5 Jahren
Ursprung
Commit
578f50871f
37 geänderte Dateien mit 1702 neuen und 385 gelöschten Zeilen
  1. 86 0
      admin-ui/app/whepi/ceshi.js
  2. 25 0
      admin-ui/app/whepi/mock/menu.json
  3. 132 0
      admin-ui/app/whepi/scan/qrImg.js
  4. 198 0
      admin-ui/app/whepi/tugou/dialogTugou.js
  5. 241 0
      admin-ui/app/whepi/tugou/tugou.js
  6. 2 2
      whepi-doc/mrsb.sql
  7. 1 1
      whepi-ui/templates/groupBuying/groupBuyingXx.ftl
  8. 2 2
      whepi-ui/templates/home/buy.ftl
  9. 1 1
      whepi-ui/templates/home/buyClient.ftl
  10. 15 15
      whepi-ui/templates/home/home.ftl
  11. 57 0
      whepi-ui/templates/home/tuangouHome.ftl
  12. 24 0
      whepi-ui/templates/tuangou/home.ftl
  13. 3 1
      whepi-ui/templates/user/changeRole.ftl
  14. 1 0
      whepi-ui/templates/user/scanEstate.ftl
  15. 1 1
      whepi-ui/templates/wuye/qiuzhu.ftl
  16. 10 9
      whepi-ui/templates/yeweihui/home.ftl
  17. 3 2
      whepi-ui/templates/yeweihui/tgPublish.ftl
  18. 45 0
      whepi-ui/templates/yeweihui/tuangouHome.ftl
  19. 25 0
      whepi-web/src/main/java/com/bofeng/controller/WxUserOpenController.java
  20. 7 0
      whepi-web/src/main/java/com/bofeng/dao/JmTuangouDao.java
  21. 14 0
      whepi-web/src/main/java/com/bofeng/dao/SweepCodeMapper.java
  22. 6 0
      whepi-web/src/main/java/com/bofeng/dao/UptownDoorMapper.java
  23. 6 0
      whepi-web/src/main/java/com/bofeng/entity/JmTuangou.java
  24. 22 0
      whepi-web/src/main/java/com/bofeng/entity/SysUptownHouse.java
  25. 7 0
      whepi-web/src/main/java/com/bofeng/entity/UptownDoor.java
  26. 107 57
      whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java
  27. 26 0
      whepi-web/src/main/java/com/bofeng/service/SweepCodeService.java
  28. 26 4
      whepi-web/src/main/java/com/bofeng/wx/WxController.java
  29. 103 0
      whepi-web/src/main/java/com/bofeng/wx/controller/ScanAdminController.java
  30. 66 13
      whepi-web/src/main/java/com/bofeng/wx/controller/ScanController.java
  31. 51 2
      whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java
  32. 300 273
      whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java
  33. 1 1
      whepi-web/src/main/resources/application.yml
  34. 1 1
      whepi-web/src/main/resources/mapper/BuyMapper.xml
  35. 28 0
      whepi-web/src/main/resources/mapper/JmTuangouMapper.xml
  36. 42 0
      whepi-web/src/main/resources/mapper/SweepCodeMapper.xml
  37. 17 0
      whepi-web/src/main/resources/mapper/UptownDoorMapper.xml

+ 86 - 0
admin-ui/app/whepi/ceshi.js

@@ -0,0 +1,86 @@
+define(function (require) {
+  return function (context) {
+
+    var $form, $form1;
+
+    //检查查询
+    function queryGrid1() {
+      var obj = $form.formGet();
+      if (obj.we == "") {
+        $.yvan.msg('请选择电话号码');
+        return false;
+      }
+      return true;
+    }
+
+    //检查查询
+    function queryGrid2() {
+      var obj = $form1.formGet();
+      if (obj.uptownId == "") {
+        $.yvan.msg('请选择小区');
+        return false;
+      }
+      if (obj.date == "") {
+        $.yvan.msg('请选择导出时间');
+        return false;
+      }
+      return true;
+    }
+
+    return {
+      center: {
+        border: false,
+        title: '数据处理',
+        items: [
+          {
+            onRender: function () {
+              $form = $(this);
+            },
+            xtype: 'formgroup',
+            title: '',
+            items: [
+              [
+                {
+                  xtype: 'textbox',
+                  label: '电话号码',
+                  name: 'we',
+                  prompt: '请输入要添加的电话号码',
+                  labelWidth: 'auto',
+                  id: 'we',
+                },
+              ]
+            ]
+          },
+          {
+            xtype: 'group',
+            title: '具体操作',
+            items: [
+              [{xtype: 'offset'},
+                {
+                  xtype: 'button', text: '授权测试', class: 'button-blue', onClick: function () {
+                    if (!queryGrid1()) {
+                      return;
+                    }
+                    var a = $form.formGet()
+
+                    $.yvan.ajax({
+                      method: 'post',
+                      url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa3991865de920847&redirect_uri=http://yuliang.ng.yvanui.com/userOpen/loginTest&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect',
+                      data: $form.formGet(),
+                      success: function (data) {
+                        $.yvan.msg('操作成功');
+                        return;
+                      }
+                    });
+
+
+                  }
+                },
+              ],
+            ]
+          }
+        ]
+      },
+    };
+  };
+});

+ 25 - 0
admin-ui/app/whepi/mock/menu.json

@@ -9,6 +9,31 @@
       "iconCls": "icon-blank fa fa-desktop",
       "state": "close",
       "children": []
+    },
+    {
+      "id": "ENT10001",
+      "text": "团购系统",
+      "href": "/app/whepi/tugou/tugou.js",
+      "iconCls": "icon-blank fa fa-align-justify",
+      "state": "close",
+      "children": []
+    },
+    {
+      "id": "ENT10002",
+      "text": "小区进出信息",
+      "href": "",
+      "iconCls": "icon-blank fa fa-bars",
+      "state": "closed",
+      "children": [
+        {
+          "id": "ENT100021",
+          "text": "进出二维码",
+          "href": "/app/whepi/scan/qrImg.js",
+          "iconCls": "icon-blank fa fa-align-justify",
+          "state": "close",
+          "children": []
+        }
+      ]
     }
   ]
 }

+ 132 - 0
admin-ui/app/whepi/scan/qrImg.js

@@ -0,0 +1,132 @@
+define(function (require) {
+        return function (context) {
+
+            var $grid1, $form;
+
+
+            //查询小区
+            function queryGrid2() {
+                var _datas = [];
+                $.yvan.ajax({
+                    async: false,
+                    method: 'post',
+                    url: api('/getAllUptown'),
+                    data: {userId: 0},
+                    success: function (data) {
+                        if (data.data != null && data.data != undefined) {
+                            for (var i = 0; i < data.data.length; i++) {
+                                _datas.push({
+                                    "id": data.data[i].uptownId,
+                                    "text": data.data[i].uptownName
+                                })
+                            }
+                        }
+                    }
+                });
+                return _datas;
+            }
+
+            // 输入搜索文本后点击回车按钮查询列表
+            function enterQueryGrid1(e) {
+                if (e.keyCode === 13) {
+                    var tmp = $(this).val();
+                    $form.formSet({queryProperties: tmp});
+                    queryGrid1();
+                }
+            }
+
+            // 检索条件查询
+            function queryGrid1() {
+                var queryForm = $form.formGet();
+                $grid1.reload({
+                    mtype: 'POST',
+                    url: api('/qrImg/scanQrImg'),
+                    queryParams: queryForm
+                }, true);
+            }
+
+            // 搜索按钮
+            var queryToolbarTitle = '团购信息管理';// 自行替换此参数
+            var queryToolbar = {
+                xtype: 'toolbar', title: queryToolbarTitle, items: [
+                    {
+                        text: '查询', iconCls: 'fa fa-search', onClick: function () {
+                            queryGrid1();
+                        }
+                    }, {
+                        text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
+                            $form.formClear();
+                            queryGrid1();
+                        }
+                    }, {
+                        text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
+                            App.closeMe(this);
+                        }
+                    }
+                ]
+            };
+
+            var queryForm = {
+                onRender: function () {
+                    $form = $(this);
+                },
+                xtype: 'form',
+                items: [[
+                    {
+                        xtype: 'textbox',
+                        label: '检索条件',
+                        name: 'queryProperties',
+                        prompt: "小区名称",
+                        labelWidth: 'auto',
+                        events: {keydown: enterQueryGrid1}, width: 350
+                    },
+                ]]
+            };
+
+            return {
+                north: {
+                    height: 88,
+                    /* split: true,
+                     border: false,*///底框是否可变动
+                    items: [
+                        queryToolbar,
+                        queryForm
+                    ]
+                },
+                center: {
+                    height: '60%',
+                    split: true,
+                    items:
+                        {
+                            onRender: function () {
+                                $grid1 = $(this);
+                                queryGrid1()
+                            },
+                            xtype: 'grid',
+                            idField: 'doorId',
+                            autoSizeColumns: true,
+                            columns:
+                                [
+                                    [
+                                        {field: 'doorId', title: '大门ID', hidden: true},
+                                        {field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
+                                        {field: 'doorName', title: '小区大门', maxWidth: 200, align: 'left',},
+                                        {
+                                            field: 'outImg', title: '外出二维码', minWidth: 300, maxWidth: 400,
+                                            formatter: function (value) {
+                                                return "<img  src='" + value + "'/>";
+                                            },
+                                        },
+                                        {field: 'inImg', title: '进入二维码', minWidth: 300, maxWidth: 400,
+                                            formatter: function (value) {
+                                                return "<img  src='" + value + "'/>";
+                                            },},
+                                        {field: 'timeUpdate', title: '修改时间', maxWidth: 200, formatter: $.fn.fmatter.ts},
+                                    ]
+                                ]
+                        }
+                }
+            };
+        };
+    }
+);

+ 198 - 0
admin-ui/app/whepi/tugou/dialogTugou.js

@@ -0,0 +1,198 @@
+define(function (require) {
+  return function (context) {
+
+    var $dlg, $form;
+
+    function queryGrid1(data) {
+      console.log(data);
+    }
+
+    //查询小区
+    function queryGrid2() {
+      var _datas = [];
+      $.yvan.ajax({
+        async: false,
+        method: 'post',
+        url: api('/getAllUptown'),
+        data: {userId: 0},
+        success: function (data) {
+          if (data.data != null && data.data != undefined) {
+            for (var i = 0; i < data.data.length; i++) {
+              _datas.push({
+                "id": data.data[i].uptownId,
+                "text": data.data[i].uptownName
+              })
+            }
+          }
+        }
+      });
+      return _datas;
+    }
+
+
+    return {
+      xtype: 'dialog',
+      dialogId: 'dialogTugou',
+      title: context.isEdit ? '取消团购信息' : '新增团购信息',
+      width: '100%',
+      height: '100%',
+      onOpen: function () {
+        $dlg = $(this);
+        if (context.isEdit) {
+          $.yvan.ajax({
+            loadingMask: false,
+            url: api('/getSelectOne'),
+            type: 'POST',
+            data: {jmId: context.jmId},
+            success: function (data) {
+              $dlg.find('form');
+              $form.formSet(data.data);
+            }
+          });
+        }
+      },
+      center: {
+        items: {
+          width: '100%',
+          height: '100%',
+          autoSizeColumns: true,
+          xtype: 'formgroup',
+          onRender: function () {
+            $form = $(this);
+          },
+          items: [
+            [{
+              name: 'jmId',
+              label: '组团id',
+              xtype: 'hidden',
+            },
+              {
+                xtype: 'yvselect',
+                name: 'uptownIds',
+                multiple: true,
+                label: '小区',
+                data: queryGrid2(),
+                width: 900,
+                height: 35,
+                validType: 'isBlank',
+                readonly: context.isEdit ? true : false,
+                onChange: function (data) {
+                  queryGrid1(data);
+                },
+              }],
+            [
+              {
+                name: 'tgTitle',
+                label: '组团标题',
+                required: true,
+                maxlength: 20,
+                readonly: context.isEdit ? true : false,
+                width: 450,
+                height: 35, validType: 'isBlank'
+              },
+              {
+                name: 'tgSupplier', label: '供应商', maxlength: 20,
+                width: 450, height: 35,
+                required: true,
+                readonly: context.isEdit ? true : false,
+              },
+              [{
+                name: 'tgGoods', label: '团购套餐',
+                required: true, width: 900, height: 35,
+                maxlength: 50,
+                readonly: context.isEdit ? true : false,
+                height: '100px', multiline: true,
+              }],
+              {
+                name: 'tgPrice',
+                label: '单价',
+                readonly: context.isEdit ? true : false,
+                maxlength: 4, validType: 'integer',
+                required: true, width: 450, height: 35,
+              },
+              {
+                name: 'tgMinNum',
+                label: '最小起订量',
+                readonly: context.isEdit ? true : false,
+                maxlength: 4, validType: 'integer',
+                required: true, width: 450, height: 35,
+              },
+              [{
+                name: 'tgMaxNum',
+                readonly: context.isEdit ? true : false,
+                label: '最大上限', required: true, validType: 'integer',
+                maxlength: 4, width: 450, height: 35,
+              },
+                {
+                  name: 'tgEndTime',
+                  label: '团购截止时间',
+                  readonly: context.isEdit ? true : false,
+                  xtype: 'datetimebox',
+                  required: true, width: 450, height: 35,
+                },],
+              [{
+                name: 'tgDeliverTime',
+                multiline: true,
+                readonly: context.isEdit ? true : false,
+                xtype: 'datetimebox',
+                label: '预计送货时间',
+                required: true, width: 450, height: 35,
+              },
+                {
+                  name: 'tgPhoneNumber', validType: 'telNum',
+                  label: '联系电话', width: 450, height: 35,
+                  readonly: context.isEdit ? true : false,
+                  required: true, maxlength: 11,
+                }],
+              [{
+                name: 'remark',
+                label: '备注',
+                multiline: true,
+                width: 900,
+                height: '100px',
+                maxlength: 100,
+              }]]
+          ],
+        }
+      },
+      buttons: [
+        {
+          text: "保存", iconCls: "fa fa-save", onClick: function () {
+            if ($form.formGet().uptownIds.trim() == '') {
+              $.yvan.msg('请先选择小区');
+              return;
+            }
+            if ($form.formGet().tgMinNum > $form.formGet().tgMaxNum) {
+              $.yvan.msg('最大上线必须大于等于最小起订量');
+              return;
+            }
+            if ($form.formGet().tgEndTime > $form.formGet().tgDeliverTime) {
+              $.yvan.msg('团购截止时间必须小于预计送货时间');
+              return;
+            }
+
+            console.log($form.formGet())
+            $.yvan.postForm($form, {
+              url: (context.isEdit ? api('/yeweihui/tgStatus') : api('/yeweihui/tgPublish')),
+              success: function (data) {
+                if (data.data == 1) {
+                  $.yvan.msg('保存成功');
+                  $dlg.window('close');
+                  if ($.type(context.confirm) === 'function') {
+                    context.confirm();
+                  }
+                } else {
+                  $.yvan.msg('保存失败');
+                }
+              }
+            });
+          }
+        }, {
+          text: "关闭", iconCls: "fa fa-times", onClick: function () {
+            $dlg.dialog('close');
+          }
+        }
+      ]
+    };
+  };
+});

+ 241 - 0
admin-ui/app/whepi/tugou/tugou.js

@@ -0,0 +1,241 @@
+define(function (require) {
+    return function (context) {
+
+      var $grid1, $form;
+
+
+      //查询小区
+      function queryGrid2() {
+        var _datas = [];
+        $.yvan.ajax({
+          async: false,
+          method: 'post',
+          url: api('/getAllUptown'),
+          data: {userId: 0},
+          success: function (data) {
+            if (data.data != null && data.data != undefined) {
+              for (var i = 0; i < data.data.length; i++) {
+                _datas.push({
+                  "id": data.data[i].uptownId,
+                  "text": data.data[i].uptownName
+                })
+              }
+            }
+          }
+        });
+        return _datas;
+      }
+
+      // 输入搜索文本后点击回车按钮查询列表
+      function enterQueryGrid1(e) {
+        if (e.keyCode === 13) {
+          var tmp = $(this).val();
+          $form.formSet({queryProperties: tmp});
+          queryGrid1();
+        }
+      }
+
+      // 检索条件查询
+      function queryGrid1() {
+        var queryUrl = '/yeweihui/tglist';// 自行替换此参数
+        var queryForm = $form.formGet();
+        queryForm.roleCode = App.currentRoleCode;
+        $grid1.reload({
+          mtype: 'POST',
+          url: api(queryUrl),
+          queryParams: queryForm
+        }, true);
+      }
+
+      // 搜索按钮
+      var queryToolbarTitle = '团购信息管理';// 自行替换此参数
+      var queryToolbar = {
+        xtype: 'toolbar', title: queryToolbarTitle, items: [
+          {
+            text: '查询', iconCls: 'fa fa-search', onClick: function () {
+              queryGrid1();
+            }
+          }, {
+            text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
+              $form.formClear();
+              queryGrid1();
+            }
+          }, {
+            text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
+              App.closeMe(this);
+            }
+          }
+        ]
+      };
+
+      // 搜索条件
+      var queryFormPrompt = '团购标题';// 自行替换此参数
+      var queryForm = {
+        onRender: function () {
+          $form = $(this);
+        },
+        xtype: 'form',
+        items: [[
+          {
+            xtype: 'textbox',
+            label: '检索条件',
+            name: 'queryProperties',
+            prompt: queryFormPrompt,
+            labelWidth: 'auto',
+            events: {keydown: enterQueryGrid1}, width: 350
+          },
+          {
+            xtype: 'yvselect',
+            name: 'uptownIds',
+            label: '小区',
+            data: queryGrid2(),
+            multiple: true,
+            labelWidth: 'auto',
+            width: 350,
+            onChange: function (data) {
+              queryGrid1();
+            },
+          },
+          {
+            xtype: 'yvselect',
+            name: 'tgStatus',
+            label: '状态',
+            data: [{id: '', text: '全部'}, {id: '1', text: '在团'}, {id: '2', text: '发货'}, {id: '3', text: '完成'}, {
+              id: '4',
+              text: '取消'
+            }],
+            labelWidth: 'auto',
+            width: 200,
+            onChange: function (data) {
+              queryGrid1();
+            },
+          }
+        ]]
+      };
+
+      var gridToolbarTitle = '团购信息列表';// 自行替换此参数
+      var gridToolbar = {
+        xtype: 'toolbar',
+        title: gridToolbarTitle,
+        items: [
+          {
+            text: '新增', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
+              $.yvan.showDialog(this,
+                require('/app/whepi/tugou/dialogTugou.js')({
+                  isEdit: false,
+                  confirm: function () {
+                    queryGrid1();
+                  }
+                })
+              );
+            }
+          },
+          {
+            text: '取消', iconCls: 'fa fa-pencil-square-o', onClick: function () {
+              var row = $grid1.rowData();
+              if (!row) {
+                $.yvan.msg('请先选择一行数据');
+                return;
+              }
+              if (row.tgStatus != 1) {
+                $.yvan.msg('在团状态才能取消');
+                return;
+              }
+              $.yvan.showDialog(this,
+                require('/app/whepi/tugou/dialogTugou.js')({
+                  isEdit: true,
+                  jmId: row.jmId,
+                  confirm: function () {
+                    $grid1.reload();
+                  }
+                })
+              );
+            }
+          }
+        ]
+      };
+
+      return {
+        north: {
+          height: 88,
+          /* split: true,
+           border: false,*///底框是否可变动
+          items: [
+            queryToolbar,
+            queryForm
+          ]
+        },
+        center: {
+          height: '60%',
+          split: true,
+          items:
+            {
+              onRender: function () {
+                $grid1 = $(this);
+                queryGrid1()
+              },
+              xtype: 'grid',
+              toolbar:
+              gridToolbar,
+              idField: 'joId',
+              autoSizeColumns: true,//序号多  正确显示
+              columns:
+                [
+                  [
+                    {field: 'jmId', title: '信息id', hidden: true},
+                    {field: 'uptown_id', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
+                    {field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
+                    {field: 'tgTitle', title: '组团标题', maxWidth: 200, align: 'left',},
+                    {field: 'tgSupplier', title: '供应商', maxWidth: 200,},
+                    {
+                      field: 'tgGoods',
+                      title: '团购套餐', maxWidth: 200,
+                    },
+                    {
+                      field: 'tgPrice',
+                      title: '单价',
+                    },
+                    {
+                      field: 'tgMinNum',
+                      title: '最小起订量',
+                      align: 'left',
+                    },
+                    {
+                      field: 'tgMaxNum',
+                      title: '最大上限',
+                      align: 'left',
+                    },
+                    {
+                      field: 'tgEndTime',
+                      title: '团购截止时间',
+                      align: 'center',
+                    },
+                    {
+                      field: 'tgDeliverTime', title: '预计送货时间', align: 'center',
+                    },
+
+                    {field: 'tgPhoneNumber', title: '联系电话', align: 'center'},
+                    {field: 'remark', title: '备注', maxWidth: 200, align: 'left'},
+                    {
+                      field: 'tgStatus', title: '状态',
+                      align: 'center', formatter: function (value) {
+                        if (value == 1) {
+                          return '<span style="color: green">在团</span>';
+                        } else if (value == 2) {
+                          return '发货';
+                        } else if (value == 3) {
+                          return '完成';
+                        } else if (value == 4) {
+                          return '<span style="color: red">取消</span>';
+                        }
+                      },
+                    },
+                    {field: 'tgStatus', title: '状态', hidden: true},
+                  ]
+                ]
+            }
+        }
+      };
+    };
+  }
+);

+ 2 - 2
whepi-doc/mrsb.sql

@@ -30,9 +30,9 @@ CREATE TABLE ms_suspected  (
   suspected_id      bigint(20) NOT NULL DEFAULT 0                           COMMENT '疑似ID',
   report_id         bigint(20) NOT NULL DEFAULT 0                           COMMENT '上报ID',
   user_name         varchar(50)  NOT NULL DEFAULT ''                        COMMENT '家人姓名',
-  grender            int(11)    NOT NULL DEFAULT 0                          COMMENT '性别:0未设置,1男,2女',
+  grender           int(11)    NOT NULL DEFAULT 0                           COMMENT '性别:0未设置,1男,2女',
   age               int(11)    NOT NULL DEFAULT 0                           COMMENT '年龄',
-  family_status     int(11)    NOT NULL DEFAULT 0                           COMMENT '基本状态:1,0,1,0,0,0,1 (0表示未选中,1表示选中)',
+  family_status     varchar(50) NOT NULL DEFAULT 0                          COMMENT '基本状态:1,0,1,0,0,0,1 (0表示未选中,1表示选中)',
   status_desp       varchar(100)  NOT NULL DEFAULT ''                       COMMENT '状态描述',
   medical           int(11)    NOT NULL DEFAULT 0                           COMMENT '是否确诊:0否,1是',
   temperature       decimal(14,2) NOT NULL DEFAULT 0                        COMMENT '体温',

+ 1 - 1
whepi-ui/templates/groupBuying/groupBuyingXx.ftl

@@ -154,7 +154,7 @@
     });
 
     function goback() {
-        window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+        window.location.href = "/yeweihui/tuangouHome.html?show=tuangou&userId=" + userId;
     }
 
     function finish() {

+ 2 - 2
whepi-ui/templates/home/buy.ftl

@@ -103,7 +103,7 @@
             $('#buyAll').append(' <a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form"\n' +
                     '                                             onclick=\'myBuyClick(' + JSON.stringify(v) + ')\'>\n' +
                     '                <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 4vh;">\n' +
-                    '                    <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;text-indent:25%;">' + v.tgTitle + '</div>\n' +
+                    '                    <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
                     '                    <div style="width: 20%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">\n' + v.count + '/' + v.tgMinNum + '</div>\n' +
                     '                    <div style="width: 35%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + sub(v.tgEndTime) + '</div>\n' +
                     '                    <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
@@ -143,7 +143,7 @@
         function MybuyList(v) {
             $('#MyBuyAll').append('<a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form" onclick=\'myBuyClick2(' + JSON.stringify(v) + ')\'>\n' +
                     '                        <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 4vh;">\n' +
-                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;text-indent:21%;">' + v.tgTitle + '</div>\n' +
+                    '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
                     '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + timestampY(v.timeCreate) + '</div>\n' +
                     '                            <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
                     '                        </div>\n' + '                    </a>')

+ 1 - 1
whepi-ui/templates/home/buyClient.ftl

@@ -98,7 +98,7 @@
     <#--返回-->
     function buyBack() {
         // window.history.back();
-        window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + "&show=tuangou";
+        window.location.href = "/user/homeIndex.html?userId=" + $('#buyuserId').val() + "&userType=" + 1 + "&show=tuangou"+"&type="+2;
     }
 
     /*撤销*/

+ 15 - 15
whepi-ui/templates/home/home.ftl

@@ -8,8 +8,8 @@
             <#include "/home/ribao.ftl" /></div>
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/home/qiuzhu.ftl" /></div>
-        <div id="tab3" class="weui-tab__bd-item">
-    <#include "/home/buy.ftl" /></div>
+       <#-- <div id="tab3" class="weui-tab__bd-item">
+    <#include "/home/buy.ftl" /></div>-->
     <#--<div id="tab4" class="weui-tab__bd-item">-->
     <#--<h1>页面四</h1> </div>-->
     </div>
@@ -22,10 +22,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label">家庭求助</p>
         </a>
-        <a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">
+      <#--  <a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">
             <div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>
             <p class="weui-tabbar__label">商品团购</p>
-        </a>
+        </a>-->
     <#--<a href="#tab4" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_cell.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">我</p>-->
@@ -84,20 +84,20 @@
         });
 
 
-        function selectTab() {
-            $("#tab1").removeClass('weui-tab__bd-item--active');
-            $("#jt1").removeClass('weui-bar__item--on');
-            $("#tab3").addClass('weui-tab__bd-item--active');
-            $("#jt3").addClass('weui-bar__item--on');
-            buyGroup();
-        }
+        <#--function selectTab() {-->
+            <#--$("#tab1").removeClass('weui-tab__bd-item--active');-->
+            <#--$("#jt1").removeClass('weui-bar__item--on');-->
+            <#--$("#tab3").addClass('weui-tab__bd-item--active');-->
+            <#--$("#jt3").addClass('weui-bar__item--on');-->
+            <#--buyGroup();-->
+        <#--}-->
 
-        var show = ${show!'"-"'};
+        <#--var show = ${show!'"-"'};-->
 
-        if (show == 'tuangou') {
-            selectTab();
+        <#--if (show == 'tuangou') {-->
+            <#--selectTab();-->
 
-        }
+        <#--}-->
     })(jQuery);
 
 

+ 57 - 0
whepi-ui/templates/home/tuangouHome.ftl

@@ -0,0 +1,57 @@
+<#assign title="我的团购"/>
+<#include "/home/frag.head.ftl" />
+
+<#--<#include "/home/buy.ftl" />-->
+<div class="weui-tab">
+    <input id="userId" type="text" hidden="hidden" value=${user_id!}/>
+    <div class="weui-tab__bd">
+        <div id="tab3" class="weui-tab__bd-item weui-tab__bd-item--active">
+    <#include "/home/buy.ftl" /></div>
+    </div>
+    <div class="weui-tabbar">
+        <a id="jt3" href="#tab3" class="weui-tabbar__item" onclick="buyGroup()">
+            <div class="weui-tabbar__icon"><img src="/static/images/wx/upload.png" alt=""></div>
+            <p class="weui-tabbar__label">商品团购</p>
+        </a>
+    <#--<a href="#tab4" class="weui-tabbar__item">-->
+    <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_cell.png" alt=""> </div>-->
+    <#--<p class="weui-tabbar__label">我</p>-->
+    <#--</a>-->
+    </div>
+</div>
+</body>
+
+<#include "/home/frag.foot.ftl" />
+<script>
+    (function ($) {
+
+        $(function () {
+            $('.weui-navbar__item').on('click', function () {
+                $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
+                //内容切换
+                var moduleClass = jQuery(this).attr("module");
+                var ss = ".weui-tab__panel ." + moduleClass + "_weui_tab_bd_item_active";
+                $(ss).removeClass(moduleClass + '_weui_tab_bd_item_active');
+                var data_toggle = jQuery(this).attr("target");
+                $(data_toggle).addClass(moduleClass + "_weui_tab_bd_item_active");
+            });
+        });
+
+      /*  function selectTab() {
+           /!* $("#tab1").removeClass('weui-tab__bd-item--active');
+            $("#jt1").removeClass('weui-bar__item--on');*!/
+            $("#tab3").addClass('weui-tab__bd-item--active');
+            $("#jt3").addClass('weui-bar__item--on');
+            buyGroup();
+        }
+
+        var show = ${show!'"-"'};
+
+        if (show == 'tuangou') {
+            selectTab();
+        }*/
+        buyGroup();
+
+    })(jQuery);
+
+</script>

+ 24 - 0
whepi-ui/templates/tuangou/home.ftl

@@ -0,0 +1,24 @@
+<#assign title="商品团购"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="weui-tab">
+    <div class="weui-tab__bd">
+
+
+    </div>
+</div>
+</div>
+</body>
+<#include "/home/frag.foot.ftl" />
+<script>
+
+    $(document).ready(function () {
+    }
+
+</script>
+
+
+
+
+
+

+ 3 - 1
whepi-ui/templates/user/changeRole.ftl

@@ -72,6 +72,8 @@
             $.alert("请选择用户角色!")
             return false;
         }
-        window.location.href = "/user/homeIndex.html?userId=" + $("#userId").val() + "&userType=" + userType;
+        <#if (type?? )&&(type = 1) >window.location.href = "/user/homeIndex.html?userId=" + $("#userId").val() + "&userType=" + userType + "&type=1";</#if>
+        <#if (type?? )&&(type = 2) >window.location.href = "/user/homeIndex.html?userId=" + $("#userId").val() + "&userType=" + userType + "&type=2";</#if>
+
     }
 </script>

+ 1 - 0
whepi-ui/templates/user/scanEstate.ftl

@@ -20,6 +20,7 @@
                     <br/>
                     <p class="user-title-long  ${collor!''}">${errorMsg!""}</p>
                     <br/>
+<#--                    <img id="qr" src="${img!''}"/>-->
                     <br/>
                 </header>
                 <br/>

+ 1 - 1
whepi-ui/templates/wuye/qiuzhu.ftl

@@ -5,7 +5,7 @@
                 用户求助
             </a>
             <a class="weui-navbar__item" target="#qz_nav2" module="qiu_zhu" id="qzMy_help" onclick="qzMy_help('')">
-                业委会任务
+                管理员任务
             </a>
         </div>
         <div class="weui-tab__panel">

+ 10 - 9
whepi-ui/templates/yeweihui/home.ftl

@@ -12,10 +12,11 @@
             <#include "/yeweihui/ribaohuiz.ftl" />
         </div>
         <div id="tab2" class="weui-tab__bd-item">
-            <#include "/yeweihui/qiuzhu.ftl" /></div>
-        <div id="tab3" class="weui-tab__bd-item">
-            <#include "/yeweihui/tuangou.ftl" />
+            <#include "/yeweihui/qiuzhu.ftl" />
         </div>
+<#--        <div id="tab3" class="weui-tab__bd-item">-->
+<#--            <#include "/yeweihui/tuangou.ftl" />-->
+<#--        </div>-->
     <#--<div id="tab3" class="weui-tab__bd-item">-->
     <#--<h1>页面三</h1> </div>-->
     <#--<div id="tab4" class="weui-tab__bd-item">-->
@@ -30,10 +31,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label">求助</p>
         </a>
-        <a id="tab3a" href="#tab3" class="weui-tabbar__item">
-            <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
-            <p class="weui-tabbar__label">团购</p>
-        </a>
+<#--        <a id="tab3a" href="#tab3" class="weui-tabbar__item">-->
+<#--            <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>-->
+<#--            <p class="weui-tabbar__label">团购</p>-->
+<#--        </a>-->
     <#--<a href="#tab3" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_article.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">发现</p>-->
@@ -52,7 +53,7 @@
 <script>
     <#include "/yeweihui/ribao.js" />
     <#include "/yeweihui/qiuzhu.js" />
-    <#include "/yeweihui/tuangou.js" />
+<#--    <#include "/yeweihui/tuangou.js" />-->
 
     var taskList = ${taskList!'[]'};
     var statisticsOrderList =${rbList!'[]'};
@@ -84,7 +85,7 @@
 
         ribao_init();
         qiuzhu_init();
-        tuangou_init();
+        // tuangou_init();
 
         $("#ribaohuiz").calendar({
             dateFormat: 'yyyy-mm-dd',

+ 3 - 2
whepi-ui/templates/yeweihui/tgPublish.ftl

@@ -44,7 +44,7 @@
     $("#tg_input_deliver_time").datetimePicker();
 
     function goback() {
-        window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+        window.location.href = "/yeweihui/tuangouHome.html?show=tuangou&userId=" + userId;
     }
 
     $("#tg_publish").on('click', function () {
@@ -183,6 +183,7 @@
             tgGoods: goods,
             tgPrice: price,
             tgMinNum: minnum,
+            tgMaxNum: maxnum,
             endTime: end_time,
             deliverTime: deliver_time,
             tgPhoneNumber: phone_number,
@@ -196,7 +197,7 @@
             success: function (data) {
                 // console.log(data);
                 if (data.success) {
-                    window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
+                    window.location.href = "/yeweihui/tuangouHome.html?show=tuangou&userId=" + userId;
                 }
                 else  {
                     $.alert(data.data);

+ 45 - 0
whepi-ui/templates/yeweihui/tuangouHome.ftl

@@ -0,0 +1,45 @@
+<#assign title="管理员"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="weui-tab">
+    <input id="userId" type="text" hidden="hidden" value=${user_id!}/>
+    <input id="uptownId" type="text" hidden="hidden" value=${uptown_id!}/>
+    <input id="uptownName" type="text" hidden="hidden" value=${uptown_name!}/>
+
+    <div class="weui-tab__bd">
+        <div id="tab__1" class="weui-tab__bd-item weui-tab__bd-item--active">
+            <#include "/yeweihui/tuangou.ftl" />
+        </div>
+    </div>
+    <div class="weui-tabbar">
+        <a href="#tab__1" class="weui-tabbar__item weui-bar__item--on">
+            <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
+            <p class="weui-tabbar__label">团购</p>
+        </a>
+    </div>
+</div>
+
+
+</body>
+
+<#include "/home/frag.foot.ftl" />
+<script>
+    <#include "/yeweihui/tuangou.js" />
+    (function ($) {
+        $(function () {
+            $('.weui-navbar__item').on('click', function () {
+                $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
+                //内容切换
+                var moduleClass = jQuery(this).attr("module");
+                var ss = ".weui-tab__panel ." + moduleClass + "_weui_tab_bd_item_active";
+                $(ss).removeClass(moduleClass + '_weui_tab_bd_item_active');
+                var data_toggle = jQuery(this).attr("target");
+                $(data_toggle).addClass(moduleClass + "_weui_tab_bd_item_active");
+            });
+
+        });
+
+        tuangou_init();
+
+    })(jQuery);
+</script>

+ 25 - 0
whepi-web/src/main/java/com/bofeng/controller/WxUserOpenController.java

@@ -8,10 +8,15 @@ import com.bofeng.entity.UserRole;
 import com.bofeng.service.HomeService;
 import com.bofeng.service.WxUserOpenService;
 import com.yvan.Model;
+import com.yvan.ModelOps;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.StringUtils;
+import com.yvan.springmvc.HttpParameterParser;
+import com.yvan.springmvc.HttpUtils;
 import io.swagger.annotations.ApiOperation;
+import lombok.val;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -30,6 +35,26 @@ public class WxUserOpenController {
     @Autowired
     private WxUserOpenService wxUserOpenService;
 
+    @GetMapping("/userOpen/loginTest")
+    public Model<UserOpen> loginTest() {
+        val parser = HttpParameterParser.newInstance(HttpUtils.currentRequest());
+        String openId = parser.getString("openId");
+        String code = parser.getString("code");
+        if (StringUtils.isNullOrEmpty(code)) {
+            return Model.newFail("code为空");
+        }
+        UserOpen userOpen = homeService.getUserOpenByCode(code);
+        if (userOpen == null) {
+            return Model.newFail("微信登录失败");
+        }
+        //成功返回用户Id
+        try {
+            return Model.newSuccess(userOpen);
+        } catch (Exception e) {
+            return Model.newFail(e.getMessage());
+        }
+    }
+
     @ApiOperation("用户注册页面点登录")
     @PostMapping("/userOpen/login")
     public Model<UserOpen> login(JsonWapper jsonWapper) {

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

@@ -2,6 +2,7 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.JmTuangou;
+import com.yvan.PageDb;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -20,6 +21,8 @@ public interface JmTuangouDao extends BaseMapper<JmTuangou> {
 
   List<JmTuangou> queryTuangouListByUserIdAndTitle(@Param("userId") Long userId, @Param("title") String title);
 
+  List<JmTuangou> whepiTuangoulist(@Param("userId") Long userId, @Param("uptownIds") String uptownIds, @Param("queryProperties") String queryProperties, @Param("status") Long status, PageDb pageDb);
+
   JmTuangou selectJmTuangouByJmId(@Param("JmId") Long JmId);
 
   Integer updateRemarkByJmId(@Param("JmId") Long JmId, @Param("remark") String remark);
@@ -31,4 +34,8 @@ public interface JmTuangouDao extends BaseMapper<JmTuangou> {
   List<JmTuangou> selectAll();
 
   int updateAll(@Param("tg") List<JmTuangou> tg);
+
+  JmTuangou selectByUserId();
+
+  JmTuangou getSelectOne(@Param("jmId") Long jmId);
 }

+ 14 - 0
whepi-web/src/main/java/com/bofeng/dao/SweepCodeMapper.java

@@ -0,0 +1,14 @@
+package com.bofeng.dao;
+
+import com.bofeng.entity.SysUptownHouse;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+@Repository
+public interface SweepCodeMapper {
+    List<SysUptownHouse> selectCode(Map<String, Object> queryParam);
+}

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

@@ -2,11 +2,15 @@ package com.bofeng.dao;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.UptownDoor;
+import com.yvan.PageDb;
 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;
+import java.util.Map;
+
 @Mapper
 @Repository
 public interface UptownDoorMapper extends BaseMapper<UptownDoor> {
@@ -15,4 +19,6 @@ public interface UptownDoorMapper extends BaseMapper<UptownDoor> {
             "sys_uptown u ON u.uptown_id = ud.uptown_id WHERE ud.door_id = #{doorId} AND ud.STATUS = 1")
     UptownDoor getUptownDoorById(@Param("doorId") Long doorId);
 
+    List<UptownDoor> getAllUptownDoor(PageDb pagination, Map<String, Object> map);
+
 }

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

@@ -60,6 +60,12 @@ public class JmTuangou implements Serializable {
     @TableField(exist = false)
     private Integer currentNum;
 
+    @TableField(exist = false)
+    private String uptownIds;
+
+    @TableField(exist = false)
+    private String uptownName;
+
     /**
      * 团购截止时间
      */

+ 22 - 0
whepi-web/src/main/java/com/bofeng/entity/SysUptownHouse.java

@@ -1,5 +1,6 @@
 package com.bofeng.entity;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
@@ -20,9 +21,11 @@ public class SysUptownHouse implements Serializable {
     private Long unitId;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"楼栋"}, index = 1)
     private String ridgepole;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"单元"}, index = 2)
     private String unit;
 
     @TableField(exist = false)
@@ -35,6 +38,7 @@ public class SysUptownHouse implements Serializable {
     private String time;
 
     @TableField("doorplate")
+    @ExcelProperty(value = {"房间号"}, index = 3)
     private String doorplate;
 
     @TableField("status")
@@ -49,10 +53,28 @@ public class SysUptownHouse implements Serializable {
     @TableField("time_update")
     private DateTime timeUpdate;
 
+    @TableField(exist = false)
+    @ExcelProperty(value = {"小区名称"}, index = 0)
+    private String uptownName;
 
+    @TableField(exist = false)
+    @ExcelProperty(value = {"小区大门"}, index = 5)
+    private String doorName;
 
+    @TableField(exist = false)
+    @ExcelProperty(value = {"进入时间"}, index = 6)
+    private String intoDate;
 
+    @TableField(exist = false)
+    @ExcelProperty(value = {"外出时间"}, index = 7)
+    private String outDate;
 
+    @TableField(exist = false)
+    @ExcelProperty(value = {"用户名"}, index = 4)
+    private String nickName;
+
+    @TableField(exist = false)
+    private String jcStatus;
 
 
 

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

@@ -45,4 +45,11 @@ public class UptownDoor {
     @ApiModelProperty("出门间隔时间")
     @TableField(exist = false)
     private Integer goOutFre;
+
+    @TableField(exist = false)
+    private String inImg;
+
+    @TableField(exist = false)
+    private String outImg;
+
 }

+ 107 - 57
whepi-web/src/main/java/com/bofeng/service/JmTuangouService.java

@@ -5,6 +5,7 @@ import com.bofeng.dao.JmTuangouDao;
 import com.bofeng.dao.YeweihuiSysOwnerMapper;
 import com.bofeng.dao.YeweihuiUserRoleMapper;
 import com.bofeng.entity.JmTuangou;
+import com.yvan.PageDb;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -19,88 +21,136 @@ import java.util.List;
 @Transactional(readOnly = true)
 public class JmTuangouService {
 
-    @Autowired
-    private BuyService buyService;
+  @Autowired
+  private BuyService buyService;
 
-    @Autowired
-    private JmTuangouDao jmTuangouDao;
+  @Autowired
+  private JmTuangouDao jmTuangouDao;
 
-    @Autowired
-    private YeweihuiUserRoleMapper yeweihuiUserRoleMapper;
+  @Autowired
+  private YeweihuiUserRoleMapper yeweihuiUserRoleMapper;
 
-    @Autowired
-    private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
+  @Autowired
+  private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
 
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public Integer tuangouPublish(JmTuangou jmTuangou) {
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public Integer tuangouPublish(JmTuangou jmTuangou) {
 
-        jmTuangou.setJmId(IdWorker.getId());
+    jmTuangou.setJmId(IdWorker.getId());
 
-        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(jmTuangou.getUserId());
-        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
-        jmTuangou.setUptownId(uptownId);
+    Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(jmTuangou.getUserId());
+    Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+    jmTuangou.setUptownId(uptownId);
 
-        jmTuangou.setTgStatus(1);
+    jmTuangou.setTgStatus(1);
 
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+    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();
-        }
+    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);
+    jmTuangou.setTgEndTime(tgEndTime);
+    jmTuangou.setTgDeliverTime(tgDeliverTime);
 
-        return jmTuangouDao.insert(jmTuangou);
-    }
+    return jmTuangouDao.insert(jmTuangou);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public Integer whepiTuangouPublish(String uptownIds, JmTuangou jmTuangou) {
+
+    Integer success = 0;
+    List<String> uptownIdArray = Arrays.asList(uptownIds.split(","));
+    for (String uptownId : uptownIdArray) {
 
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public List<JmTuangou> queryTuangouListByTitle(Long userId, String title) {
+      jmTuangou.setJmId(IdWorker.getId());
 
-        buyService.updateStatus();
+      jmTuangou.setUptownId(Long.parseLong(uptownId));
 
-        Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(userId);
-        Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+      jmTuangou.setTgStatus(1);
 
-        if (title.equals("")) {
-            return jmTuangouDao.queryTuangouListByUptownId(uptownId);
-        }
-        return jmTuangouDao.queryTuangouListByUptownIdAndTitle(uptownId, title);
+            /*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(jmTuangou.gettgEndTime);
+            jmTuangou.setTgDeliverTime(tgDeliverTime);*/
+      jmTuangou.setUserId(jmTuangouDao.selectByUserId().getUserId());
+      success = jmTuangouDao.insert(jmTuangou);
     }
+    return success;
+  }
 
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public List<JmTuangou> queryTuangouMyListByTitle(Long userId, String title) {
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public List<JmTuangou> queryTuangouListByTitle(Long userId, String title) {
 
-        buyService.updateStatus();
+    buyService.updateStatus();
 
-        if (title.equals("")) {
-            return jmTuangouDao.queryTuangouListByUserId(userId);
-        }
-        return jmTuangouDao.queryTuangouListByUserIdAndTitle(userId, title);
+    Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(userId);
+    Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+
+    if (title.equals("")) {
+      return jmTuangouDao.queryTuangouListByUptownId(uptownId);
     }
+    return jmTuangouDao.queryTuangouListByUptownIdAndTitle(uptownId, title);
+  }
 
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public JmTuangou queryByJmId(Long jmId) {
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public List<JmTuangou> queryTuangouMyListByTitle(Long userId, String title) {
 
-        buyService.updateStatus();
+    buyService.updateStatus();
 
-        return jmTuangouDao.selectJmTuangouByJmId(jmId);
+    if (title.equals("")) {
+      return jmTuangouDao.queryTuangouListByUserId(userId);
     }
+    return jmTuangouDao.queryTuangouListByUserIdAndTitle(userId, title);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public JmTuangou queryByJmId(Long jmId) {
 
-    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public Integer updateRemarkByJmId(Long jmId, Long status, String remark) {
-        if (status == 0) {
-            return jmTuangouDao.updateRemarkByJmId(jmId, remark);
-        }
-        if (remark.equals("")) {
+    buyService.updateStatus();
 
-        }
-        return jmTuangouDao.updateStatusRemarkByJmId(jmId, status, remark);
+    return jmTuangouDao.selectJmTuangouByJmId(jmId);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public List<JmTuangou> whepiTuangoulist(Long userId, String uptownIds, String queryProperties, Long status, PageDb pageDb) {
+
+    buyService.updateStatus();
+
+    return jmTuangouDao.whepiTuangoulist(userId, uptownIds, queryProperties, status, pageDb);
+  }
+
+  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+  public Integer updateRemarkByJmId(Long jmId, Long status, String remark) {
+    if (status == 0) {
+      return jmTuangouDao.updateRemarkByJmId(jmId, remark);
     }
+    if (remark.equals("")) {
+      return jmTuangouDao.updateStatusByJmId(jmId, status);
+    }
+    return jmTuangouDao.updateStatusRemarkByJmId(jmId, status, remark);
+  }
+
+  public JmTuangou selectByUserId() {
+    return jmTuangouDao.selectByUserId();
+  }
+
+  public JmTuangou getSelectOne(Long jmId){
+    return jmTuangouDao.getSelectOne(jmId);
+  }
 }

+ 26 - 0
whepi-web/src/main/java/com/bofeng/service/SweepCodeService.java

@@ -0,0 +1,26 @@
+package com.bofeng.service;
+
+
+import com.bofeng.dao.SweepCodeMapper;
+import com.bofeng.entity.SysUptownHouse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Transactional(readOnly = true)
+public class SweepCodeService {
+
+    @Autowired
+    private SweepCodeMapper sweepCodeMapper;
+
+
+    public List<SysUptownHouse> selectCode(Map<String, Object> queryParam) {
+        List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(queryParam);
+
+        return sysUptownHouses;
+    }
+}

+ 26 - 4
whepi-web/src/main/java/com/bofeng/wx/WxController.java

@@ -112,7 +112,16 @@ public class WxController {
     public ModelOps createMenu() throws WxErrorException {
         val menu = new WxMenu();
 
-        //推介客户
+//        //推介客户
+//        val btn1 = new WxMenuButton();
+//        btn1.setName("健康日报");
+//        btn1.setType(WxConsts.MenuButtonType.VIEW);
+//        btn1.setUrl(
+//                wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
+//                                "/user/home.html",
+//                        WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
+//        );
+
         val btn1 = new WxMenuButton();
         btn1.setName("健康日报");
         btn1.setType(WxConsts.MenuButtonType.VIEW);
@@ -121,6 +130,18 @@ public class WxController {
                                 "/user/home.html",
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
+        val btn2 = new WxMenuButton();
+        btn2.setName("商品团购");
+        btn2.setType(WxConsts.MenuButtonType.VIEW);
+        btn2.setUrl(
+                wxService.oauth2buildAuthorizationUrl(weChatProperties.getDomain() +
+                                "/tuangou/home.html",
+                        WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
+        );
+
+        val btn3 = new WxMenuButton();
+        btn3.setName("我的");
+
         val btnDesc = new WxMenuButton();
         btnDesc.setName("平台简介");
         btnDesc.setType(WxConsts.MenuButtonType.VIEW);
@@ -138,7 +159,8 @@ public class WxController {
                                 "/home/homeHelp.html",
                         WxConsts.OAuth2Scope.SNSAPI_USERINFO, null)
         );
-
+        btn3.getSubButtons().add(btnDesc);
+        btn3.getSubButtons().add(btnHelp);
 
 //        val btn2 = new WxMenuButton();
 //        btn2.setName("业委会");
@@ -201,8 +223,8 @@ public class WxController {
 //        btn3.getSubButtons().add(btn33);
 
         menu.getButtons().add(btn1);
-        menu.getButtons().add(btnDesc);
-        menu.getButtons().add(btnHelp);
+        menu.getButtons().add(btn2);
+        menu.getButtons().add(btn3);
 //        menu.getButtons().add(btn2);
 //        menu.getButtons().add(btn3);
         wxService.getMenuService().menuCreate(menu);

+ 103 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/ScanAdminController.java

@@ -1,9 +1,112 @@
 package com.bofeng.wx.controller;
 
+import com.bofeng.dao.UptownDoorMapper;
+import com.bofeng.entity.SysUptownHouse;
+import com.bofeng.entity.UptownDoor;
+import com.bofeng.excel.ExcelUtils;
+import com.bofeng.service.SweepCodeService;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.client.j2se.MatrixToImageConfig;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.yvan.Model;
+import com.yvan.PageDb;
+import com.yvan.mvc.Pd;
+import com.yvan.springmvc.HttpParameterParser;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.Cleanup;
+import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+
 @Api("进出扫码后台信息")
 @RestController
 public class ScanAdminController {
+
+
+    @Autowired
+    private SweepCodeService sweepCodeService;
+    @Autowired
+    private UptownDoorMapper uptownDoorMapper;
+
+    @ApiOperation("出入查询")
+    @GetMapping("/whepi/sweepCode/selectCode")
+    public Model<List<SysUptownHouse>> selectCode(HttpParameterParser parser) {
+//        HttpServletResponse response,HttpServletRequest request
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
+        return Model.newSuccess(sysUptownHouses);
+    }
+
+    @ApiOperation("导出")
+    @GetMapping("/whepi/sweepCode/export")
+    @SneakyThrows
+    public void export(HttpParameterParser parser,HttpServletResponse resp) {
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
+        ExcelUtils.writeSheet(SysUptownHouse.class, sysUptownHouses).export(resp,"扫码导出");
+    }
+
+    @ApiOperation("小区进出二维码")
+    @PostMapping("/whepi/qrImg/scanQrImg")
+    public Model<List<UptownDoor>> scanQrImg(HttpParameterParser parser, PageDb pagination) {
+        List<UptownDoor> list = uptownDoorMapper.getAllUptownDoor(pagination, parser.getMap());
+        for (UptownDoor door : list) {
+            door.setInImg("/whepi/scan/scan_qr.png?doorId=" + door.getDoorId() + "&inType=1");
+            door.setOutImg("/whepi/scan/scan_qr.png?doorId=" + door.getDoorId() + "&inType=2");
+        }
+        return Model.newSuccess(pagination, list);
+    }
+
+    // 获取code
+    private static final String oauth2 = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=";
+    private static final String moreUrl = "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
+    @Value("${yvan.wechat.appID}")
+    private String appId;
+    @Value("${yvan.wechat.domain}")
+    private String domain;
+
+    /**
+     * 生成进出门二维码
+     * @param doorId 小区大门ID
+     * @param inType 1进入;2外出
+     * @param response
+     * @throws IOException
+     * @throws WriterException
+     */
+    @GetMapping(value = "/whepi/scan/scan_qr.png", produces = MediaType.IMAGE_PNG_VALUE)
+    public void scanQrImg(@Pd(name = "doorId") Long doorId, @Pd(name = "inType") Integer inType,
+                          HttpServletResponse response) throws IOException, WriterException {
+        @Cleanup ServletOutputStream outputStream = response.getOutputStream();
+        String msg = URLEncoder.encode( domain + "user/scan.html?doorId=" + doorId + "&inType=" + inType,"utf-8");
+        BitMatrix matrix = new MultiFormatWriter().encode(oauth2 + appId + "&redirect_uri=" +
+                msg + moreUrl, BarcodeFormat.QR_CODE, 256, 256);
+        MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), outputStream, new MatrixToImageConfig());
+    }
+
+    /**
+     * 生成校园巡逻二维码
+     * @throws IOException
+     * @throws WriterException
+     */
+    @GetMapping(value = "/whepi/scan/scanEstate_qr.png", produces = MediaType.IMAGE_PNG_VALUE)
+    public void scanEstateQrImg(HttpServletResponse response) throws IOException, WriterException {
+        @Cleanup ServletOutputStream outputStream = response.getOutputStream();
+        String msg = URLEncoder.encode( domain + "user/scanEstate.html","utf-8");
+        BitMatrix matrix = new MultiFormatWriter().encode(oauth2 + appId + "&redirect_uri=" +
+                msg + moreUrl, BarcodeFormat.QR_CODE, 256, 256);
+        MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), outputStream, new MatrixToImageConfig());
+    }
+
 }

+ 66 - 13
whepi-web/src/main/java/com/bofeng/wx/controller/ScanController.java

@@ -4,25 +4,32 @@ import com.bofeng.dao.*;
 import com.bofeng.entity.*;
 import com.bofeng.service.HomeService;
 import com.bofeng.service.ScanService;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.yvan.platform.JsonWapper;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.client.j2se.MatrixToImageConfig;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.yvan.mvc.Pd;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.Cleanup;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.MediaType;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
-import java.text.DateFormat;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -30,6 +37,14 @@ import java.util.List;
 @RestController
 public class ScanController {
 
+    // 获取code
+    private static final String oauth2 = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=";
+    private static final String moreUrl = "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
+    @Value("${yvan.wechat.appID}")
+    private String appId;
+    @Value("${yvan.wechat.domain}")
+    private String domain;
+
     @Autowired
     private HomeService homeService;
     @Autowired
@@ -53,12 +68,18 @@ public class ScanController {
     @Autowired
     private OutScanEstateMapper outScanEstateMapper;
 
+    /**
+     * @param doorId 小区大门ID
+     * @param inType 1进入;2外出
+     * @param request
+     * @param model
+     * @return
+     */
     @ApiOperation("进出扫码页面")
     @GetMapping("/user/scan.html")
     public ModelAndView scan(HttpServletRequest request, ModelMap model, @RequestParam(value = "doorId", required = false, defaultValue = "0") Long doorId,
                              @RequestParam(value = "inType", required = false, defaultValue = "0") Integer inType) {
-//        String code = request.getParameter("code");
-        UserOpen userOpen = homeService.getUserOpen();
+        UserOpen userOpen = homeService.getUserOpenByCode(request.getParameter("code"));
         List<UserRole> list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
 //        List<UserRole> list = userRoleMapper.getUserRoleByUserId(1L);
 //        UserOpen userOpen = userOpenMapper.selectByUserId(1L);
@@ -71,7 +92,7 @@ public class ScanController {
             List<UptownHome> uptownHomes =  uptownHomeMapper.getUptownHomeByUserId(userOpen.getUserId());
             UptownUnit unit = uptownUnitMapper.getUptownUnitByUser(userOpen.getUserId());
             model.put("door", uptownDoor.getUptownName() + uptownDoor.getDoorName());
-            model.put("doorplate", unit.getRidgepole() + "栋" + unit.getUnit() + "单元" +unit.getDoorplate());
+            model.put("doorplate", unit.getRidgepole() + "栋" + unit.getUnit() + "单元" +unit.getDoorplate() + "号");
             model.put("name", uptownHomes.get(0).getLinkman());
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             model.put("now", format.format(new Date()));
@@ -112,8 +133,7 @@ public class ScanController {
     @ApiOperation("巡检人员检查扫码信息")
     @GetMapping("/user/scanEstate.html")
     public ModelAndView scanEstate(HttpServletRequest request, ModelMap model) {
-        String code = request.getParameter("code");
-        UserOpen userOpen = homeService.getUserOpen();
+        UserOpen userOpen = homeService.getUserOpenByCode(request.getParameter("code"));
         List<UserRole> list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
 //        List<UserRole> list = userRoleMapper.getUserRoleByUserId(1L);
 //        UserOpen userOpen = userOpenMapper.selectByUserId(1L);
@@ -124,7 +144,7 @@ public class ScanController {
         } else {
             List<UptownHome> uptownHomes =  uptownHomeMapper.getUptownHomeByUserId(userOpen.getUserId());
             UptownUnit unit = uptownUnitMapper.getUptownUnitByUser(userOpen.getUserId());
-            model.put("doorplate", unit.getRidgepole() + "栋" + unit.getUnit() + "单元" +unit.getDoorplate());
+            model.put("doorplate", unit.getRidgepole() + "栋" + unit.getUnit() + "单元" +unit.getDoorplate() + "号");
             model.put("name", uptownHomes.get(0).getLinkman());
             SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             model.put("now", format.format(new Date()));
@@ -140,6 +160,7 @@ public class ScanController {
                 model.put("errorMsg", "这是您今天第" + conut + "次出行,为了您的安全,请尽快回家。");
             }
             scanService.saveOutScanEstate(userOpen.getUserId());
+//            model.put("img", "/scan/scanEstate_qr.png");
             return new ModelAndView("/user/scanEstate.ftl", model);
         }
     }
@@ -166,4 +187,36 @@ public class ScanController {
         }
         return "";
     }
+
+    /**
+     * 生成进出门二维码
+     * @param doorId 小区大门ID
+     * @param inType 1进入;2外出
+     * @param response
+     * @throws IOException
+     * @throws WriterException
+     */
+    @GetMapping(value = "/scan/scan_qr.png", produces = MediaType.IMAGE_PNG_VALUE)
+    public void scanQrImg(@Pd(name = "doorId") Long doorId, @Pd(name = "inType") Integer inType,
+                            HttpServletResponse response) throws IOException, WriterException {
+        @Cleanup ServletOutputStream outputStream = response.getOutputStream();
+        String msg = URLEncoder.encode( domain + "user/scan.html?doorId=" + doorId + "&inType=" + inType,"utf-8");
+        BitMatrix matrix = new MultiFormatWriter().encode(oauth2 + appId + "&redirect_uri=" +
+                msg + moreUrl, BarcodeFormat.QR_CODE, 256, 256);
+        MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), outputStream, new MatrixToImageConfig());
+    }
+
+    /**
+     * 生成校园巡逻二维码
+     * @throws IOException
+     * @throws WriterException
+     */
+    @GetMapping(value = "/scan/scanEstate_qr.png", produces = MediaType.IMAGE_PNG_VALUE)
+    public void scanEstateQrImg(HttpServletResponse response) throws IOException, WriterException {
+        @Cleanup ServletOutputStream outputStream = response.getOutputStream();
+        String msg = URLEncoder.encode( domain + "user/scanEstate.html","utf-8");
+        BitMatrix matrix = new MultiFormatWriter().encode(oauth2 + appId + "&redirect_uri=" +
+                msg + moreUrl, BarcodeFormat.QR_CODE, 256, 256);
+        MatrixToImageWriter.writeToStream(matrix, MediaType.IMAGE_PNG.getSubtype(), outputStream, new MatrixToImageConfig());
+    }
 }

+ 51 - 2
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -90,6 +90,7 @@ public class UserOpenController {
                 return new ModelAndView("/home/home.ftl", model);
             }
             if (list.size() == 2) {
+                model.put("type", 1);
                 return new ModelAndView("/user/changeRole.ftl", model);
             }
         } else {
@@ -100,6 +101,47 @@ public class UserOpenController {
                 model.put("msReport", new JsonWapper(msReport));
                 return new ModelAndView("/home/home.ftl", model);
             } else if (userType == 2) {
+                model.put("type", 1);
+                return new ModelAndView("/user/changeRole.ftl", model);
+            }
+        }
+        return null;
+    }
+
+
+    @ApiOperation("商品团购")
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = false, dataType = "Long", paramType = "query"),
+            @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "Integer", paramType = "query")
+    })
+    @GetMapping("/tuangou/home.html")
+    public ModelAndView tuangouHome(ModelMap model, @RequestParam(value = "userId", required = false, defaultValue = "0") Long userId,
+                             @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType) throws JsonProcessingException {
+        List<UserRole> list = new ArrayList<>();
+        if (userId == 0) {
+            UserOpen userOpen = homeService.getUserOpen();
+            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+//            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
+//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+            userId = userOpen.getUserId();
+            model.put("user", userOpen);
+            model.put("user_id", "\"" + userOpen.getUserId() + "\"");
+            if (list.size() == 0) {
+                return new ModelAndView("/user/home.ftl", model);
+            }
+            if (list.size() == 1) {
+                return new ModelAndView("/tuangou/home.ftl", model);
+            }
+            if (list.size() == 2) {
+                model.put("type", 2);
+                return new ModelAndView("/user/changeRole.ftl", model);
+            }
+        } else {
+            model.put("user", userOpenMapper.selectByUserId(userId));
+            model.put("user_id", "\"" + userId + "\"");
+            if (userType == 1) {
+                return new ModelAndView("/tuangou/home.ftl", model);
+            } else if (userType == 2) {
+                model.put("type", 2);
                 return new ModelAndView("/user/changeRole.ftl", model);
             }
         }
@@ -108,7 +150,9 @@ public class UserOpenController {
 
     @GetMapping("/user/homeIndex.html")
     public ModelAndView homeIndex(ModelMap model, @RequestParam(value = "userId", required = false, defaultValue = "0") Long userId,
-                                  @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType, @RequestParam(value = "show", required = false, defaultValue = "-") String show) throws JsonProcessingException {
+                                  @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType,
+                                  @RequestParam(value = "type", required = false, defaultValue = "1") Integer type,
+                                  @RequestParam(value = "show", required = false, defaultValue = "-") String show) throws JsonProcessingException {
         if (userId != 0 && userType != 0) {
             model.put("user_id", "\"" + userId + "\"");
             List<Uptown> uptowns = rbMapper.selectUptown(userId);
@@ -122,13 +166,18 @@ public class UserOpenController {
                 MsReport msReport = msReportService.getReportByDateNow(userId);
                 model.put("msReport", new JsonWapper(msReport));
                 model.put("show", "\"" + show + "\"");
+                if (type == 2) {
+                    return new ModelAndView("/home/tuangouHome.ftl", model);
+                }
                 return new ModelAndView("/home/home.ftl", model);
             } else if (userType == 2) {
                 List<QzTask> taskList = qzTaskService.selectAll(userId);
                 model.put("taskList", YvanUtil.toJsonPretty(taskList));
                 List<sysUptownUnit> rbList = rbService.selectAll(userId);
                 model.put("rbList", YvanUtil.toJsonPretty(rbList));
-
+                if (type == 2) {
+                    return new ModelAndView("/yeweihui/tuangouHome.ftl", model);
+                }
                 return new ModelAndView("/yeweihui/home.ftl", model);
             }
         }

+ 300 - 273
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -11,6 +11,7 @@ import com.google.common.collect.Maps;
 import com.yvan.Model;
 import com.yvan.ModelOps;
 import com.yvan.PageDb;
+import com.yvan.mvc.JsonBody;
 import com.yvan.mvc.Pd;
 import com.yvan.platform.Conv;
 import com.yvan.platform.JsonWapper;
@@ -20,10 +21,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletResponse;
@@ -33,359 +31,388 @@ import java.util.Map;
 @RestController
 public class YeWeiHuiController {
 
-    @Autowired
-    private QzTaskService qzTaskService;
-    @Autowired
-    private RbService rbService;
+  @Autowired
+  private QzTaskService qzTaskService;
+  @Autowired
+  private RbService rbService;
 
-    @Autowired
-    private QzTaskReplyService qzTaskReplyService;
+  @Autowired
+  private QzTaskReplyService qzTaskReplyService;
 
-    @Autowired
-    private HomeService homeService;
+  @Autowired
+  private HomeService homeService;
 
-    @Autowired
-    private JmTuangouService jmTuangouService;
+  @Autowired
+  private JmTuangouService jmTuangouService;
 
-    @Autowired
-    private UptownMapper uptownMapper;
+  @Autowired
+  private UptownMapper uptownMapper;
 
-    @Autowired
-    private RbMapper rbMapper;
+  @Autowired
+  private RbMapper rbMapper;
 
-    @Autowired
-    private JmTuangouMemberService jmTuangouMemberService;
+  @Autowired
+  private JmTuangouMemberService jmTuangouMemberService;
 
-    @GetMapping("/yeweihui/home.html")
-    public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
+  @GetMapping("/yeweihui/home.html")
+  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);
-        List<QzTask> taskList = qzTaskService.selectAll(userId);
-        List<sysUptownUnit> rbList = rbService.selectAll(userId);
-        model.put("taskList", YvanUtil.toJsonPretty(taskList));
-        model.put("rbList", YvanUtil.toJsonPretty(rbList));
-        model.put("user_id", "\""+userId+"\"");
-        model.put("show", "\""+show+"\"");
-
-        return new ModelAndView("/yeweihui/home.ftl", model);
-    }
+    List<QzTask> taskList = qzTaskService.selectAll(userId);
+    List<sysUptownUnit> rbList = rbService.selectAll(userId);
+    model.put("taskList", YvanUtil.toJsonPretty(taskList));
+    model.put("rbList", YvanUtil.toJsonPretty(rbList));
+    model.put("user_id", "\"" + userId + "\"");
+    model.put("show", "\"" + show + "\"");
+
+    return new ModelAndView("/yeweihui/home.ftl", model);
+  }
+
+  @GetMapping("/yeweihui/tuangouHome.html")
+  public ModelAndView yeweihuiTuangouHome(ModelMap model, @RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
+
+    model.put("user_id", "\"" + userId + "\"");
+    model.put("show", "\"" + show + "\"");
 
-    @GetMapping("/yeweihui/qiuzhuDetail.html")
-    public ModelAndView qiuzhudetail(@Pd(name = "taskId") Long taskId,@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+    return new ModelAndView("/yeweihui/tuangouHome.ftl", model);
+  }
 
-        QzTask task = qzTaskService.queryByTaskId(taskId);
+  @GetMapping("/yeweihui/qiuzhuDetail.html")
+  public ModelAndView qiuzhudetail(@Pd(name = "taskId") Long taskId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+
+    QzTask task = qzTaskService.queryByTaskId(taskId);
 //        A业委会,B居委会,C物业,D志愿者
-        StringBuffer target = new StringBuffer();
-        if (task.getTaskTarget().equals("A")) {
-            target.append("业委会");
-        }
-        else if (task.getTaskTarget().equals("B")) {
-            if (target.length() > 0) {
-                target.append("、居委会");
-            }
-            else {
-                target.append("居委会");
-            }
-        }
-        else if (task.getTaskTarget().equals("C")) {
-            if (target.length() > 0) {
-                target.append("、物业");
-            }
-            else {
-                target.append("物业");
-            }
-        }
-        else if (task.getTaskTarget().equals("D")) {
-            if (target.length() > 0) {
-                target.append("、志愿者");
-            }
-            else {
-                target.append("志愿者");
-            }
-        }
-
-        task.setTaskTarget(target.toString());
-
-        model.put("taskJson", new JsonWapper(task));
-        model.put("task", task);
-        model.put("userId", "\""+userId+"\"");
-
-        return new ModelAndView("/yeweihui/qiuzhuDetail.ftl", model);
+    StringBuffer target = new StringBuffer();
+    if (task.getTaskTarget().equals("A")) {
+      target.append("业委会");
+    } else if (task.getTaskTarget().equals("B")) {
+      if (target.length() > 0) {
+        target.append("、居委会");
+      } else {
+        target.append("居委会");
+      }
+    } else if (task.getTaskTarget().equals("C")) {
+      if (target.length() > 0) {
+        target.append("、物业");
+      } else {
+        target.append("物业");
+      }
+    } else if (task.getTaskTarget().equals("D")) {
+      if (target.length() > 0) {
+        target.append("、志愿者");
+      } else {
+        target.append("志愿者");
+      }
     }
 
-    @PostMapping("/yeweihui/qiuzhu/queryTasksByStatus.json")
-    public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
+    task.setTaskTarget(target.toString());
 
-        List<QzTask> taskList = qzTaskService.queryQzTaskByStatus(status);
+    model.put("taskJson", new JsonWapper(task));
+    model.put("task", task);
+    model.put("userId", "\"" + userId + "\"");
 
-        return Model.newSuccess(taskList);
-    }
+    return new ModelAndView("/yeweihui/qiuzhuDetail.ftl", model);
+  }
 
-    @PostMapping("/yeweihui/qiuzhu/reply/add.json")
-    public ModelOps replyQiuzhuInsert(QzTaskReply qzTaskReply) {
+  @PostMapping("/yeweihui/qiuzhu/queryTasksByStatus.json")
+  public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
 
-        Integer success = qzTaskReplyService.insertQzTaskReply(qzTaskReply);
+    List<QzTask> taskList = qzTaskService.queryQzTaskByStatus(status);
 
-        if (success > 0) {
-            return ModelOps.newSuccess();
-        }
-        else {
-            return ModelOps.newFail("操作失败");
-        }
-    }
+    return Model.newSuccess(taskList);
+  }
 
-    @PostMapping("/yeweihui/qiuzhu/reply/querybytaskid.json")
-    public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
+  @PostMapping("/yeweihui/qiuzhu/reply/add.json")
+  public ModelOps replyQiuzhuInsert(QzTaskReply qzTaskReply) {
 
-        List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
+    Integer success = qzTaskReplyService.insertQzTaskReply(qzTaskReply);
 
-        return Model.newSuccess(reply);
+    if (success > 0) {
+      return ModelOps.newSuccess();
+    } else {
+      return ModelOps.newFail("操作失败");
     }
+  }
+
+  @PostMapping("/yeweihui/qiuzhu/reply/querybytaskid.json")
+  public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
 
-    @PostMapping("/yeweihui/qiuzhu/list.json")
-    public Model queryByHouseNumber(String houseNumber, @Pd(name = "status") Integer status) {
+    List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
 
-        if (houseNumber.length() <= 0) {
-            return Model.newSuccess(qzTaskService.queryQzTaskByStatus(status));
-        }
+    return Model.newSuccess(reply);
+  }
 
-        List<QzTask> list = qzTaskService.queryByHouseNumber(houseNumber, status);
+  @PostMapping("/yeweihui/qiuzhu/list.json")
+  public Model queryByHouseNumber(String houseNumber, @Pd(name = "status") Integer status) {
 
-        return Model.newSuccess(list);
+    if (houseNumber.length() <= 0) {
+      return Model.newSuccess(qzTaskService.queryQzTaskByStatus(status));
     }
 
-    @GetMapping("/yeweihui/ribao.html")
-    public ModelAndView yeweihuiRibao(ModelMap model) {
+    List<QzTask> list = qzTaskService.queryByHouseNumber(houseNumber, status);
+
+    return Model.newSuccess(list);
+  }
+
+  @GetMapping("/yeweihui/ribao.html")
+  public ModelAndView yeweihuiRibao(ModelMap model) {
 
 //        List<QzTask> taskList = qzTaskService.selectAll();
 //
 //        model.put("taskList", YvanUtil.toJsonPretty(taskList));
 
-        return new ModelAndView("/yeweihui/ribao.ftl", model);
-    }
+    return new ModelAndView("/yeweihui/ribao.ftl", model);
+  }
 
-    @GetMapping("/yeweihui/ribaoDy")
-    public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
+  @GetMapping("/yeweihui/ribaoDy")
+  public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
 //        String[] split = str.split("&");
-        List<SysUptownHouse> rbList = rbService.selectXq(str);
+    List<SysUptownHouse> rbList = rbService.selectXq(str);
+
+    return Model.newSuccess(rbList);
+  }
+
+  @GetMapping("/yeweihui/ribaoXq.html")
+  public ModelAndView yeweihuiRibaoYcXq(ModelMap model) {
+    Map<String, Object> queryParam = Maps.newLinkedHashMap();
+    queryParam.put("userId", "12345677");
+    queryParam.put("statistics", "M");
+    return new ModelAndView("/yeweihui/ribaoXq.ftl", model);
+  }
+
+  @GetMapping("/yeweihui/ribaoDyYcXq")
+  public Model<List<MsSuspected>> yeweihuiRibaoYcXq(Long houseId) {
+    List<MsSuspected> rbList = rbService.selectYcXq(houseId);
+    return Model.newSuccess(rbList);
+  }
+
+  @GetMapping("/yeweihui/ribaohuiz.html")
+  public ModelAndView yeweihuiRibaohuiz(ModelMap model) {
+    return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
+  }
+
+  @GetMapping("/whepi/yeweihui/ribaohuiz")
+  public Model<Map<String, Object>> yeweihuiRibaohuiz(Long userCreate, String reportDate) {
+//        Long userCreate = 1225321682867105793L;
 
-        return Model.newSuccess(rbList);
+    List<Uptown> uptowns = rbMapper.selectUptown(userCreate);
+
+    if (uptowns != null && uptowns.size() > 0) {
+      Long upId = uptowns.get(0).getUptownId();
+      Map<String, Integer> map1 = rbMapper.selecthuiz(upId, reportDate);
+      Map<String, Integer> map2 = rbMapper.selectyicahng(upId, reportDate);
+      Map<String, Integer> map3 = rbMapper.selecthuiz1(upId);
+
+      Map<String, Object> reMap = Maps.newHashMap();
+      reMap.put("uptownName", uptowns.get(0).getUptownName());
+      List<Integer> nums = Lists.newArrayList();
+      nums.add(Conv.NI(map3.get("houseCount")));
+      nums.add(Conv.NI(map1.get("reportCount")));
+      nums.add(Conv.NI(map2.get("yichangCount")));
+      nums.add(Conv.NI(map1.get("safetyNum")));
+      nums.add(Conv.NI(map1.get("suspectedNum")));
+      reMap.put("nums", nums);
+      return Model.newSuccess(reMap);
     }
-
-    @GetMapping("/yeweihui/ribaoXq.html")
-    public ModelAndView yeweihuiRibaoYcXq(ModelMap model) {
-        Map<String, Object> queryParam = Maps.newLinkedHashMap();
-        queryParam.put("userId", "12345677");
-        queryParam.put("statistics", "M");
-        return new ModelAndView("/yeweihui/ribaoXq.ftl", model);
+    return Model.newFail("没有数据");
+
+  }
+
+  @ApiOperation("导出正常家庭上报明细")
+  @GetMapping("/whepi/yeweihui/exportRiBao")
+  @SneakyThrows
+  public void exportRiBao(@Pd(name = "uptownId") Long uptownId,
+                          @Pd(name = "date") String date,
+                          HttpServletResponse resp) {
+    if (uptownId == 1238790987234L) {
+      return;
     }
-
-    @GetMapping("/yeweihui/ribaoDyYcXq")
-    public Model<List<MsSuspected>> yeweihuiRibaoYcXq(Long houseId) {
-        List<MsSuspected> rbList = rbService.selectYcXq(houseId);
-        return Model.newSuccess(rbList);
+    Uptown uptown = uptownMapper.selectById(uptownId);
+    if (uptown != null && uptown.getUptownId() > 0) {
+      Long upId = uptown.getUptownId();
+      String fileName = uptown.getUptownName();
+      fileName += "上报信息-";
+      fileName += date;
+      List<ExcelRiBao> list = rbMapper.selectExcelRiBao(upId, date);
+      ExcelUtils.writeSheet(ExcelRiBao.class, list).export(resp, fileName);
     }
-
-    @GetMapping("/yeweihui/ribaohuiz.html")
-    public ModelAndView yeweihuiRibaohuiz(ModelMap model) {
-        return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
+  }
+
+  @ApiOperation("导出凌云家庭上报明细")
+  @GetMapping("/whepi/lun/exportRiBao")
+  @SneakyThrows
+  public void lunExportRiBao(@Pd(name = "date") String date,
+                             HttpServletResponse resp) {
+
+    Uptown uptown = uptownMapper.selectById("1238790987234");
+    Long upId = uptown.getUptownId();
+    String fileName = uptown.getUptownName();
+    fileName += "上报信息-";
+    fileName += date;
+    List<ExcelRiBaoLY> list = rbMapper.selectExcelRiBaoLY(upId, date);
+    ExcelUtils.writeSheet(ExcelRiBaoLY.class, list).export(resp, fileName);
+
+  }
+
+  @ApiOperation("导出小区家庭上报明细")
+  @GetMapping("/whepi/yeweihui/EXR")
+  @SneakyThrows
+  public void exportRiBaoByXiaoQu(@Pd(name = "uptownId") Long uptownId,
+                                  @Pd(name = "date") String date,
+                                  HttpServletResponse resp) {
+    Uptown uptown = uptownMapper.selectById(uptownId);
+    if (uptown != null && uptown.getUptownId() > 0) {
+      Long upId = uptown.getUptownId();
+      String fileName = uptown.getUptownName();
+      fileName += "上报信息-";
+      fileName += date;
+      List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId, date);
+      ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
     }
+  }
 
-    @GetMapping("/whepi/yeweihui/ribaohuiz")
-    public Model<Map<String, Object>> yeweihuiRibaohuiz(Long userCreate,String reportDate) {
-//        Long userCreate = 1225321682867105793L;
-
-        List<Uptown> uptowns = rbMapper.selectUptown(userCreate);
-
-        if (uptowns!=null && uptowns.size()>0) {
-            Long upId = uptowns.get(0).getUptownId();
-            Map<String, Integer> map1 = rbMapper.selecthuiz(upId,reportDate);
-            Map<String, Integer> map2 = rbMapper.selectyicahng(upId,reportDate);
-            Map<String, Integer> map3 = rbMapper.selecthuiz1(upId);
-
-            Map<String, Object> reMap = Maps.newHashMap();
-            reMap.put("uptownName", uptowns.get(0).getUptownName());
-            List<Integer> nums = Lists.newArrayList();
-            nums.add(Conv.NI(map3.get("houseCount")));
-            nums.add(Conv.NI(map1.get("reportCount")));
-            nums.add(Conv.NI(map2.get("yichangCount")));
-            nums.add(Conv.NI(map1.get("safetyNum")));
-            nums.add(Conv.NI(map1.get("suspectedNum")));
-            reMap.put("nums", nums);
-            return Model.newSuccess(reMap);
-        }
-        return Model.newFail("没有数据");
+  @GetMapping("/yeweihui/tgPublish.html")
+  public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+    model.put("userId", "\"" + userId + "\"");
 
-    }
+    return new ModelAndView("/yeweihui/tgPublish.ftl", model);
+  }
 
-    @ApiOperation("导出正常家庭上报明细")
-    @GetMapping("/whepi/yeweihui/exportRiBao")
-    @SneakyThrows
-    public void exportRiBao(@Pd(name = "uptownId") Long uptownId,
-                            @Pd(name = "date") String date,
-                            HttpServletResponse resp) {
-        if (uptownId == 1238790987234L) {
-            return;
-        }
-        Uptown uptown = uptownMapper.selectById(uptownId);
-        if (uptown!=null && uptown.getUptownId()>0) {
-            Long upId = uptown.getUptownId();
-            String fileName = uptown.getUptownName();
-            fileName += "上报信息-";
-            fileName += date;
-            List<ExcelRiBao> list = rbMapper.selectExcelRiBao(upId,date);
-            ExcelUtils.writeSheet(ExcelRiBao.class, list).export(resp, fileName);
-        }
-    }
+  @GetMapping("/yeweihui/groupBuyingCx.html")
+  public ModelAndView groupBuyingCx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, @Pd(name = "operation") String operation, ModelMap model) throws JsonProcessingException {
 
-    @ApiOperation("导出凌云家庭上报明细")
-    @GetMapping("/whepi/lun/exportRiBao")
-    @SneakyThrows
-    public void lunExportRiBao(@Pd(name = "date") String date,
-                            HttpServletResponse resp) {
+    JmTuangou item = jmTuangouService.queryByJmId(jmId);
 
-        Uptown uptown = uptownMapper.selectById("1238790987234");
-        Long upId = uptown.getUptownId();
-        String fileName = uptown.getUptownName();
-        fileName += "上报信息-";
-        fileName += date;
-        List<ExcelRiBaoLY> list = rbMapper.selectExcelRiBaoLY(upId, date);
-        ExcelUtils.writeSheet(ExcelRiBaoLY.class, list).export(resp, fileName);
+    model.put("tgItemJson", new JsonWapper(item));
+    model.put("tgItem", item);
 
-    }
+    model.put("userId", "\"" + userId + "\"");
 
-    @ApiOperation("导出小区家庭上报明细")
-    @GetMapping("/whepi/yeweihui/EXR")
-    @SneakyThrows
-    public void exportRiBaoByXiaoQu(@Pd(name = "uptownId") Long uptownId,
-                            @Pd(name = "date") String date,
-                            HttpServletResponse resp) {
-        Uptown uptown = uptownMapper.selectById(uptownId);
-        if (uptown!=null && uptown.getUptownId()>0) {
-            Long upId = uptown.getUptownId();
-            String fileName = uptown.getUptownName();
-            fileName += "上报信息-";
-            fileName += date;
-            List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId,date);
-            ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
-        }
-    }
+    model.put("operation", "\"" + operation + "\"");
 
-    @GetMapping("/yeweihui/tgPublish.html")
-    public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
-        model.put("userId", "\""+userId+"\"");
+    return new ModelAndView("/groupBuying/groupBuyingCx.ftl", model);
+  }
 
-        return new ModelAndView("/yeweihui/tgPublish.ftl", model);
-    }
+  @GetMapping("/yeweihui/groupBuyingXx.html")
+  public ModelAndView groupBuyingXx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
 
-    @GetMapping("/yeweihui/groupBuyingCx.html")
-    public ModelAndView groupBuyingCx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, @Pd(name = "operation") String operation, ModelMap model) throws JsonProcessingException {
+    JmTuangou item = jmTuangouService.queryByJmId(jmId);
 
-        JmTuangou item = jmTuangouService.queryByJmId(jmId);
+    if (item.getUserId().equals(userId)) {
+      model.put("isMine", "mine");
+    } else {
+      model.put("isMine", "notMine");
+    }
 
-        model.put("tgItemJson", new JsonWapper(item));
-        model.put("tgItem", item);
+    model.put("userId", "\"" + userId + "\"");
+    model.put("tgItemJson", new JsonWapper(item));
+    model.put("tgItem", item);
 
-        model.put("userId", "\""+userId+"\"");
+    return new ModelAndView("/groupBuying/groupBuyingXx.ftl", model);
+  }
 
-        model.put("operation", "\""+operation+"\"");
+  @GetMapping("/yeweihui/tuangou/member/list.html")
+  public ModelAndView tuangouMemberList(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
 
-        return new ModelAndView("/groupBuying/groupBuyingCx.ftl", model);
-    }
+    JmTuangou item = jmTuangouService.queryByJmId(jmId);
 
-    @GetMapping("/yeweihui/groupBuyingXx.html")
-    public ModelAndView groupBuyingXx(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+    List<JmTuangouMember> members = jmTuangouMemberService.querMemberListByJmId(jmId);
 
-        JmTuangou item = jmTuangouService.queryByJmId(jmId);
+    model.put("tgItemJson", new JsonWapper(item));
+    model.put("tgItem", item);
 
-        if (item.getUserId().equals(userId)) {
-            model.put("isMine", "mine");
-        }
-        else {
-            model.put("isMine", "notMine");
-        }
+    model.put("members", YvanUtil.toJsonPretty(members));
 
-        model.put("userId", "\""+userId+"\"");
-        model.put("tgItemJson", new JsonWapper(item));
-        model.put("tgItem", item);
+    model.put("userId", "\"" + userId + "\"");
 
-        return new ModelAndView("/groupBuying/groupBuyingXx.ftl", model);
-    }
+    return new ModelAndView("/yeweihui/tuangouMemberList.ftl", model);
+  }
 
-    @GetMapping("/yeweihui/tuangou/member/list.html")
-    public ModelAndView tuangouMemberList(@Pd(name = "jmId") Long jmId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+  @ApiOperation("导出团购家庭信息")
+  @GetMapping("/yeweihui/tuangou/member/list/export")
+  @SneakyThrows
+  public void tgMembersExport(@Pd(name = "jmId") Long jmId,
+                              HttpServletResponse resp) {
 
-        JmTuangou item = jmTuangouService.queryByJmId(jmId);
+    List<JmTuangouMember> members = jmTuangouMemberService.querMemberListByJmId(jmId);
 
-        List<JmTuangouMember> members = jmTuangouMemberService.querMemberListByJmId(jmId);
+    String fileName = "团购家庭信息";
+    ExcelUtils.writeSheet(JmTuangouMember.class, members).export(resp, fileName);
 
-        model.put("tgItemJson", new JsonWapper(item));
-        model.put("tgItem", item);
+  }
 
-        model.put("members", YvanUtil.toJsonPretty(members));
+  @PostMapping("/yeweihui/groupBuyingCx/remark/add.json")
+  public Model groupBuyingCxRemarkAdd(@Pd(name = "jmId") Long jmId, @Pd(name = "status", required = false, defaultValue = "0") Long status, @Pd(name = "remark", required = false) String remark) {
 
-        model.put("userId", "\""+userId+"\"");
+    Integer success = jmTuangouService.updateRemarkByJmId(jmId, status, remark);
 
-        return new ModelAndView("/yeweihui/tuangouMemberList.ftl", model);
+    if (success == 1) {
+      return Model.newSuccess("操作成功");
+    } else {
+      return Model.newFail("操作失败");
     }
+  }
 
-    @ApiOperation("导出团购家庭信息")
-    @GetMapping("/yeweihui/tuangou/member/list/export")
-    @SneakyThrows
-    public void tgMembersExport(@Pd(name = "jmId") Long jmId,
-                               HttpServletResponse resp) {
+  @PostMapping("/yeweihui/tgPublish.json")
+  public Model tuangouPublish(JmTuangou jmTuangou) {
 
-        List<JmTuangouMember> members = jmTuangouMemberService.querMemberListByJmId(jmId);
+    Integer success = jmTuangouService.tuangouPublish(jmTuangou);
+    if (success == 1) {
+      return Model.newSuccess("操作成功");
+    } else {
+      return Model.newFail("操作失败");
+    }
+  }
 
-        String fileName = "团购家庭信息";
-        ExcelUtils.writeSheet(JmTuangouMember.class, members).export(resp, fileName);
+  @PostMapping("/whepi/yeweihui/tglist")
+  public Model whepiTuangoulist(@Pd(name = "userId", required = false) Long userId, @Pd(name = "uptownIds", required = false) String uptownIds, @Pd(name = "queryProperties", required = false) String queryProperties, @Pd(name = "tgStatus", required = false) Long tgStatus,
+                                PageDb pageDb) {
+    //系统管理员只有一个人 获取当前userId
+    JmTuangou jmTuangou = jmTuangouService.selectByUserId();
 
-    }
+    List<JmTuangou> myList = jmTuangouService.whepiTuangoulist(jmTuangou.getUserId(),
+      uptownIds, queryProperties, tgStatus, pageDb);
 
-    @PostMapping("/yeweihui/groupBuyingCx/remark/add.json")
-    public Model groupBuyingCxRemarkAdd(@Pd(name = "jmId") Long jmId, @Pd(name = "status", required = false, defaultValue = "0") Long status, @Pd(name = "remark", required = false) String remark) {
+    return Model.newSuccess(pageDb, myList);
+  }
 
-        Integer success = jmTuangouService.updateRemarkByJmId(jmId, status, remark);
+  @PostMapping("/whepi/yeweihui/tgPublish")
+  public ModelOps whepiTuangouPublish(@JsonBody JmTuangou jmTuangou) {
 
-        if (success == 1) {
-            return Model.newSuccess("操作成功");
-        }
-        else {
-            return Model.newFail("操作失败");
-        }
-    }
+    int success = jmTuangouService.whepiTuangouPublish(jmTuangou.getUptownIds(), jmTuangou);
+    return ModelOps.newSuccess(success);
+  }
 
-    @PostMapping("/yeweihui/tgPublish.json")
-    public Model tuangouPublish(JmTuangou jmTuangou) {
+  @PostMapping("/yeweihui/tuangou/list/query.json")
+  public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
 
-        Integer success = jmTuangouService.tuangouPublish(jmTuangou);
-        if (success == 1) {
-            return Model.newSuccess("操作成功");
-        }
-        else {
-            return Model.newFail("操作失败");
-        }
-    }
+    List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
 
-    @PostMapping("/yeweihui/tuangou/list/query.json")
-    public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+    return Model.newSuccess(list);
+  }
 
-        List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
+  @PostMapping("/yeweihui/tuangou/mylist/query.json")
+  public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
 
-        return Model.newSuccess(list);
-    }
+    List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
 
-    @PostMapping("/yeweihui/tuangou/mylist/query.json")
-    public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+    return Model.newSuccess(myList);
+  }
 
-        List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
+  @PostMapping("/whepi/yeweihui/tgStatus")
+  public ModelOps whepiYeweihuiTgStatus(@JsonBody JmTuangou jmTuangou) {
+    int success = jmTuangouService.updateRemarkByJmId(jmTuangou.getJmId(),4L, jmTuangou.getRemark());
+    return ModelOps.newSuccess(success);
+  }
 
-        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()));
+  }
 
-    @PostMapping("/whepi/getAllUptown")
-    public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
-        return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));
-    }
+  @PostMapping("/whepi/getSelectOne")
+  public Model<JmTuangou> getSelectOne(@Pd(name = "jmId")Long jmId){
+    return Model.newSuccess(jmTuangouService.getSelectOne(jmId));
+  }
 }

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

@@ -43,7 +43,7 @@ endpoints:
 #  whitelabel.enabled: false
 
 spring:
-  profiles.active: guojing
+  profiles.active: lll
 
   application:
     name: bofeng-web

+ 1 - 1
whepi-web/src/main/resources/mapper/BuyMapper.xml

@@ -15,7 +15,7 @@
        from sys_user_role a
        INNER JOIN sys_uptown_house b on a.property_id=b.house_id
        INNER JOIN sys_uptown_unit c on b.unit_id=c.unit_id
-       where a.user_id=#{userId} and a.role_id=1) ORDER BY jt.tg_end_time DESC
+       where a.user_id=#{userId} and a.role_id=1 limit 1 ) ORDER BY jt.tg_end_time DESC
     </select>
 
     <select id="MyGroup" resultType="com.bofeng.entity.Buy">

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

@@ -30,6 +30,26 @@
         order by a.tg_end_time desc
     </select>
 
+    <select id="whepiTuangoulist" resultType="com.bofeng.entity.JmTuangou">
+        select a.*,b.uptown_name, IFNULL((select SUM(b.buy_count) FROM jm_buy b where b.jm_id=a.jm_id and
+        buy_status=1),0) as currentNum
+        from jm_tuangou a
+        inner join sys_uptown b on a.uptown_id=b.uptown_id
+        <where>
+            a.user_id=#{userId}
+            <if test="uptownIds!=null and uptownIds!=''">
+                and a.uptown_id in (${uptownIds})
+            </if>
+            <if test="queryProperties!=null and queryProperties!=''">
+                and a.tg_title like concat('%',#{queryProperties},'%')
+            </if>
+            <if test="status!=null and status!=''">
+                and a.tg_status=#{status}
+            </if>
+        </where>
+        order by a.tg_end_time desc
+    </select>
+
     <select id="selectJmTuangouByJmId" resultType="com.bofeng.entity.JmTuangou">
         select a.*, IFNULL((select SUM(b.buy_count) FROM jm_buy b where b.jm_id=a.jm_id and buy_status=1),0) as currentNum
         from jm_tuangou a
@@ -58,4 +78,12 @@
             update jm_tuangou set tg_status=#{item.tgStatus} where jm_id=#{item.jmId}
         </foreach>
     </update>
+
+    <select id="selectByUserId" resultType="com.bofeng.entity.JmTuangou">
+        select * from sys_user limit 1
+    </select>
+
+    <select id="getSelectOne" resultType="com.bofeng.entity.JmTuangou">
+        select *,uptown_id as uptownIds from jm_tuangou where jm_id=#{jmId}
+    </select>
 </mapper>

+ 42 - 0
whepi-web/src/main/resources/mapper/SweepCodeMapper.xml

@@ -0,0 +1,42 @@
+<?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.SweepCodeMapper">
+    <select id="selectCode" resultType="com.bofeng.entity.SysUptownHouse">
+       select
+        a.uptown_name,
+        d.ridgepole,
+        d.unit,
+        e.doorplate,
+        b.door_name,
+        c.into_date,
+        h.out_date,
+        g.nick_name
+        from sys_uptown a
+        inner join sys_uptown_door b on a.uptown_id = b.uptown_id
+        inner join out_scan c on c.into_door_id = b.door_id
+        inner join out_scan h on h.out_door_id = b.door_id
+        inner join sys_uptown_unit d on d.uptown_id = a.uptown_id
+        inner join sys_uptown_house e on e.unit_id = d.unit_id
+        inner join sys_user_role j on j.property_id = e.house_id and j.role_id = 1
+        inner join sys_user_open g on g.user_id = j.user_id
+        <where>
+         <if test="uptownName != null and uptownName != ''">
+          a.uptown_name like concat('%',#{uptownName},'%')
+         </if>
+         <if test="intoDate != null and intoDate !=''">
+          and c.into_date >= #{intoDate}
+         </if>
+         <if test="intoDate != null and intoDate !=''">
+          and c.into_date &lt; #{intoDate}
+         </if>
+         <if test="outDate != null and outDate !=''">
+          and h.out_date &lt; #{outDate}
+         </if>
+         <if test="outDate != null and outDate !=''">
+          and h.out_date >= #{outDate}
+         </if>
+        </where>
+    </select>
+
+
+</mapper>

+ 17 - 0
whepi-web/src/main/resources/mapper/UptownDoorMapper.xml

@@ -0,0 +1,17 @@
+<?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.UptownDoorMapper">
+
+    <select id="getAllUptownDoor" resultType="com.bofeng.entity.UptownDoor">
+        SELECT ud.*,u.uptown_name as uptownName FROM sys_uptown_door ud left join sys_uptown u on u.uptown_id =
+        ud.uptown_id
+        <where>
+            and ud.status = 1
+            <if test="queryProperties!=null and queryProperties!=''">
+                and u.uptown_name like concat('%',#{queryProperties},'%')
+            </if>
+        </where>
+        order by ud.time_update desc
+    </select>
+
+</mapper>