Browse Source

小程序

LIVE_YE 2 năm trước cách đây
mục cha
commit
b18e18e79b
38 tập tin đã thay đổi với 424 bổ sung121 xóa
  1. 0 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UsageRecordController.java
  2. 15 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UseGuideController.java
  3. 17 8
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/WelfareGuideController.java
  4. 27 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  5. 16 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  6. 75 52
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wechat/AppletLoginController.java
  7. 5 1
      ruoyi-admin/src/main/resources/application-druid.yml
  8. 5 1
      ruoyi-admin/src/main/resources/application-prod.yml
  9. 28 0
      ruoyi-common/pom.xml
  10. 4 2
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletLoginForm.java
  11. 1 3
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletSessionDTO.java
  12. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/WechatEnum.java
  13. 31 17
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
  14. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/AppletDecryptDataUtil.java
  15. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64.java
  16. 5 7
      ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCodeSessionUtil.java
  17. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtils.java
  18. 2 2
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  19. 39 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
  20. 1 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
  21. 27 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/UsageRecord.java
  22. 3 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/InterestsTableMapper.java
  23. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SettledMerchantsMapper.java
  24. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/UseGuideMapper.java
  25. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/WelfareGuideMapper.java
  26. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISettledMerchantsService.java
  27. 4 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IUseGuideService.java
  28. 4 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IWelfareGuideService.java
  29. 1 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PolicyMenuServiceImpl.java
  30. 22 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SettledMerchantsServiceImpl.java
  31. 9 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsageRecordServiceImpl.java
  32. 12 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UseGuideServiceImpl.java
  33. 12 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WelfareGuideServiceImpl.java
  34. 6 1
      ruoyi-system/src/main/resources/mapper/system/InterestsTableMapper.xml
  35. 5 1
      ruoyi-system/src/main/resources/mapper/system/SettledMerchantsMapper.xml
  36. 24 1
      ruoyi-system/src/main/resources/mapper/system/UsageRecordMapper.xml
  37. 6 1
      ruoyi-system/src/main/resources/mapper/system/UseGuideMapper.xml
  38. 6 1
      ruoyi-system/src/main/resources/mapper/system/WelfareGuideMapper.xml

+ 0 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UsageRecordController.java

@@ -37,7 +37,6 @@ public class UsageRecordController extends BaseController
     /**
      * 查询使用记录列表
      */
