zhubaomin
2024-08-22 6f7059beb3f44bcb4bc18cc4bf13285d0913e065
2024-08-22 朱宝民 优化代码-财务对账
4个文件已修改
91 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoGeneral.java
@@ -1,6 +1,9 @@
package com.dy.pipIrrGlobal.voSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.dy.common.po.BaseEntity;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -8,19 +11,22 @@
 * @author ZhuBaoMin
 * @date 2024-01-24 17:00
 * @LastEditTime 2024-01-24 17:00
 * @Description
 * @Description 2024-08-22 朱宝民增加总额字段
 */
@Data
@JsonPropertyOrder({ "generalId", "cashierId", "cashierName", "tradeAmount", "gift", "refundAmount", "totalAmount", "operateDate", "auditStatus"})
@Schema(title = "财务对账之总账视图对象")
public class VoGeneral implements BaseEntity {
    private static final long serialVersionUID = 202401241706001L;
    @Schema(title = "总账ID")
    private String generalId;
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long generalId;
    @Schema(title = "收银员ID")
    private String cashierId;
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long cashierId;
    @Schema(title = "收银员姓名")
    private String cashierName;
@@ -34,6 +40,12 @@
    @Schema(title = "返还金额")
    private Float refundAmount;
    /**
     * 总额 = 实收金额 + 赠送金额 + 返还金额
     */
    @Schema(title = "总额")
    private Float totalAmount;
    @Schema(title = "交易日期")
    private String operateDate;
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -287,9 +287,9 @@
      ope.price,
      us.name AS opr,
      (CASE
        WHEN ope.operate_type = 1 THEN "开卡"
        WHEN ope.operate_type = 2 THEN "充值"
        WHEN ope.operate_type = 5 THEN "返还"
        WHEN ope.operate_type = 1 THEN '开卡'
        WHEN ope.operate_type = 2 THEN '充值'
        WHEN ope.operate_type = 5 THEN '返还'
      END) AS operateType,
      ope.operate_dt
    FROM se_card_operate ope
@@ -334,7 +334,7 @@
    FROM v_trade_details
    <where>
      <if test = "villageId != null and villageId > 0">
        AND villageId = ${villageId}
        AND villageId = #{villageId}
      </if>
      <if test = "operateTimeStart != null and operateTimeStop != null">
@@ -342,7 +342,7 @@
      </if>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
        AND cashierId = #{cashierId}
      </if>
      <if test = "tradeTime != null">
@@ -356,7 +356,7 @@
    SELECT * FROM v_trade_details
    <where>
      <if test = "villageId != null and villageId > 0">
        AND villageId = ${villageId}
        AND villageId = #{villageId}
      </if>
      <if test = "operateTimeStart != null and operateTimeStop != null">
@@ -364,12 +364,12 @@
      </if>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
        AND cashierId = #{cashierId}
      </if>
    </where>
    ORDER BY tradeTime
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${pageCurr}, ${pageSize}
      LIMIT #{pageCurr}, #{pageSize}
    </if>
  </select>
@@ -391,7 +391,7 @@
      </if>
      <if test = "state != null and state > 0">
        AND card.state = ${state}
        AND card.state = #{state}
      </if>
      <if test = "activeTimeStart != null and activeTimeStop != null">
@@ -409,9 +409,9 @@
    card.cardNum AS cardNum,
    card.state AS state,
    (CASE
    WHEN card.state = 1 THEN "正常"
    WHEN card.state = 2 THEN "已注销"
    WHEN card.state = 3 THEN "已挂失"
    WHEN card.state = 1 THEN '正常'
    WHEN card.state = 2 THEN '已注销'
    WHEN card.state = 3 THEN '已挂失'
    END) AS stateName,
    ope.card_cost AS cardCost,
    ope.payment_id AS paymentId,
@@ -431,7 +431,7 @@
      </if>
      <if test = "state != null and state > 0">
        AND card.state = ${state}
        AND card.state = #{state}
      </if>
      <if test = "activeTimeStart != null and activeTimeStop != null">
@@ -515,7 +515,7 @@
        INNER JOIN ba_user us ON ope.operator = us.id
    <where>
      <if test = "operateType != null and operateType > 0">
        AND ope.operate_type = ${operateType}
        AND ope.operate_type = #{operateType}
      </if>
      <if test = "clientName != null and clientName !=''">
@@ -542,7 +542,7 @@
        ope.operate_dt AS operateDt,
        IFNULL(ope.trade_amount,0) AS refund,
        (CASE
            WHEN ope.payment_id = 1 THEN "现金"
            WHEN ope.payment_id = 1 THEN '现金'
        END) AS refundTypeName,
        card.money,
        IFNULL(ope.system_balance,0) AS systemBalance
@@ -552,7 +552,7 @@
        INNER JOIN ba_user us ON ope.operator = us.id
    <where>
      <if test = "operateType != null and operateType > 0">
        AND ope.operate_type = ${operateType}
        AND ope.operate_type = #{operateType}
      </if>
      <if test = "clientName != null and clientName !=''">
@@ -589,7 +589,7 @@
    <where>
      AND ope.operate_type IN(1,2)
      <if test = "operateId != null and operateId > 0">
        AND ope.id = ${operateId}
        AND ope.id = #{operateId}
      </if>
      <if test = "clientName != null and clientName !=''">
@@ -634,7 +634,7 @@
    <where>
      AND ope.operate_type IN(1,2)
      <if test = "operateId != null and operateId > 0">
        AND ope.id = ${operateId}
        AND ope.id = #{operateId}
      </if>
      <if test = "clientName != null and clientName !=''">
@@ -667,7 +667,7 @@
    <where>
      AND ope.operate_type IN(1,2)
      <if test = "operateId != null and operateId > 0">
        AND ope.id = ${operateId}
        AND ope.id = #{operateId}
      </if>
      <if test = "clientName != null and clientName !=''">
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
@@ -198,7 +198,7 @@
      </if>
      <if test = "auditStatus != null and auditStatus > 0">
        AND audit_status = ${auditStatus}
        AND audit_status = #{auditStatus}
      </if>
      <if test = "operateDateStart != null and operateDateStop != null">
@@ -210,17 +210,18 @@
  <!--根据指定条件获取总账记录-->
  <select id="getGenerals" resultType="com.dy.pipIrrGlobal.voSe.VoGeneral">
    SELECT
        CAST(id AS  char) AS generalId,
        CAST(cashier_id AS char) AS cashierId,
        id AS generalId,
        cashier_id AS cashierId,
        cashier_name AS cashierName,
        trade_amount AS tradeAmount,
        gift,
        refund_amount AS refundAmount,
        (trade_amount + gift + refund_amount) AS totalAmount,
        Date(operate_date) AS operateDate,
        (CASE
          WHEN audit_status = 1 THEN "未审核"
          WHEN audit_status = 2 THEN "同意"
          WHEN audit_status = 3 THEN "驳回"
          WHEN audit_status = 1 THEN '未审核'
          WHEN audit_status = 2 THEN '同意'
          WHEN audit_status = 3 THEN '驳回'
        END) AS auditStatus
    FROM se_general
    <where>
@@ -229,7 +230,7 @@
      </if>
      <if test = "auditStatus != null and auditStatus > 0">
        AND audit_status = ${auditStatus}
        AND audit_status = #{auditStatus}
      </if>
      <if test = "operateDateStart != null and operateDateStop != null">
@@ -255,11 +256,11 @@
      </if>
      <if test = "paymentId != null and paymentId >0">
        AND ope.payment_id = ${paymentId}
        AND ope.payment_id = #{paymentId}
      </if>
      <if test = "cashierId != null and cashierId >0">
        AND ope.operator = ${cashierId}
        AND ope.operator = #{cashierId}
      </if>
    </where>
    GROUP BY ope.payment_id,  Date(ope.operate_dt)
@@ -286,7 +287,7 @@
    SELECT * FROM v_trade_summary
    <where>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
        AND cashierId = #{cashierId}
      </if>
      <if test = "timeStart != null and timeStop != null">
@@ -303,7 +304,7 @@
    FROM v_trade_details
    <where>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
        AND cashierId = #{cashierId}
      </if>
      <if test = "tradeDate != null">
@@ -317,7 +318,7 @@
    SELECT * FROM v_trade_details
    <where>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
        AND cashierId = #{cashierId}
      </if>
      <if test = "tradeDate != null">
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -971,11 +971,11 @@
    @SsoAop()
    public BaseResponse<Map> getReceipts(QoReceipt vo){
        try {
            Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap());
            if(res.size() == 0) {
                return BaseResponseUtils.buildErrorMsg(SellResultCode.No_RECEIPTS.getMessage());
            }
            return BaseResponseUtils.buildSuccess(res);
        //    Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap());
        //    if(res.size() == 0) {
        //        return BaseResponseUtils.buildErrorMsg(SellResultCode.No_RECEIPTS.getMessage());
        //    }
            return BaseResponseUtils.buildSuccess(cardOperateSv.getReceipts(vo));
        } catch (Exception e) {
            log.error("获取电子钱包账户记录", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;