Commit 1f863386 by lijinqi

1.我的资源基础代码

2.orderitem新增三个字段
3.首页 images改为image
parent bf850f79
......@@ -85,42 +85,15 @@ public class BannerInfoController {
public CommonResult<BannerInfoRespVO> getBannerInfo(@RequestParam("id") Long id) {
BannerInfoDO bannerInfo = bannerInfoService.getBannerInfo(id);
BannerInfoRespVO respVO = BeanUtils.toBean(bannerInfo, BannerInfoRespVO.class);
// 将存储的逗号分隔字符串转换为列表
if (bannerInfo.getImage() != null && !bannerInfo.getImage().isEmpty()) {
List<String> images = Arrays.asList(bannerInfo.getImage().split(","));
respVO.setImages(images);
}
return success(respVO);
}
// @GetMapping("/page")
// @Operation(summary = "获得banner页管理分页")
// @PreAuthorize("@ss.hasPermission('biz:banner-info:query')")
// public CommonResult<PageResult<BannerInfoRespVO>> getBannerInfoPage(@Valid BannerInfoPageReqVO pageReqVO) {
// PageResult<BannerInfoDO> pageResult = bannerInfoService.getBannerInfoPage(pageReqVO);
// return success(BeanUtils.toBean(pageResult, BannerInfoRespVO.class));
// }
@GetMapping("/page")
@Operation(summary = "获得banner页管理分页")
@PreAuthorize("@ss.hasPermission('biz:banner-info:query')")
public CommonResult<PageResult<BannerInfoRespVO>> getBannerInfoPage(@Valid BannerInfoPageReqVO pageReqVO) {
PageResult<BannerInfoDO> pageResult = bannerInfoService.getBannerInfoPage(pageReqVO);
PageResult<BannerInfoRespVO> respResult = BeanUtils.toBean(pageResult, BannerInfoRespVO.class);
// 处理图片列表转换
if (respResult.getList() != null) {
respResult.getList().forEach(banner -> {
BannerInfoDO original = pageResult.getList().stream()
.filter(item -> item.getId().equals(banner.getId()))
.findFirst()
.orElse(null);
if (original != null && original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
banner.setImages(images);
}
});
}
return success(respResult);
}
......
......@@ -17,7 +17,7 @@ public class BannerInfoRespVO {
@Schema(description = "轮播图地址")
@ExcelProperty("轮播图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("内容")
......
......@@ -13,7 +13,7 @@ public class BannerInfoSaveReqVO {
private Long id;
@Schema(description = "轮播图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "内容不能为空")
......
......@@ -79,13 +79,7 @@ public class ComputilityInformationController {
// @PreAuthorize("@ss.hasPermission('biz:computility-information:query')")
public CommonResult<ComputilityInformationRespVO> getComputilityInformation(@RequestParam("id") Long id) {
ComputilityInformationDO computilityInformation = computilityInformationService.getComputilityInformation(id);
ComputilityInformationRespVO respVO = BeanUtils.toBean(computilityInformation, ComputilityInformationRespVO.class);
// 将存储的逗号分隔字符串转换为列表
if (computilityInformation.getImage() != null && !computilityInformation.getImage().isEmpty()) {
List<String> images = Arrays.asList(computilityInformation.getImage().split(","));
respVO.setImages(images);
}
return success(respVO);
}
......@@ -94,23 +88,7 @@ public class ComputilityInformationController {
@PreAuthorize("@ss.hasPermission('biz:computility-information:query')")
public CommonResult<PageResult<ComputilityInformationRespVO>> getComputilityInformationPage(@Valid ComputilityInformationPageReqVO pageReqVO) {
PageResult<ComputilityInformationDO> pageResult = computilityInformationService.getComputilityInformationPage(pageReqVO);
PageResult<ComputilityInformationRespVO> respResult = BeanUtils.toBean(pageResult, ComputilityInformationRespVO.class);
// 处理图片列表转换
if (respResult.getList() != null) {
respResult.getList().forEach(computility -> {
ComputilityInformationDO original = pageResult.getList().stream()
.filter(item -> item.getId().equals(computility.getId()))
.findFirst()
.orElse(null);
if (original != null && original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
computility.setImages(images);
}
});
}
return success(respResult);
}
......
......@@ -17,7 +17,7 @@ public class ComputilityInformationRespVO {
@Schema(description = "展示图地址")
@ExcelProperty("展示图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("内容")
......
......@@ -13,7 +13,7 @@ public class ComputilityInformationSaveReqVO {
private Long id;
@Schema(description = "展示图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "内容不能为空")
......
......@@ -81,15 +81,7 @@ public class IndustryApplicationController {
IndustryApplicationDO industryApplication = industryApplicationService.getIndustryApplication(id);
IndustryApplicationRespVO respVO = BeanUtils.toBean(industryApplication, IndustryApplicationRespVO.class);
// 将存储的逗号分隔字符串转换为列表
if (industryApplication.getImage() != null && !industryApplication.getImage().isEmpty()) {
List<String> images = Arrays.asList(industryApplication.getImage().split(","));
respVO.setImages(images);
}
if (industryApplication.getHomeImage() != null && !industryApplication.getHomeImage().isEmpty()) {
List<String> homeImages = Arrays.asList(industryApplication.getHomeImage().split(","));
respVO.setHomeImages(homeImages);
}
return success(respVO);
}
......@@ -101,24 +93,6 @@ public class IndustryApplicationController {
PageResult<IndustryApplicationRespVO> respResult = BeanUtils.toBean(pageResult, IndustryApplicationRespVO.class);
// 处理图片列表转换
if (respResult.getList() != null) {
respResult.getList().forEach(industryApplication -> {
IndustryApplicationDO original = pageResult.getList().stream()
.filter(item -> item.getId().equals(industryApplication.getId()))
.findFirst()
.orElse(null);
if (original != null && original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
industryApplication.setImages(images);
}
if (original != null && original.getHomeImage() != null && !original.getHomeImage().isEmpty()) {
List<String> homeImages = Arrays.asList(original.getHomeImage().split(","));
industryApplication.setHomeImages(homeImages);
}
});
}
return success(respResult);
}
......
......@@ -17,7 +17,7 @@ public class IndustryApplicationRespVO {
@Schema(description = "展示图地址")
@ExcelProperty("展示图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("内容")
......
......@@ -13,7 +13,7 @@ public class IndustryApplicationSaveReqVO {
private Long id;
@Schema(description = "展示图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "内容不能为空")
......
......@@ -79,13 +79,7 @@ public class InformationController {
@PreAuthorize("@ss.hasPermission('biz:information:query')")
public CommonResult<InformationRespVO> getInformation(@RequestParam("id") Long id) {
InformationDO information = informationService.getInformation(id);
InformationRespVO respVO = BeanUtils.toBean(information, InformationRespVO.class);
// 将存储的逗号分隔字符串转换为列表
if (information.getImage() != null && !information.getImage().isEmpty()) {
List<String> images = Arrays.asList(information.getImage().split(","));
respVO.setImages(images);
}
return success(respVO);
}
......@@ -95,21 +89,6 @@ public class InformationController {
public CommonResult<PageResult<InformationRespVO>> getInformationPage(@Valid InformationPageReqVO pageReqVO) {
PageResult<InformationDO> pageResult = informationService.getInformationPage(pageReqVO);
PageResult<InformationRespVO> respResult = BeanUtils.toBean(pageResult, InformationRespVO.class);
// 处理图片列表转换
if (respResult.getList() != null) {
respResult.getList().forEach(information -> {
InformationDO original = pageResult.getList().stream()
.filter(item -> item.getId().equals(information.getId()))
.findFirst()
.orElse(null);
if (original != null && original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
information.setImages(images);
}
});
}
return success(respResult);
}
......
......@@ -37,7 +37,7 @@ public class InformationRespVO {
@Schema(description = "预览图")
@ExcelProperty("预览图")
private List<String> images;
private String image;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
......
......@@ -32,7 +32,7 @@ public class InformationSaveReqVO {
private Integer showStatus;
@Schema(description = "预览图")
private List<String> images;
private String image;
@Schema(description = "备注", example = "你说的对")
private String remark;
......
......@@ -89,43 +89,15 @@ public class PartnerController {
public CommonResult<PartnerRespVO> getPartner(@RequestParam("id") Long id) {
PartnerDO partner = partnerService.getPartner(id);
PartnerRespVO respVO = BeanUtils.toBean(partner, PartnerRespVO.class);
// 将存储的逗号分隔字符串转换为列表
if (partner.getImage() != null && !partner.getImage().isEmpty()) {
List<String> images = Arrays.asList(partner.getImage().split(","));
respVO.setImages(images);
}
return success(respVO);
}
// @GetMapping("/page")
// @Operation(summary = "获得合作伙伴管理分页")
// @PreAuthorize("@ss.hasPermission('biz:partner:query')")
// public CommonResult<PageResult<AppPartnerRespVO>> getPartnerPage(@Valid PartnerPageReqVO pageReqVO) {
// PageResult<PartnerDO> pageResult = partnerService.getPartnerPage(pageReqVO);
// return success(BeanUtils.toBean(pageResult, AppPartnerRespVO.class));
// }
@GetMapping("/page")
@Operation(summary = "获得合作伙伴管理分页")
// @PreAuthorize("@ss.hasPermission('biz:partner:query')")
public CommonResult<PageResult<PartnerRespVO>> getPartnerPage(@Valid PartnerPageReqVO pageReqVO) {
PageResult<PartnerDO> pageResult = partnerService.getPartnerPage(pageReqVO);
PageResult<PartnerRespVO> respResult = BeanUtils.toBean(pageResult, PartnerRespVO.class);
// 处理图片列表转换
if (respResult.getList() != null) {
respResult.getList().forEach(partner -> {
PartnerDO original = pageResult.getList().stream()
.filter(item -> item.getId().equals(partner.getId()))
.findFirst()
.orElse(null);
if (original != null && original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
partner.setImages(images);
}
});
}
return success(respResult);
}
......
......@@ -17,7 +17,7 @@ public class PartnerRespVO {
@Schema(description = "展示图地址")
@ExcelProperty("展示图地址")
private List<String> images;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("内容")
......
......@@ -45,20 +45,6 @@ public class AppBannerInfoController {
public CommonResult<List<BannerInfoRespVO>> getBannerList() {
List<BannerInfoDO> list = bannerInfoService.getAllBanners(); // 新增Service方法
List<BannerInfoRespVO> result = BeanUtils.toBean(list, BannerInfoRespVO.class);
// 处理图片列表转换
if (result != null) {
for (int i = 0; i < result.size(); i++) {
BannerInfoDO original = list.get(i);
BannerInfoRespVO banner = result.get(i);
if (original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
banner.setImages(images);
}
}
}
return success(result);
}
}
......@@ -42,20 +42,6 @@ public class AppComputilityinformationController {
public CommonResult<List<ComputilityInformationRespVO>> getList() {
List<ComputilityInformationDO> list = computilityInformationService.getAllComputilityInformations(); // 新增Service方法
List<ComputilityInformationRespVO> result = BeanUtils.toBean(list, ComputilityInformationRespVO.class);
// 处理图片列表转换
if (result != null) {
for (int i = 0; i < result.size(); i++) {
ComputilityInformationDO original = list.get(i);
ComputilityInformationRespVO computility = result.get(i);
if (original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
computility.setImages(images);
}
}
}
return success(result);
}
}
......@@ -31,24 +31,6 @@ public class AppIndustryApplicationController {
public CommonResult<List<IndustryApplicationRespVO>> getIndustryApplicationList() {
List<IndustryApplicationDO> list = industryApplicationService.getAllIndustryApplication(); // 新增Service方法
List<IndustryApplicationRespVO> result = BeanUtils.toBean(list, IndustryApplicationRespVO.class);
// 处理图片列表转换
if (result != null) {
for (int i = 0; i < result.size(); i++) {
IndustryApplicationDO original = list.get(i);
IndustryApplicationRespVO industry = result.get(i);
if (original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
industry.setImages(images);
}
if (original.getHomeImage() != null && !original.getHomeImage().isEmpty()) {
List<String> homeImages = Arrays.asList(original.getHomeImage().split(","));
industry.setHomeImages(homeImages);
}
}
}
return success(result);
}
......@@ -58,24 +40,6 @@ public class AppIndustryApplicationController {
public CommonResult<List<IndustryApplicationRespVO>> getIndustryApplicationHomepageList( @RequestParam Integer count) {
List<IndustryApplicationDO> list = industryApplicationService.selectByCount(count); // 新增Service方法
List<IndustryApplicationRespVO> result = BeanUtils.toBean(list, IndustryApplicationRespVO.class);
// 处理图片列表转换
if (result != null) {
for (int i = 0; i < result.size(); i++) {
IndustryApplicationDO original = list.get(i);
IndustryApplicationRespVO industry = result.get(i);
if (original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
industry.setImages(images);
}
if (original.getHomeImage() != null && !original.getHomeImage().isEmpty()) {
List<String> homeImages = Arrays.asList(original.getHomeImage().split(","));
industry.setHomeImages(homeImages);
}
}
}
return success(result);
}
}
......@@ -41,18 +41,6 @@ public class AppInformationController {
List<InformationDO> list = informationService.getAllInformation(); // 新增Service方法
List<InformationRespVO> result = BeanUtils.toBean(list, InformationRespVO.class);
// 处理图片列表转换
if (result != null) {
for (int i = 0; i < result.size(); i++) {
InformationDO original = list.get(i);
InformationRespVO information = result.get(i);
if (original.getImage() != null && !original.getImage().isEmpty()) {
List<String> images = Arrays.asList(original.getImage().split(","));
information.setImages(images);
}
}
}
return success(result);
}
......
......@@ -17,7 +17,7 @@ public class AppPartnerRespVO {
private Long id;
@Schema(description = "展示图地址")
private List<String> image;
private String image;
@Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
private String information;
......
......@@ -7,6 +7,7 @@ import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.bannerinfo.BannerInfoDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.bannerinfo.vo.*;
......@@ -44,4 +45,10 @@ public interface BannerInfoMapper extends BaseMapperX<BannerInfoDO> {
.orderByDesc(BannerInfoDO::getId)));
}
default List<BannerInfoDO> selectShowList() {
return selectList((new LambdaQueryWrapperX<BannerInfoDO>()
.eqIfPresent(BannerInfoDO::getShowStatus, ShowStatus.YES.getValue())
.orderByDesc(BannerInfoDO::getOrderNum)));
}
}
\ No newline at end of file
......@@ -5,7 +5,9 @@ import java.util.*;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.bannerinfo.BannerInfoDO;
import com.luhu.computility.module.biz.dal.dataobject.computilityinformation.ComputilityInformationDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.computilityinformation.vo.*;
......@@ -28,4 +30,10 @@ public interface ComputilityInformationMapper extends BaseMapperX<ComputilityInf
.orderByDesc(ComputilityInformationDO::getId));
}
default List<ComputilityInformationDO> selectShowList() {
return selectList((new LambdaQueryWrapperX<ComputilityInformationDO>()
.eqIfPresent(ComputilityInformationDO::getShowStatus, ShowStatus.YES.getValue())
.orderByDesc(ComputilityInformationDO::getId)));
}
}
\ No newline at end of file
......@@ -5,7 +5,9 @@ import java.util.*;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.computilityinformation.ComputilityInformationDO;
import com.luhu.computility.module.biz.dal.dataobject.industryapplication.IndustryApplicationDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.industryapplication.vo.*;
......@@ -36,4 +38,10 @@ public interface IndustryApplicationMapper extends BaseMapperX<IndustryApplicati
}
default List<IndustryApplicationDO> selectShowList() {
return selectList((new LambdaQueryWrapperX<IndustryApplicationDO>()
.eqIfPresent(IndustryApplicationDO::getShowStatus, ShowStatus.YES.getValue())
.orderByDesc(IndustryApplicationDO::getId)));
}
}
\ No newline at end of file
......@@ -5,7 +5,9 @@ import java.util.*;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.industryapplication.IndustryApplicationDO;
import com.luhu.computility.module.biz.dal.dataobject.information.InformationDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.information.vo.*;
......@@ -27,4 +29,11 @@ public interface InformationMapper extends BaseMapperX<InformationDO> {
.orderByDesc(InformationDO::getId));
}
default List<InformationDO> selectShowList() {
return selectList((new LambdaQueryWrapperX<InformationDO>()
.eqIfPresent(InformationDO::getShowStatus, ShowStatus.YES.getValue())
.orderByDesc(InformationDO::getId)));
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.partner.PartnerDO;
import com.luhu.computility.module.biz.dal.dataobject.solution.SolutionDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.partner.vo.*;
......@@ -32,9 +33,9 @@ public interface PartnerMapper extends BaseMapperX<PartnerDO> {
}
default List<PartnerDO> selectAll() {
default List<PartnerDO> selectShowList() {
return selectList(new LambdaQueryWrapperX<PartnerDO>()
.eqIfPresent(PartnerDO::getShowStatus, Boolean.TRUE)
.eqIfPresent(PartnerDO::getShowStatus, ShowStatus.YES.getValue())
.orderByDesc(PartnerDO::getOrderNum));
}
......
......@@ -6,6 +6,7 @@ import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.biz.dal.dataobject.solution.SolutionDO;
import com.luhu.computility.module.biz.enums.ShowStatus;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.biz.controller.admin.solution.vo.*;
......@@ -37,9 +38,9 @@ public interface SolutionMapper extends BaseMapperX<SolutionDO> {
default List<SolutionDO> selectAll() {
default List<SolutionDO> selectShowList() {
return selectList(new LambdaQueryWrapperX<SolutionDO>()
.eqIfPresent(SolutionDO::getStatus, Boolean.TRUE)
.eqIfPresent(SolutionDO::getStatus, ShowStatus.YES.getValue())
.orderByDesc(SolutionDO::getId));
}
......
package com.luhu.computility.module.biz.enums;
/**
* 客户企业审核状态
*/
public enum ShowStatus {
// 请根据实际情况改成对应的值和备注
NO(0, "隐藏"),
YES(1, "展示");
private int value;
private String remark;
private ShowStatus(int value, String remark) {
this.value = value;
this.remark = remark;
}
public int getValue() {
return value;
}
public String getRemark() {
return remark;
}
public static ShowStatus getByValue(int value) {
for (ShowStatus o : ShowStatus.values()) {
if (o.getValue() == value) {
return o;
}
}
return null;
}
}
......@@ -38,10 +38,7 @@ public class BannerInfoServiceImpl implements BannerInfoService {
public Long createBannerInfo(BannerInfoSaveReqVO createReqVO) {
// 插入
BannerInfoDO bannerInfo = BeanUtils.toBean(createReqVO, BannerInfoDO.class);
// 将图片列表转换为JSON字符串存储
if (createReqVO.getImages() != null && !createReqVO.getImages().isEmpty()) {
bannerInfo.setImage(String.join(",", createReqVO.getImages()));
}
bannerInfoMapper.insert(bannerInfo);
// 返回
......@@ -54,10 +51,7 @@ public class BannerInfoServiceImpl implements BannerInfoService {
validateBannerInfoExists(updateReqVO.getId());
// 更新
BannerInfoDO updateObj = BeanUtils.toBean(updateReqVO, BannerInfoDO.class);
// 将图片列表转换为JSON字符串存储
if (updateReqVO.getImages() != null && !updateReqVO.getImages().isEmpty()) {
updateObj.setImage(String.join(",", updateReqVO.getImages()));
}
bannerInfoMapper.updateById(updateObj);
}
......@@ -100,7 +94,7 @@ public class BannerInfoServiceImpl implements BannerInfoService {
@Override
public List<BannerInfoDO> getAllBanners() {
return bannerInfoMapper.selectList(new BannerInfoPageReqVO()); // 查询所有数据
return bannerInfoMapper.selectShowList(); // 查询所有数据
}
}
\ No newline at end of file
......@@ -38,10 +38,7 @@ public class ComputilityInformationServiceImpl implements ComputilityInformation
public Long createComputilityInformation(ComputilityInformationSaveReqVO createReqVO) {
// 插入
ComputilityInformationDO computilityInformation = BeanUtils.toBean(createReqVO, ComputilityInformationDO.class);
// 将图片列表转换为JSON字符串存储
if (createReqVO.getImages() != null && !createReqVO.getImages().isEmpty()) {
computilityInformation.setImage(String.join(",", createReqVO.getImages()));
}
computilityInformationMapper.insert(computilityInformation);
// 返回
......@@ -54,10 +51,7 @@ public class ComputilityInformationServiceImpl implements ComputilityInformation
validateComputilityInformationExists(updateReqVO.getId());
// 更新
ComputilityInformationDO updateObj = BeanUtils.toBean(updateReqVO, ComputilityInformationDO.class);
// 将图片列表转换为JSON字符串存储
if (updateReqVO.getImages() != null && !updateReqVO.getImages().isEmpty()) {
updateObj.setImage(String.join(",", updateReqVO.getImages()));
}
computilityInformationMapper.updateById(updateObj);
}
......@@ -94,6 +88,6 @@ public class ComputilityInformationServiceImpl implements ComputilityInformation
@Override
public List<ComputilityInformationDO> getAllComputilityInformations() {
return computilityInformationMapper.selectList(null); // 查询所有数据
return computilityInformationMapper.selectShowList(); // 查询所有数据
}
}
\ No newline at end of file
......@@ -37,15 +37,6 @@ public class IndustryApplicationServiceImpl implements IndustryApplicationServic
public Long createIndustryApplication(IndustryApplicationSaveReqVO createReqVO) {
// 插入
IndustryApplicationDO industryApplication = BeanUtils.toBean(createReqVO, IndustryApplicationDO.class);
// 将图片列表转换为JSON字符串存储
if (createReqVO.getImages() != null && !createReqVO.getImages().isEmpty()) {
industryApplication.setImage(String.join(",", createReqVO.getImages()));
}
if (createReqVO.getHomeImages() != null && !createReqVO.getHomeImages().isEmpty()) {
industryApplication.setHomeImage(String.join(",", createReqVO.getHomeImages()));
}
industryApplicationMapper.insert(industryApplication);
// 返回
......@@ -58,13 +49,7 @@ public class IndustryApplicationServiceImpl implements IndustryApplicationServic
validateIndustryApplicationExists(updateReqVO.getId());
// 更新
IndustryApplicationDO updateObj = BeanUtils.toBean(updateReqVO, IndustryApplicationDO.class);
// 将图片列表转换为JSON字符串存储
if (updateReqVO.getImages() != null && !updateReqVO.getImages().isEmpty()) {
updateObj.setImage(String.join(",", updateReqVO.getImages()));
}
if (updateReqVO.getHomeImages() != null && !updateReqVO.getHomeImages().isEmpty()) {
updateObj.setHomeImage(String.join(",", updateReqVO.getHomeImages()));
}
industryApplicationMapper.updateById(updateObj);
}
......@@ -101,7 +86,7 @@ public class IndustryApplicationServiceImpl implements IndustryApplicationServic
@Override
public List<IndustryApplicationDO> getAllIndustryApplication() {
return industryApplicationMapper.selectList(null); // 查询所有数据
return industryApplicationMapper.selectShowList(); // 查询所有数据
}
@Override
......
......@@ -37,10 +37,7 @@ public class InformationServiceImpl implements InformationService {
public Long createInformation(InformationSaveReqVO createReqVO) {
// 插入
InformationDO information = BeanUtils.toBean(createReqVO, InformationDO.class);
// 将图片列表转换为JSON字符串存储
if (createReqVO.getImages() != null && !createReqVO.getImages().isEmpty()) {
information.setImage(String.join(",", createReqVO.getImages()));
}
informationMapper.insert(information);
// 返回
......@@ -53,10 +50,7 @@ public class InformationServiceImpl implements InformationService {
validateInformationExists(updateReqVO.getId());
// 更新
InformationDO updateObj = BeanUtils.toBean(updateReqVO, InformationDO.class);
// 将图片列表转换为JSON字符串存储
if (updateReqVO.getImages() != null && !updateReqVO.getImages().isEmpty()) {
updateObj.setImage(String.join(",", updateReqVO.getImages()));
}
informationMapper.updateById(updateObj);
}
......@@ -93,7 +87,7 @@ public class InformationServiceImpl implements InformationService {
@Override
public List<InformationDO> getAllInformation() {
return informationMapper.selectList(null); // 查询所有数据
return informationMapper.selectShowList(); // 查询所有数据
}
}
\ No newline at end of file
......@@ -86,7 +86,7 @@ public class PartnerServiceImpl implements PartnerService {
@Override
public List<PartnerDO> getAllPartner() {
List<PartnerDO> result = partnerMapper.selectAll();
List<PartnerDO> result = partnerMapper.selectShowList();
return result;
}
......
......@@ -88,7 +88,7 @@ public class SolutionServiceImpl implements SolutionService {
@Override
public List<SolutionDO> getAllSolution() {
List<SolutionDO> result = solutionMapper.selectAll();
List<SolutionDO> result = solutionMapper.selectShowList();
return result;
}
......
......@@ -47,6 +47,21 @@ public class ProductSkuRespDTO {
* 图片地址
*/
private String picUrl;
/**
* 费用描述
*/
private String feeInfo;
/**
* 有效期
*/
private Integer expDuration;
/**
* 鉴权信息
*/
private String auth;
/**
* 库存
*/
......
......@@ -80,6 +80,18 @@ public class TradeOrderItemDO extends BaseDO {
@TableField(typeHandler = JacksonTypeHandler.class)
private List<Property> properties;
/**
* 费用描述
*/
private String feeInfo;
/**
* 有效期(天)
*/
private Integer expDuration;
/**
* 鉴权信息
*/
private String auth;
/**
* 商品图片
*/
private String picUrl;
......
......@@ -25,6 +25,7 @@ import com.luhu.computility.module.pay.enums.order.PayOrderStatusEnum;
import com.luhu.computility.module.pay.enums.refund.PayRefundStatusEnum;
import com.luhu.computility.module.product.api.comment.ProductCommentApi;
import com.luhu.computility.module.product.api.comment.dto.ProductCommentCreateReqDTO;
import com.luhu.computility.module.product.api.sku.ProductSkuApi;
import com.luhu.computility.module.system.api.social.SocialClientApi;
import com.luhu.computility.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO;
import com.luhu.computility.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
......@@ -118,6 +119,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
@Resource
private ProductCommentApi productCommentApi;
@Resource
private ProductSkuApi productSkuApi;
@Resource
public SocialClientApi socialClientApi;
@Resource
public PayRefundApi payRefundApi;
......@@ -228,7 +231,16 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
private List<TradeOrderItemDO> buildTradeOrderItems(TradeOrderDO tradeOrderDO,
TradePriceCalculateRespBO calculateRespBO) {
return TradeOrderConvert.INSTANCE.convertList(tradeOrderDO, calculateRespBO);
List<TradeOrderItemDO> tradeOrderItemDOS = TradeOrderConvert.INSTANCE.convertList(tradeOrderDO, calculateRespBO);
for (TradeOrderItemDO tradeOrderItemDO : tradeOrderItemDOS) {
String auth = productSkuApi.getSku(tradeOrderItemDO.getSkuId()).getAuth();
Integer expDuration = productSkuApi.getSku(tradeOrderItemDO.getSkuId()).getExpDuration();
String feeInfo = productSkuApi.getSku(tradeOrderItemDO.getSkuId()).getFeeInfo();
tradeOrderItemDO.setAuth(auth);
tradeOrderItemDO.setExpDuration(expDuration);
tradeOrderItemDO.setFeeInfo(feeInfo);
}
return tradeOrderItemDOS;
}
/**
......
......@@ -25,6 +25,7 @@ public class TradeProductSkuOrderHandler implements TradeOrderHandler {
@Override
public void beforeOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) {
//更新库存,还要更新下架状态
productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convertNegative(orderItems));
}
......
package com.luhu.computility.module.member.controller.admin.resource;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.luhu.computility.framework.common.pojo.PageParam;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.common.pojo.CommonResult;
import com.luhu.computility.framework.common.util.object.BeanUtils;
import static com.luhu.computility.framework.common.pojo.CommonResult.success;
import com.luhu.computility.framework.excel.core.util.ExcelUtils;
import com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog;
import static com.luhu.computility.framework.apilog.core.enums.OperateTypeEnum.*;
import com.luhu.computility.module.member.controller.admin.resource.vo.*;
import com.luhu.computility.module.member.dal.dataobject.resource.ResourceDO;
import com.luhu.computility.module.member.service.resource.ResourceService;
@Tag(name = "管理后台 - 用户资源")
@RestController
@RequestMapping("/member/resource")
@Validated
public class ResourceController {
@Resource
private ResourceService resourceService;
@PostMapping("/create")
@Operation(summary = "创建用户资源")
@PreAuthorize("@ss.hasPermission('member:resource:create')")
public CommonResult<Long> createResource(@Valid @RequestBody ResourceSaveReqVO createReqVO) {
return success(resourceService.createResource(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新用户资源")
@PreAuthorize("@ss.hasPermission('member:resource:update')")
public CommonResult<Boolean> updateResource(@Valid @RequestBody ResourceSaveReqVO updateReqVO) {
resourceService.updateResource(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除用户资源")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('member:resource:delete')")
public CommonResult<Boolean> deleteResource(@RequestParam("id") Long id) {
resourceService.deleteResource(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除用户资源")
@PreAuthorize("@ss.hasPermission('member:resource:delete')")
public CommonResult<Boolean> deleteResourceList(@RequestParam("ids") List<Long> ids) {
resourceService.deleteResourceListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得用户资源")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('member:resource:query')")
public CommonResult<ResourceRespVO> getResource(@RequestParam("id") Long id) {
ResourceDO resource = resourceService.getResource(id);
return success(BeanUtils.toBean(resource, ResourceRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得用户资源分页")
@PreAuthorize("@ss.hasPermission('member:resource:query')")
public CommonResult<PageResult<ResourceRespVO>> getResourcePage(@Valid ResourcePageReqVO pageReqVO) {
PageResult<ResourceDO> pageResult = resourceService.getResourcePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ResourceRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出用户资源 Excel")
@PreAuthorize("@ss.hasPermission('member:resource:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportResourceExcel(@Valid ResourcePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ResourceDO> list = resourceService.getResourcePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "用户资源.xls", "数据", ResourceRespVO.class,
BeanUtils.toBean(list, ResourceRespVO.class));
}
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.admin.resource.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.luhu.computility.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.luhu.computility.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 用户资源分页 Request VO")
@Data
public class ResourcePageReqVO extends PageParam {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7380")
private Long id;
@Schema(description = "类型", example = "1")
private Integer categoryId;
@Schema(description = "客户id", example = "19646")
private Long memberUserId;
@Schema(description = "关联订单id", example = "11797")
private Long tradeOrderId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.admin.resource.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 用户资源 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ResourceRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7191")
@ExcelProperty("主键")
private Long id;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("类型")
private Integer categoryId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19646")
@ExcelProperty("客户id")
private Long memberUserId;
@Schema(description = "关联订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11797")
@ExcelProperty("关联订单id")
private Long tradeOrderId;
@Schema(description = "属性")
@ExcelProperty("属性")
private String properties;
@Schema(description = "过期时间")
@ExcelProperty("过期时间")
private LocalDateTime expTime;
@Schema(description = "鉴权信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鉴权信息")
private String auth;
@Schema(description = "费用描述", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("费用描述")
private String feeInfo;
@Schema(description = "有效期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("有效期")
private Integer expDuration;
@Schema(description = "剩余使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "14711")
@ExcelProperty("剩余使用次数")
private Integer unuseCount;
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.admin.resource.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 用户资源新增/修改 Request VO")
@Data
public class ResourceSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7380")
private Long id;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "类型不能为空")
private Integer categoryId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19646")
@NotNull(message = "客户id不能为空")
private Long memberUserId;
@Schema(description = "关联订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11797")
@NotNull(message = "关联订单id不能为空")
private Long tradeOrderId;
@Schema(description = "属性")
private String properties;
@Schema(description = "过期时间")
private LocalDateTime expTime;
@Schema(description = "鉴权信息", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "鉴权信息不能为空")
private String auth;
@Schema(description = "费用描述", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "费用描述不能为空")
private String feeInfo;
@Schema(description = "有效期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "有效期不能为空")
private Integer expDuration;
@Schema(description = "剩余使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "14711")
@NotNull(message = "剩余使用次数不能为空")
private Integer unuseCount;
@Schema(description = "备注", example = "你说的对")
private String remark;
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.app.resource;
import com.luhu.computility.framework.apilog.core.annotation.ApiAccessLog;
import com.luhu.computility.framework.common.pojo.CommonResult;
import com.luhu.computility.framework.common.pojo.PageParam;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.common.util.object.BeanUtils;
import com.luhu.computility.framework.excel.core.util.ExcelUtils;
import com.luhu.computility.module.member.controller.admin.resource.vo.ResourcePageReqVO;
import com.luhu.computility.module.member.controller.app.resource.vo.AppResourcePageReqVO;
import com.luhu.computility.module.member.controller.app.resource.vo.AppResourceRespVO;
import com.luhu.computility.module.member.dal.dataobject.resource.ResourceDO;
import com.luhu.computility.module.member.service.resource.ResourceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static com.luhu.computility.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static com.luhu.computility.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 用户资源")
@RestController
@RequestMapping("/member/resource")
@Validated
public class AppResourceController {
@Resource
private ResourceService resourceService;
@GetMapping("/get")
@Operation(summary = "获得我的资源")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<AppResourceRespVO> getResource(@RequestParam("id") Long id) {
ResourceDO resource = resourceService.getResource(id);
return success(BeanUtils.toBean(resource, AppResourceRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得我的资源分页")
public CommonResult<PageResult<AppResourceRespVO>> getResourcePage(@Valid ResourcePageReqVO pageReqVO) {
PageResult<ResourceDO> pageResult = resourceService.getResourcePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, AppResourceRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出我的资源 Excel")
@ApiAccessLog(operateType = EXPORT)
public void exportResourceExcel(@Valid ResourcePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ResourceDO> list = resourceService.getResourcePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "我的资源.xls", "数据", AppResourceRespVO.class,
BeanUtils.toBean(list, AppResourceRespVO.class));
}
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.app.resource.vo;
import com.luhu.computility.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.luhu.computility.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "用户APP - 用户资源分页 Request VO")
@Data
public class AppResourcePageReqVO extends PageParam {
@Schema(description = "类型", example = "1")
private Integer categoryId;
@Schema(description = "关联订单id", example = "11797")
private Long tradeOrderId;
@Schema(description = "用户id", example = "11797")
private Long memberUserId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.app.resource.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户App - 用户资源 Response VO")
@Data
@ExcelIgnoreUnannotated
public class AppResourceRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7191")
@ExcelProperty("主键")
private Long id;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("类型")
private Integer categoryId;
@Schema(description = "关联订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11797")
@ExcelProperty("关联订单id")
private Long tradeOrderId;
@Schema(description = "属性")
@ExcelProperty("属性")
private String properties;
@Schema(description = "过期时间")
@ExcelProperty("过期时间")
private LocalDateTime expTime;
@Schema(description = "鉴权信息", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鉴权信息")
private String auth;
@Schema(description = "费用描述", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("费用描述")
private String feeInfo;
@Schema(description = "有效期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("有效期")
private Integer expDuration;
@Schema(description = "剩余使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "14711")
@ExcelProperty("剩余使用次数")
private Integer unuseCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package com.luhu.computility.module.member.controller.app.resource.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 用户资源新增/修改 Request VO")
@Data
public class AppResourceSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7191")
private Long id;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "类型不能为空")
private Integer categoryId;
@Schema(description = "客户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19646")
@NotNull(message = "客户id不能为空")
private Long memberUserId;
@Schema(description = "关联订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11797")
@NotNull(message = "关联订单id不能为空")
private Long tradeOrderId;
@Schema(description = "过期时间")
private LocalDateTime expTime;
@Schema(description = "鉴权信息", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "鉴权信息不能为空")
private String auth;
@Schema(description = "费用描述", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "费用描述不能为空")
private String feeInfo;
@Schema(description = "有效期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "有效期不能为空")
private Integer expDuration;
@Schema(description = "剩余使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "14711")
@NotNull(message = "剩余使用次数不能为空")
private Integer unuseCount;
@Schema(description = "备注", example = "你说的对")
private String remark;
}
\ No newline at end of file
package com.luhu.computility.module.member.dal.dataobject.resource;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.luhu.computility.framework.mybatis.core.dataobject.BaseDO;
/**
* 用户资源 DO
*
* @author ljq
*/
@TableName("member_resource")
@KeySequence("member_resource_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResourceDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 类型
*/
private Integer categoryId;
/**
* 客户id
*/
private Long memberUserId;
/**
* 关联订单id
*/
private Long tradeOrderId;
/**
* 属性
*/
private String properties;
/**
* 过期时间
*/
private LocalDateTime expTime;
/**
* 鉴权信息
*/
private String auth;
/**
* 费用描述
*/
private String feeInfo;
/**
* 有效期
*/
private Integer expDuration;
/**
* 剩余使用次数
*/
private Integer unuseCount;
/**
* 备注
*/
private String remark;
}
\ No newline at end of file
package com.luhu.computility.module.member.dal.mysql.resource;
import java.util.*;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.luhu.computility.framework.mybatis.core.mapper.BaseMapperX;
import com.luhu.computility.module.member.controller.app.resource.vo.AppResourcePageReqVO;
import com.luhu.computility.module.member.dal.dataobject.resource.ResourceDO;
import org.apache.ibatis.annotations.Mapper;
import com.luhu.computility.module.member.controller.admin.resource.vo.*;
/**
* 用户资源 Mapper
*
* @author ljq
*/
@Mapper
public interface ResourceMapper extends BaseMapperX<ResourceDO> {
default PageResult<ResourceDO> selectPage(ResourcePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ResourceDO>()
.eqIfPresent(ResourceDO::getCategoryId, reqVO.getCategoryId())
.eqIfPresent(ResourceDO::getMemberUserId, reqVO.getMemberUserId())
.eqIfPresent(ResourceDO::getTradeOrderId, reqVO.getTradeOrderId())
.betweenIfPresent(ResourceDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ResourceDO::getId));
}
default PageResult<ResourceDO> selectMyPage(AppResourcePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ResourceDO>()
.eqIfPresent(ResourceDO::getCategoryId, reqVO.getCategoryId())
.eqIfPresent(ResourceDO::getMemberUserId, reqVO.getMemberUserId())
.eqIfPresent(ResourceDO::getTradeOrderId, reqVO.getTradeOrderId())
.betweenIfPresent(ResourceDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ResourceDO::getId));
}
}
\ No newline at end of file
......@@ -55,4 +55,5 @@ public interface ErrorCodeConstants {
ErrorCode GROUP_NOT_EXISTS = new ErrorCode(1_004_012_000, "用户分组不存在");
ErrorCode GROUP_HAS_USER = new ErrorCode(1_004_012_001, "用户分组下存在用户,无法删除");
ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1_004_012_002, "客户企业不存在");
ErrorCode RESOURCE_NOT_EXISTS = new ErrorCode(1_004_012_003, "用户资源不存在");
}
package com.luhu.computility.module.member.service.resource;
import java.util.*;
import javax.validation.*;
import com.luhu.computility.module.member.controller.admin.resource.vo.*;
import com.luhu.computility.module.member.controller.app.resource.vo.AppResourcePageReqVO;
import com.luhu.computility.module.member.dal.dataobject.resource.ResourceDO;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.common.pojo.PageParam;
/**
* 用户资源 Service 接口
*
* @author ljq
*/
public interface ResourceService {
/**
* 创建用户资源
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createResource(@Valid ResourceSaveReqVO createReqVO);
/**
* 更新用户资源
*
* @param updateReqVO 更新信息
*/
void updateResource(@Valid ResourceSaveReqVO updateReqVO);
/**
* 删除用户资源
*
* @param id 编号
*/
void deleteResource(Long id);
/**
* 批量删除用户资源
*
* @param ids 编号
*/
void deleteResourceListByIds(List<Long> ids);
/**
* 获得用户资源
*
* @param id 编号
* @return 用户资源
*/
ResourceDO getResource(Long id);
/**
* 获得用户资源分页
*
* @param pageReqVO 分页查询
* @return 用户资源分页
*/
PageResult<ResourceDO> getResourcePage(ResourcePageReqVO pageReqVO);
/**
* 获得我的用户资源分页
*
* @param appResourcePageReqVO 分页查询
* @return 我的用户资源分页
*/
//PageResult<ResourceDO> getMyResourcePage(AppResourcePageReqVO appResourcePageReqVO);
}
\ No newline at end of file
package com.luhu.computility.module.member.service.resource;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.luhu.computility.module.member.controller.admin.resource.vo.*;
import com.luhu.computility.module.member.dal.dataobject.resource.ResourceDO;
import com.luhu.computility.framework.common.pojo.PageResult;
import com.luhu.computility.framework.common.pojo.PageParam;
import com.luhu.computility.framework.common.util.object.BeanUtils;
import com.luhu.computility.module.member.dal.mysql.resource.ResourceMapper;
import static com.luhu.computility.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.luhu.computility.framework.common.util.collection.CollectionUtils.convertList;
import static com.luhu.computility.framework.common.util.collection.CollectionUtils.diffList;
import static com.luhu.computility.module.member.enums.ErrorCodeConstants.*;
/**
* 用户资源 Service 实现类
*
* @author ljq
*/
@Service
@Validated
public class ResourceServiceImpl implements ResourceService {
@Resource
private ResourceMapper resourceMapper;
@Override
public Long createResource(ResourceSaveReqVO createReqVO) {
// 插入
ResourceDO resource = BeanUtils.toBean(createReqVO, ResourceDO.class);
resourceMapper.insert(resource);
// 返回
return resource.getId();
}
@Override
public void updateResource(ResourceSaveReqVO updateReqVO) {
// 校验存在
validateResourceExists(updateReqVO.getId());
// 更新
ResourceDO updateObj = BeanUtils.toBean(updateReqVO, ResourceDO.class);
resourceMapper.updateById(updateObj);
}
@Override
public void deleteResource(Long id) {
// 校验存在
validateResourceExists(id);
// 删除
resourceMapper.deleteById(id);
}
@Override
public void deleteResourceListByIds(List<Long> ids) {
// 删除
resourceMapper.deleteByIds(ids);
}
private void validateResourceExists(Long id) {
if (resourceMapper.selectById(id) == null) {
throw exception(RESOURCE_NOT_EXISTS);
}
}
@Override
public ResourceDO getResource(Long id) {
return resourceMapper.selectById(id);
}
@Override
public PageResult<ResourceDO> getResourcePage(ResourcePageReqVO pageReqVO) {
return resourceMapper.selectPage(pageReqVO);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment