瀏覽代碼

前端,后端小程序

LIVE_YE 2 年之前
父節點
當前提交
1a8b4e3254
共有 20 個文件被更改,包括 1880 次插入0 次删除
  1. 104 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UseGuideController.java
  2. 104 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/WelfareGuideController.java
  3. 154 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wechat/AppletLoginController.java
  4. 53 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletLoginForm.java
  5. 55 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletSessionDTO.java
  6. 21 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/WechatEnum.java
  7. 57 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/AppletDecryptDataUtil.java
  8. 278 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64.java
  9. 116 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCodeSessionUtil.java
  10. 112 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtils.java
  11. 111 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/UseGuide.java
  12. 97 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/WelfareGuide.java
  13. 61 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/UseGuideMapper.java
  14. 61 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/WelfareGuideMapper.java
  15. 61 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IUseGuideService.java
  16. 61 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IWelfareGuideService.java
  17. 96 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UseGuideServiceImpl.java
  18. 96 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WelfareGuideServiceImpl.java
  19. 93 0
      ruoyi-system/src/main/resources/mapper/system/UseGuideMapper.xml
  20. 89 0
      ruoyi-system/src/main/resources/mapper/system/WelfareGuideMapper.xml

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UseGuideController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.system.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.UseGuide;
+import com.ruoyi.system.service.IUseGuideService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 使用指南Controller
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@RestController
+@RequestMapping("/system/guide")
+public class UseGuideController extends BaseController
+{
+    @Autowired
+    private IUseGuideService useGuideService;
+
+    /**
+     * 查询使用指南列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(UseGuide useGuide)
+    {
+        startPage();
+        List<UseGuide> list = useGuideService.selectUseGuideList(useGuide);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出使用指南列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:export')")
+    @Log(title = "使用指南", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, UseGuide useGuide)
+    {
+        List<UseGuide> list = useGuideService.selectUseGuideList(useGuide);
+        ExcelUtil<UseGuide> util = new ExcelUtil<UseGuide>(UseGuide.class);
+        util.exportExcel(response, list, "使用指南数据");
+    }
+
+    /**
+     * 获取使用指南详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(useGuideService.selectUseGuideById(id));
+    }
+
+    /**
+     * 新增使用指南
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:add')")
+    @Log(title = "使用指南", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody UseGuide useGuide)
+    {
+        return toAjax(useGuideService.insertUseGuide(useGuide));
+    }
+
+    /**
+     * 修改使用指南
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:edit')")
+    @Log(title = "使用指南", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody UseGuide useGuide)
+    {
+        return toAjax(useGuideService.updateUseGuide(useGuide));
+    }
+
+    /**
+     * 删除使用指南
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:remove')")
+    @Log(title = "使用指南", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(useGuideService.deleteUseGuideByIds(ids));
+    }
+}

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/WelfareGuideController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.system.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.WelfareGuide;
+import com.ruoyi.system.service.IWelfareGuideService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 小程序党建福利信息Controller
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@RestController
+@RequestMapping("/system/guide")
+public class WelfareGuideController extends BaseController
+{
+    @Autowired
+    private IWelfareGuideService welfareGuideService;
+
+    /**
+     * 查询小程序党建福利信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(WelfareGuide welfareGuide)
+    {
+        startPage();
+        List<WelfareGuide> list = welfareGuideService.selectWelfareGuideList(welfareGuide);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出小程序党建福利信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:export')")
+    @Log(title = "小程序党建福利信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, WelfareGuide welfareGuide)
+    {
+        List<WelfareGuide> list = welfareGuideService.selectWelfareGuideList(welfareGuide);
+        ExcelUtil<WelfareGuide> util = new ExcelUtil<WelfareGuide>(WelfareGuide.class);
+        util.exportExcel(response, list, "小程序党建福利信息数据");
+    }
+
+    /**
+     * 获取小程序党建福利信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(welfareGuideService.selectWelfareGuideById(id));
+    }
+
+    /**
+     * 新增小程序党建福利信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:add')")
+    @Log(title = "小程序党建福利信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody WelfareGuide welfareGuide)
+    {
+        return toAjax(welfareGuideService.insertWelfareGuide(welfareGuide));
+    }
+
+    /**
+     * 修改小程序党建福利信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:edit')")
+    @Log(title = "小程序党建福利信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody WelfareGuide welfareGuide)
+    {
+        return toAjax(welfareGuideService.updateWelfareGuide(welfareGuide));
+    }
+
+    /**
+     * 删除小程序党建福利信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:guide:remove')")
+    @Log(title = "小程序党建福利信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(welfareGuideService.deleteWelfareGuideByIds(ids));
+    }
+}

+ 154 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wechat/AppletLoginController.java

@@ -0,0 +1,154 @@
+package com.boman.wechat.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.enums.UserStatus;
+import com.boman.common.core.exception.BaseException;
+import com.boman.common.core.utils.IdUtils;
+import com.boman.common.core.utils.ServletUtils;
+import com.boman.common.core.utils.StringUtils;
+import com.boman.common.core.utils.ip.IpUtils;
+import com.boman.common.core.utils.obj.ObjectUtils;
+import com.boman.common.redis.service.RedisService;
+import com.boman.domain.AppletLoginForm;
+import com.boman.domain.SysDept;
+import com.boman.domain.SysUser;
+import com.boman.domain.constant.CacheConstants;
+import com.boman.domain.constant.Constants;
+import com.boman.domain.constant.UserEnvConstant;
+import com.boman.domain.dto.AppletSessionDTO;
+import com.boman.domain.dto.R;
+import com.boman.system.api.RemoteDeptService;
+import com.boman.system.api.RemoteLogService;
+import com.boman.system.api.RemoteUserService;
+import com.boman.system.api.model.LoginUser;
+import com.boman.wechat.utils.WxCodeSessionUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author shiqian
+ * @date 2021年09月08日 17:29
+ **/
+@RestController
+@RequestMapping("applet")
+public class AppletLoginController {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(AppletLoginController.class);
+
+    private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60;
+
+    private final static long EXPIRE_TIME_QR = 3 * 60;
+
+    private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
+
+    protected static final long MILLIS_SECOND = 1000;
+
+    @Resource
+    private WxCodeSessionUtil codeUtil;
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private RemoteUserService remoteUserService;
+    @Resource
+    private RemoteLogService remoteLogService;
+    @Resource
+    private RemoteDeptService remoteDeptService;
+
+    @Value("${upkeep}")
+    private Boolean upKeep;
+
+    @PostMapping("/login")
+    public R<Map<String, Object>> getPhone(@RequestBody AppletLoginForm form) {
+        if (upKeep){
+            throw new BaseException("当前正在维护");
+        }
+        AppletSessionDTO dto = codeUtil.jscode2Session(form);
+        String phoneNumber = dto.getPhoneNumber();
+        if (StringUtils.isBlank(phoneNumber)){
+            throw new BaseException("对不起,未获取到手机号");
+        }
+        SysUser user = remoteUserService.getByPhone(dto.getPhoneNumber());
+        if (user == null){
+            throw new BaseException("对不起,未获取到相关信息");
+        }
+        String userName = user.getUserName();
+        if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
+            remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
+            throw new BaseException("对不起,您的账号:" + userName + " 已被删除");
+        }
+
+        if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
+            remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
+            throw new BaseException("对不起,您的账号:" + userName + " 已停用");
+        }
+
+        remoteLogService.saveLogininfor(userName, Constants.LOGIN_SUCCESS, "登录成功");
+        LOGGER.info("appletLogin, remoteUserService: {}", remoteUserService);
+        LoginUser loginUser = remoteUserService.packInfo(user);
+        LOGGER.info("appletLogin, loginUser: {}", JSON.toJSONString(loginUser));
+        return R.ok(createToken(loginUser));
+    }
+
+    public Map<String, Object> createToken(LoginUser loginUser) {
+        // 生成token
+        String token = IdUtils.fastUUID();
+        loginUser.setToken(token);
+        loginUser.setUserid(loginUser.getSysUser().getId());
+        loginUser.setUsername(loginUser.getSysUser().getUserName());
+        loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
+
+        JSONObject userEnv = packUserEnv(loginUser);
+        loginUser.setUserEnv(userEnv);
+        loginUser.setLoginType("App");
+        refreshToken(loginUser);
+
+        // 保存或更新用户token
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("access_token", token);
+        map.put("expires_in", EXPIRE_TIME);
+        redisService.setCacheObject(ACCESS_TOKEN + token, loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
+        return map;
+    }
+
+    public void refreshToken(LoginUser loginUser) {
+        loginUser.setLoginTime(System.currentTimeMillis());
+        loginUser.setExpireTime(loginUser.getLoginTime() + EXPIRE_TIME * MILLIS_SECOND);
+        // 根据uuid将loginUser缓存
+        String userKey = getTokenKey(loginUser.getToken());
+        redisService.setCacheObject(userKey, loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
+    }
+
+    private String getTokenKey(String token) {
+        return ACCESS_TOKEN + token;
+    }
+
+    private JSONObject packUserEnv(LoginUser loginUser) {
+        JSONObject userEnv = new JSONObject();
+        userEnv.put(UserEnvConstant.USER_ID, loginUser.getUserid());
+        userEnv.put(UserEnvConstant.USERNAME, loginUser.getUsername());
+
+        SysDept dept = loginUser.getSysUser().getDept();
+        userEnv.put(UserEnvConstant.USER_DEPT_ID, loginUser.getSysUser().getDeptId());
+        userEnv.put(UserEnvConstant.USER_DEPT_NAME, dept.getDeptName());
+
+        Long parentId = dept.getParentId();
+        SysDept parentDept = remoteDeptService.getById(parentId);
+        if (ObjectUtils.isNotEmpty(parentDept)) {
+            userEnv.put(UserEnvConstant.USER_PARENT_DEPT_ID, parentDept.getId());
+            userEnv.put(UserEnvConstant.USER_PARENT_DEPT_NAME, parentDept.getDeptName());
+        }
+
+        return userEnv;
+    }
+}

+ 53 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletLoginForm.java

@@ -0,0 +1,53 @@
+package com.boman.domain;
+
+/**
+ * @author shiqian
+ * @date 2021年09月08日 17:15
+ **/
+public class AppletLoginForm {
+
+
+    // 微信code
+    private String code;
+
+    // 微信用户基本信息
+    private SysUser user;
+
+    // 加密数据
+    private String encryptedData;
+
+    // 向量
+    private String iv;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public SysUser getUser() {
+        return user;
+    }
+
+    public void setUser(SysUser user) {
+        this.user = user;
+    }
+
+    public String getEncryptedData() {
+        return encryptedData;
+    }
+
+    public void setEncryptedData(String encryptedData) {
+        this.encryptedData = encryptedData;
+    }
+
+    public String getIv() {
+        return iv;
+    }
+
+    public void setIv(String iv) {
+        this.iv = iv;
+    }
+}

+ 55 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletSessionDTO.java

@@ -0,0 +1,55 @@
+package com.boman.domain.dto;
+
+import lombok.Data;
+
+
+/**
+ * 微信通用接口凭证
+ */
+
+public class AppletSessionDTO {
+
+    // 授权openid
+    private String openId;
+
+    // 微信会话session
+    private String sessionKey;
+
+    // 微信用户唯一unionid
+    private String unionId;
+
+    // 绑定手机号
+    private String phoneNumber;
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getSessionKey() {
+        return sessionKey;
+    }
+
+    public void setSessionKey(String sessionKey) {
+        this.sessionKey = sessionKey;
+    }
+
+    public String getUnionId() {
+        return unionId;
+    }
+
+    public void setUnionId(String unionId) {
+        this.unionId = unionId;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public void setPhoneNumber(String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+}

+ 21 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/WechatEnum.java

@@ -0,0 +1,21 @@
+package com.boman.domain;
+
+public enum WechatEnum {
+    /** 用户账号登录 */
+    U("u"),
+    /** 微信授权登录 */
+    W("w");
+
+
+    private String value;
+
+    private WechatEnum(String value)
+    {
+        this.value = value;
+    }
+
+    public String getValue()
+    {
+        return value;
+    }
+}

+ 57 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/AppletDecryptDataUtil.java

@@ -0,0 +1,57 @@
+package com.boman.domain.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.AlgorithmParameters;
+import java.security.Security;
+import java.util.Arrays;
+
+/**
+ * 解密工具
+ */
+public class AppletDecryptDataUtil {
+
+    public static JSONObject decryptData(byte[] keyByte, byte[] ivByte, byte[] dataByte) throws Exception {
+        // 如果密钥不足16位,那么就补足.  这个if 中的内容很重要
+        int base = 16;
+        if (keyByte.length % base != 0) {
+            int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0);
+            byte[] temp = new byte[groups * base];
+            Arrays.fill(temp, (byte) 0);
+            System.arraycopy(keyByte, 0, temp, 0, keyByte.length);
+            keyByte = temp;
+        }
+
+        byte[] resultByte;
+        // 初始化
+        Security.addProvider(new BouncyCastleProvider());
+        try {
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
+            AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
+            parameters.init(new IvParameterSpec(ivByte));
+            cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化
+            resultByte = cipher.doFinal(dataByte);
+            if (null == resultByte || resultByte.length <= 0) {
+                return null;
+            }
+        }catch (Exception e){
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding","BC");
+            SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
+            AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
+            parameters.init(new IvParameterSpec(ivByte));
+            cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化
+            resultByte = cipher.doFinal(dataByte);
+            if (null == resultByte || resultByte.length <= 0) {
+                return null;
+            }
+        }
+
+        String result = new String(resultByte, "UTF-8");
+        return JSONObject.parseObject(result);
+    }
+}

+ 278 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64.java

@@ -0,0 +1,278 @@
+package com.boman.domain.utils;
+
+/*
+ * Copyright (C) 2010 The MobileSecurePay Project
+ * All right reserved.
+ * author: shiqun.shi@alipay.com
+ */
+public final class Base64 {
+
+    static private final int BASELENGTH = 128;
+    static private final int LOOKUPLENGTH = 64;
+    static private final int TWENTYFOURBITGROUP = 24;
+    static private final int EIGHTBIT = 8;
+    static private final int SIXTEENBIT = 16;
+    static private final int FOURBYTE = 4;
+    static private final int SIGN = -128;
+    static private final char PAD = '=';
+    static private final boolean fDebug = false;
+    static final private byte[] base64Alphabet = new byte[BASELENGTH];
+    static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
+
+    static {
+        for (int i = 0; i < BASELENGTH; ++i) {
+            base64Alphabet[i] = -1;
+        }
+        for (int i = 'Z'; i >= 'A'; i--) {
+            base64Alphabet[i] = (byte) (i - 'A');
+        }
+        for (int i = 'z'; i >= 'a'; i--) {
+            base64Alphabet[i] = (byte) (i - 'a' + 26);
+        }
+
+        for (int i = '9'; i >= '0'; i--) {
+            base64Alphabet[i] = (byte) (i - '0' + 52);
+        }
+
+        base64Alphabet['+'] = 62;
+        base64Alphabet['/'] = 63;
+
+        for (int i = 0; i <= 25; i++) {
+            lookUpBase64Alphabet[i] = (char) ('A' + i);
+        }
+
+        for (int i = 26, j = 0; i <= 51; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('a' + j);
+        }
+
+        for (int i = 52, j = 0; i <= 61; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('0' + j);
+        }
+        lookUpBase64Alphabet[62] = (char) '+';
+        lookUpBase64Alphabet[63] = (char) '/';
+
+    }
+
+    private static boolean isWhiteSpace(char octect) {
+        return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
+    }
+
+    private static boolean isPad(char octect) {
+        return (octect == PAD);
+    }
+
+    private static boolean isData(char octect) {
+        return (octect < BASELENGTH && base64Alphabet[octect] != -1);
+    }
+
+    /**
+     * Encodes hex octects into Base64
+     *
+     * @param binaryData Array containing binaryData
+     * @return Encoded Base64 array
+     */
+    public static String encode(byte[] binaryData) {
+
+        if (binaryData == null) {
+            return null;
+        }
+
+        int lengthDataBits = binaryData.length * EIGHTBIT;
+        if (lengthDataBits == 0) {
+            return "";
+        }
+
+        int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
+        int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
+        int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
+        char encodedData[] = null;
+
+        encodedData = new char[numberQuartet * 4];
+
+        byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
+
+        int encodedIndex = 0;
+        int dataIndex = 0;
+        if (fDebug) {
+            System.out.println("number of triplets = " + numberTriplets);
+        }
+
+        for (int i = 0; i < numberTriplets; i++) {
+            b1 = binaryData[dataIndex++];
+            b2 = binaryData[dataIndex++];
+            b3 = binaryData[dataIndex++];
+
+            if (fDebug) {
+                System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3);
+            }
+
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+            byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
+
+            if (fDebug) {
+                System.out.println("val2 = " + val2);
+                System.out.println("k4   = " + (k << 4));
+                System.out.println("vak  = " + (val2 | (k << 4)));
+            }
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
+        }
+
+        // form integral number of 6-bit groups
+        if (fewerThan24bits == EIGHTBIT) {
+            b1 = binaryData[dataIndex];
+            k = (byte) (b1 & 0x03);
+            if (fDebug) {
+                System.out.println("b1=" + b1);
+                System.out.println("b1<<2 = " + (b1 >> 2));
+            }
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
+            encodedData[encodedIndex++] = PAD;
+            encodedData[encodedIndex++] = PAD;
+        } else if (fewerThan24bits == SIXTEENBIT) {
+            b1 = binaryData[dataIndex];
+            b2 = binaryData[dataIndex + 1];
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
+            encodedData[encodedIndex++] = PAD;
+        }
+
+        return new String(encodedData);
+    }
+
+    /**
+     * Decodes Base64 data into octects
+     *
+     * @param encoded string containing Base64 data
+     * @return Array containind decoded data.
+     */
+    public static byte[] decode(String encoded) {
+
+        if (encoded == null) {
+            return null;
+        }
+
+        char[] base64Data = encoded.toCharArray();
+        // remove white spaces
+        int len = removeWhiteSpace(base64Data);
+
+        if (len % FOURBYTE != 0) {
+            return null;//should be divisible by four
+        }
+
+        int numberQuadruple = (len / FOURBYTE);
+
+        if (numberQuadruple == 0) {
+            return new byte[0];
+        }
+
+        byte decodedData[] = null;
+        byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
+        char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
+
+        int i = 0;
+        int encodedIndex = 0;
+        int dataIndex = 0;
+        decodedData = new byte[(numberQuadruple) * 3];
+
+        for (; i < numberQuadruple - 1; i++) {
+
+            if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
+                    || !isData((d3 = base64Data[dataIndex++]))
+                    || !isData((d4 = base64Data[dataIndex++]))) {
+                return null;
+            }//if found "no data" just return null
+
+            b1 = base64Alphabet[d1];
+            b2 = base64Alphabet[d2];
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+        }
+
+        if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
+            return null;//if found "no data" just return null
+        }
+
+        b1 = base64Alphabet[d1];
+        b2 = base64Alphabet[d2];
+
+        d3 = base64Data[dataIndex++];
+        d4 = base64Data[dataIndex++];
+        if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters
+            if (isPad(d3) && isPad(d4)) {
+                if ((b2 & 0xf) != 0)//last 4 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 1];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+                return tmp;
+            } else if (!isPad(d3) && isPad(d4)) {
+                b3 = base64Alphabet[d3];
+                if ((b3 & 0x3) != 0)//last 2 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 2];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+                tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+                return tmp;
+            } else {
+                return null;
+            }
+        } else { //No PAD e.g 3cQl
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+
+        }
+
+        return decodedData;
+    }
+
+    /**
+     * remove WhiteSpace form MIME containing encoded Base64 data.
+     *
+     * @param data the byte array of base64 data (with WS)
+     * @return the new length
+     */
+    private static int removeWhiteSpace(char[] data) {
+        if (data == null) {
+            return 0;
+        }
+
+        // count characters that's not whitespace
+        int newSize = 0;
+        int len = data.length;
+        for (int i = 0; i < len; i++) {
+            if (!isWhiteSpace(data[i])) {
+                data[newSize++] = data[i];
+            }
+        }
+        return newSize;
+    }
+}

