瀏覽代碼

提交关于我们及api接口

luobo 3 年之前
父節點
當前提交
4ecefb7a8e
共有 27 個文件被更改,包括 1565 次插入26 次删除
  1. 161 0
      smart-admin/src/main/java/com/huijy/web/controller/api/ApiAbstractController.java
  2. 28 0
      smart-admin/src/main/java/com/huijy/web/controller/api/ApiBigScreenController.java
  3. 108 0
      smart-admin/src/main/java/com/huijy/web/controller/api/ApiIndexController.java
  4. 170 0
      smart-admin/src/main/java/com/huijy/web/controller/api/ApiLoginController.java
  5. 103 0
      smart-admin/src/main/java/com/huijy/web/controller/management/AboutUsController.java
  6. 3 3
      smart-admin/src/main/java/com/huijy/web/core/config/SwaggerConfig.java
  7. 9 0
      smart-admin/src/main/resources/application.yml
  8. 25 0
      smart-common/src/main/java/com/huijy/common/annotation/LoginMember.java
  9. 22 0
      smart-common/src/main/java/com/huijy/common/annotation/UnLogin.java
  10. 1 1
      smart-common/src/main/java/com/huijy/common/exception/ServiceException.java
  11. 73 0
      smart-common/src/main/java/com/huijy/common/utils/JwtUtils.java
  12. 4 0
      smart-framework/src/main/java/com/huijy/framework/config/SecurityConfig.java
  13. 47 0
      smart-framework/src/main/java/com/huijy/framework/config/WebMvcConfig.java
  14. 81 0
      smart-framework/src/main/java/com/huijy/framework/interceptor/MemberAuthorizationInterceptor.java
  15. 55 0
      smart-framework/src/main/java/com/huijy/framework/resolver/LoginMemberHandlerMethodArgumentResolver.java
  16. 1 0
      smart-framework/src/main/java/com/huijy/framework/security/filter/JwtAuthenticationTokenFilter.java
  17. 200 0
      smart-system/src/main/java/com/huijy/management/domain/AboutUs.java
  18. 61 0
      smart-system/src/main/java/com/huijy/management/mapper/AboutUsMapper.java
  19. 16 8
      smart-system/src/main/java/com/huijy/management/mapper/MemberMapper.java
  20. 61 0
      smart-system/src/main/java/com/huijy/management/service/IAboutUsService.java
  21. 15 8
      smart-system/src/main/java/com/huijy/management/service/IMemberService.java
  22. 95 0
      smart-system/src/main/java/com/huijy/management/service/impl/AboutUsServiceImpl.java
  23. 5 0
      smart-system/src/main/java/com/huijy/management/service/impl/MemberServiceImpl.java
  24. 49 0
      smart-system/src/main/java/com/huijy/management/vo/WxLoginFrom.java
  25. 55 0
      smart-system/src/main/java/com/huijy/management/vo/WxUserInfo.java
  26. 105 0
      smart-system/src/main/resources/mapper/management/AboutUsMapper.xml
  27. 12 6
      smart-system/src/main/resources/mapper/management/MemberMapper.xml

+ 161 - 0
smart-admin/src/main/java/com/huijy/web/controller/api/ApiAbstractController.java

@@ -0,0 +1,161 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.web.controller.api;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.huijy.common.constant.HttpStatus;
+import com.huijy.common.core.page.PageDomain;
+import com.huijy.common.core.page.TableDataInfo;
+import com.huijy.common.core.page.TableSupport;
+import com.huijy.common.exception.ServiceException;
+import com.huijy.common.exception.base.BaseException;
+import com.huijy.common.utils.ip.IpUtils;
+import com.huijy.common.utils.sql.SqlUtil;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * Controller公共组件
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public abstract class ApiAbstractController {
+	protected Logger logger = LoggerFactory.getLogger(getClass());
+	/**
+	 * 得到request对象
+	 */
+	@Autowired
+	protected HttpServletRequest request;
+
+	public  <T> T getClassRequest(Class<T> clazz){
+
+		StringBuilder sb = new StringBuilder();
+		try (BufferedReader reader = request.getReader()) {
+			char[] buff = new char[1024];
+			int len;
+			while ((len = reader.read(buff)) != -1) {
+				sb.append(buff, 0, len);
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		try {
+			return JSON.parseObject(sb.toString(),clazz);
+		} catch (Exception e) {
+			throw new ServiceException("获取参数失败");
+		}
+
+	}
+
+
+	public JSONObject getJsonRequest() {
+		JSONObject result = null;
+		StringBuilder sb = new StringBuilder();
+		try (BufferedReader reader = request.getReader()) {
+			char[] buff = new char[1024];
+			int len;
+			while ((len = reader.read(buff)) != -1) {
+				sb.append(buff, 0, len);
+			}
+			result = JSONObject.parseObject(sb.toString());
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return result;
+	}
+
+
+	public String getXmlStrRequest() throws IOException {
+
+			request.setCharacterEncoding("UTF-8");
+
+			InputStream in = request.getInputStream();
+			ByteArrayOutputStream out = new ByteArrayOutputStream();
+			byte[] buffer = new byte[1024];
+			int len = 0;
+			while ((len = in.read(buffer)) != -1) {
+				out.write(buffer, 0, len);
+			}
+			out.close();
+			in.close();
+			//xml数据
+			String reponseXml = new String(out.toByteArray(), "utf-8");
+			return  reponseXml;
+
+	}
+
+	/**
+	 * 获取请求方IP
+	 *
+	 * @return 客户端Ip
+	 */
+	public String getClientIp() {
+		String ip = IpUtils.getIpAddr(request);
+		if (StringUtils.isBlank(ip)){
+			ip = "8.8.8.8";
+		}
+		return ip;
+	}
+
+	/**
+	 * 设置请求分页数据
+	 */
+	protected void startPage()
+	{
+		PageDomain pageDomain = TableSupport.buildPageRequest();
+		Integer pageNum = pageDomain.getPageNum();
+		Integer pageSize = pageDomain.getPageSize();
+		if (com.huijy.common.utils.StringUtils.isNotNull(pageNum) && com.huijy.common.utils.StringUtils.isNotNull(pageSize))
+		{
+			String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+			PageHelper.startPage(pageNum, pageSize, orderBy);
+		}
+	}
+
+	/**
+	 * 设置请求排序数据
+	 */
+	protected void startOrderBy()
+	{
+		PageDomain pageDomain = TableSupport.buildPageRequest();
+		if (com.huijy.common.utils.StringUtils.isNotEmpty(pageDomain.getOrderBy()))
+		{
+			String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+			PageHelper.orderBy(orderBy);
+		}
+	}
+
+	/**
+	 * 响应请求分页数据
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	protected TableDataInfo getDataTable(List<?> list)
+	{
+		TableDataInfo rspData = new TableDataInfo();
+		rspData.setCode(HttpStatus.SUCCESS);
+		rspData.setMsg("查询成功");
+		rspData.setRows(list);
+		rspData.setTotal(new PageInfo(list).getTotal());
+		return rspData;
+	}
+
+}

+ 28 - 0
smart-admin/src/main/java/com/huijy/web/controller/api/ApiBigScreenController.java

@@ -0,0 +1,28 @@
+package com.huijy.web.controller.api;
+
+import com.huijy.common.core.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(value = "大屏",tags = "大屏接口")
+@RestController
+@RequestMapping("/api/big/screen")
+public class ApiBigScreenController extends ApiAbstractController {
+
+    @PostMapping("/getTest")
+    @ApiOperation("测试")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
+//            @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
+//    })
+    public AjaxResult getTest(){
+        return  AjaxResult.success();
+    }
+
+
+}

+ 108 - 0
smart-admin/src/main/java/com/huijy/web/controller/api/ApiIndexController.java

@@ -0,0 +1,108 @@
+package com.huijy.web.controller.api;
+
+import com.huijy.common.core.domain.AjaxResult;
+import com.huijy.common.core.page.TableDataInfo;
+import com.huijy.management.domain.*;
+import com.huijy.management.service.IAboutUsService;
+import com.huijy.management.service.IContentService;
+import com.huijy.management.service.IMemberLocationService;
+import com.huijy.management.service.IMemberService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Api(value = "小程序",tags = "小程序接口")
+@RestController
+@RequestMapping("/api/index")
+public class ApiIndexController extends ApiAbstractController {
+
+    @Autowired
+    private IMemberService memberService;
+    @Autowired
+    private IMemberLocationService memberLocationService;
+    @Autowired
+    private IAboutUsService aboutUsService;
+    @Autowired
+    private IContentService contentService;
+
+    @PostMapping("/pushLatLng")
+    @ApiOperation("上传会员坐标")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
+            @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body")
+    })
+    public AjaxResult pushLatLng(@ApiIgnore Member member, @RequestBody Map params) {
+
+        String lat = (String) params.get("lat");
+        String lng = (String) params.get("lng");
+
+
+        member.setLastLat(lat);
+        member.setLastLng(lng);
+        memberService.updateMember(member);
+        MemberLocation location = new MemberLocation();
+        location.setLat(lat);
+        location.setLng(lng);
+        location.setMemberId(member.getMemberId());
+
+
+        memberLocationService.insertMemberLocation(location);
+        return AjaxResult.success();
+    }
+    //上传会员拨打记录
+    @PostMapping("/pushHelp")
+    @ApiOperation("上传会员拨打记录")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "lat", value = "坐标的lat", paramType = "body"),
+            @ApiImplicitParam(name = "lng", value = "坐标的lng", paramType = "body"),
+            @ApiImplicitParam(name = "phone", value = "求助电话", paramType = "body")
+    })
+    public AjaxResult pushHelp(@ApiIgnore Member member, @RequestBody Map params) {
+        String lat = (String) params.get("lat");
+        String lng = (String) params.get("lng");
+        String phone = (String) params.get("phone");
+        MemberHelp help = new MemberHelp();
+        help.setLat(lat);
+        help.setLng(lng);
+        help.setPhone(phone);
+        help.setMemberId(member.getMemberId());
+        return AjaxResult.success();
+    }
+
+    //关于我们信息,包括小程序的展示素材
+    @GetMapping("/getAboutUs")
+    @ApiOperation("获取关于我们的信息")
+    public AjaxResult getAboutUs(@ApiIgnore Member member) {
+        AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
+        Map<String, Object> resultObj = new HashMap<String, Object>();
+        resultObj.put("aboutUs", aboutUs);
+        return AjaxResult.success(resultObj);
+    }
+
+    //分页获取主要内容信息
+    @GetMapping("/getPageContent")
+    @ApiOperation("分页获取主要内容信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "类型:1、党政服务;2、景区介绍;3、旅游攻略;4、热门活动",required = true,defaultValue = "1",dataType = "Integer",
+                    allowableValues = "1,2,3,4",paramType = "query"),
+            @ApiImplicitParam(name = "pageNum", required = true,defaultValue = "1",value = "页码", paramType = "query"),
+            @ApiImplicitParam(name = "pageSize", required = true,defaultValue = "20", value = "显示记录数", paramType = "query")
+    })
+    public TableDataInfo getPageContent(@ApiIgnore Member member, Integer type) {
+       // AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
+        Content content = new Content();
+        content.setServiceInfo(type+"");
+        startPage();
+        List<Content> list = contentService.selectContentList(content);
+        return getDataTable(list);
+
+    }
+}

+ 170 - 0
smart-admin/src/main/java/com/huijy/web/controller/api/ApiLoginController.java

@@ -0,0 +1,170 @@
+package com.huijy.web.controller.api;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
+import cn.hutool.core.util.RandomUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.huijy.common.annotation.LoginMember;
+import com.huijy.common.annotation.UnLogin;
+import com.huijy.common.core.domain.AjaxResult;
+import com.huijy.common.exception.ServiceException;
+import com.huijy.common.exception.base.BaseException;
+import com.huijy.common.utils.JwtUtils;
+import com.huijy.management.domain.Member;
+import com.huijy.management.service.IMemberService;
+import com.huijy.management.vo.WxLoginFrom;
+import com.huijy.management.vo.WxUserInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.val;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Api(value = "登录",tags = "登录接口")
+@RestController
+@RequestMapping("/api/login")
+public class ApiLoginController extends ApiAbstractController  {
+
+
+    @Autowired
+    private JwtUtils jwtUtils;
+
+
+    private WxMaService wxService;
+
+    @Autowired
+    private IMemberService memberService;
+
+
+    @UnLogin
+    @ApiOperation("测试获取token")
+    @GetMapping("/getToken")
+    public AjaxResult getToken(){
+       Member member = memberService.selectMemberByMemberId(1L);
+        //生成token
+       String token = jwtUtils.generateToken(member.getMemberId());
+        if (StringUtils.isBlank(token)) {
+            return AjaxResult.error("登录失败,获取token出错");
+        }
+        Map<String, Object> resultObj = new HashMap<String, Object>();
+        resultObj.put(jwtUtils.getHeader(), token);
+        resultObj.put("expire", jwtUtils.getExpire());
+       // resultObj.put("memberInfo", member);
+        return AjaxResult.success(resultObj);
+    }
+
+    @ApiOperation("获取测试会员")
+    @GetMapping("/getTestMember")
+    public AjaxResult getTestMember(@ApiIgnore @LoginMember Member member){
+        Map<String, Object> resultObj = new HashMap<String, Object>();
+        resultObj.put("memberInfo", member);
+        return AjaxResult.success(resultObj);
+
+    }
+
+    @UnLogin
+    @ApiOperation("游客微信小程序登录")
+    @PostMapping("/wxLogin/{code}")
+    public AjaxResult weixin(@PathVariable String code,@RequestBody WxLoginFrom wxLoginFrom){
+
+        if (null == wxLoginFrom) {
+            return AjaxResult.error("登录失败,无用户信息");
+        }
+        //微信提交过来的用户信息
+        WxUserInfo wxUserInfo = wxLoginFrom.getUserInfo();
+        String token, sessionKey, openId, unionId;
+        try {
+            WxMaJscode2SessionResult result = this.wxService.getUserService().getSessionInfo(code);
+            unionId = result.getUnionid();
+            sessionKey = result.getSessionKey();
+            openId = result.getOpenid();
+        } catch (WxErrorException e) {
+           e.printStackTrace();
+            throw new ServiceException("openid获取失败");
+        }
+        if (StringUtils.isBlank(openId) || StringUtils.isBlank(sessionKey)) {
+            throw new ServiceException("openid获取失败");
+        }
+//        //验证用户信息完整性
+        String sha1 = DigestUtils.sha1Hex(wxLoginFrom.getRawData() + sessionKey);
+        if (!wxLoginFrom.getSignature().equalsIgnoreCase(sha1)) {
+            logger.info("=====验证===="+wxLoginFrom.getSignature()+"=========="+sha1);
+
+            return AjaxResult.error("登录失败,验证用户信息失败");
+        }
+       //根据openid查询游客是否已经存在
+        Member member = memberService.getMemberByOpenId(openId);
+        Date nowTime = new Date();
+        if (member!=null){
+            //昵称
+            member.setNickName(wxUserInfo.getNickName());
+            //微信openid
+            member.setOpenid(openId);
+            //微信UnionId
+            member.setUnionid(unionId);
+            //微信头像
+            member.setAvatarUrl(wxUserInfo.getAvatarUrl());
+            //登录ip
+            member.setLastLoginIp(this.getClientIp());
+            //最后登录 时间
+            member.setLastLoginTime(nowTime);
+            //登录次数
+            member.setLoginNum(member.getLoginNum()+1);
+        }else{
+            member = new Member();
+            //用户名
+            member.setName("wx_" + RandomUtil.randomNumbers(10));
+
+            //性别 0:未知、1:男、2:女
+            member.setGender(wxUserInfo.getGender()+"");
+            //昵称
+            member.setNickName(wxUserInfo.getNickName());
+            //微信openid
+            member.setOpenid(openId);
+            //微信UnionId
+            member.setUnionid(unionId);
+            //微信头像
+            member.setAvatarUrl(wxUserInfo.getAvatarUrl());
+            //国家
+            member.setCountry(wxUserInfo.getCountry());
+            //城市
+            member.setCity(wxUserInfo.getCity());
+            //省会
+            member.setProvince(wxUserInfo.getProvince());
+            //语言
+            member.setLanguage(wxUserInfo.getLanguage());
+            //登录ip
+            member.setLastLoginIp(this.getClientIp());
+            //最后登录 时间
+            member.setLastLoginTime(nowTime);
+            //注册时间
+            member.setRegisterTime(nowTime);
+            //登录次数
+            member.setLoginNum(1L);
+
+            memberService.insertMember(member);
+        }
+        //生成token
+         token = jwtUtils.generateToken(member.getMemberId());
+        if (StringUtils.isBlank(token)) {
+            return AjaxResult.error("登录失败,获取token出错");
+        }
+        Map<String, Object> resultObj = new HashMap<String, Object>();
+        resultObj.put(jwtUtils.getHeader(), token);
+        resultObj.put("expire", jwtUtils.getExpire());
+        resultObj.put("memberInfo", member);
+        return AjaxResult.success(resultObj);
+
+    }
+
+}

+ 103 - 0
smart-admin/src/main/java/com/huijy/web/controller/management/AboutUsController.java

@@ -0,0 +1,103 @@
+package com.huijy.web.controller.management;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+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.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.huijy.common.annotation.Log;
+import com.huijy.common.core.controller.BaseController;
+import com.huijy.common.core.domain.AjaxResult;
+import com.huijy.common.enums.BusinessType;
+import com.huijy.management.domain.AboutUs;
+import com.huijy.management.service.IAboutUsService;
+import com.huijy.common.utils.poi.ExcelUtil;
+import com.huijy.common.core.page.TableDataInfo;
+
+/**
+ * 关于我们Controller
+ *
+ * @author luobo
+ * @date 2021-09-20
+ */
+@RestController
+@RequestMapping("/management/aboutUs")
+public class AboutUsController extends BaseController
+{
+    @Autowired
+    private IAboutUsService aboutUsService;
+
+    /**
+     * 查询关于我们列表
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AboutUs aboutUs)
+    {
+        startPage();
+        List<AboutUs> list = aboutUsService.selectAboutUsList(aboutUs);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出关于我们列表
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:export')")
+    @Log(title = "关于我们", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(AboutUs aboutUs)
+    {
+        List<AboutUs> list = aboutUsService.selectAboutUsList(aboutUs);
+        ExcelUtil<AboutUs> util = new ExcelUtil<AboutUs>(AboutUs.class);
+        return util.exportExcel(list, "关于我们数据");
+    }
+
+    /**
+     * 获取关于我们详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:query')")
+    @GetMapping(value = "/{aboutUsId}")
+    public AjaxResult getInfo(@PathVariable("aboutUsId") Long aboutUsId)
+    {
+        return AjaxResult.success(aboutUsService.selectAboutUsByAboutUsId(aboutUsId));
+    }
+
+    /**
+     * 新增关于我们
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:add')")
+    @Log(title = "关于我们", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AboutUs aboutUs)
+    {
+        return toAjax(aboutUsService.insertAboutUs(aboutUs));
+    }
+
+    /**
+     * 修改关于我们
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:edit')")
+    @Log(title = "关于我们", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AboutUs aboutUs)
+    {
+        return toAjax(aboutUsService.updateAboutUs(aboutUs));
+    }
+
+    /**
+     * 删除关于我们
+     */
+    @PreAuthorize("@ss.hasPermi('management:aboutUs:remove')")
+    @Log(title = "关于我们", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{aboutUsIds}")
+    public AjaxResult remove(@PathVariable Long[] aboutUsIds)
+    {
+        return toAjax(aboutUsService.deleteAboutUsByAboutUsIds(aboutUsIds));
+    }
+}

+ 3 - 3
smart-admin/src/main/java/com/huijy/web/core/config/SwaggerConfig.java

@@ -58,7 +58,7 @@ public class SwaggerConfig
                 // 扫描所有有注解的api,用这种方式更灵活
                 .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                 // 扫描指定包中的swagger注解
-                // .apis(RequestHandlerSelectors.basePackage("com.huijy.project.tool.swagger"))
+                 .apis(RequestHandlerSelectors.basePackage("com.huijy.web.controller.api"))
                 // 扫描所有 .apis(RequestHandlerSelectors.any())
                 .paths(PathSelectors.any())
                 .build()
@@ -113,9 +113,9 @@ public class SwaggerConfig
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题
-                .title("标题:若依管理系统_接口文档")
+                .title("标题:智慧旅游_接口文档")
                 // 描述
-                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+                .description("描述:智慧旅游_接口文档")
                 // 作者信息
                 .contact(new Contact(ruoyiConfig.getName(), null, null))
                 // 版本

+ 9 - 0
smart-admin/src/main/resources/application.yml

@@ -144,3 +144,12 @@ wx:
 mall:
   # 支付、物流回调地址,即后台服务7500端口的外网访问域名,要保证外网能访问
   notify-host: http://xx.xxxx.com
+
+api:
+  # APP模块,是通过jwt认证的,如果要使用APP模块,则需要修改【加密秘钥】
+  jwt:
+    # 加密秘钥
+    secret: a0dad695ddaf43f465dd51f4591c8f4e[huijy.iot]
+    # token有效时长,7天,单位秒
+    expire: 604800
+    header: apiToken

+ 25 - 0
smart-common/src/main/java/com/huijy/common/annotation/LoginMember.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.common.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 登录用户信息
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LoginMember {
+
+}

+ 22 - 0
smart-common/src/main/java/com/huijy/common/annotation/UnLogin.java

@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.common.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * api不登录效验
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface UnLogin {
+}

+ 1 - 1
smart-common/src/main/java/com/huijy/common/exception/ServiceException.java

@@ -12,7 +12,7 @@ public final class ServiceException extends RuntimeException
     /**
      * 错误码
      */
-    private Integer code;
+    private Integer code = 500;
 
     /**
      * 错误提示

+ 73 - 0
smart-common/src/main/java/com/huijy/common/utils/JwtUtils.java

@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.common.utils;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import lombok.Data;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * jwt工具类
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@ConfigurationProperties(prefix = "api.jwt")
+@Component
+@Data
+public class JwtUtils {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    private String secret;
+    private long expire;
+    private String header;
+
+    /**
+     * 生成jwt token
+     */
+    public String generateToken(Long memberId) {
+        Date nowDate = new Date();
+        //过期时间
+        Date expireDate = new Date(nowDate.getTime() + expire * 1000);
+        return Jwts.builder()
+                .setHeaderParam("typ", "JWT")
+                .setSubject(memberId+"")
+                .setIssuedAt(nowDate)
+                .setExpiration(expireDate)
+                .signWith(SignatureAlgorithm.HS512, secret)
+                .compact();
+    }
+
+    public Claims getClaimByToken(String token) {
+        try {
+            return Jwts.parser()
+                    .setSigningKey(secret)
+                    .parseClaimsJws(token)
+                    .getBody();
+        }catch (Exception e){
+            logger.debug("validate is token error ", e);
+            return null;
+        }
+    }
+
+    /**
+     * token是否过期
+     * @return  true:过期
+     */
+    public boolean isTokenExpired(Date expiration) {
+        return expiration.before(new Date());
+    }
+
+}

+ 4 - 0
smart-framework/src/main/java/com/huijy/framework/config/SecurityConfig.java

@@ -17,6 +17,7 @@ import org.springframework.web.filter.CorsFilter;
 import com.huijy.framework.security.filter.JwtAuthenticationTokenFilter;
 import com.huijy.framework.security.handle.AuthenticationEntryPointImpl;
 import com.huijy.framework.security.handle.LogoutSuccessHandlerImpl;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
 /**
  * spring security配置
@@ -50,6 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
     @Autowired
     private JwtAuthenticationTokenFilter authenticationTokenFilter;
 
+
     /**
      * 跨域过滤器
      */
@@ -114,6 +116,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/webjars/**").anonymous()
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
+                .antMatchers("/api/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()
@@ -121,6 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
         httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
         // 添加JWT filter
         httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
+
         // 添加CORS filter
         httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
         httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);

+ 47 - 0
smart-framework/src/main/java/com/huijy/framework/config/WebMvcConfig.java

@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.framework.config;
+
+import com.huijy.framework.interceptor.MemberAuthorizationInterceptor;
+
+import com.huijy.framework.resolver.LoginMemberHandlerMethodArgumentResolver;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.util.List;
+
+/**
+ * MVC配置
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Configuration
+public class WebMvcConfig implements WebMvcConfigurer {
+    @Autowired
+    private MemberAuthorizationInterceptor memberAuthorizationInterceptor;
+    @Autowired
+    private LoginMemberHandlerMethodArgumentResolver loginMemberHandlerMethodArgumentResolver;
+
+
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(memberAuthorizationInterceptor).addPathPatterns("/api/**");
+
+    }
+
+    @Override
+    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
+        argumentResolvers.add(loginMemberHandlerMethodArgumentResolver);
+    }
+}

+ 81 - 0
smart-framework/src/main/java/com/huijy/framework/interceptor/MemberAuthorizationInterceptor.java

@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.framework.interceptor;
+
+
+import com.huijy.common.annotation.UnLogin;
+import com.huijy.common.exception.ServiceException;
+import com.huijy.common.utils.JwtUtils;
+import io.jsonwebtoken.Claims;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 权限(Token)验证
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Component
+public class MemberAuthorizationInterceptor extends HandlerInterceptorAdapter {
+    @Autowired
+    private JwtUtils jwtUtils;
+
+    public static final String MEMBER_KEY = "smart_member_id";
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        UnLogin annotation;
+        if(handler instanceof HandlerMethod) {
+            annotation = ((HandlerMethod) handler).getMethodAnnotation(UnLogin.class);
+        }else{
+            return true;
+        }
+
+        if(annotation != null){
+            return true;
+        }
+
+        //获取用户凭证
+        String token = request.getHeader(jwtUtils.getHeader());
+        if(StringUtils.isBlank(token)){
+            token = request.getParameter(jwtUtils.getHeader());
+        }
+
+        //凭证为空
+        if(StringUtils.isBlank(token)){
+            throw new ServiceException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
+        }
+        /**
+         * app或小程序 有可能回传这些内容
+         */
+        if (token.equalsIgnoreCase("undefined")
+                || token.equalsIgnoreCase("'undefined'")
+                || token.equalsIgnoreCase("null")
+                || token.equalsIgnoreCase("'null'")){
+            throw new ServiceException(jwtUtils.getHeader() + "不能为空", HttpStatus.UNAUTHORIZED.value());
+        }
+
+        Claims claims = jwtUtils.getClaimByToken(token);
+        if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){
+            throw new ServiceException(jwtUtils.getHeader() + "失效,请重新登录", HttpStatus.UNAUTHORIZED.value());
+        }
+
+        //设置userId到request里,后续根据userId,获取用户信息
+        request.setAttribute(MEMBER_KEY, Long.parseLong(claims.getSubject()));
+
+        return true;
+    }
+}

+ 55 - 0
smart-framework/src/main/java/com/huijy/framework/resolver/LoginMemberHandlerMethodArgumentResolver.java

@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2016-2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.huijy.framework.resolver;
+
+import com.huijy.common.annotation.LoginMember;
+import com.huijy.framework.interceptor.MemberAuthorizationInterceptor;
+import com.huijy.management.domain.Member;
+import com.huijy.management.service.IMemberService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.MethodParameter;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.support.WebDataBinderFactory;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.method.support.ModelAndViewContainer;
+
+/**
+ * 有@LoginMember注解的方法参数,注入当前登录会员信息
+ *
+ * @author luobo
+ */
+@Component
+public class LoginMemberHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
+    @Autowired
+    private IMemberService memberService;
+
+    @Override
+    public boolean supportsParameter(MethodParameter parameter) {
+        return parameter.getParameterType().isAssignableFrom(Member.class) && parameter.hasParameterAnnotation(LoginMember.class);
+    }
+
+    @Override
+    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
+                                  NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
+        //获取会员ID
+        Object object = request.getAttribute(MemberAuthorizationInterceptor.MEMBER_KEY, RequestAttributes.SCOPE_REQUEST);
+        if(object == null){
+            return null;
+        }
+        //获取用户信息
+        Member member = memberService.selectMemberByMemberId((Long)object);
+
+        if (member == null){
+            return null;
+        }
+        return member;
+    }
+}

+ 1 - 0
smart-framework/src/main/java/com/huijy/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -31,6 +31,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
     protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
             throws ServletException, IOException
     {
+
         LoginUser loginUser = tokenService.getLoginUser(request);
         if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
         {

+ 200 - 0
smart-system/src/main/java/com/huijy/management/domain/AboutUs.java

@@ -0,0 +1,200 @@
+package com.huijy.management.domain;
+
+import com.huijy.common.annotation.Excel;
+import com.huijy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 关于我们对象 t_about_us
+ *
+ * @author luobo
+ * @date 2021-09-20
+ */
+public class AboutUs extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 关于我们id */
+    private Long aboutUsId;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String title;
+
+    /** 求助电话 */
+    @Excel(name = "求助电话")
+    private String helpPhone;
+
+    /** 展示图片 */
+    private String showPictures;
+
+    /** 简介1 */
+    @Excel(name = "简介1")
+    private String briefText1;
+
+    /** 简介2 */
+    @Excel(name = "简介2")
+    private String briefText2;
+
+    /** 简介3 */
+    @Excel(name = "简介3")
+    private String briefText3;
+
+    /** 简介4 */
+    @Excel(name = "简介4")
+    private String briefText4;
+
+    /** 详情 */
+    private String content;
+
+    /** 背景图片1 */
+    private String bgImg1;
+
+    /** 背景图片2 */
+    private String bgImg2;
+
+    /** 背景图片3 */
+    private String bgImg3;
+
+    /** 背景图片4 */
+    private String bgImg4;
+
+    public void setAboutUsId(Long aboutUsId)
+    {
+        this.aboutUsId = aboutUsId;
+    }
+
+    public Long getAboutUsId()
+    {
+        return aboutUsId;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setHelpPhone(String helpPhone)
+    {
+        this.helpPhone = helpPhone;
+    }
+
+    public String getHelpPhone()
+    {
+        return helpPhone;
+    }
+    public void setShowPictures(String showPictures)
+    {
+        this.showPictures = showPictures;
+    }
+
+    public String getShowPictures()
+    {
+        return showPictures;
+    }
+    public void setBriefText1(String briefText1)
+    {
+        this.briefText1 = briefText1;
+    }
+
+    public String getBriefText1()
+    {
+        return briefText1;
+    }
+    public void setBriefText2(String briefText2)
+    {
+        this.briefText2 = briefText2;
+    }
+
+    public String getBriefText2()
+    {
+        return briefText2;
+    }
+    public void setBriefText3(String briefText3)
+    {
+        this.briefText3 = briefText3;
+    }
+
+    public String getBriefText3()
+    {
+        return briefText3;
+    }
+    public void setBriefText4(String briefText4)
+    {
+        this.briefText4 = briefText4;
+    }
+
+    public String getBriefText4()
+    {
+        return briefText4;
+    }
+    public void setContent(String content)
+    {
+        this.content = content;
+    }
+
+    public String getContent()
+    {
+        return content;
+    }
+    public void setBgImg1(String bgImg1)
+    {
+        this.bgImg1 = bgImg1;
+    }
+
+    public String getBgImg1()
+    {
+        return bgImg1;
+    }
+    public void setBgImg2(String bgImg2)
+    {
+        this.bgImg2 = bgImg2;
+    }
+
+    public String getBgImg2()
+    {
+        return bgImg2;
+    }
+    public void setBgImg3(String bgImg3)
+    {
+        this.bgImg3 = bgImg3;
+    }
+
+    public String getBgImg3()
+    {
+        return bgImg3;
+    }
+    public void setBgImg4(String bgImg4)
+    {
+        this.bgImg4 = bgImg4;
+    }
+
+    public String getBgImg4()
+    {
+        return bgImg4;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+            .append("aboutUsId", getAboutUsId())
+            .append("title", getTitle())
+            .append("helpPhone", getHelpPhone())
+            .append("showPictures", getShowPictures())
+            .append("briefText1", getBriefText1())
+            .append("briefText2", getBriefText2())
+            .append("briefText3", getBriefText3())
+            .append("briefText4", getBriefText4())
+            .append("content", getContent())
+            .append("bgImg1", getBgImg1())
+            .append("bgImg2", getBgImg2())
+            .append("bgImg3", getBgImg3())
+            .append("bgImg4", getBgImg4())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+}

+ 61 - 0
smart-system/src/main/java/com/huijy/management/mapper/AboutUsMapper.java

@@ -0,0 +1,61 @@
+package com.huijy.management.mapper;
+
+import java.util.List;
+import com.huijy.management.domain.AboutUs;
+
+/**
+ * 关于我们Mapper接口
+ * 
+ * @author luobo
+ * @date 2021-09-20
+ */
+public interface AboutUsMapper 
+{
+    /**
+     * 查询关于我们
+     * 
+     * @param aboutUsId 关于我们主键
+     * @return 关于我们
+     */
+    public AboutUs selectAboutUsByAboutUsId(Long aboutUsId);
+
+    /**
+     * 查询关于我们列表
+     * 
+     * @param aboutUs 关于我们
+     * @return 关于我们集合
+     */
+    public List<AboutUs> selectAboutUsList(AboutUs aboutUs);
+
+    /**
+     * 新增关于我们
+     * 
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    public int insertAboutUs(AboutUs aboutUs);
+
+    /**
+     * 修改关于我们
+     * 
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    public int updateAboutUs(AboutUs aboutUs);
+
+    /**
+     * 删除关于我们
+     * 
+     * @param aboutUsId 关于我们主键
+     * @return 结果
+     */
+    public int deleteAboutUsByAboutUsId(Long aboutUsId);
+
+    /**
+     * 批量删除关于我们
+     * 
+     * @param aboutUsIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAboutUsByAboutUsIds(Long[] aboutUsIds);
+}

+ 16 - 8
smart-system/src/main/java/com/huijy/management/mapper/MemberMapper.java

@@ -2,18 +2,19 @@ package com.huijy.management.mapper;
 
 import java.util.List;
 import com.huijy.management.domain.Member;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 会员信息(游客)Mapper接口
- * 
+ *
  * @author luobo
  * @date 2021-09-12
  */
-public interface MemberMapper 
+public interface MemberMapper
 {
     /**
      * 查询会员信息(游客)
-     * 
+     *
      * @param memberId 会员信息(游客)主键
      * @return 会员信息(游客)
      */
@@ -21,7 +22,7 @@ public interface MemberMapper
 
     /**
      * 查询会员信息(游客)列表
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 会员信息(游客)集合
      */
@@ -29,7 +30,7 @@ public interface MemberMapper
 
     /**
      * 新增会员信息(游客)
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface MemberMapper
 
     /**
      * 修改会员信息(游客)
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface MemberMapper
 
     /**
      * 删除会员信息(游客)
-     * 
+     *
      * @param memberId 会员信息(游客)主键
      * @return 结果
      */
@@ -53,9 +54,16 @@ public interface MemberMapper
 
     /**
      * 批量删除会员信息(游客)
-     * 
+     *
      * @param memberIds 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteMemberByMemberIds(Long[] memberIds);
+
+    /**
+     * 根据openId获取会员信息
+     * @param openId
+     * @return
+     */
+    Member selectByOpenId(@Param("openId") String openId);
 }

+ 61 - 0
smart-system/src/main/java/com/huijy/management/service/IAboutUsService.java

@@ -0,0 +1,61 @@
+package com.huijy.management.service;
+
+import java.util.List;
+import com.huijy.management.domain.AboutUs;
+
+/**
+ * 关于我们Service接口
+ * 
+ * @author luobo
+ * @date 2021-09-20
+ */
+public interface IAboutUsService 
+{
+    /**
+     * 查询关于我们
+     * 
+     * @param aboutUsId 关于我们主键
+     * @return 关于我们
+     */
+    public AboutUs selectAboutUsByAboutUsId(Long aboutUsId);
+
+    /**
+     * 查询关于我们列表
+     * 
+     * @param aboutUs 关于我们
+     * @return 关于我们集合
+     */
+    public List<AboutUs> selectAboutUsList(AboutUs aboutUs);
+
+    /**
+     * 新增关于我们
+     * 
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    public int insertAboutUs(AboutUs aboutUs);
+
+    /**
+     * 修改关于我们
+     * 
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    public int updateAboutUs(AboutUs aboutUs);
+
+    /**
+     * 批量删除关于我们
+     * 
+     * @param aboutUsIds 需要删除的关于我们主键集合
+     * @return 结果
+     */
+    public int deleteAboutUsByAboutUsIds(Long[] aboutUsIds);
+
+    /**
+     * 删除关于我们信息
+     * 
+     * @param aboutUsId 关于我们主键
+     * @return 结果
+     */
+    public int deleteAboutUsByAboutUsId(Long aboutUsId);
+}

+ 15 - 8
smart-system/src/main/java/com/huijy/management/service/IMemberService.java

@@ -5,15 +5,15 @@ import com.huijy.management.domain.Member;
 
 /**
  * 会员信息(游客)Service接口
- * 
+ *
  * @author luobo
  * @date 2021-09-12
  */
-public interface IMemberService 
+public interface IMemberService
 {
     /**
      * 查询会员信息(游客)
-     * 
+     *
      * @param memberId 会员信息(游客)主键
      * @return 会员信息(游客)
      */
@@ -21,7 +21,7 @@ public interface IMemberService
 
     /**
      * 查询会员信息(游客)列表
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 会员信息(游客)集合
      */
@@ -29,7 +29,7 @@ public interface IMemberService
 
     /**
      * 新增会员信息(游客)
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface IMemberService
 
     /**
      * 修改会员信息(游客)
-     * 
+     *
      * @param member 会员信息(游客)
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface IMemberService
 
     /**
      * 批量删除会员信息(游客)
-     * 
+     *
      * @param memberIds 需要删除的会员信息(游客)主键集合
      * @return 结果
      */
@@ -53,9 +53,16 @@ public interface IMemberService
 
     /**
      * 删除会员信息(游客)信息
-     * 
+     *
      * @param memberId 会员信息(游客)主键
      * @return 结果
      */
     public int deleteMemberByMemberId(Long memberId);
+
+    /**
+     * 根据openId获取
+     * @param openId
+     * @return
+     */
+    Member getMemberByOpenId(String openId);
 }

+ 95 - 0
smart-system/src/main/java/com/huijy/management/service/impl/AboutUsServiceImpl.java

@@ -0,0 +1,95 @@
+package com.huijy.management.service.impl;
+
+import java.util.List;
+import com.huijy.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.huijy.management.mapper.AboutUsMapper;
+import com.huijy.management.domain.AboutUs;
+import com.huijy.management.service.IAboutUsService;
+
+/**
+ * 关于我们Service业务层处理
+ *
+ * @author luobo
+ * @date 2021-09-20
+ */
+@Service
+public class AboutUsServiceImpl implements IAboutUsService
+{
+    @Autowired
+    private AboutUsMapper aboutUsMapper;
+
+    /**
+     * 查询关于我们
+     *
+     * @param aboutUsId 关于我们主键
+     * @return 关于我们
+     */
+    @Override
+    public AboutUs selectAboutUsByAboutUsId(Long aboutUsId)
+    {
+        return aboutUsMapper.selectAboutUsByAboutUsId(aboutUsId);
+    }
+
+    /**
+     * 查询关于我们列表
+     *
+     * @param aboutUs 关于我们
+     * @return 关于我们
+     */
+    @Override
+    public List<AboutUs> selectAboutUsList(AboutUs aboutUs)
+    {
+        return aboutUsMapper.selectAboutUsList(aboutUs);
+    }
+
+    /**
+     * 新增关于我们
+     *
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    @Override
+    public int insertAboutUs(AboutUs aboutUs)
+    {
+        aboutUs.setCreateTime(DateUtils.getNowDate());
+        return aboutUsMapper.insertAboutUs(aboutUs);
+    }
+
+    /**
+     * 修改关于我们
+     *
+     * @param aboutUs 关于我们
+     * @return 结果
+     */
+    @Override
+    public int updateAboutUs(AboutUs aboutUs)
+    {
+        return aboutUsMapper.updateAboutUs(aboutUs);
+    }
+
+    /**
+     * 批量删除关于我们
+     *
+     * @param aboutUsIds 需要删除的关于我们主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAboutUsByAboutUsIds(Long[] aboutUsIds)
+    {
+        return aboutUsMapper.deleteAboutUsByAboutUsIds(aboutUsIds);
+    }
+
+    /**
+     * 删除关于我们信息
+     *
+     * @param aboutUsId 关于我们主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAboutUsByAboutUsId(Long aboutUsId)
+    {
+        return aboutUsMapper.deleteAboutUsByAboutUsId(aboutUsId);
+    }
+}

+ 5 - 0
smart-system/src/main/java/com/huijy/management/service/impl/MemberServiceImpl.java

@@ -90,4 +90,9 @@ public class MemberServiceImpl implements IMemberService
     {
         return memberMapper.deleteMemberByMemberId(memberId);
     }
+
+    @Override
+    public Member getMemberByOpenId(String openId) {
+        return memberMapper.selectByOpenId(openId);
+    }
 }

+ 49 - 0
smart-system/src/main/java/com/huijy/management/vo/WxLoginFrom.java

@@ -0,0 +1,49 @@
+package com.huijy.management.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 微信提交的登录信息信息
+ */
+@Data
+public class WxLoginFrom implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 用户信息对象,不包含 openid 等敏感信息
+     */
+    private WxUserInfo userInfo;
+
+    /**
+     * 不包括敏感信息的原始数据字符串,用于计算签名
+     */
+    private String rawData;
+
+    /**
+     * 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息
+     */
+    private String signature;
+
+
+    /**
+     * 包括敏感数据在内的完整用户信息的加密数据
+     */
+    private String encryptedData;
+
+
+    /**
+     * 加密算法的初始向量
+     */
+    private String iv;
+
+    /**
+     * 描述信息
+     */
+    private String errMsg;
+
+
+
+
+}

+ 55 - 0
smart-system/src/main/java/com/huijy/management/vo/WxUserInfo.java

@@ -0,0 +1,55 @@
+package com.huijy.management.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 微信提交的用户信息
+ */
+@Data
+public class WxUserInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 用户昵称
+     */
+    private String nickName;
+    /**
+     * 用户头像图片的 URL
+     */
+    private String avatarUrl;
+
+    /**
+     * 用户性别 0、未知 1、男性 2、女性
+     */
+    private Integer gender;
+    /**
+     * 用户所在国家
+     */
+    private String country;
+
+    /**
+     * 用户所在省份
+     */
+    private String province;
+    /**
+     * 用户所在城市
+     */
+    private String city;
+    /**
+     * 显示 country,province,city 所用的语言 en:英文; zh_CN:简体中文; zh_TW:繁体中文
+     */
+    private String language;
+    /**
+     * 普通用户的标识,对当前开发者帐号唯一
+     */
+    private String openId;
+
+    /**
+     * 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的 unionid 是唯一的。
+     */
+    private String unionId;
+
+}

+ 105 - 0
smart-system/src/main/resources/mapper/management/AboutUsMapper.xml

@@ -0,0 +1,105 @@
+<?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.huijy.management.mapper.AboutUsMapper">
+    
+    <resultMap type="AboutUs" id="AboutUsResult">
+        <result property="aboutUsId"    column="about_us_id"    />
+        <result property="title"    column="title"    />
+        <result property="helpPhone"    column="help_phone"    />
+        <result property="showPictures"    column="show_pictures"    />
+        <result property="briefText1"    column="brief_text1"    />
+        <result property="briefText2"    column="brief_text2"    />
+        <result property="briefText3"    column="brief_text3"    />
+        <result property="briefText4"    column="brief_text4"    />
+        <result property="content"    column="content"    />
+        <result property="bgImg1"    column="bg_img1"    />
+        <result property="bgImg2"    column="bg_img2"    />
+        <result property="bgImg3"    column="bg_img3"    />
+        <result property="bgImg4"    column="bg_img4"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectAboutUsVo">
+        select about_us_id, title, help_phone, show_pictures, brief_text1, brief_text2, brief_text3, brief_text4, content, bg_img1, bg_img2, bg_img3, bg_img4, create_time from t_about_us
+    </sql>
+
+    <select id="selectAboutUsList" parameterType="AboutUs" resultMap="AboutUsResult">
+        <include refid="selectAboutUsVo"/>
+        <where>  
+        </where>
+    </select>
+    
+    <select id="selectAboutUsByAboutUsId" parameterType="Long" resultMap="AboutUsResult">
+        <include refid="selectAboutUsVo"/>
+        where about_us_id = #{aboutUsId}
+    </select>
+        
+    <insert id="insertAboutUs" parameterType="AboutUs">
+        insert into t_about_us
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="aboutUsId != null">about_us_id,</if>
+            <if test="title != null">title,</if>
+            <if test="helpPhone != null">help_phone,</if>
+            <if test="showPictures != null">show_pictures,</if>
+            <if test="briefText1 != null">brief_text1,</if>
+            <if test="briefText2 != null">brief_text2,</if>
+            <if test="briefText3 != null">brief_text3,</if>
+            <if test="briefText4 != null">brief_text4,</if>
+            <if test="content != null">content,</if>
+            <if test="bgImg1 != null">bg_img1,</if>
+            <if test="bgImg2 != null">bg_img2,</if>
+            <if test="bgImg3 != null">bg_img3,</if>
+            <if test="bgImg4 != null">bg_img4,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="aboutUsId != null">#{aboutUsId},</if>
+            <if test="title != null">#{title},</if>
+            <if test="helpPhone != null">#{helpPhone},</if>
+            <if test="showPictures != null">#{showPictures},</if>
+            <if test="briefText1 != null">#{briefText1},</if>
+            <if test="briefText2 != null">#{briefText2},</if>
+            <if test="briefText3 != null">#{briefText3},</if>
+            <if test="briefText4 != null">#{briefText4},</if>
+            <if test="content != null">#{content},</if>
+            <if test="bgImg1 != null">#{bgImg1},</if>
+            <if test="bgImg2 != null">#{bgImg2},</if>
+            <if test="bgImg3 != null">#{bgImg3},</if>
+            <if test="bgImg4 != null">#{bgImg4},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAboutUs" parameterType="AboutUs">
+        update t_about_us
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="title != null">title = #{title},</if>
+            <if test="helpPhone != null">help_phone = #{helpPhone},</if>
+            <if test="showPictures != null">show_pictures = #{showPictures},</if>
+            <if test="briefText1 != null">brief_text1 = #{briefText1},</if>
+            <if test="briefText2 != null">brief_text2 = #{briefText2},</if>
+            <if test="briefText3 != null">brief_text3 = #{briefText3},</if>
+            <if test="briefText4 != null">brief_text4 = #{briefText4},</if>
+            <if test="content != null">content = #{content},</if>
+            <if test="bgImg1 != null">bg_img1 = #{bgImg1},</if>
+            <if test="bgImg2 != null">bg_img2 = #{bgImg2},</if>
+            <if test="bgImg3 != null">bg_img3 = #{bgImg3},</if>
+            <if test="bgImg4 != null">bg_img4 = #{bgImg4},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where about_us_id = #{aboutUsId}
+    </update>
+
+    <delete id="deleteAboutUsByAboutUsId" parameterType="Long">
+        delete from t_about_us where about_us_id = #{aboutUsId}
+    </delete>
+
+    <delete id="deleteAboutUsByAboutUsIds" parameterType="String">
+        delete from t_about_us where about_us_id in 
+        <foreach item="aboutUsId" collection="array" open="(" separator="," close=")">
+            #{aboutUsId}
+        </foreach>
+    </delete>
+</mapper>

+ 12 - 6
smart-system/src/main/resources/mapper/management/MemberMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.huijy.management.mapper.MemberMapper">
-    
+
     <resultMap type="Member" id="MemberResult">
         <result property="memberId"    column="member_id"    />
         <result property="name"    column="name"    />
@@ -32,19 +32,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMemberList" parameterType="Member" resultMap="MemberResult">
         <include refid="selectMemberVo"/>
-        <where>  
+        <where>
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="mobile != null  and mobile != ''"> and mobile = #{mobile}</if>
             <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
             <if test="gender != null  and gender != ''"> and gender = #{gender}</if>
         </where>
     </select>
-    
+
     <select id="selectMemberByMemberId" parameterType="Long" resultMap="MemberResult">
         <include refid="selectMemberVo"/>
         where member_id = #{memberId}
     </select>
-        
+
     <insert id="insertMember" parameterType="Member" useGeneratedKeys="true" keyProperty="memberId">
         insert into t_member
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -119,9 +119,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteMemberByMemberIds" parameterType="String">
-        delete from t_member where member_id in 
+        delete from t_member where member_id in
         <foreach item="memberId" collection="array" open="(" separator="," close=")">
             #{memberId}
         </foreach>
     </delete>
-</mapper>
+
+    <select id="selectByOpenId" resultMap="MemberResult">
+        <include refid="selectMemberVo"/>
+        where openid = #{openId}
+
+    </select>
+</mapper>