From 3c46485b302f347211d32d4a872a0e4d84a32a1d Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 13 Apr 2021 10:20:17 +0800
Subject: [PATCH] 修改充值卡查询接口格式
---
zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseFlowDao.xml | 30 +++++++++++++++
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java | 3 +
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxMoneyCardUseAction.java | 18 ++------
zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseFlowDao.java | 7 ++-
zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/MoneyCardUseFlowDto.java | 34 +++++++++++++++++
5 files changed, 76 insertions(+), 16 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseFlowDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseFlowDao.java
index 5c4bad7..597762f 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseFlowDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardUseFlowDao.java
@@ -1,10 +1,11 @@
package com.matrix.system.hive.dao;
-import java.util.List;
-
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.hive.bean.MoneyCardUseFlow;
+import com.matrix.system.shopXcx.api.dto.MoneyCardUseFlowDto;
import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
@@ -25,6 +26,8 @@
public List<MoneyCardUseFlow> selectInPage(@Param("record") MoneyCardUseFlow moneyCardUseFlow, @Param("pageVo") PaginationVO pageVo);
+ public List<MoneyCardUseFlow> selectForWxInPage(@Param("record")MoneyCardUseFlowDto moneyCardUseFlowDto);
+
public List<MoneyCardUseFlow> selectByModel(@Param("record") MoneyCardUseFlow moneyCardUseFlow);
public int selectTotalRecord(@Param("record") MoneyCardUseFlow moneyCardUseFlow);
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
index 8c31f22..d36a21e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxCommonAction.java
@@ -313,7 +313,8 @@
MoneyCardUse moneyCardUse = moneyCardUseDao.selectVipCard(user.getId());
moneyCardUseFlow.setCarUseId(moneyCardUse.getId());
moneyCardUseFlow.setCardName(moneyCardUse.getCardName());
- moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney());
+ Double balance=moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney();
+ moneyCardUseFlow.setBalance(balance==null?0:balance);
moneyCardUseFlowDao.update(moneyCardUseFlow);
moneyCardUse.setRealMoney(moneyCardUse.getRealMoney()+payMoney.doubleValue());
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxMoneyCardUseAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxMoneyCardUseAction.java
index 8bb4daa..2b18016 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxMoneyCardUseAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxMoneyCardUseAction.java
@@ -8,7 +8,6 @@
import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.BasePageQueryDto;
-import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.LogUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.hive.bean.MoneyCardUse;
@@ -17,6 +16,7 @@
import com.matrix.system.hive.dao.MoneyCardUseFlowDao;
import com.matrix.system.hive.dao.MoneyCardUseV2Dao;
import com.matrix.system.hive.service.CodeService;
+import com.matrix.system.shopXcx.api.dto.MoneyCardUseFlowDto;
import com.matrix.system.shopXcx.api.vo.WxMoneyCardUseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -135,19 +135,11 @@
@ApiResponses({
@ApiResponse(code = 200, message = "ok", response = MoneyCardUseFlow.class)
})
- public AjaxResult getRechargeList(@RequestBody @Validated BasePageQueryDto pageDto) {
- if(StringUtils.isBlank(pageDto.getKeywords())){
- return AjaxResult.buildFailInstance("keywords参数是必须的");
- }
- PaginationVO pageVo = new PaginationVO();
- pageVo.setOffset((pageDto.getPageNum() - 1) * pageDto.getPageSize());
- pageVo.setLimit(pageDto.getPageSize());
+ public AjaxResult getRechargeList(@RequestBody @Validated MoneyCardUseFlowDto pageDto) {
SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class);
- MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow();
- moneyCardUseFlow.setVipId(sysVipInfo.getId());
- moneyCardUseFlow.setCarUseId(Long.parseLong(pageDto.getKeywords()));
- List<MoneyCardUseFlow> dataList = moneyCardUseFlowDao.selectInPage(moneyCardUseFlow, pageVo);
- return AjaxResult.buildSuccessInstance(dataList, moneyCardUseFlowDao.selectTotalRecord(moneyCardUseFlow));
+ pageDto.setCompanyId(sysVipInfo.getCompanyId());
+ List<MoneyCardUseFlow> dataList = moneyCardUseFlowDao.selectForWxInPage(pageDto);
+ return AjaxResult.buildSuccessInstance(dataList);
}
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/MoneyCardUseFlowDto.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/MoneyCardUseFlowDto.java
new file mode 100644
index 0000000..138cabb
--- /dev/null
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/dto/MoneyCardUseFlowDto.java
@@ -0,0 +1,34 @@
+package com.matrix.system.shopXcx.api.dto;
+
+import com.matrix.core.pojo.BasePageQueryDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "MoneyCardUseFlowDto", description = "储值卡流水查询参数接收类")
+public class MoneyCardUseFlowDto extends BasePageQueryDto {
+
+
+ @NotEmpty(message = "请选择查询时间")
+ @ApiModelProperty(value = "查询月份",example = "2021-03")
+ private String queryTime;
+
+
+ @ApiModelProperty(value = "收支类型 不传全部,1,收入,2支出", example = "1")
+ private Integer revenueType;
+
+ @NotNull(message = "请选择要查询的储值卡ID")
+ @ApiModelProperty(value = "储值卡id", example = "1")
+ private Long carUseId;
+
+ @ApiModelProperty(hidden = true)
+ private Long companyId;
+
+
+
+
+}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseFlowDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseFlowDao.xml
index 9a30f8e..4fe3c21 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseFlowDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardUseFlowDao.xml
@@ -331,6 +331,36 @@
</if>
</if>
</select>
+
+ <select id="selectForWxInPage" resultMap="MoneyCardUseFlowMap">
+ select
+ id,
+ order_no,
+ pay_no,
+ content,
+ create_time,
+ type,
+ total,
+ times,
+ gift_money,
+ balance,
+ (SELECT su_name from sys_users a WHERE operation_id=a.su_id) staffName
+ from money_card_use_flow
+ <where>
+ and car_use_id=#{record.carUseId}
+
+ <if test="record.queryTime!=null and record.queryTime!=''">
+ and DATE_FORMAT(create_time,'%Y-%m')=#{record.queryTime}
+ </if>
+ <if test="record.revenueType==1">
+ and total>0
+ </if>
+ <if test="record.revenueType==2">
+ <![CDATA[ and total<0 ]]>
+ </if>
+ </where>
+ order by create_time desc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1