Browse Source

Merge remote-tracking branch 'origin/master'

yuliang 5 năm trước cách đây
mục cha
commit
d3aabb405f

+ 34 - 60
whepi-web/src/main/java/com/bofeng/controller/AdminAreaController.java

@@ -1,60 +1,34 @@
-// package com.bofeng.controller;
-//
-// import com.bofeng.Consts;
-// import com.bofeng.entity.Place;
-// import com.bofeng.service.PlaceService;
-// import com.google.common.base.Strings;
-// import com.yvan.Model;
-// import com.yvan.ModelOps;
-// import com.yvan.mvc.Pd;
-// import lombok.val;
-// import org.apache.shiro.authz.annotation.RequiresPermissions;
-// 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.RequestBody;
-// import org.springframework.web.bind.annotation.RestController;
-// import org.springframework.web.servlet.ModelAndView;
-//
-// import java.util.List;
-//
-// @RestController
-// @RequiresPermissions(Consts.USER_TYPE_ADMIN)
-// public class AdminAreaController {
-//
-//     @Autowired
-//     private PlaceService placeService;
-//
-//     @GetMapping("/admin/place.html")
-//     public ModelAndView placeView() {
-//         return new ModelAndView("/admin/place.ftl");
-//     }
-//
-//     @GetMapping("/admin/sysArea")
-//     public Model<List<Place>> getArea() {
-//         return Model.newSuccess(placeService.selectAll());
-//     }
-//
-//     @PostMapping("/admin/place_addnew.json")
-//     public ModelOps placeAddNew(@RequestBody Place place) {
-//         val msg = placeService.insert(place);
-//         if (Strings.isNullOrEmpty(msg)) {
-//             return ModelOps.newSuccess();
-//         }
-//         return ModelOps.newFail(msg);
-//     }
-//
-//     @PostMapping("/admin/place_edit")
-//     public ModelOps placeEdit(@RequestBody Place place) {
-//         val msg = placeService.updateById(place);
-//         if (Strings.isNullOrEmpty(msg)) {
-//             return ModelOps.newSuccess();
-//         }
-//         return ModelOps.newFail(msg);
-//     }
-//
-//     @PostMapping("/admin/place_delete.json")
-//     public ModelOps placeDelete(@Pd(name = "placeId", desc = "") Long placeId) {
-//         return ModelOps.newSuccess(placeService.deleteById(placeId));
-//     }
-// }
+package com.bofeng.controller;
+
+import com.bofeng.entity.SysArea;
+import com.bofeng.service.SysAreaService;
+import com.yvan.Model;
+import com.yvan.mvc.Pd;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+public class AdminAreaController {
+
+    @Autowired
+    private SysAreaService sysAreaService;
+
+    @GetMapping("/admin/selectProvince")
+    public Model<List<SysArea>> selectProvince() {
+        return Model.newSuccess(sysAreaService.selectProvince());
+    }
+
+    @GetMapping("/admin/selectCityByProvince")
+    public Model<List<SysArea>> selectCityByProvince(@Pd(name = "areaId") Long areaId) {
+        return Model.newSuccess(sysAreaService.selectCityByProvince(areaId));
+    }
+
+    @GetMapping("/admin/selectAreaByCity")
+    public Model<List<SysArea>> selectAreaByCity(@Pd(name = "areaId") Long areaId) {
+        return Model.newSuccess(sysAreaService.selectAreaByCity(areaId));
+    }
+
+}

+ 6 - 5
whepi-web/src/main/java/com/bofeng/dao/SysAreaMapper.java

@@ -3,6 +3,7 @@ package com.bofeng.dao;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.SysArea;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -11,13 +12,13 @@ import java.util.List;
 @Repository
 public interface SysAreaMapper extends BaseMapper<SysArea> {
 
-    //暂时只显示湖北省
+    //查询省份
     List<SysArea> selectProvince();
 
-    //暂时只显示湖北省下的城市
-    List<SysArea> selectCityByProvince();
+    //查询省份下的城市
+    List<SysArea> selectCityByProvince(@Param("areaId") Long areaId);
 
-    //暂时只显示武汉市下的区
-    List<SysArea> selectAreaByCity();
+    //查询城市下的区
+    List<SysArea> selectAreaByCity(@Param("areaId") Long areaId);
 
 }