+ 116 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCodeSessionUtil.java

@@ -0,0 +1,116 @@
+package com.boman.wechat.utils;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.AppletLoginForm;
+import com.boman.domain.dto.AppletSessionDTO;
+import com.boman.domain.utils.AppletDecryptDataUtil;
+import com.boman.domain.utils.Base64;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ */
+@Component
+@Slf4j
+@RefreshScope
+public class WxCodeSessionUtil {
+
+
+    /**
+     * 根据code获取小程序openid和unionid
+     */
+    private static final String JSCODE_SESSION_API = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";
+
+    /**
+     * 小程序appId
+     */
+    @Value("${wx.appId}")
+    private String appId;
+
+    /**
+     * 小程序密钥
+     */
+    @Value("${wx.appSecret}")
+    private String appSecret;
+
+
+    /**
+     * 根据code获取小程序openid和unionid
+     *
+     * @param form
+     * @return
+     */
+    public AppletSessionDTO jscode2Session(AppletLoginForm form) {
+        // 获取openId和sessionKey
+        JSONObject result;
+        try {
+            String requestUrl = JSCODE_SESSION_API.replace("APPID", this.appId)
+                    .replace("SECRET", this.appSecret)
+                    .replace("JSCODE", form.getCode().trim());
+
+            String jsonStr = HttpClientUtils.doGet1(requestUrl);
+            result = JSONObject.parseObject(jsonStr);
+            if (StringUtils.isEmpty(result.toString())) {
+                throw new RuntimeException("错误");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("错误");
+        }
+
+        int errcode = result.getIntValue("errcode");
+        if (errcode != 0) {
+            String errmsg = result.getString("errmsg");
+            throw new RuntimeException("获取小程序授权错误信息, " + errmsg);
+        }
+        // 获取openId,unionId,sessionKey
+        AppletSessionDTO appletSession = new AppletSessionDTO();
+        appletSession.setOpenId(result.getString("openid"));
+        // unionId有可能是空
+        appletSession.setUnionId(result.getString("unionid"));
+        appletSession.setSessionKey(result.getString("session_key"));
+
+        System.out.println();
+        String phoneNumber = getPhoneNumber(form, appletSession);
+        appletSession.setPhoneNumber(phoneNumber);
+        return appletSession;
+    }
+
+    /**
+     * 手机号解密
+     */
+    private String getPhoneNumber(AppletLoginForm form, AppletSessionDTO appletSession) {
+
+        // 解密文件
+        String encryptedData = form.getEncryptedData();
+        // 解密向量
+        String iv = form.getIv();
+        // 加密秘钥
+        byte[] dataByte = Base64.decode(encryptedData);
+        // session_key
+        byte[] keyByte = Base64.decode(appletSession.getSessionKey());
+        // 偏移量
+        byte[] ivByte = Base64.decode(iv);
+        JSONObject result;
+        try {
+            result = AppletDecryptDataUtil.decryptData(keyByte, ivByte, dataByte);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+        assert result != null;
+        String purePhoneNumber = result.getString("purePhoneNumber");
+        if (null == purePhoneNumber || purePhoneNumber.isEmpty()) {
+            throw new RuntimeException("获取手机号失败");
+        }
+        return purePhoneNumber;
+    }
+
+
+}

+ 112 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtils.java

@@ -0,0 +1,112 @@
+package com.boman.wechat.utils;
+
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpClientUtils {
+
+    final static int TIMEOUT = 1000;
+    final static int TIMEOUT_MSEC = 5 * 1000;
+
+    public static String doPost(String url, Map<String, String> paramMap) throws IOException {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpPost httpPost = new HttpPost(url);
+            // 创建参数列表
+            if (paramMap != null) {
+                List<NameValuePair> paramList = new ArrayList<>();
+                for (Map.Entry<String, String> param : paramMap.entrySet()) {
+                    paramList.add(new BasicNameValuePair(param.getKey(), param.getValue()));
+                }
+                // 模拟表单
+                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
+                httpPost.setEntity(entity);
+            }
+
+            httpPost.setConfig(builderRequestConfig());
+
+            // 执行http请求
+            response = httpClient.execute(httpPost);
+
+            resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                throw e;
+            }
+        }
+
+        return resultString;
+    }
+
+    public static String doGet(String url, Map<String, String> paramMap) throws IOException {
+        url += "?appid=" + paramMap.get("appid") + "&secret=" + paramMap.get("secret") + "&js_code=" + paramMap.get("js_code") + "&grant_type=" + paramMap.get("grant_type");
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpGet httpGet = new HttpGet(url);
+            // 执行http请求
+            response = httpClient.execute(httpGet);
+            resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            try {
+                response.close();
+            } catch (IOException e) {
+                throw e;
+            }
+        }
+        return resultString;
+    }
+
+    public static String doGet1(String url) throws IOException {
+        // 创建Httpclient对象
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        CloseableHttpResponse response = null;
+        String resultString = "";
+        try {
+            // 创建Http Post请求
+            HttpGet httpGet = new HttpGet(url);
+            // 执行http请求
+            response = httpClient.execute(httpGet);
+            resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            assert response != null;
+            response.close();
+        }
+        return resultString;
+    }
+
+    private static RequestConfig builderRequestConfig() {
+        return RequestConfig.custom()
+                .setConnectTimeout(TIMEOUT_MSEC)
+                .setConnectionRequestTimeout(TIMEOUT_MSEC)
+                .setSocketTimeout(TIMEOUT_MSEC).build();
+    }
+}

