2024-02-01 朱宝民 票据接口,金额转大写,财务对账查询接口
| | |
| | | * @return |
| | | */ |
| | | List<VoReissueCard> getReissueCards(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getReceiptsRecordCount(Map<?, ?> params); |
| | | |
| | | /*** |
| | | * 根据指定条件获取收据列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoReceipt> getReceipts(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取收据收费金额合计 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Double getTotalAmount(Map<?, ?> params); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoTradeDetails; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @return |
| | | */ |
| | | Map getTransactionStatisticsSums(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录数 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getTradeDetailsRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoTradeDetails> getTradeDetails(Map<?, ?> params); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<VoWalletRefund> getWalletRefunds(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期微信退款(只计算已退的)总额,财务对账审核页使用 |
| | | * @param tradeDate |
| | | * @return |
| | | */ |
| | | Double getRefundSum(@Param("tradeDate") String tradeDate); |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<VoWalletRecharge> getWalletRecharges(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 获取指定日期微信收款总额,财务对账审核页使用 |
| | | * @param tradeDate |
| | | * @return |
| | | */ |
| | | Double getRechargeSum(@Param("tradeDate") String tradeDate); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.util; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 9:58 |
| | | * @LastEditTime 2024-02-01 9:58 |
| | | * @Description 金额数字转中文大写 |
| | | */ |
| | | public class AmountToChinese { |
| | | private static final String[] CN_UPPER_NUMBER = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; |
| | | private static final String[] CN_UPPER_MONETRAY_UNIT = { "分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟" }; |
| | | private static final String CN_FULL = "整"; |
| | | private static final String CN_NEGATIVE = "负"; |
| | | private static final int MONEY_PRECISION = 2; |
| | | private static final String CN_ZEOR_FULL = "零元" + CN_FULL; |
| | | |
| | | public static String toChinese(BigDecimal amount) { |
| | | StringBuilder result = new StringBuilder(); |
| | | amount = amount.setScale(MONEY_PRECISION, BigDecimal.ROUND_HALF_UP); |
| | | long number = amount.movePointRight(MONEY_PRECISION).setScale(0, BigDecimal.ROUND_HALF_UP).longValue(); |
| | | boolean zero = true; |
| | | int unitIndex = 0; |
| | | if (number == 0) { |
| | | return CN_ZEOR_FULL; |
| | | } |
| | | if (number < 0) { |
| | | number = -number; |
| | | result.append(CN_NEGATIVE); |
| | | } |
| | | long scale = 10; |
| | | while (true) { |
| | | if (number == 0) { |
| | | break; |
| | | } |
| | | long numIndex = number % scale; |
| | | if (zero && numIndex == 0) { |
| | | zero = false; |
| | | } |
| | | if (numIndex != 0) { |
| | | result.insert(0, CN_UPPER_MONETRAY_UNIT[unitIndex]) |
| | | .insert(0, CN_UPPER_NUMBER[(int) numIndex]); |
| | | zero = false; |
| | | } |
| | | else if (!zero) { |
| | | result.insert(0, CN_UPPER_NUMBER[(int) numIndex]); |
| | | } |
| | | number = number / scale; |
| | | unitIndex++; |
| | | } |
| | | if (zero) { |
| | | result.append(CN_FULL); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 10:36 |
| | | * @LastEditTime 2024-02-01 10:36 |
| | | * @Description 收据视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "收据视图对象") |
| | | public class VoReceipt { |
| | | private static final long serialVersionUID = 202402011037001L; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | private String cashierId; |
| | | |
| | | @Schema(title = "订单号") |
| | | private String orderNumber; |
| | | |
| | | @Schema(title = "镇名称") |
| | | private String townName; |
| | | |
| | | @Schema(title = "村名称") |
| | | private String villageName; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String name; |
| | | |
| | | @Schema(title = "电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "购水金额") |
| | | private Double waterCost; |
| | | |
| | | @Schema(title = "购卡金额") |
| | | private Double cardCost; |
| | | |
| | | @Schema(title = "收费金额") |
| | | private Double amount; |
| | | |
| | | @Schema(title = "水卡余额") |
| | | private Double money; |
| | | |
| | | @Schema(title = "支付方式") |
| | | private String paymentName; |
| | | |
| | | @Schema(title = "操作人") |
| | | private String operatorName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "操作时间") |
| | | private Date operateTime; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "当前时间") |
| | | private Date currentTime; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 20:38 |
| | | * @LastEditTime 2024-02-01 20:38 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "财务对账,交易明细视图对象") |
| | | public class VoTradeDetails implements BaseEntity { |
| | | private static final long serialVersionUID = 202402012040001L; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "联系电话") |
| | | private String phone; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "业务类型") |
| | | private String operateType; |
| | | |
| | | @Schema(title = "交易金额") |
| | | private Double tradeAmount; |
| | | |
| | | @Schema(title = "付款方式") |
| | | private String paymentName; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Schema(title = "交易时间") |
| | | private Date tradeDate; |
| | | } |
| | |
| | | |
| | | @Schema(title = "赠送金额") |
| | | private Float gift; |
| | | |
| | | @Schema(title = "收银员ID") |
| | | private String cashierId; |
| | | } |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据列表数--> |
| | | <select id="getReceiptsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据列表--> |
| | | <select id="getReceipts" resultType="com.dy.pipIrrGlobal.voSe.VoReceipt"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS orderNumber, |
| | | tow.name AS townName, |
| | | vil.name AS villageName, |
| | | cli.`name`, |
| | | cli.phone, |
| | | CAST(cli.clientNum AS char) AS clientNum, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | (CASE |
| | | WHEN ope.operate_type = 1 THEN '开卡' |
| | | WHEN ope.operate_type = 2 THEN '充值' |
| | | END) AS operateType, |
| | | IFNULL(ope.trade_amount,0) AS waterCost, |
| | | IFNULL(ope.card_cost,0) AS cardCost, |
| | | (IFNULL(ope.trade_amount,0) + IFNULL(ope.card_cost,0)) AS amount, |
| | | card.money, |
| | | pay.`name` AS paymentName, |
| | | us.`name` AS operatorName, |
| | | ope.operate_dt AS operateTime, |
| | | NOW() AS currentTime |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取收据收费金额合计--> |
| | | <select id="getTotalAmount" parameterType="java.util.Map" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(IFNULL(ope.trade_amount,0) + IFNULL(ope.card_cost,0)) AS totalAmount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | <where> |
| | | AND ope.operate_type IN(1,2) |
| | | <if test = "operateId != null and operateId > 0"> |
| | | AND ope.id = ${operateId} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!--根据交易日期获取总账记录列表(待生成的) --> |
| | | <select id="getGeneralByOperateDate" resultType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> |
| | | SELECT |
| | | us.id AS cashierId, |
| | | us.`name` AS cashierName, |
| | | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, |
| | | IFNULL(SUM(ope.gift),0) AS gift, |
| | | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, |
| | | Date(ope.operate_dt) AS operateDate, |
| | | 1 AS auditStatus |
| | | us.id AS cashierId, |
| | | us.`name` AS cashierName, |
| | | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, |
| | | IFNULL(SUM(ope.gift),0) AS gift, |
| | | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, |
| | | Date(ope.operate_dt) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_card_operate ope |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | WHERE Date(ope.operate_dt) = #{operateDate} |
| | | GROUP BY ope.operator, Date(ope.operate_dt) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(SUM(amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | IFNULL(SUM(amount), 0) AS totalAmount, |
| | | Date(recharge_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_wallet_recharge |
| | | WHERE Date(recharge_time) = #{operateDate} |
| | | GROUP BY Date(recharge_time) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(-SUM(refund_amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | IFNULL(-SUM(refund_amount), 0) AS totalAmount, |
| | | Date(audit_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_refund |
| | | WHERE Date(audit_time) = #{operateDate} |
| | | GROUP BY Date(audit_time) |
| | | </select> |
| | | |
| | | <!--根据指定条件获取总账记录数--> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <!--财务对账审核页,收银员+日期分组,排除交易类型分组--> |
| | | <!--财务对账审核页,收银员+日期+类型分组,排除交易类型分组--> |
| | | <select id="getToAudit" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics2 |
| | | <where> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 根据收银员ID及日期获取财务对账_交易明细记录数--> |
| | | <select id="getTradeDetailsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据收银员ID及日期获取财务对账_交易明细记录--> |
| | | <select id="getTradeDetails" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails"> |
| | | SELECT * FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取指定日期微信退款(只计算已退的)总额,财务对账审核页使用--> |
| | | <select id="getRefundSum" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(refund_amount) AS tradeAmount |
| | | FROM se_refund |
| | | <where> |
| | | AND refund_status = 2 |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(audit_time) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | GROUP BY Date(audit_time) |
| | | </select> |
| | | </mapper> |
| | |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--获取指定日期微信收款总额,财务对账审核页使用--> |
| | | <select id="getRechargeSum" resultType="java.lang.Double"> |
| | | SELECT |
| | | SUM(amount) AS tradeAmount |
| | | FROM se_wallet_recharge |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(recharge_time) = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | GROUP BY Date(recharge_time) |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.util.AmountToChinese; |
| | | import com.dy.pipIrrGlobal.util.Constant; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCardNew; |
| | | import com.dy.pipIrrGlobal.voSe.VoRecharge; |
| | | import com.dy.pipIrrGlobal.voSe.VoReissueCard; |
| | | import com.dy.pipIrrGlobal.voSe.*; |
| | | import com.dy.pipIrrSell.cardOperate.converter.RechargeDtoMapper; |
| | | import com.dy.pipIrrSell.cardOperate.dto.*; |
| | | import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获取收据记录", description = "返回收据记录") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页补卡数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoActiveCard.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/get_receipts") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getReceipts(QoReceipt vo){ |
| | | try { |
| | | Map res = Optional.ofNullable(cardOperateSv.getReceipts(vo)).orElse(new HashMap()); |
| | | if(res.size() == 0) { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_RECEIPTS.getMessage()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("获取电子钱包账户记录", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 金额转大写 |
| | | * @param amount |
| | | * @return |
| | | */ |
| | | |
| | | @GetMapping(path = "/amount_to_chinese") |
| | | public BaseResponse<Boolean> amountToChinese(BigDecimal amount) { |
| | | try { |
| | | AmountToChinese amountToChinese = new AmountToChinese(); |
| | | String chinese = amountToChinese.toChinese(amount); |
| | | return BaseResponseUtils.buildSuccess(chinese) ; |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | rsVo.obj = seCardOperateMapper.getReissueCards(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取收据列表 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getReceipts(QoReceipt queryVo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | Double totalAmount = Optional.ofNullable(seCardOperateMapper.getTotalAmount(params)).orElse(0.0); |
| | | |
| | | Long itemTotal = seCardOperateMapper.getReceiptsRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoReceipt>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | //rsVo.obj = seCardOperateMapper.getReceipts(params); |
| | | //return rsVo ; |
| | | |
| | | List<VoReceipt> list = seCardOperateMapper.getReceipts(params); |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("pageSize", rsVo.pageSize); |
| | | map_record.put("pageTotal", rsVo.pageTotal); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalAmount", df.format(totalAmount)); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.cardOperate.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-02-01 11:03 |
| | | * @LastEditTime 2024-02-01 11:03 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(name = "收据查询条件") |
| | | public class QoReceipt extends QueryConditionVo { |
| | | @Schema(description = "交易ID") |
| | | public Long operateId; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String clientName; |
| | | |
| | | @Schema(description = "充值机时间_开始") |
| | | public String timeStart; |
| | | |
| | | @Schema(description = "充值机时间_结束") |
| | | public String timeStop; |
| | | } |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取财务对账_交易明细 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获取财务对账_交易明细", description = "获取财务对账_交易明细") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "get_trade_details") |
| | | @SsoAop() |
| | | public BaseResponse<Map> getTradeDetails(QoToAudit vo){ |
| | | try { |
| | | Map res = Optional.ofNullable(generalSv.getTradeDetails(vo)).orElse(new HashMap()); |
| | | if(res.size() > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.No_TRADE_DETAILS.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询交易记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.general; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeAuditsMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeGeneralMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.*; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeAudits; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoGeneral; |
| | | import com.dy.pipIrrGlobal.voSe.VoTradeDetails; |
| | | import com.dy.pipIrrGlobal.voSe.VoTransactionStatistics; |
| | | import com.dy.pipIrrSell.general.qo.QoGeneral; |
| | | import com.dy.pipIrrSell.general.qo.QoToAudit; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SeCardOperateMapper seCardOperateMapper; |
| | | |
| | | @Autowired |
| | | private SeWalletRechargeMapper seWalletRechargeMapper; |
| | | |
| | | @Autowired |
| | | private SeRefundMapper seRefundMapper; |
| | | |
| | | /** |
| | | * 获取未生成总账的交易日期列表(当天的交易记录不生成总账) |
| | |
| | | } |
| | | |
| | | /** |
| | | * t添加总账审核记录 |
| | | * 添加总账审核记录 |
| | | * @param po |
| | | * @return |
| | | */ |
| | |
| | | * @return |
| | | */ |
| | | public Map getToAudit(QoToAudit vo) { |
| | | /** |
| | | * 取出指定日期三种支付方式(现金、扫码、转账)实收金额 |
| | | */ |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | |
| | | // 接收传入参数:操作日期、收银员ID |
| | | JSONArray array_paymentSums = new JSONArray(); |
| | | String tradeDate = vo.getTradeDate(); |
| | | Long cashierId = vo.cashierId; |
| | | |
| | | // 分别计算指定日期、指定收银员、指定支付方式实收金额 |
| | | Float receivedCash = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 1L)).orElse(0f); |
| | | Float receivedQRCode = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId,2L)).orElse(0f); |
| | | Float receivedTransfer = Optional.ofNullable(seGeneralMapper.getPaymentSums(tradeDate, cashierId, 3L)).orElse(0f); |
| | | |
| | | // 分级计算指定日期微信收退款合计,再计算实收金额 |
| | | Double rechargeWeChat = Optional.ofNullable(seWalletRechargeMapper.getRechargeSum(tradeDate)).orElse(0.0); |
| | | Double refundWeChat = Optional.ofNullable(seRefundMapper.getRefundSum(tradeDate)).orElse(0.0); |
| | | Double receiveWeChat = rechargeWeChat - refundWeChat; |
| | | |
| | | // 四种支付方式实收金额合计写入返回对象(写入前格式化) |
| | | JSONObject job = new JSONObject(); |
| | | job.put("tradeDate", tradeDate); |
| | | job.put("receivedCash", receivedCash); |
| | | job.put("receivedQRCode", receivedQRCode); |
| | | job.put("receivedTransfer", receivedTransfer); |
| | | job.put("receivedCash", df.format(receivedCash)); |
| | | job.put("receivedQRCode", df.format(receivedQRCode)); |
| | | job.put("receivedTransfer", df.format(receivedTransfer)); |
| | | job.put("receiveWeChat", df.format(receiveWeChat)); |
| | | array_paymentSums.add(job); |
| | | |
| | | // 生成查询参数 |
| | |
| | | |
| | | return map_result; |
| | | } |
| | | |
| | | /** |
| | | * 根据收银员ID及日期获取财务对账_交易明细记录 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public Map getTradeDetails(QoToAudit queryVo) { |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); |
| | | |
| | | Long itemTotal = seGeneralMapper.getTradeDetailsRecordCount(params); |
| | | |
| | | QueryResultVo<List<VoTradeDetails>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | //rsVo.obj = seGeneralMapper.getTradeDetails(params); |
| | | List<VoTradeDetails> list = Optional.ofNullable(seGeneralMapper.getTradeDetails(params)).orElse(new ArrayList<>()); |
| | | if(list.size() == 0) { |
| | | return new HashMap(); |
| | | } |
| | | |
| | | Double totalTradeAmount = 0.0; |
| | | JSONArray array= JSONArray.parseArray(JSON.toJSONString(list)); |
| | | for(int i = 0; i < array.size(); i++) { |
| | | JSONObject job = array.getJSONObject(i); |
| | | Double tradeAmount = Optional.ofNullable(job.getDouble("tradeAmount")).orElse(0.0); |
| | | totalTradeAmount = totalTradeAmount + tradeAmount; |
| | | } |
| | | |
| | | Map map_record = new HashMap(); |
| | | map_record.put("itemTotal", rsVo.itemTotal); |
| | | map_record.put("pageCurr", rsVo.pageCurr); |
| | | map_record.put("list", list); |
| | | |
| | | Map map_result = new HashMap(); |
| | | map_result.put("totalTradeAmount", df.format(totalTradeAmount)); |
| | | map_result.put("records", map_record); |
| | | |
| | | return map_result; |
| | | |
| | | } |
| | | } |
| | |
| | | AUDIT_REFUND_FAIL(900012, "审核退款申请失败"), |
| | | No_WALLER_RECHARGES(900013, "没有符合条件的充值数据"), |
| | | WALLET_CLIENT_ID_CANNOT_BE_NULL(900014, "查询电子钱包消费汇总失败,农户ID不能为空"), |
| | | No_REFUNDS(900015, "没有符合条件的退款数据"); |
| | | No_REFUNDS(900015, "没有符合条件的退款数据"), |
| | | |
| | | /** |
| | | * 收据 |
| | | */ |
| | | No_RECEIPTS(100001, "没有符合条件的收据"), |
| | | |
| | | /** |
| | | * 财务对账 |
| | | */ |
| | | No_TRADE_DETAILS(100001, "没有符合条件的交易明细"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |