Kaynağa Gözat

我的账单

fllmoyu 4 yıl önce
ebeveyn
işleme
b24936589f

+ 17 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dto/DetailDTO.java

@@ -0,0 +1,17 @@
+package com.jpsoft.enterprise.modules.base.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-2-23 11:28
+ */
+@Data
+public class DetailDTO {
+
+    private String name;
+
+    private BigDecimal value;
+}

+ 57 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dto/OrderDetailDTO.java

@@ -3,10 +3,14 @@ package com.jpsoft.enterprise.modules.base.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.record.pivottable.PageItemRecord;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author 墨鱼_mo
@@ -29,14 +33,67 @@ public class OrderDetailDTO {
 
     private String billDetail;
 
+    private List<DetailDTO> detailList;
+
     private Integer payStatus;
 
+    private String payStatusStr;
+
     private String payName;
 
+    private String payNameStr;
+
     private String outOrderNo;
 
     @ApiModelProperty(value = "支付时间")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
     private Date payTime;
+
+    private String accountName;
+
+    private String accountBank;
+
+    private String accountNo;
+
+    private String ticketStatus;
+
+    public String getPayStatusStr() {
+        if (payStatus.equals(10)){
+            return "未支付";
+        }
+        else if (payStatus.equals(20)){
+            return "已支付";
+        }
+        else if (payStatus.equals(30)){
+            return "已关闭";
+        }
+        else{
+            return "已退款";
+        }
+    }
+
+    public String getPayNameStr() {
+        if (StringUtils.isBlank(payName)){
+            return "未支付";
+        }
+        else if ("wechat".equals(payName)){
+            return "微信支付";
+        }
+        else if ("alipay".equals(payName)){
+            return "支付宝支付";
+        }
+        else if ("cash".equals(payName)){
+            return "现金";
+        }
+        else if ("transfer".equals(payName)){
+            return "对公转账";
+        }
+        else if ("individual".equals(payName)){
+            return "个人账户";
+        }
+
+        return payNameStr;
+    }
+
 }

+ 2 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/BillDetailInfo.java

@@ -59,5 +59,7 @@ public class BillDetailInfo {
 
    private Integer sortNo;
 
+   private String ticketStatus = "0";
+
 
 }

+ 2 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/OrderInfo.java

@@ -92,6 +92,8 @@ public class OrderInfo {
     @ApiModelProperty(value = "支付金额")
     private BigDecimal refundFee;
 
+    private String accountId;
+
 
     public String getPayNameStr() {
         if (StringUtils.isBlank(payName)){

+ 3 - 3
common/src/main/resources/mapper/base/AccountInfo.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<!-- namespace±ØÐëÖ¸ÏòDAO½Ó¿Ú -->
+
 <mapper namespace="com.jpsoft.enterprise.modules.base.dao.AccountInfoDAO">
 	<resultMap id="AccountInfoMap" type="com.jpsoft.enterprise.modules.base.entity.AccountInfo">
 		<id property="id" column="id_" />
@@ -81,7 +81,7 @@
 	where id_=#{id}
 	</update>
 	<select id="get" parameterType="string" resultMap="AccountInfoMap">
-		select 
+		select
 id_,account_name,account_bank,account_no,wx_mchid,app_auth_token,create_by,create_time,update_by,update_time,del_flag		from base_account_info where id_=#{0}
 	</select>
 	<select id="exist" parameterType="string" resultType="int">

+ 7 - 2
common/src/main/resources/mapper/base/BillDetailInfo.xml

@@ -16,6 +16,7 @@
         <result property="updateTime" column="update_time" />
         <result property="delFlag" column="del_flag" />
         <result property="sortNo" column="sort_no"/>
+        <result property="ticketStatus" column="ticket_status"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.BillDetailInfo">
         <!--
@@ -25,7 +26,7 @@
         -->
         <![CDATA[
 		insert into base_bill_detail_info
-	    (id_,bill_id,order_id,company_id,bill_detail,rush_status,create_by,create_time,update_by,update_time,del_flag,sort_no)
+	    (id_,bill_id,order_id,company_id,bill_detail,rush_status,create_by,create_time,update_by,update_time,del_flag,sort_no,ticket_status)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -40,6 +41,7 @@
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{sortNo,jdbcType=INTEGER}
+,#{ticketStatus,jdbcType=VARCHAR}
 		)
 	]]>
     </insert>
@@ -80,7 +82,10 @@
                 del_flag=#{delFlag,jdbcType= NUMERIC },
             </if>
             <if test="sortNo != null">
-                sort_no = #{sortNo,jdbcType=INTEGER}
+                sort_no = #{sortNo,jdbcType=INTEGER},
+            </if>
+            <if test="ticketStatus != null">
+                ticket_status = #{ticketStatus,jdbcType=VARCHAR}
             </if>
         </set>
         where id_=#{id}

+ 8 - 3
common/src/main/resources/mapper/base/OrderInfo.xml

@@ -22,6 +22,7 @@
         <result property="type" column="type_"/>
         <result property="refundFee" column="refund_fee"/>
         <result property="refundTime" column="refund_time"/>
+        <result property="accountId" column="account_id"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.OrderInfo">
         <!--
@@ -31,7 +32,7 @@
         -->
         <![CDATA[
 		insert into base_order_info
-	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,pay_time,out_order_no,transaction_id,open_id,del_flag,create_by,create_time,update_by,update_time,type_,refund_fee,refund_time)
+	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,pay_time,out_order_no,transaction_id,open_id,del_flag,create_by,create_time,update_by,update_time,type_,refund_fee,refund_time,account_id)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -52,6 +53,7 @@
 ,#{type,jdbcType=VARCHAR}
 ,#{refundFee,jdbcType=DECIMAL}
 ,#{refundTime,jdbcType=TIMESTAMP}
+,#{accountId,jdbcType=VARCHAR}
 		)
 	]]>
     </insert>
