From 8030ee5fe363b2902c7e8635b6b2f1dff64b9a04 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Fri, 11 Oct 2024 10:32:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/iocoder/yudao/common/SystemEnum.java | 44 +++++++ .../app/wechat/service/WechatService.java | 14 +++ .../service/impl/WechatServiceImpl.java | 74 +++++++++++ .../java/cn/iocoder/yudao/util/AESUtil.java | 61 +++++++++ .../app/controller/LoginController.java | 117 ++++-------------- .../app/service/WechatLoginService.java | 20 --- .../yudao/module/app/vo/WxLoginBody.java | 2 +- .../service/auth/AdminAuthServiceImpl.java | 2 +- 8 files changed, 220 insertions(+), 114 deletions(-) create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/common/SystemEnum.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/util/AESUtil.java delete mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/WechatLoginService.java diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/common/SystemEnum.java b/dl-module-base/src/main/java/cn/iocoder/yudao/common/SystemEnum.java new file mode 100644 index 00000000..40e75ac4 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/common/SystemEnum.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.common; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * Bpm 消息的枚举 + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum SystemEnum { + /** + * 维修系统 + */ + REPAIR("weixiu","维修系统"), + /** + * 救援系统 + */ + RESCUE("jiuyuan","救援系统"), + /** + * 驾校系统 + */ + SCHOOL("jiaxiao","驾校系统"), + /** + * 检测系统 + */ + INSPECTION("jiance","检测系统"), + /** + * 保险系统 + */ + INSURE("baoxian","保险系统"); + + /** + * 系统标识 + */ + private String code; + /** + * 系统名称 + */ + private String name; + +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/WechatService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/WechatService.java index d08add78..29280b72 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/WechatService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/WechatService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.app.wechat.service; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; /** * @author vinjor-m @@ -14,4 +15,17 @@ public interface WechatService { * @param map 参数 **/ CommonResult loginByOpenId(String code); + + /** + * 微信授权登录-未注册自动注册,已登录的返回用户信息- + * --目前维修系统使用,后续客户信息整合可以复用 + * @author vinjor-M + * @date 15:14 2024/10/9 + * @param sysCode 系统标识 + * @param decryptResult 微信授权解密密文 + * @param openId 微信openId + * @param inviteId 邀请者code + * @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO + **/ + AdminUserDO wechatLogin(String sysCode, String decryptResult, String openId, String inviteId); } diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/impl/WechatServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/impl/WechatServiceImpl.java index 3cc6460a..e683756a 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/impl/WechatServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/wechat/service/impl/WechatServiceImpl.java @@ -1,15 +1,22 @@ package cn.iocoder.yudao.module.app.wechat.service.impl; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.common.SystemEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.app.wechat.service.WechatService; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.WeChatLoginUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -31,6 +38,10 @@ public class WechatServiceImpl implements WechatService { private AdminUserApi adminUserApi; @Resource private AdminAuthService loginService; + @Resource + private AdminUserService userService; + @Resource + private PasswordEncoder passwordEncoder; /** * 微信自动登录 * @@ -88,4 +99,67 @@ public class WechatServiceImpl implements WechatService { throw new Exception(e.getMessage()); } } + + /** + * 微信授权登录-未注册自动注册,已登录的返回用户信息- + * --目前维修系统使用,后续客户信息整合可以复用 + * + * @param sysCode 系统标识 + * @param decryptResult 微信授权解密密文 + * @param openId 微信openId + * @param inviteId 邀请者code + * @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO + * @author vinjor-M + * @date 15:14 2024/10/9 + **/ + @Override + public AdminUserDO wechatLogin(String sysCode, String decryptResult, String openId, String inviteId) { + //字符串转json + JSONObject jsonObject = JSONUtil.parseObj(decryptResult); + String phoneNumber = jsonObject.getStr("phoneNumber"); + //根据手机号判断数据库中是否有该用户 + AdminUserDO wxUser = userService.getUserByMobileWithoutTenant(phoneNumber); + //如果查不到,则新增,查到了,则更新 + UserSaveReqVO user = new UserSaveReqVO(); + if (null == wxUser) { + // 直接新注册一个账号 + user.setUsername(phoneNumber); + user.setNickname(phoneNumber); + user.setMobile(phoneNumber); + user.setPassword(passwordEncoder.encode("123456")); + //TODO 客户后期没有租户ID + user.setTenantId(180L); + user.setDeptId(100L); + }else { + //更新 + user.setId(wxUser.getId()); + } + //设置微信openId + if(SystemEnum.REPAIR.getCode().equals(sysCode)){ + //维修业务系统 + user.setRepairOpenId(openId); + }else if(SystemEnum.INSPECTION.getCode().equals(sysCode)){ + //检测业务系统 + }else if(SystemEnum.SCHOOL.getCode().equals(sysCode)){ + //驾校业务系统 + }else if(SystemEnum.RESCUE.getCode().equals(sysCode)){ + //救援业务系统 + }else if(SystemEnum.INSURE.getCode().equals(sysCode)){ + //保险业务系统 + }else { + //默认维修业务 + user.setRepairOpenId(openId); + } + if(null!=user.getId()){ + //更新 + userService.updateUser(user); + }else{ + //插入 + Long uid = userService.createUser(user); + wxUser = new AdminUserDO(); + wxUser.setId(uid); + wxUser.setUsername(phoneNumber); + } + return wxUser; + } } diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/util/AESUtil.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/AESUtil.java new file mode 100644 index 00000000..d5f236df --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/AESUtil.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.util; + +import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; +import org.springframework.stereotype.Component; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.spec.AlgorithmParameterSpec; +import java.util.Arrays; + +/** + * AES加解密util + * @author vinjor-M + * @date 17:41 2024/10/10 +**/ +@Component +public class AESUtil { + /** + * AES解密 + */ + public String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{ + // 转化为字节数组 + byte[] key = Base64.decode(sessionKey); + byte[] iv = Base64.decode(encryptedIv); + byte[] encData = Base64.decode(encryptedData); + // 如果密钥不足16位,那么就补足 + int base =16; + if (key.length % base !=0) { + int groups = key.length / base +(key.length % base != 0 ? 1 : 0); + byte[] temp = new byte[groups * base]; + Arrays.fill(temp,(byte) 0); + System.arraycopy(key,0,temp,0,key.length); + key = temp; + } + // 如果初始向量不足16位,也补足 + if (iv.length % base !=0) { + int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0); + byte[] temp = new byte[groups * base]; + Arrays.fill(temp,(byte) 0); + System.arraycopy(iv,0,temp,0,iv.length); + iv = temp; + } + + AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv); + String resultStr = null; + + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(key,"AES"); + cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec); + resultStr = new String(cipher.doFinal(encData),"UTF-8"); + } catch (Exception e){ +// logger.info("解析错误"); + e.printStackTrace(); + } + + // 解析加密后的字符串 + return resultStr; + } +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/LoginController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/LoginController.java index c1ba316c..e3ed1641 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/LoginController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/LoginController.java @@ -1,62 +1,34 @@ package cn.iocoder.yudao.module.app.controller; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.common.CommonErrorCodeConstants; +import cn.iocoder.yudao.common.SystemEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.security.config.SecurityProperties; -import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; - import cn.iocoder.yudao.module.app.vo.WxLoginBody; -import cn.iocoder.yudao.module.custom.entity.CustomerMain; -import cn.iocoder.yudao.module.custom.service.CustomerMainService; -import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; -import cn.iocoder.yudao.module.system.api.dict.DictDataApi; -import cn.iocoder.yudao.module.system.api.permission.PermissionApi; -import cn.iocoder.yudao.module.system.api.permission.RoleApi; -import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; -import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO; +import cn.iocoder.yudao.module.app.wechat.service.WechatService; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO; -import cn.iocoder.yudao.module.system.controller.admin.user.LoginBody; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; -import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; -import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; -import cn.iocoder.yudao.module.system.service.permission.MenuService; -import cn.iocoder.yudao.module.system.service.permission.RoleService; -import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import cn.iocoder.yudao.util.AESUtil; import cn.iocoder.yudao.util.WechatPayConfig; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import io.swagger.v3.oas.annotations.Operation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; +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 org.springframework.web.client.RestTemplate; - import javax.annotation.Resource; -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; import javax.servlet.http.HttpServletRequest; -import java.security.spec.AlgorithmParameterSpec; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.*; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** * 登录验证 @@ -76,11 +48,20 @@ public class LoginController { @Resource private SecurityProperties securityProperties; @Autowired - private CustomerMainService customerMainService; + private WechatService wechatService; + @Autowired + private AESUtil aesUtil; + /** + * 微信授权登录 + * @author vinjor-M + * @date 17:43 2024/10/10 + * @param wxLoginBody 请求体 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ @PostMapping("/wxLogin") @TenantIgnore - public CommonResult wxLogin(@RequestBody WxLoginBody wxLoginBody) { + public CommonResult wxLogin(@RequestBody WxLoginBody wxLoginBody) { String code = wxLoginBody.getCode(); //秘钥 String encryptedIv = wxLoginBody.getEncryptedIv(); @@ -97,29 +78,25 @@ public class LoginController { String decryptResult = ""; try { //如果没有绑定微信开放平台,解析结果是没有unionid的。 - decryptResult = decrypt(sessionKey, encryptedIv, encryptedData); + decryptResult = aesUtil.decrypt(sessionKey, encryptedIv, encryptedData); } catch (Exception e) { e.printStackTrace(); return error(500, "微信登录失败!"); } - if (StringUtils.hasText(decryptResult)) { //如果解析成功,获取token - AuthLoginRespVO loginVO = loginService.wxLoginRepair(decryptResult,openId,wxLoginBody.getInviteId()); + //查用户(未注册的话自动注册) + AdminUserDO adminUserDO = wechatService.wechatLogin(SystemEnum.REPAIR.getCode(),decryptResult,openId,wxLoginBody.getInviteId()); + //登录生成token + AuthLoginRespVO loginVO = loginService.wxLoginByUserId(adminUserDO.getId(),adminUserDO.getUsername()); Map map = new HashMap<>(); map.put("token", loginVO.getAccessToken()); - //查会员表里是否有数据 - CustomerMain customerMain = customerMainService.getCustomerByUserId(loginVO.getUserId()); - map.put("ifNeedFill", null==customerMain); return success(map); } else { return error(500, "微信登录失败!"); } } - - - @PostMapping("/logout") @Operation(summary = "登出系统") public CommonResult logout(HttpServletRequest request) { @@ -130,48 +107,4 @@ public class LoginController { } return success(true); } - - /** - * AES解密 - */ - private String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{ - // 转化为字节数组 - byte[] key = Base64.decode(sessionKey); - byte[] iv = Base64.decode(encryptedIv); - byte[] encData = Base64.decode(encryptedData); - // 如果密钥不足16位,那么就补足 - int base =16; - if (key.length % base !=0) { - int groups = key.length / base +(key.length % base != 0 ? 1 : 0); - byte[] temp = new byte[groups * base]; - Arrays.fill(temp,(byte) 0); - System.arraycopy(key,0,temp,0,key.length); - key = temp; - } - // 如果初始向量不足16位,也补足 - if (iv.length % base !=0) { - int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0); - byte[] temp = new byte[groups * base]; - Arrays.fill(temp,(byte) 0); - System.arraycopy(iv,0,temp,0,iv.length); - iv = temp; - } - - AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv); - String resultStr = null; - - try { - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - SecretKeySpec keySpec = new SecretKeySpec(key,"AES"); - cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec); - resultStr = new String(cipher.doFinal(encData),"UTF-8"); - } catch (Exception e){ -// logger.info("解析错误"); - e.printStackTrace(); - } - - // 解析加密后的字符串 - return resultStr; - } - } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/WechatLoginService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/WechatLoginService.java deleted file mode 100644 index 13fc339b..00000000 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/WechatLoginService.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.yudao.module.app.service; - -import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; - -/** - * @author vinjor-m - * @description 维修模块微信登录逻辑 - **/ -public interface WechatLoginService { - /** - * 维修系统-微信授权登录-未注册自动注册 - * @author vinjor-M - * @date 15:14 2024/10/9 - * @param decryptResult TODO - * @param openId TODO - * @param inviteId TODO - * @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO - **/ - AdminUserDO wechatLogin(String decryptResult,String openId,String inviteId); -} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/vo/WxLoginBody.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/vo/WxLoginBody.java index 0d219ff4..d99b2c38 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/vo/WxLoginBody.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/vo/WxLoginBody.java @@ -20,5 +20,5 @@ public class WxLoginBody { private String encryptedData; //邀请码 - private Long inviteId; + private String inviteId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index cdd01132..5886d2eb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -408,7 +408,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { @Override public AuthLoginRespVO wxLoginByUserId(Long userId, String userName) { // 生成token - return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_USERNAME); + return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_SOCIAL); } /** From 1ed5310e227a36bc5161085493e9dd0555a96639 Mon Sep 17 00:00:00 2001 From: 13405411873 <1994398261@qq.com> Date: Fri, 11 Oct 2024 00:13:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit e1b00b5ac6d9606bfeace2db066f3983828e2cc8) --- .../InspectionEquInfoController.java | 15 ++++++----- .../controller/PartnerOwnController.java | 26 +++++++++---------- .../mapper/AppInspectionPartnerMapper.java | 4 +-- .../mapper/InspectionAppointmentMapper.java | 3 ++- .../mapper/InspectionEquInfoMapper.java | 5 +++- .../service/AppInspectionPartnerService.java | 6 ++--- .../IInspectionAppointmentService.java | 3 ++- .../service/IInspectionEquInfoService.java | 4 ++- .../impl/AppInspectionPartnerServiceImpl.java | 9 +++---- .../InspectionAppointmentServiceImpl.java | 3 ++- .../impl/InspectionEquInfoServiceImpl.java | 6 +++-- .../module/payment/entity/OrderInfo.java | 14 ++++------ .../service/impl/OrderInfoServiceImpl.java | 2 +- .../inspection/AppInspectionPartnerMapper.xml | 3 +-- .../inspection/InspectionEquInfoMapper.xml | 9 ++++--- yudao-dependencies/pom.xml | 2 +- .../service/auth/AdminAuthServiceImpl.java | 2 +- 17 files changed, 62 insertions(+), 54 deletions(-) diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java index a7a5b03b..e3d691e3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionEquInfoController.java @@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService; import cn.iocoder.yudao.module.shop.entity.ShopMallPartners; import cn.iocoder.yudao.util.ExcelUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -39,11 +41,11 @@ public class InspectionEquInfoController extends BaseController * 查询equInfo列表 */ @GetMapping("/list") - public TableDataInfo list(InspectionEquInfo inspectionEquInfo) throws Exception { + public CommonResult list(Integer pageNum,Integer pageSize,InspectionEquInfo inspectionEquInfo) throws Exception { - startPage(); - List list = inspectionEquInfoService.selectInspectionEquInfoList(inspectionEquInfo); - return getDataTable(list); + Page page =new Page(pageNum,pageSize); + IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo); + return success(list); } /** @@ -52,9 +54,10 @@ public class InspectionEquInfoController extends BaseController @PostMapping("/export") public void export(HttpServletResponse response, InspectionEquInfo inspectionEquInfo) { - List list = inspectionEquInfoService.selectInspectionEquInfoList(inspectionEquInfo); + Page page =new Page(1,100000); + IPage list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo); ExcelUtil util = new ExcelUtil(InspectionEquInfo.class); - util.exportExcel(response, list, "equInfo数据"); + util.exportExcel(response, list.getRecords(), "equInfo数据"); } /** diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java index 7f852a34..ec92bbe3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java @@ -347,14 +347,14 @@ public class PartnerOwnController extends BaseController { //获取检测的数据 @GetMapping("/inspectionList") - public TableDataInfo inspectionList(Long partnerId,String status,String carNum,Integer pageSize,Integer pageNum) throws Exception { + public CommonResult inspectionList(Long partnerId,String status,String carNum,Integer pageSize,Integer pageNum) throws Exception { ShopMallPartners partners = partnerList.shopInfo(); if (!partnerId.equals(partners.getPartnerId())){ return null; } Page page = new Page<>(pageNum,pageSize); - List inspectionInfos = partnerList.inspectionList(page,partnerId, status, carNum); - return getDataTable(inspectionInfos); + IPage inspectionInfos = partnerList.inspectionList(page,partnerId, status, carNum); + return success(inspectionInfos); } //获取检测的详细信息 @@ -365,7 +365,7 @@ public class PartnerOwnController extends BaseController { //获取检测的数据 @GetMapping("/workerInspectionList") - public TableDataInfo workerInspectionList(Long partnerId,String status,String searchValue,Integer pageSize,Integer pageNum) { + public CommonResult workerInspectionList(Long partnerId,String status,String searchValue,Integer pageSize,Integer pageNum) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); queryWrapper.eq(PartnerWorker::getUserId,user.getId()).eq(PartnerWorker::getPartnerId,partnerId); @@ -374,8 +374,8 @@ public class PartnerOwnController extends BaseController { return null; } Page page = new Page<>(pageNum,pageSize); - List inspectionInfos = partnerList.inspectionList(page,partnerId, status, searchValue); - return getDataTable(inspectionInfos); + IPage inspectionInfos = partnerList.inspectionList(page,partnerId, status, searchValue); + return success(inspectionInfos); } //增加检测步骤信息 @PostMapping("/addStepInfo") @@ -397,28 +397,28 @@ public class PartnerOwnController extends BaseController { } //获取到店预约的数据 @GetMapping("/getAppointmentList") - public TableDataInfo getAppointmentList(Long partnerId,String phoneNum,Integer pageSize,Integer pageNum) { + public CommonResult getAppointmentList(Long partnerId,String phoneNum,Integer pageSize,Integer pageNum) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = partnerList.getById(partnerId); if (!partnersTmp.getUserId().equals(user.getId())){ return null; } Page page = new Page<>(pageNum,pageSize); - List appointments = partnerList.getAppointmentList(page,partnerId,phoneNum); - return getDataTable(appointments); + IPage appointments = partnerList.getAppointmentList(page,partnerId,phoneNum); + return success(appointments); } //获取上门取车数据 @GetMapping("/getPickCarList") - public TableDataInfo getPickCarList(Long partnerId,String phoneNum,String pickStatus,Integer pageSize,Integer pageNum) { + public CommonResult getPickCarList(Long partnerId,String phoneNum,String pickStatus,Integer pageSize,Integer pageNum) { LoginUser user = SecurityFrameworkUtils.getLoginUser(); ShopMallPartners partnersTmp = partnerList.getById(partnerId); if (!partnersTmp.getUserId().equals(user.getId())){ return null; } - PageHelper.startPage(pageNum,pageSize); - List pickCarList = partnerList.getPickCarList(partnerId,phoneNum,pickStatus); - return getDataTable(pickCarList); + Page page = new Page<>(pageNum,pageSize); + IPage pickCarList = partnerList.getPickCarList(page,partnerId,phoneNum,pickStatus); + return success(pickCarList); } //获取上门取车详情页 diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java index b0e09768..61e2716d 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/AppInspectionPartnerMapper.java @@ -36,10 +36,10 @@ public interface AppInspectionPartnerMapper extends BaseMapper List orderList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum,@Param("title") String title); List getWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum); IPage pageWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum,Page page); - List inspectionList(Page page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum); + IPage inspectionList(Page page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum); List workerInspectionList(@Param("workerId")Long workerId,@Param("status") String status, @Param("searchValue")String searchValue); List validationList(@Param("partnerId") Long partnerId, @Param("searchValue") String searchValue); - List getPickCarList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus); + IPage getPickCarList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus); List getPickCarListOfWorker(@Param("workerId") Long workerId, @Param("phoneNum") String phoneNum); List chartInfoAmount(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("partnerId")Long partnerId); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java index d5af610f..ca85cfa0 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -64,7 +65,7 @@ public interface InspectionAppointmentMapper extends BaseMapper getAppointmentList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum); + IPage getAppointmentList(Page page, @Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum); List getAppointmentOwn(@Param("userId") Long userId); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionEquInfoMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionEquInfoMapper.java index ebfca915..ce5aac7b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionEquInfoMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionEquInfoMapper.java @@ -4,7 +4,10 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * equInfoMapper接口 @@ -29,6 +32,6 @@ public interface InspectionEquInfoMapper extends BaseMapper * @param inspectionEquInfo equInfo * @return equInfo集合 */ - public List selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo); + public IPage selectInspectionEquInfoList(Page page, @Param("inspectionEquInfo") InspectionEquInfo inspectionEquInfo); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java index 1a607599..d6efc30b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java @@ -69,20 +69,20 @@ public interface AppInspectionPartnerService extends IService void delWorker(Long partnerId,Long workId); - List inspectionList(Page page,Long partnerId, String status, String carNum); + IPage inspectionList(Page page,Long partnerId, String status, String carNum); InspectionInfoVo inspectionDetail(Long inspectionInfoId); List workerInspectionList(Long partnerId,String status,String searchValue); void addStepInfo(InspectionStepInfo stepInfo); void stopInspection(InspectionInfo info) throws Exception; void makeCertOk(Long inspectionId); - List getAppointmentList(Page page,Long partnerId,String phoneNum); + IPage getAppointmentList(Page page,Long partnerId,String phoneNum); List validationList(Long partnerId,String searchValue); void sendCoupon(ShopCouponTemplate template) throws Exception; List listCoupon(Long partnerId,String searchValue); void delCoupon(Long partnerId,Long id); void designatePickCarWorker(Long pickCarId,Long workerId); - List getPickCarList(Long partnerId, String phoneNum,String pickStatus); + IPage getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus); InspectionPickCar getPickCarDetail(Long dataId); List getPickCarListOfWorker(Long workerId, String phoneNum); JSONObject vehicleLicenseOCR(String imagePath) throws Exception; diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java index 3ad5e154..88f040c9 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.inspection.service; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment; @@ -73,6 +74,6 @@ public interface IInspectionAppointmentService extends IService getAppointmentList(Page page,Long partnerId, String phoneNum); + public IPage getAppointmentList(Page page, Long partnerId, String phoneNum); List getAppointmentOwn(); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java index 971f1f6d..e8d157b7 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionEquInfoService.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.inspection.service; import java.util.List; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo; @@ -27,7 +29,7 @@ public interface IInspectionEquInfoService extends IService * @param inspectionEquInfo equInfo * @return equInfo集合 */ - public List selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo); + public IPage selectInspectionEquInfoList(Page page,InspectionEquInfo inspectionEquInfo); /** * 新增equInfo diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java index f6721005..25f890c8 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java @@ -239,7 +239,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl inspectionList(Page page,Long partnerId, String status, String carNum) { + public IPage inspectionList(Page page,Long partnerId, String status, String carNum) { return baseMapper.inspectionList(page,partnerId,status,carNum); } @@ -1243,7 +1242,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getAppointmentList(Page page,Long partnerId,String phoneNum) { + public IPage getAppointmentList(Page page,Long partnerId,String phoneNum) { return appointmentService.getAppointmentList(page,partnerId,phoneNum); } @@ -1311,9 +1310,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getPickCarList(Long partnerId, String phoneNum,String pickStatus) { + public IPage getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus) { - return baseMapper.getPickCarList(partnerId,phoneNum,pickStatus); + return baseMapper.getPickCarList(page,partnerId,phoneNum,pickStatus); } @Override diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java index aa52b592..eb41970f 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionAppointmentServiceImpl.java @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.SendSmsUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.iocoder.yudao.util.DateUtils; @@ -347,7 +348,7 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl getAppointmentList(Page page,Long partnerId, String phoneNum) { + public IPage getAppointmentList(Page page, Long partnerId, String phoneNum) { return baseMapper.getAppointmentList(page,partnerId,phoneNum); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java index 54c7d741..664fc4d2 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionEquInfoServiceImpl.java @@ -7,6 +7,8 @@ import java.util.List; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.iocoder.yudao.util.DateUtils; import cn.iocoder.yudao.module.inspection.entity.WarnMessage; @@ -48,9 +50,9 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo) + public IPage selectInspectionEquInfoList(Page page,InspectionEquInfo inspectionEquInfo) { - return baseMapper.selectInspectionEquInfoList(inspectionEquInfo); + return baseMapper.selectInspectionEquInfoList(page,inspectionEquInfo); } /** diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java index ddedb438..4392c762 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/entity/OrderInfo.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.payment.entity; +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -14,7 +15,7 @@ import java.util.Date; * @since 2023-07-24 18:30:28 */ @Data -public class OrderInfo { +public class OrderInfo extends TenantBaseDO { //订单id private Long id; private String transactionId; @@ -63,16 +64,11 @@ public class OrderInfo { private Integer commentStar; //订单类型 private String orderType; - //创建时间 - private Date createTime; - //创建人id - private Long creator; + + //创建人所在部门 private Long deptId; - //更新时间 - private Date updateTime; - //更新人id - private Integer updater; + //积分充值的金额 @TableField(exist = false) private Long balanceCz; diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java index 7133e0c3..c6c9208d 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/payment/service/impl/OrderInfoServiceImpl.java @@ -278,7 +278,7 @@ public class OrderInfoServiceImpl extends ServiceImpl select * from inspection_equ_info - and equ_name like concat('%', #{equName}, '%') - and equ_model like concat('%', #{equModel}, '%') - and equ_number like concat('%', #{equNumber}, '%') - and next_check_time between #{params.beginNextCheckTime} and #{params.endNextCheckTime} + and equ_name like concat('%', #{inspectionEquInfo.equName}, '%') + and equ_model like concat('%', #{inspectionEquInfo.equModel}, '%') + and equ_number like concat('%', #{inspectionEquInfo.equNumber}, '%') + + and next_check_time between #{inspectionEquInfo.params.beginNextCheckTime} and #{inspectionEquInfo.params.endNextCheckTime} diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 4f823ba4..096bfa19 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -26,7 +26,7 @@ 1.2.23 3.5.16 3.5.7 - 2.1.0 + 1.4.6 4.9 3.5.7 4.3.1 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index 5886d2eb..bd91cbad 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -375,7 +375,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { List jcyh = roleService.getRoleListByCodes(Collections.singletonList("jcyh")); Set ids = new HashSet<>(); ids.add(jcyh.get(0).getId()); - permissionService.assignUserRole(user.getId(),ids); + permissionService.assignUserRole(uid,ids); }else { //更新 user.setId(wxUser.getId());