mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
购买记录分页、导出接口完善
This commit is contained in:
+69
@@ -0,0 +1,69 @@
|
||||
package com.cf.imes.module.system.controller.admin.funds.purchase;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
import com.cf.imes.module.system.service.funds.purchase.PurchaseService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
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.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
/**
|
||||
* @author 软件购买
|
||||
*/
|
||||
@Tag(name = "管理后台 - 软件购买")
|
||||
@RestController
|
||||
@RequestMapping("/system/purchase")
|
||||
@Validated
|
||||
public class PurchaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private PurchaseService purchaseService;
|
||||
|
||||
|
||||
@GetMapping("")
|
||||
@Operation(summary = "获取软件的购买记录")
|
||||
public CommonResult<PageResult<PurchaseRecordRespVO>> getPurchaseRecord(@Valid PurchaseRecordPageReqVO pageReqVO) {
|
||||
|
||||
return success(purchaseService.getPurchaseRecord(pageReqVO));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出软件购买记录")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void billDetailsExport(@Valid PurchaseRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PurchaseRecordRespVO> list = purchaseService.getPurchaseRecord(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "软件购买记录表.xls", "数据", PurchaseRecordRespVO.class, list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.cf.imes.module.system.controller.admin.funds.purchase.vo;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 组织购买记录明细 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
public class PurchaseRecordPageReqVO extends PageParam {
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "产品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
@Schema(description = "购买时长")
|
||||
private Integer purchaseDuration;
|
||||
|
||||
|
||||
@Schema(description = "购买时间", example = "[2022-07-01 01:01:01 ,2022-07-01 01:01:01]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private String creator;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.cf.imes.module.system.controller.admin.funds.purchase.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
public class PurchaseRecordRespVO {
|
||||
|
||||
|
||||
@Schema(description = "购买记录ID")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
|
||||
@Schema(description = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
|
||||
@Schema(description = "产品明细ID")
|
||||
private Long productDetailsId;
|
||||
|
||||
|
||||
@Schema(description = "产品名称")
|
||||
private String productName;
|
||||
|
||||
|
||||
@Schema(description = "购买时长", example = "1")
|
||||
private Integer purchaseDuration;
|
||||
|
||||
@Schema(description = "购买时长单位,0:年、1:月、2:日", example = "1")
|
||||
private Integer purchaseDurationUnit;
|
||||
|
||||
@Schema(description = "赠送时长", example = "1")
|
||||
private Integer giftDuration;
|
||||
|
||||
@Schema(description = "赠送时长单位,0:年、1:月、2:日", example = "1")
|
||||
private Integer giftDurationUnit;
|
||||
|
||||
@Schema(description = "支付方式")
|
||||
private Integer paymentMethod;
|
||||
|
||||
|
||||
@Schema(description = "订单总额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
|
||||
@Schema(description = "现金余额支出")
|
||||
private BigDecimal accountBalanceSpent;
|
||||
|
||||
|
||||
@Schema(description = "支付宝支出")
|
||||
private BigDecimal alipaySpent;
|
||||
|
||||
|
||||
@Schema(description = "微信支出")
|
||||
private BigDecimal wechatSpent;
|
||||
|
||||
|
||||
@Schema(description = "赠送金")
|
||||
private BigDecimal giftMoneySpent;
|
||||
|
||||
|
||||
@Schema(description = "货币类型")
|
||||
private Integer currency;
|
||||
|
||||
|
||||
@Schema(description = "货币单位")
|
||||
private String currencyUnit;
|
||||
|
||||
|
||||
@Schema(description = "是否开票")
|
||||
private Integer isInvocing;
|
||||
|
||||
|
||||
@Schema(description = "购买时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private String creator;
|
||||
|
||||
|
||||
}
|
||||
+10
-10
@@ -43,16 +43,16 @@ public class PurchaseRecordDO extends BaseDO {
|
||||
private Long organId;
|
||||
|
||||
|
||||
// /**
|
||||
// * 用户ID-发票申请人ID
|
||||
// */
|
||||
// private Long userId;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 用户姓名
|
||||
// */
|
||||
// private Long userName;
|
||||
/**
|
||||
* 用户ID-发票申请人ID
|
||||
*/
|
||||
private Long InvoiceApplicantUserId;
|
||||
|
||||
|
||||
/**
|
||||
* 发票申请人名称
|
||||
*/
|
||||
private Long InvoiceApplicantUserName;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+20
@@ -1,6 +1,9 @@
|
||||
package com.cf.imes.module.system.dal.mysql.funds.purchase;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -18,4 +21,21 @@ public interface PurchaseRecordMapper extends BaseMapperX<PurchaseRecordDO> {
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getInvoicingAmount(Long organId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
default PageResult<PurchaseRecordDO> selectPage(PurchaseRecordPageReqVO pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<PurchaseRecordDO>()
|
||||
.eq(PurchaseRecordDO::getDeleted, false)
|
||||
.eqIfPresent(PurchaseRecordDO::getOrganId, pageReqVO.getOrganId())
|
||||
.likeIfPresent(PurchaseRecordDO::getProductName, pageReqVO.getProductName())
|
||||
.eqIfPresent(PurchaseRecordDO::getPurchaseDuration, pageReqVO.getPurchaseDuration())
|
||||
.betweenIfPresent(PurchaseRecordDO::getCreateTime, pageReqVO.getCreateTime())
|
||||
.likeIfPresent(PurchaseRecordDO::getCreator, pageReqVO.getCreator()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -1,6 +1,9 @@
|
||||
package com.cf.imes.module.system.service.funds.purchase;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.OrgEarliestPurchaseProductRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -17,6 +20,14 @@ public interface PurchaseService {
|
||||
*/
|
||||
PurchaseRecordDO getRecord(Long id);
|
||||
|
||||
/**
|
||||
* 查询购买记录分页
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
PageResult<PurchaseRecordRespVO> getPurchaseRecord(PurchaseRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 创建购买记录
|
||||
*
|
||||
|
||||
+22
@@ -1,9 +1,15 @@
|
||||
package com.cf.imes.module.system.service.funds.purchase;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.OrgEarliestPurchaseProductRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.funds.purchase.vo.PurchaseRecordRespVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.funds.purchase.PurchaseRecordDO;
|
||||
import com.cf.imes.module.system.dal.mysql.funds.products.ProductsDetailMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.funds.purchase.PurchaseRecordMapper;
|
||||
@@ -14,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 软件购买接口 实现类
|
||||
@@ -33,6 +40,21 @@ public class PurchaseServiceImpl implements PurchaseService {
|
||||
return purchaseRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PurchaseRecordRespVO> getPurchaseRecord(PurchaseRecordPageReqVO pageReqVO) {
|
||||
// 生成起时间0点和止时间12点的区间
|
||||
pageReqVO.setCreateTime(LocalDateTimeUtils.generateTimeSection(pageReqVO.getCreateTime()));
|
||||
|
||||
PageResult<PurchaseRecordDO> pageResult = purchaseRecordMapper.selectPage(pageReqVO);
|
||||
List<PurchaseRecordDO> resultList = pageResult.getList();
|
||||
|
||||
if (CollUtil.isEmpty(resultList)) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
List<PurchaseRecordRespVO> respVOS = BeanUtils.toBean(resultList, PurchaseRecordRespVO.class);
|
||||
return new PageResult<>(respVOS, pageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRecord(PurchaseRecordDO purchaseRecordDO) {
|
||||
purchaseRecordMapper.insert(purchaseRecordDO);
|
||||
|
||||
Reference in New Issue
Block a user