From ba25e89d170fe4429f93453ce5c583135b3231d0 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 08 八月 2024 17:20:21 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserDetailDto.java | 19 ++ ruoyi-service/ruoyi-account/pom.xml | 12 + ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserListQueryDto.java | 14 + ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserTagMapper.xml | 2 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java | 26 +++ ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 5 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java | 57 +++++++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java | 19 ++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 18 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 133 ++++++++++++++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/TAppUserVipDetailMapper.java | 16 ++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 17 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java | 16 ++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java | 10 + ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserSignMapper.xml | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TUserTagController.java | 28 +++ ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppCouponMapper.xml | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java | 8 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml | 2 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInviteUserMapper.xml | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java | 6 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserCarMapper.xml | 2 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserMapper.xml | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java | 21 ++ ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml | 2 27 files changed, 430 insertions(+), 18 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserDetailDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserDetailDto.java new file mode 100644 index 0000000..cf8da17 --- /dev/null +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserDetailDto.java @@ -0,0 +1,19 @@ +package com.ruoyi.account.api.dto; + +import com.ruoyi.account.api.model.TAppUser; +import com.ruoyi.account.api.model.TAppUserCar; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; +@Data +public class UserDetailDto extends TAppUser { + @ApiModelProperty("累计充电数") + private Long orderCount; + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("车辆列表") + List<TAppUserCar> carList; + +} diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserListQueryDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserListQueryDto.java new file mode 100644 index 0000000..876d173 --- /dev/null +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/UserListQueryDto.java @@ -0,0 +1,14 @@ +package com.ruoyi.account.api.dto; + +import com.ruoyi.common.core.web.page.BasePage; +import lombok.Data; + +@Data +public class UserListQueryDto extends BasePage { + String userPhone; + String cityCode; + Integer status; + Integer userTagId; + Integer vipTypeId; + Integer companyId; +} diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java index 0bfa1c3..0a731d5 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUser.java @@ -104,4 +104,14 @@ private LocalDateTime lastLoginTime; + + + @ApiModelProperty(value = "标签名称") + @TableField(exist = false) + private String tagName; + @ApiModelProperty(value = "vip名称") + @TableField(exist = false) + private String vipName; + + } diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java new file mode 100644 index 0000000..9ca255a --- /dev/null +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java @@ -0,0 +1,57 @@ +package com.ruoyi.account.api.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * <p> + * + * </p> + * + * @author luodangjia + * @since 2024-08-08 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("t_app_user_vip_detail") +@ApiModel(value="TAppUserVipDetail对象", description="") +public class TAppUserVipDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId("id") + private Long id; + + @ApiModelProperty(value = "用户id") + @TableField("app_user_id") + private Long appUserId; + + @ApiModelProperty(value = "剩余充电次数") + @TableField("charge_num") + private Integer chargeNum; + + @ApiModelProperty(value = "会员id") + @TableField("vip_id") + private Integer vipId; + + @ApiModelProperty(value = "会员开始时间") + @TableField("start_time") + private LocalDateTime startTime; + + @ApiModelProperty(value = "会员结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @TableField("create_time") + private LocalDateTime createTime; + + +} diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java index cb381c7..3f8d2c1 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java @@ -1,5 +1,6 @@ package com.ruoyi.order.api.factory; +import com.ruoyi.common.core.domain.R; import com.ruoyi.order.api.feignClient.ChargingOrderClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,7 +21,12 @@ public ChargingOrderClient create(Throwable throwable) { log.error("充电订单调用失败:{}", throwable.getMessage()); return new ChargingOrderClient() { - + + @Override + public R<Long> useOrderCount(Long userId) { + return R.fail("订单计数:" + throwable.getMessage()); + + } }; } } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index 165973b..2e9f1dd 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -1,5 +1,6 @@ package com.ruoyi.order.api.factory; +import com.ruoyi.common.core.domain.R; import com.ruoyi.order.api.feignClient.ChargingOrderClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,6 +23,10 @@ log.error("商品订单调用失败:{}", cause.getMessage()); return new ChargingOrderClient() { + @Override + public R<Long> useOrderCount(Long userId) { + return null; + } }; } } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java index 7f227d4..aa4639f 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java @@ -1,8 +1,11 @@ package com.ruoyi.order.api.feignClient; import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; /** * 充电订单服务 @@ -10,6 +13,8 @@ */ @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) public interface ChargingOrderClient { + @PostMapping(value = "/t-charging-order/useOrderCount") + R<Long> useOrderCount(@RequestParam Long userId); } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java index 2466d95..cfb52c2 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java @@ -6,12 +6,14 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TCompany; import com.ruoyi.other.api.domain.TUserTag; -import com.ruoyi.other.api.feignClient.GoodsClient; import com.ruoyi.other.api.feignClient.OtherClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; /** * 商品服务降级处理 @@ -57,6 +59,21 @@ public R deleteTag(Integer id) { return R.fail("查询标签:" + throwable.getMessage()); } + + @Override + public R<Map<Integer, String>> getTagMap(List<Integer> ids) { + return R.fail("查询标签map:" + throwable.getMessage()); + } + + @Override + public R<TUserTag> getByIdTag(Integer id) { + return R.fail("查询标签:" + throwable.getMessage()); + } + + @Override + public R<Map<Integer, String>> getVipMap(List<Integer> ids) { + return R.fail("获取会员map:" + throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java index 4630bf6..833e422 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java @@ -7,12 +7,14 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TCompany; import com.ruoyi.other.api.domain.TUserTag; -import com.ruoyi.other.api.factory.GoodsFallbackFactory; import com.ruoyi.other.api.factory.OtherFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; +import java.util.Map; /** * 商品服务 @@ -30,6 +32,8 @@ @PostMapping(value = "/t-company/unit/delete") R unitDelete(@RequestParam Integer id); + @PostMapping(value = "/t-company/unit/detail") + R<TCompany> unitDetail(@RequestParam Integer id); //标签分页 @PostMapping(value = "/t-user-tag/page") @@ -38,6 +42,26 @@ //用户新增标签 @PostMapping(value = "/t-user-tag/addorUpdateTag") R addorUpdateTag(@RequestBody TUserTag tUserTag); + //删除用户标签 @PostMapping(value = "/t-user-tag/delete") R deleteTag(@RequestParam Integer id); + + //获取标签Map + @PostMapping(value = "/t-user-tag/getTagMap") + R<Map<Integer, String>> getTagMap(@RequestBody List<Integer> ids); + //获取标签 + @PostMapping(value = "/t-user-tag/getById") + R<TUserTag> getByIdTag(@RequestParam Integer id); + + @PostMapping(value = "/vip/getVipMap") + R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids); + + + + + + + + + } diff --git a/ruoyi-service/ruoyi-account/pom.xml b/ruoyi-service/ruoyi-account/pom.xml index 5f0a89f..957885b 100644 --- a/ruoyi-service/ruoyi-account/pom.xml +++ b/ruoyi-service/ruoyi-account/pom.xml @@ -112,6 +112,18 @@ <version>3.6.2</version> <scope>compile</scope> </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-api-order</artifactId> + <version>3.6.2</version> + <scope>compile</scope> + </dependency> </dependencies> diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index c261e65..8377509 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -4,11 +4,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.account.api.dto.UnitListQueryDto; +import com.ruoyi.account.api.dto.UserDetailDto; +import com.ruoyi.account.api.dto.UserListQueryDto; import com.ruoyi.account.api.model.TAppUser; +import com.ruoyi.account.api.model.TAppUserCar; +import com.ruoyi.account.api.model.TAppUserTag; +import com.ruoyi.account.api.model.TAppUserVipDetail; +import com.ruoyi.account.service.TAppUserCarService; import com.ruoyi.account.service.TAppUserService; +import com.ruoyi.account.service.TAppUserTagService; +import com.ruoyi.account.service.TAppUserVipDetailService; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.bean.BeanUtils; +import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.order.api.feignClient.ChargingOrderClient; import com.ruoyi.other.api.domain.TCompany; +import com.ruoyi.other.api.domain.TUserTag; import com.ruoyi.other.api.feignClient.OtherClient; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -16,6 +28,13 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -33,6 +52,16 @@ private OtherClient otherClient; @Resource private TAppUserService appUserService; + @Resource + private TAppUserTagService appUserTagService; + + @Resource + private TAppUserVipDetailService tAppUserVipDetailService; + @Resource + private ChargingOrderClient chargingOrderClient; + + @Resource + private TAppUserCarService appUserCarService; @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) @PostMapping(value = "/unit/page") @@ -63,21 +92,117 @@ } - @ApiOperation(value = "用户列表", tags = {"用户管理-用户管理"}) + @ApiOperation(value = "用户列表", tags = {"用户管理-用户列表"}) @PostMapping(value = "/user/page") - public R<Page<TCompany>> userPage(@RequestBody UnitListQueryDto unitListQueryDto) { + public R<Page<TAppUser>> userPage(@RequestBody UserListQueryDto userListQueryDto) { + List<Long> userIds = new ArrayList<>(); - //拿到标签tag + //如果要筛选标签。用标签获取useids + if (userListQueryDto.getUserTagId() != null){ + userIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getUserTagId, userListQueryDto.getUserTagId()).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); + } - //拿到会员map + //列表查询 + Page<TAppUser> page = appUserService.lambdaQuery() + .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) + .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) + .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) + .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) + .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) + .in(!userIds.isEmpty(),TAppUser::getId,userIds) + .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); + + if (page.getRecords().isEmpty()){ + return R.ok(page); + } + List<Integer> vipIds = new ArrayList<>(); + vipIds = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList()); + //获取会员map + R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); + //循环处理 + for (TAppUser appUser : page.getRecords()) { + //拿到最新的tagId + TAppUserTag one = appUserTagService.lambdaQuery().eq(TAppUserTag::getAppUserId, appUser.getId()).orderByDesc(TAppUserTag::getCreateTime).last("limit 1").one(); + //设置最新的tagName + R<TUserTag> byIdTag = otherClient.getByIdTag(one.getUserTagId()); + if (byIdTag.getData()!=null) { + appUser.setTagName(byIdTag.getData().getName()); + } + //匹配vipMap的值 + appUser.setVipName(vipMap.getData().get(appUser.getVipId())); + } + return R.ok(page); + } + @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) + @PostMapping(value = "/user/addOrUpdate") + public R addOrUpdate(@RequestBody TAppUser tAppUser) { + if (tAppUser.getId() != null){ + //为编辑操作,要进行vip的逻辑处理 + TAppUser nowUser = appUserService.getById(tAppUser.getId()); + //会员结束时间不为空 + if (tAppUser.getVipEndTime()!=null&&tAppUser.getVipEndTime()!=nowUser.getVipEndTime()){ + //计算改变后的结束时间和当前结束时间差距了多少时间 + Duration duration = Duration.between(tAppUser.getVipEndTime(), nowUser.getVipEndTime()); + List<TAppUserVipDetail> detailList = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, tAppUser.getId()).gt(TAppUserVipDetail::getEndTime, LocalDateTime.now()).orderByAsc(TAppUserVipDetail::getStartTime).list(); + //如果是增加,则将明细表里当前会员的结束时间往后移,并将其余未开始会员的开始时间和结束时间往后移 + if (tAppUser.getVipEndTime().isAfter(nowUser.getVipEndTime())){ + for (int i = 0; i < detailList.size(); i++) { + TAppUserVipDetail tAppUserVipDetail = detailList.get(i); + if (i == 0 ){ + tAppUserVipDetail.setEndTime(tAppUser.getVipEndTime().plus(duration)); + }else { + tAppUserVipDetail.setStartTime(tAppUserVipDetail.getStartTime().plus(duration)); + tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plus(duration)); + } + } + }else { + //如果是减少,将当前会员结束时间减少,并将其余会员开始和结束时间都往前移动 + for (int i = 0; i < detailList.size(); i++) { + TAppUserVipDetail tAppUserVipDetail = detailList.get(i); + if (i == 0 ){ + tAppUserVipDetail.setEndTime(tAppUser.getVipEndTime().minus(duration)); + }else { + tAppUserVipDetail.setStartTime(tAppUserVipDetail.getStartTime().minus(duration)); + tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().minus(duration)); + } + } + } + } + } + appUserService.saveOrUpdate(tAppUser); return R.ok(); } + @ApiOperation(value = "用户详情", tags = {"用户管理-用户列表"}) + @PostMapping(value = "/user/detail/{id}") + public R<UserDetailDto> userDetail(@PathVariable Long id) { + TAppUser user = appUserService.getById(id); + UserDetailDto userDetailDto = new UserDetailDto(); + BeanUtils.copyProperties(user,userDetailDto); + if (user.getVipId()!=null) { + R<Map<Integer, String>> vipMap = otherClient.getVipMap(Arrays.asList(user.getVipId())); + user.setVipName(vipMap.getData().get(user.getVipId())); + } + //获取累计充电数量 + R<Long> useOrderCount = chargingOrderClient.useOrderCount(user.getId()); + userDetailDto.setOrderCount(useOrderCount.getData()); + R<TCompany> tCompanyR = otherClient.unitDetail(user.getCompanyId()); + if (tCompanyR.getData()!=null){ + userDetailDto.setUnitName(tCompanyR.getData().getName()); + } + List<TAppUserCar> carList = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, id).orderByDesc(BasePojo::getCreateTime).list(); + userDetailDto.setCarList(carList); + + List<Integer> tagIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getAppUserId, id).orderByDesc(TAppUserTag::getCreateTime).list().stream().map(TAppUserTag::getUserTagId).collect(Collectors.toList()); + R<Map<Integer, String>> tagMap = otherClient.getTagMap(tagIds); + userDetailDto.setTagName(tagMap.getData().values().toString()); + return R.ok(userDetailDto); + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/TAppUserVipDetailMapper.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/TAppUserVipDetailMapper.java new file mode 100644 index 0000000..6b72880 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/TAppUserVipDetailMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.account.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.account.api.model.TAppUserVipDetail; + +/** + * <p> + * Mapper 接口 + * </p> + * + * @author luodangjia + * @since 2024-08-08 + */ +public interface TAppUserVipDetailMapper extends BaseMapper<TAppUserVipDetail> { + +} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java new file mode 100644 index 0000000..8e90bd7 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/TAppUserVipDetailService.java @@ -0,0 +1,16 @@ +package com.ruoyi.account.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.account.api.model.TAppUserVipDetail; + +/** + * <p> + * 服务类 + * </p> + * + * @author luodangjia + * @since 2024-08-08 + */ +public interface TAppUserVipDetailService extends IService<TAppUserVipDetail> { + +} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java new file mode 100644 index 0000000..50674ce --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java @@ -0,0 +1,21 @@ +package com.ruoyi.account.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.account.api.model.TAppUserVipDetail; +import com.ruoyi.account.mapper.TAppUserVipDetailMapper; + +import com.ruoyi.account.service.TAppUserVipDetailService; +import org.springframework.stereotype.Service; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author luodangjia + * @since 2024-08-08 + */ +@Service +public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService { + +} diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppCouponMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppCouponMapper.xml similarity index 94% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppCouponMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppCouponMapper.xml index 002b4a4..da0679a 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppCouponMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppCouponMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppCouponMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppCouponMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppCoupon"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml similarity index 93% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml index d827753..c8ffb59 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserAddressMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserAddressMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserAddressMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserAddress"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserCarMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserCarMapper.xml similarity index 93% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserCarMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserCarMapper.xml index bfc95ec..3861951 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserCarMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserCarMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserCarMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserCarMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserCar"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml similarity index 92% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml index b5c42c7..ee2ebd2 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserIntegralChangeMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserIntegralChangeMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserIntegralChangeMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserIntegralChange"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserMapper.xml similarity index 96% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserMapper.xml index 747077e..0dad576 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUser"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserSignMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserSignMapper.xml similarity index 91% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserSignMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserSignMapper.xml index d0cb7d0..60f857a 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserSignMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserSignMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserSignMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserSignMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserSign"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserTagMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserTagMapper.xml similarity index 90% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserTagMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserTagMapper.xml index c6c4943..e69d184 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TAppUserTagMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TAppUserTagMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TAppUserTagMapper"> +<mapper namespace="com.ruoyi.account.mapper.TAppUserTagMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TAppUserTag"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInviteUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInviteUserMapper.xml similarity index 91% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInviteUserMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInviteUserMapper.xml index bed9a01..6c95869 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInviteUserMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInviteUserMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TInviteUserMapper"> +<mapper namespace="com.ruoyi.account.mapper.TInviteUserMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TInviteUser"> diff --git a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml similarity index 94% rename from ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml rename to ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml index 4cbf9cf..113c0f6 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/TInvoiceInformationMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="com.ruoyi.account.api.mapper.TInvoiceInformationMapper"> +<mapper namespace="com.ruoyi.account.mapper.TInvoiceInformationMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.TInvoiceInformation"> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 50e1818..2c37b8b 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -1,9 +1,16 @@ package com.ruoyi.order.controller; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.order.api.model.TChargingOrder; +import com.ruoyi.order.service.TChargingOrderService; import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; /** * <p> @@ -18,5 +25,15 @@ @RequestMapping("/t-charging-order") public class TChargingOrderController { + @Resource + private TChargingOrderService chargingOrderService; + + @PostMapping(value = "/useOrderCount") + public R<Long> useOrderCount(@RequestParam Long userId) { + Long count = chargingOrderService.lambdaQuery().eq(TChargingOrder::getAppUserId, userId).count(); + + return R.ok(count); + } + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java index 83a51af..66c00cb 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TCompanyController.java @@ -53,5 +53,11 @@ return R.ok(); } + @PostMapping(value = "/unit/delete") + public R<TCompany> delete(@RequestParam Integer id) { + + + return R.ok( companyService.getById(id)); + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TUserTagController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TUserTagController.java index 1ce47ac..a224192 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TUserTagController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TUserTagController.java @@ -13,6 +13,9 @@ import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -28,6 +31,7 @@ @Resource private TUserTagService tUserTagService; + //标签分页 @PostMapping(value = "/page") public R<Page<TUserTag>> page(@RequestBody TagListQueryDto tagListQueryDto) { Page<TUserTag> page = tUserTagService.lambdaQuery() @@ -37,20 +41,40 @@ return R.ok(page); } - + //标签新增修改 @PostMapping(value = "/addorUpdateTag") public R addorUpdateTag(@RequestBody TUserTag tUserTag) { tUserTag.setCreateTime(LocalDateTime.now()); tUserTagService.saveOrUpdate(tUserTag); return R.ok(); } - + //标签删除 @PostMapping(value = "/delete") public R delete(@RequestParam Integer id) { tUserTagService.removeById(id); return R.ok(); } + //获取标签map + @PostMapping(value = "/getTagMap") + public R<Map<Integer, String>> getTagMap(@RequestBody List<Integer> ids) { + + List<TUserTag> list = tUserTagService.lambdaQuery().in(!ids.isEmpty(), TUserTag::getId, ids).list(); + Map<Integer, String> idNameMap = list.stream() + .collect(Collectors.toMap( + TUserTag::getId, + TUserTag::getName + )); + return R.ok(idNameMap); + } + + @PostMapping(value = "/getById") + public R<TUserTag> getById(@RequestParam Integer id) { + + return R.ok(tUserTagService.getById(id)); + } + + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index 0a1e9a1..b2f94b8 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.TIntegralRule; +import com.ruoyi.other.api.domain.TUserTag; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.service.TVipService; import io.swagger.annotations.ApiImplicitParam; @@ -13,6 +14,10 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -60,5 +65,18 @@ return AjaxResult.ok(vipService.pageList(pageCurr,pageSize)); } + //获取会员Map + @PostMapping(value = "/getVipMap") + public R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids) { + + List<TVip> list = vipService.lambdaQuery().in(!ids.isEmpty(), TVip::getId, ids).list(); + Map<Integer, String> idNameMap = list.stream() + .collect(Collectors.toMap( + TVip::getId, + TVip::getName + )); + return R.ok(idNameMap); + } + } -- Gitblit v1.7.1