-    @PreAuthorize("@ss.hasPermi('system:record:list')")
     @GetMapping("/list")
     public TableDataInfo list(UsageRecord usageRecord)
     {
@@ -62,7 +61,6 @@ public class UsageRecordController extends BaseController
     /**
      * 获取使用记录详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:record:query')")
     @GetMapping(value = "/{recordId}")
     public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
     {
@@ -72,7 +70,6 @@ public class UsageRecordController extends BaseController
     /**
      * 新增使用记录
      */
-    @PreAuthorize("@ss.hasPermi('system:record:add')")
     @Log(title = "使用记录", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody UsageRecord usageRecord)

+ 15 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/UseGuideController.java

@@ -1,4 +1,4 @@
-package com.ruoyi.system.controller;
+package com.ruoyi.web.controller.business;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
@@ -28,7 +28,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
  * @date 2022-07-14
  */
 @RestController
-@RequestMapping("/system/guide")
+@RequestMapping("/system/use")
 public class UseGuideController extends BaseController
 {
     @Autowired
@@ -37,7 +37,6 @@ public class UseGuideController extends BaseController
     /**
      * 查询使用指南列表
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:list')")
     @GetMapping("/list")
     public TableDataInfo list(UseGuide useGuide)
     {
@@ -49,7 +48,6 @@ public class UseGuideController extends BaseController
     /**
      * 导出使用指南列表
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:export')")
     @Log(title = "使用指南", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, UseGuide useGuide)
@@ -62,7 +60,6 @@ public class UseGuideController extends BaseController
     /**
      * 获取使用指南详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
@@ -72,7 +69,7 @@ public class UseGuideController extends BaseController
     /**
      * 新增使用指南
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:add')")
+    @PreAuthorize("@ss.hasPermi('system:use:add')")
     @Log(title = "使用指南", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody UseGuide useGuide)
@@ -83,7 +80,7 @@ public class UseGuideController extends BaseController
     /**
      * 修改使用指南
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:edit')")
+    @PreAuthorize("@ss.hasPermi('system:use:edit')")
     @Log(title = "使用指南", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody UseGuide useGuide)
@@ -94,11 +91,21 @@ public class UseGuideController extends BaseController
     /**
      * 删除使用指南
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:remove')")
+    @PreAuthorize("@ss.hasPermi('system:use:remove')")
     @Log(title = "使用指南", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
         return toAjax(useGuideService.deleteUseGuideByIds(ids));
     }
+
+    /**
+     * 获取最新的使用指南详细信息
+     */
+    @GetMapping(value = "/new")
+    public AjaxResult getInfoNew()
+    {
+        return useGuideService.getInfoNew();
+    }
+
 }

+ 17 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/WelfareGuideController.java

@@ -1,4 +1,4 @@
-package com.ruoyi.system.controller;
+package com.ruoyi.web.controller.business;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
@@ -28,7 +28,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
  * @date 2022-07-14
  */
 @RestController
-@RequestMapping("/system/guide")
+@RequestMapping("/system/welfare")
 public class WelfareGuideController extends BaseController
 {
     @Autowired
@@ -37,7 +37,7 @@ public class WelfareGuideController extends BaseController
     /**
      * 查询小程序党建福利信息列表
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:list')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:list')")
     @GetMapping("/list")
     public TableDataInfo list(WelfareGuide welfareGuide)
     {
@@ -49,7 +49,7 @@ public class WelfareGuideController extends BaseController
     /**
      * 导出小程序党建福利信息列表
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:export')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:export')")
     @Log(title = "小程序党建福利信息", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, WelfareGuide welfareGuide)
@@ -62,7 +62,7 @@ public class WelfareGuideController extends BaseController
     /**
      * 获取小程序党建福利信息详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:query')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
@@ -72,7 +72,7 @@ public class WelfareGuideController extends BaseController
     /**
      * 新增小程序党建福利信息
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:add')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:add')")
     @Log(title = "小程序党建福利信息", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody WelfareGuide welfareGuide)
@@ -83,7 +83,7 @@ public class WelfareGuideController extends BaseController
     /**
      * 修改小程序党建福利信息
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:edit')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:edit')")
     @Log(title = "小程序党建福利信息", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody WelfareGuide welfareGuide)
@@ -94,11 +94,20 @@ public class WelfareGuideController extends BaseController
     /**
      * 删除小程序党建福利信息
      */
-    @PreAuthorize("@ss.hasPermi('system:guide:remove')")
+    @PreAuthorize("@ss.hasPermi('system:welfare:remove')")
     @Log(title = "小程序党建福利信息", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
         return toAjax(welfareGuideService.deleteWelfareGuideByIds(ids));
     }
+
+    /**
+     * 获取最新的小程序党建福利详细信息
+     */
+    @GetMapping(value = "/new")
+    public AjaxResult getInfoNew()
+    {
+        return welfareGuideService.getInfoNew();
+    }
 }

+ 27 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -6,6 +6,9 @@ import java.util.Set;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.domain.SettledMerchants;
+import com.ruoyi.system.service.ISettledMerchantsService;
+import com.ruoyi.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.constant.Constants;
@@ -38,6 +41,12 @@ public class SysLoginController
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private ISysUserService userService;
+
+    @Autowired
+    private ISettledMerchantsService settledMerchantsService;
+
     /**
      * 登录方法
      * 
@@ -55,6 +64,24 @@ public class SysLoginController
         return ajax;
     }
 
+
+    @PostMapping("/loginApp")
+    public AjaxResult loginApp(@RequestBody LoginBody loginBody)
+    {
+        AjaxResult ajax = AjaxResult.success();
+        // 生成令牌
+        String token = loginService.loginApp(loginBody.getUsername(), loginBody.getPassword(),
+                loginBody.getUuid());
+        ajax.put(Constants.TOKEN, token);
+        //根据userName查询用户
+        SysUser user = userService.selectUserByUserName(loginBody.getUsername());
+        ajax.put("userId", user.getUserId());
+        //获取商家的信息
+        SettledMerchants settledMerchants = settledMerchantsService.selectByPhone(user.getUserName());
+        ajax.put("settledMerchants", settledMerchants);
+        return ajax;
+    }
+
     /**
      * 获取用户信息
      * 

+ 16 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -98,7 +98,6 @@ public class SysUserController extends BaseController
     /**
      * 根据用户编号获取详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:user:query')")
     @GetMapping(value = { "/", "/{userId}" })
     public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
     {
@@ -120,7 +119,6 @@ public class SysUserController extends BaseController
     /**
      * 新增用户
      */
-    @PreAuthorize("@ss.hasPermi('system:user:add')")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysUser user)
@@ -147,7 +145,6 @@ public class SysUserController extends BaseController
     /**
      * 修改用户
      */
-    @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody SysUser user)
@@ -186,13 +183,26 @@ public class SysUserController extends BaseController
     /**
      * 重置密码
      */