@@ -107,10 +109,13 @@
                 type_=#{type,jdbcType= VARCHAR },
             </if>
             <if test="refundFee!=null">
-                refund_fee = #{refundFee,jdbcType=DECIMAL}
+                refund_fee = #{refundFee,jdbcType=DECIMAL},
             </if>
             <if test="refundTime != null">
-                refund_time = #{refundTime,jdbcType=TIMESTAMP}
+                refund_time = #{refundTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="accountId != null">
+                account_id = #{accountId,jdbcType=VARCHAR}
             </if>
         </set>
         where id_=#{id}

+ 28 - 4
web/src/main/java/com/jpsoft/enterprise/modules/mobile/controller/OrderInfoApiController.java

@@ -1,6 +1,9 @@
 package com.jpsoft.enterprise.modules.mobile.controller;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.github.pagehelper.Page;
 import com.jpsoft.enterprise.modules.base.dto.*;
 import com.jpsoft.enterprise.modules.base.entity.*;
@@ -17,10 +20,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author 墨鱼_mo
@@ -47,6 +47,9 @@ public class OrderInfoApiController {
     @Autowired
     private BillDetailInfoService billDetailInfoService;
 
+    @Autowired
+    private AccountInfoService accountInfoService;
+
     @PostMapping("orderList")
     @ApiOperation(value = "订单列表")
     public MessageResult<Map> orderList(
@@ -134,6 +137,9 @@ public class OrderInfoApiController {
             BillInfo billInfo = billInfoService.get(billDetailInfo.getBillId());
             OrderInfo orderInfo = orderInfoService.get(billDetailInfo.getOrderId());
             CompanyInfo companyInfo = companyInfoService.get(billDetailInfo.getCompanyId());
+            AccountInfo accountInfo = accountInfoService.get(orderInfo.getAccountId());
+
+
             OrderDetailDTO orderDetailDTO = new OrderDetailDTO();
             orderDetailDTO.setId(orderInfo.getId());
             orderDetailDTO.setBillDetailId(billDetailInfo.getId());
@@ -146,6 +152,24 @@ public class OrderInfoApiController {
             orderDetailDTO.setPayName(orderInfo.getPayName());
             orderDetailDTO.setOutOrderNo(orderInfo.getOutOrderNo());
             orderDetailDTO.setPayTime(orderInfo.getPayTime());
+            orderDetailDTO.setAccountName(accountInfo.getAccountName());
+            orderDetailDTO.setAccountBank(accountInfo.getAccountBank());
+            orderDetailDTO.setAccountNo(accountInfo.getAccountNo());
+            orderDetailDTO.setPayStatusStr(orderDetailDTO.getPayStatusStr());
+            orderDetailDTO.setPayNameStr(orderDetailDTO.getPayNameStr());
+            orderDetailDTO.setTicketStatus(billDetailInfo.getTicketStatus());
+
+            List<DetailDTO> detailDTOList = new ArrayList<>();
+            JSONObject jsonObject = JSONUtil.parseObj(billDetailInfo.getBillDetail());
+            Set<String> set = jsonObject.keySet();
+            for (String key : set){
+                DetailDTO detailDTO = new DetailDTO();
+                detailDTO.setName(key);
+                detailDTO.setValue(jsonObject.getBigDecimal(key));
+                detailDTOList.add(detailDTO);
+            }
+            orderDetailDTO.setDetailList(detailDTOList);
+
 
             messageResult.setData(orderDetailDTO);
             messageResult.setResult(true);