diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/car/controller/AppCarMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/car/controller/AppCarMainController.java index fd37be12..7d125dd7 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/car/controller/AppCarMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/car/controller/AppCarMainController.java @@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -73,7 +72,6 @@ public class AppCarMainController { @Operation(summary = "获得车辆信息") // @PreAuthorize("@ss.hasPermission('base:car-main:query')") public CommonResult> getCarMain() { - List carMain = carMainService.getCarMain(); return CommonResult.success(carMain); } diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/UserCarController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/UserCarController.java deleted file mode 100644 index 06d28ae7..00000000 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/UserCarController.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.yudao.module.custom.controller.admin; - -import cn.iocoder.yudao.module.custom.service.UserCarService; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -@Tag(name = "管理后台 - 用户车辆信息表--用户个人录入的") -@RestController -@RequestMapping("/base/user-car") -@Validated -public class UserCarController { - - @Resource - private UserCarService userCarService; - - -} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/app/UserCarController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/app/UserCarController.java new file mode 100644 index 00000000..466ae2da --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/app/UserCarController.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.custom.controller.app; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.custom.service.UserCarService; +import cn.iocoder.yudao.module.custom.vo.UserCarVO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@Tag(name = "管理后台 - 用户车辆信息表--用户个人录入的") +@RestController +@RequestMapping("/base/user-car") +@Validated +public class UserCarController { + + @Resource + private UserCarService userCarService; + + /** + * 查询当前登录用户的所有车辆 + * @author vinjor-M + * @date 14:28 2024/10/11 + **/ + @GetMapping("/getMyCar") + @Operation(summary = "查询个人车辆列表") + public CommonResult getMyCar() { + return CommonResult.success(userCarService.getMyCar()); + } + + /** + * 创建或更新车辆信息 + * + * @param userCarVO 车辆信息 + */ + @PostMapping("/createOrUpdate") + @Operation(summary = "创建或更新车辆信息") + public CommonResult createOrUpdate(@RequestBody UserCarVO userCarVO) { + return userCarService.createOrUpdate(userCarVO); + } + + /** + * OCR识别 + * @author vinjor-M + * @date 16:58 2024/10/11 + * @param imagePath 公网图片地址 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @PostMapping("/vehicleLicenseOCR") + public CommonResult vehicleLicenseOCR(@RequestBody String imagePath) throws Exception { + return CommonResult.success(userCarService.vehicleLicenseOCR(imagePath)); + } + + /** + * 删除车辆 + * @author vinjor-M + * @date 14:28 2024/10/11 + **/ + @DeleteMapping("/delById") + @Operation(summary = "删除车辆") + public CommonResult delById(String id) { + return CommonResult.success(userCarService.removeById(id)); + } +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/UserCar.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/UserCar.java index e5dbe0db..ab6d12d8 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/UserCar.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/UserCar.java @@ -1,20 +1,12 @@ package cn.iocoder.yudao.module.custom.entity; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.util.Date; /** * 用户车辆信息表--用户个人录入的 DO @@ -35,6 +27,10 @@ public class UserCar extends BaseDO { */ @TableId(type = IdType.ASSIGN_UUID) private String id; + /** + * 用户ID + */ + private Long userId; /** * 发动机号码 */ @@ -70,11 +66,11 @@ public class UserCar extends BaseDO { /** * 车辆注册日期 */ - private LocalDateTime carRegisterDate; + private Date carRegisterDate; /** * 保养日期 */ - private LocalDateTime maintenanceDate; + private Date maintenanceDate; /** * 保养里程 */ @@ -82,19 +78,19 @@ public class UserCar extends BaseDO { /** * 年检日期 */ - private LocalDateTime inspectionDate; + private Date inspectionDate; /** * 保险日期 */ - private LocalDateTime insuranceDate; + private Date insuranceDate; /** * 二级维护时间 */ - private LocalDateTime checkDate; + private Date checkDate; /** * 下次保养日期 */ - private LocalDateTime nextMaintenanceDate; + private Date nextMaintenanceDate; /** * 下次保养里程 */ @@ -102,15 +98,15 @@ public class UserCar extends BaseDO { /** * 下次年检日期 */ - private LocalDateTime nextInspectionDate; + private Date nextInspectionDate; /** * 保险到期日期 */ - private LocalDateTime insuranceExpiryDate; + private Date insuranceExpiryDate; /** * 下次二级维护时间 */ - private LocalDateTime nextCheckDate; + private Date nextCheckDate; /** * 是否车主 */ diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/UserCarMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/UserCarMapper.java index 6954e49e..2f741ef0 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/UserCarMapper.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/UserCarMapper.java @@ -1,8 +1,12 @@ package cn.iocoder.yudao.module.custom.mapper; import cn.iocoder.yudao.module.custom.entity.UserCar; +import cn.iocoder.yudao.module.custom.vo.UserCarVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 用户车辆信息表--用户个人录入的 Mapper @@ -12,5 +16,13 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface UserCarMapper extends BaseMapper { + /** + * 查询用户的车辆 + * @author vinjor-M + * @date 18:53 2024/10/11 + * @param userId 用户id + * @return java.util.List + **/ + List selectByUserId(@Param("userId") Long userId); } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/UserCarService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/UserCarService.java index df877698..9be61022 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/UserCarService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/UserCarService.java @@ -1,7 +1,12 @@ package cn.iocoder.yudao.module.custom.service; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.custom.entity.UserCar; +import cn.iocoder.yudao.module.custom.vo.UserCarVO; import com.baomidou.mybatisplus.extension.service.IService; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; + +import java.util.List; /** * 用户车辆信息表--用户个人录入的 Service 接口 @@ -10,5 +15,29 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface UserCarService extends IService { + /** + * 创建或更新车辆信息 + * @author vinjor-M + * @date 14:11 2024/10/11 + * @param userCarVO 车辆信息 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + CommonResult createOrUpdate(UserCarVO userCarVO); + /** + * 查询当前登录用户的所有车辆 + * @author vinjor-M + * @date 14:28 2024/10/11 + * @return java.util.List + **/ + List getMyCar(); + + /** + * + * @author vinjor-M + * @date 16:59 2024/10/11 + * @param imagePath 公网图片地址 + * @return java.lang.Object + **/ + Object vehicleLicenseOCR(String imagePath) throws TencentCloudSDKException; } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/UserCarServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/UserCarServiceImpl.java index ac74f5d9..9d49512b 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/UserCarServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/UserCarServiceImpl.java @@ -1,13 +1,24 @@ package cn.iocoder.yudao.module.custom.service.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.custom.entity.UserCar; import cn.iocoder.yudao.module.custom.mapper.UserCarMapper; import cn.iocoder.yudao.module.custom.service.UserCarService; +import cn.iocoder.yudao.module.custom.vo.DrivelicenseVO; +import cn.iocoder.yudao.module.custom.vo.UserCarVO; +import cn.iocoder.yudao.util.VehicleLicenseOCR; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.List; /** * 用户车辆信息表--用户个人录入的 Service 实现类 @@ -20,4 +31,53 @@ public class UserCarServiceImpl extends ServiceImpl impl @Resource private UserCarMapper userCarMapper; + + /** + * 创建或更新车辆信息 + * + * @param userCarVO 车辆信息 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author vinjor-M + * @date 14:11 2024/10/11 + **/ + @Override + public CommonResult createOrUpdate(UserCarVO userCarVO) { + //车牌号英文全部转大写 + userCarVO.setLicenseNumber(userCarVO.getLicenseNumber().toUpperCase()); + //设置所属者 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + userCarVO.setUserId(loginUser.getId()); + this.saveOrUpdate(userCarVO); + return CommonResult.ok(); + } + + /** + * 查询当前登录用户的所有车辆 + * + * @return java.util.List + * @author vinjor-M + * @date 14:28 2024/10/11 + **/ + @Override + public List getMyCar() { + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + return userCarMapper.selectByUserId(loginUser.getId()); + } + + /** + * @param imagePath 公网图片地址 + * @return java.lang.Object + * @author vinjor-M + * @date 16:59 2024/10/11 + **/ + @Override + public Object vehicleLicenseOCR(String imagePath) throws TencentCloudSDKException { + String info = VehicleLicenseOCR.dealFunction(imagePath); + JSONObject infoJson = JSONUtil.parseObj(info); + DrivelicenseVO licenseVO = BeanUtil.toBean(infoJson.getJSONObject("FrontInfo"),DrivelicenseVO.class); + if(licenseVO.getModel().contains("牌")){ + licenseVO.setBrand(licenseVO.getModel().split("牌")[0]); + } + return licenseVO; + } } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/DrivelicenseVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/DrivelicenseVO.java new file mode 100644 index 00000000..14781c5c --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/DrivelicenseVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.custom.vo; + +import lombok.Data; + +/** + * 行驶证OCR识别结果 + * @author vinjor-M + * @date 17:17 2024/10/11 +**/ +@Data +public class DrivelicenseVO { + /**所有人*/ + private String Owner; + /**住址*/ + private String Address; + /**车辆类型*/ + private String VehicleType; + /**品牌型号*/ + private String Model; + /**品牌*/ + private String brand; + /**注册日期*/ + private String RegisterDate; + /**发证日期*/ + private String IssueDate; + /**车辆识别代号*/ + private String Vin; + /**所有人*/ + private String Seal; + /**车牌号*/ + private String PlateNo; + /**使用性质*/ + private String UseCharacter; + /**发动机号码*/ + private String EngineNo; +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/UserCarVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/UserCarVO.java new file mode 100644 index 00000000..6c510b1a --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/UserCarVO.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.custom.vo; + +import cn.iocoder.yudao.module.custom.entity.UserCar; +import lombok.Data; + +@Data +public class UserCarVO extends UserCar { + /**品牌名称*/ + private String brandName; + /**品牌logo*/ + private String logoImg; +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/util/BaseUtil.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/BaseUtil.java new file mode 100644 index 00000000..8432ab98 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/util/BaseUtil.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.util; + +import org.springframework.stereotype.Component; + +/** + * 基础工具类 + * @author vinjor-M + * @date 14:15 2024/10/11 +**/ +@Component +public class BaseUtil { +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/VehicleLicenseOCR.java b/dl-module-base/src/main/java/cn/iocoder/yudao/util/VehicleLicenseOCR.java similarity index 100% rename from dl-module-inspection/src/main/java/cn/iocoder/yudao/util/VehicleLicenseOCR.java rename to dl-module-base/src/main/java/cn/iocoder/yudao/util/VehicleLicenseOCR.java diff --git a/dl-module-base/src/main/resources/mapper/custom/UserCarMapper.xml b/dl-module-base/src/main/resources/mapper/custom/UserCarMapper.xml index 248fa658..b9d4d5cb 100644 --- a/dl-module-base/src/main/resources/mapper/custom/UserCarMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/UserCarMapper.xml @@ -9,4 +9,15 @@ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> + \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/AppUserController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/AppUserController.java new file mode 100644 index 00000000..df95af5c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/AppUserController.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.controller.app.user; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 用户") +@RestController +@RequestMapping("/system/user") +@Validated +public class AppUserController { + + @Resource + private AdminUserService userService; + + /** + * 微信小程序端修改个人信息 + * @author vinjor-M + * @date 20:14 2024/10/11 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @PutMapping("update") + @Operation(summary = "修改用户") + public CommonResult updateUser(@RequestBody UserInfoVO reqVO) { + userService.updateCusInfo(reqVO); + return success(true); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/UserInfoVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/UserInfoVO.java new file mode 100644 index 00000000..f5e4b47c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/user/UserInfoVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.controller.app.user; + +import lombok.Data; + +@Data +public class UserInfoVO { + /** 用户id **/ + private Long id; + /** 用户昵称 **/ + private String nickname; + /** 头像地址 **/ + private String avatar; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java index 8108a7ed..cbcdbeba 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; +import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -59,4 +60,6 @@ public interface AdminUserMapper extends BaseMapperX { AdminUserDO getUserByMobileWithoutTenant(String phoneNumber); int updateSetOpenId(@Param("userId")Long userId,@Param("openId")String openId); + + int updateCusInfo(@Param("entity") UserInfoVO userInfoVO); } 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 bd91cbad..212c49ed 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 @@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; -import cn.iocoder.yudao.framework.security.core.LoginUser; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO; import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO; @@ -217,6 +215,16 @@ public class AdminAuthServiceImpl implements AdminAuthService { return AuthConvert.INSTANCE.convert(accessTokenDO); } + private AuthLoginRespVO createTokenAfterLoginSuccessCustomer(Long userId, String username, LoginLogTypeEnum logType) { + // 插入登陆日志 + createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS); + // 创建访问令牌 + OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, UserTypeEnum.MEMBER.getValue(), + OAuth2ClientConstants.CLIENT_ID_DEFAULT, null); + // 构建返回结果 + return AuthConvert.INSTANCE.convert(accessTokenDO); + } + @Override public AuthLoginRespVO refreshToken(String refreshToken) { OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT); @@ -408,7 +416,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { @Override public AuthLoginRespVO wxLoginByUserId(Long userId, String userName) { // 生成token - return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_SOCIAL); + return createTokenAfterLoginSuccessCustomer(userId, userName, LoginLogTypeEnum.LOGIN_SOCIAL); } /** diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index 73e370f8..a1c4b266 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -1,17 +1,23 @@ package cn.iocoder.yudao.module.system.service.user; import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; -import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import javax.validation.Valid; import java.io.InputStream; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 后台用户 Service 接口 @@ -35,6 +41,14 @@ public interface AdminUserService { */ void updateUser(@Valid UserSaveReqVO updateReqVO); + /** + * 微信小程序端修改用户个人信息 + * @author vinjor-M + * @date 20:11 2024/10/11 + * @param userInfoVO 用户对象 + **/ + void updateCusInfo(UserInfoVO userInfoVO); + /** * 更新用户的最后登陆信息 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index 15ade9ba..cf55e617 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -12,13 +12,13 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils; import cn.iocoder.yudao.module.infra.api.config.ConfigApi; import cn.iocoder.yudao.module.infra.api.file.FileApi; -import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; @@ -142,6 +142,18 @@ public class AdminUserServiceImpl implements AdminUserService { LogRecordContext.putVariable("user", oldUser); } + /** + * 微信小程序端修改用户个人信息 + * + * @param userInfoVO 用户对象 + * @author vinjor-M + * @date 20:11 2024/10/11 + **/ + @Override + public void updateCusInfo(UserInfoVO userInfoVO) { + userMapper.updateCusInfo(userInfoVO); + } + private void updateUserPost(UserSaveReqVO reqVO, AdminUserDO updateObj) { Long userId = reqVO.getId(); Set dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/SysUserMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/SysUserMapper.xml index 9bc0a9cb..40245dc2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/SysUserMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/SysUserMapper.xml @@ -6,6 +6,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" UPDATE system_users SET open_id = #{openId} WHERE id = #{userId} + + UPDATE system_users + SET nickname = #{entity.nickname},avatar = #{entity.avatar} + WHERE id = #{entity.id} +