-    @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/resetPwd")
     public AjaxResult resetPwd(@RequestBody SysUser user)
     {
-        userService.checkUserAllowed(user);
-        userService.checkUserDataScope(user.getUserId());
+        //userService.checkUserAllowed(user);
+        //userService.checkUserDataScope(user.getUserId());
+        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+        user.setUpdateBy(getUsername());
+        return toAjax(userService.resetPwd(user));
+    }
+
+    /**
+     * 修改密码
+     */
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+    @PostMapping("/updatePwd")
+    public AjaxResult updatePwd(@RequestBody SysUser user)
+    {
+        //userService.checkUserAllowed(user);
+        //userService.checkUserDataScope(user.getUserId());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
         user.setUpdateBy(getUsername());
         return toAjax(userService.resetPwd(user));

+ 75 - 52
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wechat/AppletLoginController.java

@@ -1,30 +1,36 @@
-package com.boman.wechat.controller;
+package com.ruoyi.web.controller.wechat;
 
 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 com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.domain.UserEnvConstant;
+import com.ruoyi.common.core.domain.dto.AppletLoginForm;
+import com.ruoyi.common.core.domain.dto.AppletSessionDTO;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.core.redis.RedisService;
+import com.ruoyi.common.enums.UserStatus;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.ObjectUtils;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.WxCodeSessionUtil;
+import com.ruoyi.common.utils.ip.AddressUtils;
+import com.ruoyi.common.utils.ip.IpUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.domain.SettledMerchants;
+import com.ruoyi.system.service.ISettledMerchantsService;
+import com.ruoyi.system.service.ISysLogininforService;
+import com.ruoyi.system.service.ISysUserService;
+import eu.bitwalker.useragentutils.UserAgent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -41,7 +47,7 @@ import java.util.concurrent.TimeUnit;
  * @date 2021年09月08日 17:29
  **/
 @RestController
-@RequestMapping("applet")
+@RequestMapping("/applet")
 public class AppletLoginController {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(AppletLoginController.class);
@@ -59,43 +65,43 @@ public class AppletLoginController {
     @Resource
     private RedisService redisService;
     @Resource
-    private RemoteUserService remoteUserService;
+    private ISysUserService iSysUserService;
     @Resource
-    private RemoteLogService remoteLogService;
-    @Resource
-    private RemoteDeptService remoteDeptService;
+    private ISysLogininforService iSysLogininforService;
+    @Autowired
+    private ISettledMerchantsService settledMerchantsService;
+    @Autowired
+    private RedisCache redisCache;
+    @Autowired
+    private TokenService tokenService;
 
-    @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)){
+        if (StringUtils.isBlank(phoneNumber)) {
             throw new BaseException("对不起,未获取到手机号");
         }
-        SysUser user = remoteUserService.getByPhone(dto.getPhoneNumber());
-        if (user == null){
+        SysUser user = iSysUserService.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, remoteUserService: {}", iSysUserService);
+        //获取当前用户信息
+        LoginUser loginUser = new LoginUser();
+        loginUser.setUser(user);
         LOGGER.info("appletLogin, loginUser: {}", JSON.toJSONString(loginUser));
         return R.ok(createToken(loginUser));
     }
@@ -104,20 +110,36 @@ public class AppletLoginController {
         // 生成token
         String token = IdUtils.fastUUID();
         loginUser.setToken(token);
-        loginUser.setUserid(loginUser.getSysUser().getId());
-        loginUser.setUsername(loginUser.getSysUser().getUserName());
+        loginUser.setUserId(loginUser.getUser().getUserId());
+        loginUser.setUserName(loginUser.getUser().getUserName());
         loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
 
         JSONObject userEnv = packUserEnv(loginUser);
         loginUser.setUserEnv(userEnv);
-        loginUser.setLoginType("App");
+        //loginUser.setLoginType("App");
+
+        //设置用户代理信息
+        UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
+        String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
+        loginUser.setIpaddr(ip);
+        loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip));
+        loginUser.setBrowser(userAgent.getBrowser().getName());
+        loginUser.setOs(userAgent.getOperatingSystem().getName());
+
         refreshToken(loginUser);
 
+        Map<String, Object> claims = new HashMap<>();
+        claims.put(Constants.LOGIN_USER_KEY, token);
         // 保存或更新用户token
         Map<String, Object> map = new HashMap<String, Object>();
-        map.put("access_token", token);
+        map.put("access_token", tokenService.createToken(claims));
         map.put("expires_in", EXPIRE_TIME);
-        redisService.setCacheObject(ACCESS_TOKEN + token, loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
+        //redisService.setCacheObject(ACCESS_TOKEN + token, loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
+
+        //获取商家的信息
+        SettledMerchants settledMerchants = settledMerchantsService.selectByPhone(loginUser.getUser().getUserName());
+        map.put("settledMerchants", settledMerchants);
+        map.put("userId", loginUser.getUser().getUserId());
         return map;
     }
 
@@ -126,7 +148,8 @@ public class AppletLoginController {
         loginUser.setExpireTime(loginUser.getLoginTime() + EXPIRE_TIME * MILLIS_SECOND);
         // 根据uuid将loginUser缓存
         String userKey = getTokenKey(loginUser.getToken());
-        redisService.setCacheObject(userKey, loginUser, EXPIRE_TIME, TimeUnit.SECONDS);
+        redisCache.setCacheObject(userKey, loginUser, (int)EXPIRE_TIME, TimeUnit.SECONDS);
+
     }
 
     private String getTokenKey(String token) {
@@ -135,19 +158,19 @@ public class AppletLoginController {
 
     private JSONObject packUserEnv(LoginUser loginUser) {
         JSONObject userEnv = new JSONObject();
-        userEnv.put(UserEnvConstant.USER_ID, loginUser.getUserid());
+        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());
+        //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();
+       /* 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;
     }

+ 5 - 1
ruoyi-admin/src/main/resources/application-druid.yml

@@ -94,4 +94,8 @@ spring:
                 # 连接池的最大数据库连接数
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
-                max-wait: -1ms
+                max-wait: -1ms
+
+wx:
+    appId: wxb9b83f3c86545690
+    appSecret: 95adc6921a24a3c6cff55f2a1290f6f6

+ 5 - 1
ruoyi-admin/src/main/resources/application-prod.yml

@@ -95,4 +95,8 @@ spring:
                 # 连接池的最大数据库连接数
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
-                max-wait: -1ms
+                max-wait: -1ms
+
+wx:
+    appId: wxb9b83f3c86545690
+    appSecret: 95adc6921a24a3c6cff55f2a1290f6f6

+ 28 - 0
ruoyi-common/pom.xml

@@ -125,6 +125,34 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.4.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+            <version>1.56</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 4 - 2
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletLoginForm.java

@@ -1,7 +1,9 @@
-package com.boman.domain;
+package com.ruoyi.common.core.domain.dto;
+
+import com.ruoyi.common.core.domain.entity.SysUser;
 
 /**
- * @author shiqian
+ * @author
  * @date 2021年09月08日 17:15
  **/
 public class AppletLoginForm {

+ 1 - 3
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/AppletSessionDTO.java

@@ -1,6 +1,4 @@
-package com.boman.domain.dto;
-
-import lombok.Data;
+package com.ruoyi.common.core.domain.dto;
 
 
 /**

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

@@ -1,4 +1,4 @@
-package com.boman.domain;
+package com.ruoyi.common.core.domain.dto;
 
 public enum WechatEnum {
     /** 用户账号登录 */

+ 31 - 17
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java

@@ -5,8 +5,7 @@ package com.ruoyi.common.core.domain.model;
  * 
  * @author ruoyi
  */
-public class LoginBody
-{
+public class LoginBody {
     /**
      * 用户名
      */
@@ -17,16 +16,35 @@ public class LoginBody
      */
     private String password;
 
-    /**
-     * 验证码
-     */
     private String code;
 
+    private String logintype;
+
     /**
-     * 唯一标识
+     * 手机号
+     */
+    private String phone;
+    /**
+     * 扫码登录的uuid
      */
     private String uuid;
 
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
     public String getUsername()
     {
         return username;
@@ -47,23 +65,19 @@ public class LoginBody
         this.password = password;
     }
 
-    public String getCode()
-    {
+    public String getCode() {
         return code;
     }
 
-    public void setCode(String code)
-    {
+    public void setCode(String code) {
         this.code = code;
     }
 
-    public String getUuid()
-    {
-        return uuid;
+    public String getLogintype() {
+        return logintype;
     }
 
-    public void setUuid(String uuid)
-    {
-        this.uuid = uuid;
+    public void setLogintype(String logintype) {
+        this.logintype = logintype;
     }
-}
+}

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

@@ -1,4 +1,4 @@
-package com.boman.domain.utils;
+package com.ruoyi.common.utils;
 
 import com.alibaba.fastjson.JSONObject;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;

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

@@ -1,4 +1,4 @@
-package com.boman.domain.utils;
+package com.ruoyi.common.utils;
 
 /*
  * Copyright (C) 2010 The MobileSecurePay Project

+ 5 - 7
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxCodeSessionUtil.java

@@ -1,15 +1,14 @@
-package com.boman.wechat.utils;
+package com.ruoyi.common.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 com.ruoyi.common.core.domain.dto.AppletLoginForm;
+import com.ruoyi.common.core.domain.dto.AppletSessionDTO;
+import com.ruoyi.common.utils.http.HttpClientUtils;
 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;
 
 /**
@@ -17,7 +16,6 @@ import org.springframework.stereotype.Component;
  */
 @Component
 @Slf4j
-@RefreshScope
 public class WxCodeSessionUtil {
 
 

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

@@ -1,4 +1,4 @@
-package com.boman.wechat.utils;
+package com.ruoyi.common.utils.http;
 
 import org.apache.http.NameValuePair;
 import org.apache.http.client.config.RequestConfig;

+ 2 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register", "/captchaImage").anonymous()
+                .antMatchers("/login","/loginApp", "/applet/login","/register", "/captchaImage").anonymous()
                 .antMatchers(
                         HttpMethod.GET,
                         "/",
@@ -113,8 +113,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
                 .antMatchers("/system/h5/**").anonymous()
-                .antMatchers("/system/policy/**").anonymous()
                 .antMatchers("/scanCode/**").anonymous()
+                .antMatchers("/system/policy/listPolicyMenuApp").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 39 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java

@@ -93,6 +93,45 @@ public class SysLoginService
         return tokenService.createToken(loginUser);
     }
 
+
+    /**
+     * 登录验证小程序
+     *
+     * @param username 用户名
+     * @param password 密码
+     * @param uuid 唯一标识
+     * @return 结果
+     */
+    public String loginApp(String username, String password, String uuid)
+    {
+        // 用户验证
+        Authentication authentication = null;
+        try
+        {
+            // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
+            authentication = authenticationManager
+                    .authenticate(new UsernamePasswordAuthenticationToken(username, password));
+        }
+        catch (Exception e)
+        {
+            if (e instanceof BadCredentialsException)
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
+                throw new UserPasswordNotMatchException();
+            }
+            else
+            {
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
+                throw new ServiceException(e.getMessage());
+            }
+        }
+        AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
+        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
+        recordLoginInfo(loginUser.getUserId());
+        // 生成token
+        return tokenService.createToken(loginUser);
+    }
+
     /**
      * 校验验证码
      * 

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java

@@ -209,7 +209,7 @@ public class TokenService
      * @param claims 数据声明
      * @return 令牌
      */
-    private String createToken(Map<String, Object> claims)
+    public String createToken(Map<String, Object> claims)
     {
         String token = Jwts.builder()
                 .setClaims(claims)

+ 27 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UsageRecord.java

@@ -43,6 +43,10 @@ public class UsageRecord extends BaseEntity
     @Excel(name = "记录名称")
     private String recordName;
 
+    /** 核销人员等级 */
+    @Excel(name = "核销人员等级")
+    private String recordLevel;
+
     /** 显示顺序 */
     @Excel(name = "显示顺序")
     private Integer orderNum;
@@ -55,6 +59,11 @@ public class UsageRecord extends BaseEntity
     @Excel(name = "使用人id")
     private Long creditId;
 
+    /** 使用人姓名 */
+    @Excel(name = "使用人姓名")
+    private String creditName;
+
+
     /** 剩余次数 */
     @Excel(name = "剩余次数")
     private String surplusNum;
@@ -184,6 +193,22 @@ public class UsageRecord extends BaseEntity
         this.creditPhone = creditPhone;
     }
 
+    public String getRecordLevel() {
+        return recordLevel;
+    }
+
+    public void setRecordLevel(String recordLevel) {
+        this.recordLevel = recordLevel;
+    }
+
+    public String getCreditName() {
+        return creditName;
+    }
+
+    public void setCreditName(String creditName) {
+        this.creditName = creditName;
+    }
+
     @Override
     public String toString() {
         return "UsageRecord{" +
@@ -194,9 +219,11 @@ public class UsageRecord extends BaseEntity
                 ", recordYear='" + recordYear + '\'' +
                 ", recordType='" + recordType + '\'' +
                 ", recordName='" + recordName + '\'' +
+                ", recordLevel='" + recordLevel + '\'' +
                 ", orderNum=" + orderNum +
                 ", useNum='" + useNum + '\'' +
                 ", creditId=" + creditId +
+                ", creditName='" + creditName + '\'' +
                 ", surplusNum='" + surplusNum + '\'' +
                 ", creditPhone='" + creditPhone + '\'' +
                 ", children=" + children +

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/InterestsTableMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 import java.util.List;
 import com.ruoyi.system.domain.InterestsTable;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 商户权益记录Mapper接口
@@ -58,4 +59,6 @@ public interface InterestsTableMapper
      * @return 结果
      */
     public int deleteInterestsTableByIds(Long[] ids);
+
+    InterestsTable selectInterestsTable(@Param("businessId") Long businessId, @Param("policyId")Long policyId);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SettledMerchantsMapper.java

@@ -65,4 +65,6 @@ public interface SettledMerchantsMapper
      * @return 结果
      */
     public int deleteSettledMerchantsByBusinessIds(Long[] businessIds);
+
+    SettledMerchants selectByPhone(String businessPhone);
 }

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

@@ -58,4 +58,6 @@ public interface UseGuideMapper
      * @return 结果
      */
     public int deleteUseGuideByIds(Long[] ids);
+
+    UseGuide getInfoNew();
 }

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

@@ -58,4 +58,6 @@ public interface WelfareGuideMapper
      * @return 结果
      */
     public int deleteWelfareGuideByIds(Long[] ids);
+
+    WelfareGuide getInfoNew();
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISettledMerchantsService.java

@@ -67,4 +67,6 @@ public interface ISettledMerchantsService
      * @return 结果
      */
     public int deleteSettledMerchantsByBusinessId(Long businessId);
+
+    public SettledMerchants selectByPhone(String businessPhone);
 }

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

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.UseGuide;
 
 /**
@@ -58,4 +60,6 @@ public interface IUseGuideService
      * @return 结果
      */
     public int deleteUseGuideById(Long id);
+
+    AjaxResult getInfoNew();
 }

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

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.WelfareGuide;
 
 /**
@@ -58,4 +60,6 @@ public interface IWelfareGuideService
      * @return 结果
      */
     public int deleteWelfareGuideById(Long id);
+
+    AjaxResult getInfoNew();
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PolicyMenuServiceImpl.java

@@ -265,7 +265,7 @@ public class PolicyMenuServiceImpl implements IPolicyMenuService {
                     map.put("total",interestsNumberTable.getNumber());
                     //查询该用户已在该商家使用次数(按年来查询)
                     String year =DateUtils.getCurrentYear();
-                    int count = usageRecordMapper.selectUsageRecordByRecordNum(creditUser.getPhoneNum(),policyMenuZ.getMenuId(),year);
+                    int count = usageRecordMapper.selectUsageRecordByRecordNum(creditUser.getPhoneNum(),interestsNumberTable.getInterestsId(),year);
                     map.put("remaining",interestsNumberTable.getNumber()-count);
                 }else{
                     map.put("total","无限次");

+ 22 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SettledMerchantsServiceImpl.java

@@ -6,15 +6,18 @@ import java.util.List;
 import com.github.pagehelper.PageHelper;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.PolicyMenu;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.page.PageDomain;
 import com.ruoyi.common.core.page.TableSupport;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.ObjectUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.sql.SqlUtil;
 import com.ruoyi.system.domain.SettledMerchantsInterests;
 import com.ruoyi.system.mapper.PolicyMenuMapper;
 import com.ruoyi.system.mapper.SettledMerchantsInterestsMapper;
+import com.ruoyi.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.SettledMerchantsMapper;
@@ -37,6 +40,8 @@ public class SettledMerchantsServiceImpl implements ISettledMerchantsService
     private SettledMerchantsInterestsMapper settledMerchantsInterestsMapper;
     @Autowired
     private PolicyMenuMapper policyMenuMapper;
+    @Autowired
+    private ISysUserService userService;
 
     /**
      * 查询入驻商家
@@ -136,6 +141,18 @@ public class SettledMerchantsServiceImpl implements ISettledMerchantsService
             settledMerchantsInterests.setMenuName(policyMenu.getMenuName());
             childCount +=  settledMerchantsInterestsMapper.insertSettledMerchantsInterests(settledMerchantsInterests);
         }
+
+        if(childCount > 0){
+            //将入驻商家生成账号
+            SysUser user = new SysUser();
+            user.setUserName(settledMerchants.getBusinessPhone());
+            user.setNickName(settledMerchants.getBusinessName());
+            user.setPhonenumber(settledMerchants.getBusinessPhone());
+            user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
+            userService.insertUser(user);
+
+        }
+
         return childCount > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
@@ -191,6 +208,11 @@ public class SettledMerchantsServiceImpl implements ISettledMerchantsService
         return settledMerchantsMapper.deleteSettledMerchantsByBusinessId(businessId);
     }
 
+    @Override
+    public SettledMerchants selectByPhone(String businessPhone) {
+        return settledMerchantsMapper.selectByPhone(businessPhone);
+    }
+
     private void startPage() {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UsageRecordServiceImpl.java

@@ -10,8 +10,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.CreditUser;
 import com.ruoyi.system.domain.InterestsNumberTable;
+import com.ruoyi.system.domain.InterestsTable;
 import com.ruoyi.system.mapper.CreditUserMapper;
 import com.ruoyi.system.mapper.InterestsNumberTableMapper;
+import com.ruoyi.system.mapper.InterestsTableMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.UsageRecordMapper;
@@ -35,6 +37,8 @@ public class UsageRecordServiceImpl implements IUsageRecordService
     private CreditUserMapper creditUserMapper;
     @Autowired
     private InterestsNumberTableMapper interestsNumberTableMapper;
+    @Autowired
+    private InterestsTableMapper interestsTableMapper;
 
     /**
      * 查询使用记录
@@ -73,6 +77,9 @@ public class UsageRecordServiceImpl implements IUsageRecordService
         CreditUser creditUser = new CreditUser();
         creditUser.setPhoneNum(usageRecord.getCreditPhone());
         creditUser = creditUserMapper.selectCreditUser(creditUser);
+        //根据商家ID和分类id查询权益id
+        InterestsTable tnterestsTable = interestsTableMapper.selectInterestsTable(usageRecord.getBusinessId(),usageRecord.getPolicyId());
+        usageRecord.setInterestsId(tnterestsTable.getId());
         //查询用户权益等级对应的商家权益次数
         InterestsNumberTable interestsNumberTable = new InterestsNumberTable();
         interestsNumberTable.setInterestsId(usageRecord.getInterestsId());
@@ -88,6 +95,8 @@ public class UsageRecordServiceImpl implements IUsageRecordService
         usageRecord.setSurplusNum(String.valueOf(index));
         usageRecord.setRecordYear(year);
         usageRecord.setCreditId(creditUser.getId());
+        usageRecord.setRecordLevel(creditUser.getCreditLevel());
+        usageRecord.setCreditName(creditUser.getUserName());
         usageRecord.setCreateTime(DateUtils.getNowDate());
 
         int c = usageRecordMapper.insertUsageRecord(usageRecord);

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

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -93,4 +95,14 @@ public class UseGuideServiceImpl implements IUseGuideService
     {
         return useGuideMapper.deleteUseGuideById(id);
     }
+
+    @Override
+    public AjaxResult getInfoNew() {
+
+        UseGuide useGuide = useGuideMapper.getInfoNew();
+        if(useGuide == null){
+            useGuide = new UseGuide();
+        }
+        return AjaxResult.success("访问成功",useGuide);
+    }
 }

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

@@ -1,7 +1,10 @@
 package com.ruoyi.system.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.UseGuide;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.WelfareGuideMapper;
@@ -93,4 +96,13 @@ public class WelfareGuideServiceImpl implements IWelfareGuideService
     {
         return welfareGuideMapper.deleteWelfareGuideById(id);
     }
+
+    @Override
+    public AjaxResult getInfoNew() {
+        WelfareGuide welfareGuide = welfareGuideMapper.getInfoNew();
+        if(welfareGuide == null){
+            welfareGuide = new WelfareGuide();
+        }
+        return AjaxResult.success("访问成功",welfareGuide);
+    }
 }

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/InterestsTableMapper.xml

@@ -54,7 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join interests_number_table n on i.id = n.interests_id
         where i.id = #{id}
     </select>
-        
+    <select id="selectInterestsTable"  parameterType="InterestsTable" resultMap="InterestsTableResult">
+        <include refid="selectInterestsTableVo"></include>
+        where merchants_id = #{businessId} and interests_policy_id = #{policyId}
+        limit 1
+    </select>
+
     <insert id="insertInterestsTable" parameterType="InterestsTable" useGeneratedKeys="true" keyProperty="id">
         insert into interests_table
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 5 - 1
ruoyi-system/src/main/resources/mapper/system/SettledMerchantsMapper.xml

@@ -68,7 +68,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectSettledMerchantsVo"/>
         where policy_id = #{menuId} and status = '0' and visible = '0' order by order_num
     </select>
-        
+     <select id="selectByPhone" resultMap="SettledMerchantsResult">
+        <include refid="selectSettledMerchantsVo"/>
+        where business_phone = #{businessPhone} and status = '0' and visible = '0' order by order_num
+    </select>
+
     <insert id="insertSettledMerchants" parameterType="SettledMerchants" useGeneratedKeys="true" keyProperty="businessId">
         insert into settled_merchants
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 24 - 1
ruoyi-system/src/main/resources/mapper/system/UsageRecordMapper.xml

@@ -14,9 +14,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="recordYear"    column="record_year"    />
         <result property="recordType"    column="record_type"    />
         <result property="recordName"    column="record_name"    />
+
+        <result property="recordLevel"    column="record_level"    />
+
         <result property="orderNum"    column="order_num"    />
         <result property="useNum"    column="use_num"    />
         <result property="creditId"    column="credit_id"    />
+
+        <result property="creditName"    column="credit_name"    />
+
         <result property="creditPhone"    column="credit_phone"    />
         <result property="surplusNum"    column="surplus_num"    />
         <result property="createBy"    column="create_by"    />
@@ -27,13 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectUsageRecordVo">
-        select record_id,business_id,policy_id,interests_id, record_year, record_type, record_name, order_num, use_num, credit_id,credit_phone, surplus_num, create_by, create_time, update_by, update_time, remark from usage_record
+        select record_id,business_id,policy_id,interests_id, record_year, record_type, record_name,record_level, order_num, use_num, credit_id,credit_name,credit_phone, surplus_num, create_by, create_time, update_by, update_time, remark from usage_record
     </sql>
 
     <select id="selectUsageRecordList" parameterType="UsageRecord" resultMap="UsageRecordResult">
         <include refid="selectUsageRecordVo"/>
         <where>
             <if test="creditId != null  and creditId != ''"> and credit_id = #{creditId}</if>
+            <if test="creditName != null  and creditName != ''"> and credit_name = #{creditName}</if>
+            <if test="recordYear != null  and recordYear != ''"> and record_year = #{recordYear }</if>
+            <if test="createTime != null "> and create_time like concat( #{createTime}, '%')</if>
         </where>
     </select>
     
@@ -62,9 +71,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="recordYear != null and recordYear != ''">record_year,</if>
             <if test="recordType != null and recordType != ''">record_type,</if>
             <if test="recordName != null">record_name,</if>
+
+            <if test="recordLevel != null">record_level,</if>
+
             <if test="orderNum != null">order_num,</if>
             <if test="useNum != null">use_num,</if>
             <if test="creditId != null">credit_id,</if>
+            <if test="creditName != null">credit_name,</if>
             <if test="creditPhone != null">credit_phone,</if>
             <if test="surplusNum != null">surplus_num,</if>
             <if test="createBy != null">create_by,</if>
@@ -82,9 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="recordYear != null and recordYear != ''">#{recordYear},</if>
             <if test="recordType != null and recordType != ''">#{recordType},</if>
             <if test="recordName != null">#{recordName},</if>
+
+            <if test="recordLevel != null">#{recordLevel},</if>
+
             <if test="orderNum != null">#{orderNum},</if>
             <if test="useNum != null">#{useNum},</if>
             <if test="creditId != null">#{creditId},</if>
+            <if test="creditName != null">#{creditName},</if>
             <if test="creditPhone != null">#{creditPhone},</if>
             <if test="surplusNum != null">#{surplusNum},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -106,9 +123,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="recordYear != null and recordYear != ''">record_year = #{recordYear},</if>
             <if test="recordType != null and recordType != ''">record_type = #{recordType},</if>
             <if test="recordName != null">record_name = #{recordName},</if>
+
+            <if test="recordLevel != null">record_level = #{recordLevel},</if>
+
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="useNum != null">use_num = #{useNum},</if>
             <if test="creditId != null">credit_id = #{creditId},</if>
+
+            <if test="creditName != null">credit_name = #{creditName},</if>
+
             <if test="creditPhone != null">credit_phone = #{creditPhone},</if>
             <if test="surplusNum != null">surplus_num = #{surplusNum},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/UseGuideMapper.xml

@@ -34,7 +34,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectUseGuideVo"/>
         where id = #{id}
     </select>
-        
+    <select id="getInfoNew" parameterType="Long" resultMap="UseGuideResult">
+        <include refid="selectUseGuideVo"/>
+        order by update_time desc
+        limit 1
+    </select>
+
     <insert id="insertUseGuide" parameterType="UseGuide" useGeneratedKeys="true" keyProperty="id">
         insert into use_guide
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/WelfareGuideMapper.xml

@@ -33,7 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectWelfareGuideVo"/>
         where id = #{id}
     </select>
-        
+    <select id="getInfoNew" parameterType="Long" resultMap="WelfareGuideResult">
+        <include refid="selectWelfareGuideVo"/>
+        order by update_time desc
+        limit 1
+    </select>
+
     <insert id="insertWelfareGuide" parameterType="WelfareGuide" useGeneratedKeys="true" keyProperty="id">
         insert into welfare_guide
         <trim prefix="(" suffix=")" suffixOverrides=",">