+ 30 - 5
whepi-web/src/main/java/com/bofeng/entity/SysArea.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
+import org.joda.time.DateTime;
 
 @Getter
 @Setter
@@ -18,20 +19,44 @@ public class SysArea {
     @TableId("AREA_ID")
     private Long areaId;
 
-    @ApiModelProperty("省")
+    @ApiModelProperty("省(暂时不用)")
     @TableField("PROVINCE")
     private String province;
 
-    @ApiModelProperty("市")
+    @ApiModelProperty("市(暂时不用)")
     @TableField("CITY")
     private String city;
 
-    @ApiModelProperty("区")
-    @TableField("AREA")
-    private String area;
+    @ApiModelProperty("名称")
+    @TableField("AREA_NAME")
+    private String areaName;
 
     @ApiModelProperty("状态:1正常,0草稿,-1删除")
     @TableField("STATUS")
     private int status;
 
+    @ApiModelProperty("上级id")
+    @TableField("AREA_UP")
+    private Long areaUp;
+
+    @ApiModelProperty("层级")
+    @TableField("LEV")
+    private Long lev;
+
+    @ApiModelProperty("纬度")
+    @TableField("LATITUDE")
+    private String latitude;
+
+    @ApiModelProperty("经度")
+    @TableField("LONGITUDE")
+    private String longitude;
+
+    @ApiModelProperty("新增时间")
+    @TableField("TIME_CREATE")
+    private DateTime timeCreate;
+
+    @ApiModelProperty("修改时间")
+    @TableField("TIME_UPDATE")
+    private DateTime timeUpdate;
+
 }

+ 7 - 7
whepi-web/src/main/java/com/bofeng/service/SysAreaService.java