+ 111 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UseGuide.java

@@ -0,0 +1,111 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 使用指南对象 use_guide
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public class UseGuide extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String useTitle;
+
+    /** 使用指南简介 */
+    @Excel(name = "使用指南简介")
+    private String useProfile;
+
+    /** 使用指南内容 */
+    private String useContent;
+
+    /** 使用指南版本 */
+    @Excel(name = "使用指南版本")
+    private String useVersion;
+
+    /** 状态(0正常 1关闭) */
+    @Excel(name = "状态", readConverterExp = "0=正常,1=关闭")
+    private String status;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setUseTitle(String useTitle) 
+    {
+        this.useTitle = useTitle;
+    }
+
+    public String getUseTitle() 
+    {
+        return useTitle;
+    }
+    public void setUseProfile(String useProfile) 
+    {
+        this.useProfile = useProfile;
+    }
+
+    public String getUseProfile() 
+    {
+        return useProfile;
+    }
+    public void setUseContent(String useContent) 
+    {
+        this.useContent = useContent;
+    }
+
+    public String getUseContent() 
+    {
+        return useContent;
+    }
+    public void setUseVersion(String useVersion) 
+    {
+        this.useVersion = useVersion;
+    }
+
+    public String getUseVersion() 
+    {
+        return useVersion;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("useTitle", getUseTitle())
+            .append("useProfile", getUseProfile())
+            .append("useContent", getUseContent())
+            .append("useVersion", getUseVersion())
+            .append("status", getStatus())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 97 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/WelfareGuide.java

@@ -0,0 +1,97 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 小程序党建福利信息对象 welfare_guide
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public class WelfareGuide extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String welfareTitle;
+
+    /** 福利简介 */
+    @Excel(name = "福利简介")
+    private String welfareProfile;
+
+    /** 福利内容 */
+    private String welfareContent;
+
+    /** 状态(0正常 1关闭) */
+    @Excel(name = "状态", readConverterExp = "0=正常,1=关闭")
+    private String status;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setWelfareTitle(String welfareTitle) 
+    {
+        this.welfareTitle = welfareTitle;
+    }
+
+    public String getWelfareTitle() 
+    {
+        return welfareTitle;
+    }
+    public void setWelfareProfile(String welfareProfile) 
+    {
+        this.welfareProfile = welfareProfile;
+    }
+
+    public String getWelfareProfile() 
+    {
+        return welfareProfile;
+    }
+    public void setWelfareContent(String welfareContent) 
+    {
+        this.welfareContent = welfareContent;
+    }
+
+    public String getWelfareContent() 
+    {
+        return welfareContent;
+    }
+    public void setStatus(String status) 
+    {
+        this.status = status;
+    }
+
+    public String getStatus() 
+    {
+        return status;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("welfareTitle", getWelfareTitle())
+            .append("welfareProfile", getWelfareProfile())
+            .append("welfareContent", getWelfareContent())
+            .append("status", getStatus())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UseGuideMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.UseGuide;
+
+/**
+ * 使用指南Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface UseGuideMapper 
+{
+    /**
+     * 查询使用指南
+     * 
+     * @param id 使用指南主键
+     * @return 使用指南
+     */
+    public UseGuide selectUseGuideById(Long id);
+
+    /**
+     * 查询使用指南列表
+     * 
+     * @param useGuide 使用指南
+     * @return 使用指南集合
+     */
+    public List<UseGuide> selectUseGuideList(UseGuide useGuide);
+
+    /**
+     * 新增使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    public int insertUseGuide(UseGuide useGuide);
+
+    /**
+     * 修改使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    public int updateUseGuide(UseGuide useGuide);
+
+    /**
+     * 删除使用指南
+     * 
+     * @param id 使用指南主键
+     * @return 结果
+     */
+    public int deleteUseGuideById(Long id);
+
+    /**
+     * 批量删除使用指南
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteUseGuideByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/WelfareGuideMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.WelfareGuide;
+
+/**
+ * 小程序党建福利信息Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface WelfareGuideMapper 
+{
+    /**
+     * 查询小程序党建福利信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 小程序党建福利信息
+     */
+    public WelfareGuide selectWelfareGuideById(Long id);
+
+    /**
+     * 查询小程序党建福利信息列表
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 小程序党建福利信息集合
+     */
+    public List<WelfareGuide> selectWelfareGuideList(WelfareGuide welfareGuide);
+
+    /**
+     * 新增小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    public int insertWelfareGuide(WelfareGuide welfareGuide);
+
+    /**
+     * 修改小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    public int updateWelfareGuide(WelfareGuide welfareGuide);
+
+    /**
+     * 删除小程序党建福利信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 结果
+     */
+    public int deleteWelfareGuideById(Long id);
+
+    /**
+     * 批量删除小程序党建福利信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteWelfareGuideByIds(Long[] ids);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IUseGuideService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.UseGuide;
+
+/**
+ * 使用指南Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface IUseGuideService 
+{
+    /**
+     * 查询使用指南
+     * 
+     * @param id 使用指南主键
+     * @return 使用指南
+     */
+    public UseGuide selectUseGuideById(Long id);
+
+    /**
+     * 查询使用指南列表
+     * 
+     * @param useGuide 使用指南
+     * @return 使用指南集合
+     */
+    public List<UseGuide> selectUseGuideList(UseGuide useGuide);
+
+    /**
+     * 新增使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    public int insertUseGuide(UseGuide useGuide);
+
+    /**
+     * 修改使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    public int updateUseGuide(UseGuide useGuide);
+
+    /**
+     * 批量删除使用指南
+     * 
+     * @param ids 需要删除的使用指南主键集合
+     * @return 结果
+     */
+    public int deleteUseGuideByIds(Long[] ids);
+
+    /**
+     * 删除使用指南信息
+     * 
+     * @param id 使用指南主键
+     * @return 结果
+     */
+    public int deleteUseGuideById(Long id);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IWelfareGuideService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.WelfareGuide;
+
+/**
+ * 小程序党建福利信息Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface IWelfareGuideService 
+{
+    /**
+     * 查询小程序党建福利信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 小程序党建福利信息
+     */
+    public WelfareGuide selectWelfareGuideById(Long id);
+
+    /**
+     * 查询小程序党建福利信息列表
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 小程序党建福利信息集合
+     */
+    public List<WelfareGuide> selectWelfareGuideList(WelfareGuide welfareGuide);
+
+    /**
+     * 新增小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    public int insertWelfareGuide(WelfareGuide welfareGuide);
+
+    /**
+     * 修改小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    public int updateWelfareGuide(WelfareGuide welfareGuide);
+
+    /**
+     * 批量删除小程序党建福利信息
+     * 
+     * @param ids 需要删除的小程序党建福利信息主键集合
+     * @return 结果
+     */
+    public int deleteWelfareGuideByIds(Long[] ids);
+
+    /**
+     * 删除小程序党建福利信息信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 结果
+     */
+    public int deleteWelfareGuideById(Long id);
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UseGuideServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.UseGuideMapper;
+import com.ruoyi.system.domain.UseGuide;
+import com.ruoyi.system.service.IUseGuideService;
+
+/**
+ * 使用指南Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@Service
+public class UseGuideServiceImpl implements IUseGuideService 
+{
+    @Autowired
+    private UseGuideMapper useGuideMapper;
+
+    /**
+     * 查询使用指南
+     * 
+     * @param id 使用指南主键
+     * @return 使用指南
+     */
+    @Override
+    public UseGuide selectUseGuideById(Long id)
+    {
+        return useGuideMapper.selectUseGuideById(id);
+    }
+
+    /**
+     * 查询使用指南列表
+     * 
+     * @param useGuide 使用指南
+     * @return 使用指南
+     */
+    @Override
+    public List<UseGuide> selectUseGuideList(UseGuide useGuide)
+    {
+        return useGuideMapper.selectUseGuideList(useGuide);
+    }
+
+    /**
+     * 新增使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    @Override
+    public int insertUseGuide(UseGuide useGuide)
+    {
+        useGuide.setCreateTime(DateUtils.getNowDate());
+        return useGuideMapper.insertUseGuide(useGuide);
+    }
+
+    /**
+     * 修改使用指南
+     * 
+     * @param useGuide 使用指南
+     * @return 结果
+     */
+    @Override
+    public int updateUseGuide(UseGuide useGuide)
+    {
+        useGuide.setUpdateTime(DateUtils.getNowDate());
+        return useGuideMapper.updateUseGuide(useGuide);
+    }
+
+    /**
+     * 批量删除使用指南
+     * 
+     * @param ids 需要删除的使用指南主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUseGuideByIds(Long[] ids)
+    {
+        return useGuideMapper.deleteUseGuideByIds(ids);
+    }
+
+    /**
+     * 删除使用指南信息
+     * 
+     * @param id 使用指南主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUseGuideById(Long id)
+    {
+        return useGuideMapper.deleteUseGuideById(id);
+    }
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WelfareGuideServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.WelfareGuideMapper;
+import com.ruoyi.system.domain.WelfareGuide;
+import com.ruoyi.system.service.IWelfareGuideService;
+
+/**
+ * 小程序党建福利信息Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@Service
+public class WelfareGuideServiceImpl implements IWelfareGuideService 
+{
+    @Autowired
+    private WelfareGuideMapper welfareGuideMapper;
+
+    /**
+     * 查询小程序党建福利信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 小程序党建福利信息
+     */
+    @Override
+    public WelfareGuide selectWelfareGuideById(Long id)
+    {
+        return welfareGuideMapper.selectWelfareGuideById(id);
+    }
+
+    /**
+     * 查询小程序党建福利信息列表
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 小程序党建福利信息
+     */
+    @Override
+    public List<WelfareGuide> selectWelfareGuideList(WelfareGuide welfareGuide)
+    {
+        return welfareGuideMapper.selectWelfareGuideList(welfareGuide);
+    }
+
+    /**
+     * 新增小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    @Override
+    public int insertWelfareGuide(WelfareGuide welfareGuide)
+    {
+        welfareGuide.setCreateTime(DateUtils.getNowDate());
+        return welfareGuideMapper.insertWelfareGuide(welfareGuide);
+    }
+
+    /**
+     * 修改小程序党建福利信息
+     * 
+     * @param welfareGuide 小程序党建福利信息
+     * @return 结果
+     */
+    @Override
+    public int updateWelfareGuide(WelfareGuide welfareGuide)
+    {
+        welfareGuide.setUpdateTime(DateUtils.getNowDate());
+        return welfareGuideMapper.updateWelfareGuide(welfareGuide);
+    }
+
+    /**
+     * 批量删除小程序党建福利信息
+     * 
+     * @param ids 需要删除的小程序党建福利信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWelfareGuideByIds(Long[] ids)
+    {
+        return welfareGuideMapper.deleteWelfareGuideByIds(ids);
+    }
+
+    /**
+     * 删除小程序党建福利信息信息
+     * 
+     * @param id 小程序党建福利信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteWelfareGuideById(Long id)
+    {
+        return welfareGuideMapper.deleteWelfareGuideById(id);
+    }
+}

+ 93 - 0
ruoyi-system/src/main/resources/mapper/system/UseGuideMapper.xml

@@ -0,0 +1,93 @@
+<?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.ruoyi.system.mapper.UseGuideMapper">
+    
+    <resultMap type="UseGuide" id="UseGuideResult">
+        <result property="id"    column="id"    />
+        <result property="useTitle"    column="use_title"    />
+        <result property="useProfile"    column="use_profile"    />
+        <result property="useContent"    column="use_content"    />
+        <result property="useVersion"    column="use_version"    />
+        <result property="status"    column="status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectUseGuideVo">
+        select id, use_title, use_profile, use_content, use_version, status, create_by, create_time, update_by, update_time, remark from use_guide
+    </sql>
+
+    <select id="selectUseGuideList" parameterType="UseGuide" resultMap="UseGuideResult">
+        <include refid="selectUseGuideVo"/>
+        <where>  
+            <if test="useVersion != null  and useVersion != ''"> and use_version = #{useVersion}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectUseGuideById" parameterType="Long" resultMap="UseGuideResult">
+        <include refid="selectUseGuideVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertUseGuide" parameterType="UseGuide" useGeneratedKeys="true" keyProperty="id">
+        insert into use_guide
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="useTitle != null">use_title,</if>
+            <if test="useProfile != null">use_profile,</if>
+            <if test="useContent != null">use_content,</if>
+            <if test="useVersion != null">use_version,</if>
+            <if test="status != null">status,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="useTitle != null">#{useTitle},</if>
+            <if test="useProfile != null">#{useProfile},</if>
+            <if test="useContent != null">#{useContent},</if>
+            <if test="useVersion != null">#{useVersion},</if>
+            <if test="status != null">#{status},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateUseGuide" parameterType="UseGuide">
+        update use_guide
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="useTitle != null">use_title = #{useTitle},</if>
+            <if test="useProfile != null">use_profile = #{useProfile},</if>
+            <if test="useContent != null">use_content = #{useContent},</if>
+            <if test="useVersion != null">use_version = #{useVersion},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteUseGuideById" parameterType="Long">
+        delete from use_guide where id = #{id}
+    </delete>
+
+    <delete id="deleteUseGuideByIds" parameterType="String">
+        delete from use_guide where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 89 - 0
ruoyi-system/src/main/resources/mapper/system/WelfareGuideMapper.xml

@@ -0,0 +1,89 @@
+<?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.ruoyi.system.mapper.WelfareGuideMapper">
+    
+    <resultMap type="WelfareGuide" id="WelfareGuideResult">
+        <result property="id"    column="id"    />
+        <result property="welfareTitle"    column="welfare_title"    />
+        <result property="welfareProfile"    column="welfare_profile"    />
+        <result property="welfareContent"    column="welfare_content"    />
+        <result property="status"    column="status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectWelfareGuideVo">
+        select id, welfare_title, welfare_profile, welfare_content, status, create_by, create_time, update_by, update_time, remark from welfare_guide
+    </sql>
+
+    <select id="selectWelfareGuideList" parameterType="WelfareGuide" resultMap="WelfareGuideResult">
+        <include refid="selectWelfareGuideVo"/>
+        <where>  
+            <if test="welfareTitle != null  and welfareTitle != ''"> and welfare_title = #{welfareTitle}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+        </where>
+    </select>
+    
+    <select id="selectWelfareGuideById" parameterType="Long" resultMap="WelfareGuideResult">
+        <include refid="selectWelfareGuideVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertWelfareGuide" parameterType="WelfareGuide" useGeneratedKeys="true" keyProperty="id">
+        insert into welfare_guide
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="welfareTitle != null">welfare_title,</if>
+            <if test="welfareProfile != null">welfare_profile,</if>
+            <if test="welfareContent != null">welfare_content,</if>
+            <if test="status != null">status,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="welfareTitle != null">#{welfareTitle},</if>
+            <if test="welfareProfile != null">#{welfareProfile},</if>
+            <if test="welfareContent != null">#{welfareContent},</if>
+            <if test="status != null">#{status},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateWelfareGuide" parameterType="WelfareGuide">
+        update welfare_guide
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="welfareTitle != null">welfare_title = #{welfareTitle},</if>
+            <if test="welfareProfile != null">welfare_profile = #{welfareProfile},</if>
+            <if test="welfareContent != null">welfare_content = #{welfareContent},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteWelfareGuideById" parameterType="Long">
+        delete from welfare_guide where id = #{id}
+    </delete>
+
+    <delete id="deleteWelfareGuideByIds" parameterType="String">
+        delete from welfare_guide where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>