@@ -15,24 +15,24 @@ public class SysAreaService {
     @Autowired
     private SysAreaMapper sysAreaMapper;
 
-    public String selectProvince() {
+    public List<SysArea> selectProvince() {
         List<SysArea> lst = sysAreaMapper.selectProvince();
         if (lst != null && lst.size() > 0) {
-            return lst.get(0).getProvince();
+            return lst;
         }
-        return "无省份数据";
+        return null;
     }
 
-    public List<SysArea> selectCityByProvince() {
-        List<SysArea> lst = sysAreaMapper.selectCityByProvince();
+    public List<SysArea> selectCityByProvince(Long areaId) {
+        List<SysArea> lst = sysAreaMapper.selectCityByProvince(areaId);
         if (lst != null && lst.size() > 0) {
             return lst;
         }
         return null;
     }
 
-    public List<SysArea> selectAreaByCity() {
-        List<SysArea> lst = sysAreaMapper.selectAreaByCity();
+    public List<SysArea> selectAreaByCity(Long areaId) {
+        List<SysArea> lst = sysAreaMapper.selectAreaByCity(areaId);
         if (lst != null && lst.size() > 0) {
             return lst;
         }

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

@@ -0,0 +1,73 @@
+logging:
+  level:
+    root: INFO
+    jdbc.sqltiming: INFO
+  pattern:
+    console: '%d %-5level %logger{32} - %msg%n'
+
+debug: false
+ui-path: file:whepi-ui
+secret: 456 # jwt私钥
+salt: 123 #密码加盐
+token_time_minutes: 720 #12小时有效期
+token_time_minutes_mobile: 525600 #1年有效
+
+server:
+  port: 8086
+
+yvan:
+  debug: false
+  static_version: v20170728
+  static_domain: /static
+  upload_domain: /static
+  wechat:
+    #测试帐号
+    token: hudingbo
+    appID: wx39b9602905ed3b75
+    appsecret: 2ad7a715bed0cd8672a0d577492dd259
+
+#    token: yuliang
+#    appID: wx1b020f76b18f0294
+#    appsecret: 69f06d671d445dc14b04a097fe50f4cc
+
+    #token: slxtoken
+    #appID: wx79c1af613d5d22dd
+    #appsecret: 2de3b4abfe30ff7523f464ace8322b44
+    #EncodingAESKey: wb4IyoD7FZa0yB2BMU8HWQ0inWJuAfJSiRR6jlfivo2
+    ## 商户编号
+    #pay_mch_id: 1499356522
+    ## 回调地址
+    #notify_url: http://central.good5you.com/pay/wx/notify
+
+    ## 绑定客户的二维码有效时间
+    #qrcode_bind_expire_second: 10800
+    ## 找到用户的二维码有效时间
+    #qrcode_match_cust_expire_second: 10800
+
+    ##domain: http://wx.good5you.com/
+#    domain: http://bofeng.ng.good5you.com
+    domain: http://hudingbo.ng.yvanui.com
+#    domain: http://yyc21fmd42.hkhttp.cn
+#    tmpTicketExpireSeconds: 10800
+    templates:
+      预定信息: 'MLNz8YVi7zofQOBeLS0Ruhr-3fJpTnfsKjyPeDB879s'
+      修改预定信息: 'FsPj2Syigep3ctUd0aBmE4JMsuxjW-U0JgmoLAXjJtc'
+      结账信息: '5t4LSW4cb7j4mcHxoYyzTvLHnp2gehpxn1faf7G4ABs'
+      结算信息: 'GoZBKvyqAfP8uM3xrJk40YHhMoM_E44aPLEoKV_1-pQ'
+    #  round_out_template_id: 'xpQJsBwlhZ5r7P7Glur8hiNl1IgjQxtMGTVwdVOfGKg'
+    #  round_in_template_id: 'oobiXKFatguG1H7K-HPi2lipzF-Qv0pMY12e1JaQxdA'
+
+spring:
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    #driverClassName: com.mysql.jdbc.Driver
+    #url: jdbc:mysql://localhost:3306/bofeng_test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+    driverClassName: net.sf.log4jdbc.DriverSpy
+    url: jdbc:log4jdbc:mysql://39.99.148.1:3306/whepi_test?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false
+    username: whepi_test
+    password: 123456
+
+  redis:
+    database: 4
+    host: localhost
+    port: 6379

+ 26 - 3
whepi-web/src/main/resources/mapper/SysArea.xml

@@ -2,15 +2,38 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.bofeng.dao.SysAreaMapper">
     <select id="selectProvince" resultType="com.bofeng.entity.SysArea">
-        select province from sys_area where province='湖北省' group by province
+        select * from sys_area where lev=1
     </select>
 
     <select id="selectCityByProvince" resultType="com.bofeng.entity.SysArea">
-        SELECT * from sys_area where province='湖北省' and (area='市辖区' or city='省直辖县级行政区划' or area='恩施市')
+        select * from sys_area
+        <where>
+            area_name!='省直辖县级行政区划'
+            <if test="areaId!=null and areaId!=''">
+                and area_up=#{areaId}
+            </if>
+        </where>
+        union all (
+        select * from sys_area where area_up in
+        (select area_id from sys_area
+        <where>
+            area_name='省直辖县级行政区划'
+            <if test="areaId!=null and areaId!=''">
+                and area_up=#{areaId}
+            </if>
+        </where>
+        )
+        )
     </select>
 
     <select id="selectAreaByCity" resultType="com.bofeng.entity.SysArea">
-        select * from sys_area where city='武汉市'
+        select * from sys_area
+        <where>
+            area_name!='市辖区'
+            <if test="areaId!=null and areaId!=''">
+                and area_up=#{areaId}
+            </if>
+        </where>
     </select>
 
 </mapper>