Procházet zdrojové kódy

付款管理-付款明细导出

ZhangWenQiang před 4 roky
rodič
revize
f632f1b479

+ 28 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/controller/HlgPaymentDetailController.java

@@ -17,6 +17,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailExport;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailExport;
+import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailExportOut;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
 import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
 
 
@@ -322,4 +323,31 @@ public class HlgPaymentDetailController {
         return mv;
         return mv;
     }
     }
 
 
+    /**
+     * 导出excel
+     *
+     * @param request
+     */
+    @RequestMapping(value = "/exportXlsUrl")
+    public ModelAndView exportXlsUrl(HttpServletRequest request, HlgPaymentDetail hlgPaymentDetail) {
+        // Step.1 组装查询条件查询数据
+        List<HlgPaymentDetailExportOut> pageList = hlgPaymentDetailService.findListNoPage(hlgPaymentDetail);
+        // Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        // 过滤选中数据
+        String selections = request.getParameter("selections");
+        if (oConvertUtils.isEmpty(selections)) {
+            mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        } else {
+            List<String> selectionList = Arrays.asList(selections.split(","));
+            List<HlgPaymentDetailExportOut> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
+            mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
+        }
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "付款明细表");
+        mv.addObject(NormalExcelConstants.CLASS, HlgPaymentDetailExportOut.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("付款明细表", "导出信息"));
+        return mv;
+    }
+
 }
 }

+ 37 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/entity/HlgPaymentDetailExportOut.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.hlgpayment.entity;
+
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+
+/**
+ * @Description: hw_enrollment
+ * @Author: jeecg-boot
+ * @Date: 2019-09-23
+ * @Version: V1.0
+ */
+@Data
+public class HlgPaymentDetailExportOut implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Excel(name = "姓名", width = 15)
+    private String userName; //姓名
+
+    @Excel(name = "身份证号", width = 20)
+    public String idcardNumber;//身份证号
+
+    @Excel(name = "手机号", width = 15)
+    private String phone;
+
+    @Excel(name = "银行卡号", width = 20)
+    private String cardNumber;//银行卡号
+
+
+    @Excel(name = "付款金额", width = 15)
+    private Double payment; //金额
+
+    private Integer id;//序号
+
+
+}

+ 3 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/IHlgPaymentDetailService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailExportOut;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -36,4 +37,6 @@ public interface IHlgPaymentDetailService extends IService<HlgPaymentDetail> {
     void deleteByLogic(HlgPayment hlgPayment);
     void deleteByLogic(HlgPayment hlgPayment);
 
 
     Page<HlgPaymentDetail> pageListApi(Integer pageNo, Integer pageSize, HlgPaymentDetail hlgPaymentDetail, HttpServletRequest req);
     Page<HlgPaymentDetail> pageListApi(Integer pageNo, Integer pageSize, HlgPaymentDetail hlgPaymentDetail, HttpServletRequest req);
+
+    List<HlgPaymentDetailExportOut> findListNoPage(HlgPaymentDetail hlgPaymentDetail);
 }
 }

+ 42 - 4
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgpayment/service/impl/HlgPaymentDetailServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.hlgpayment.service.impl;
 package org.jeecg.modules.hlgpayment.service.impl;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,6 +14,7 @@ import org.jeecg.common.utils.OauthApi;
 import org.jeecg.common.utils.OauthTokenUtils;
 import org.jeecg.common.utils.OauthTokenUtils;
 import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPayment;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetail;
+import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailExportOut;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.entity.HlgPaymentDetailStatistics;
 import org.jeecg.modules.hlgpayment.mapper.HlgPaymentDetailMapper;
 import org.jeecg.modules.hlgpayment.mapper.HlgPaymentDetailMapper;
 import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
 import org.jeecg.modules.hlgpayment.service.IHlgPaymentDetailService;
@@ -24,10 +26,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -178,4 +177,43 @@ public class HlgPaymentDetailServiceImpl extends ServiceImpl<HlgPaymentDetailMap
         }
         }
         return page;
         return page;
     }
     }
+
+    @Override
+    public List<HlgPaymentDetailExportOut> findListNoPage(HlgPaymentDetail hlgPaymentDetail) {
+        List<HlgPaymentDetailExportOut> list = new ArrayList<>();
+        //付款申请详情列表信息
+        String accessToken = OauthTokenUtils.getDayAccessToken();
+        String requestUrl = OauthApi.paymentDetailList;
+        Map<String, Object> parameters = new HashMap<>();
+        parameters.put("pageNo", 1);
+        parameters.put("pageSize", -1);
+        parameters.put("paymentId", hlgPaymentDetail.getPaymentId());
+        parameters.put("status", hlgPaymentDetail.getStatus());
+        //数据加密
+        String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
+        JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
+        log.info("付款申请详情列表===={}", jsonObject);
+        if (jsonObject != null) {
+            if (jsonObject.getBoolean(HttpsContants.SUCCESS_FLAG)) {
+                log.info("付款申请详情列表成功===={}", jsonObject);
+                JSONArray jsonArray = jsonObject.getJSONArray("result");
+                for (int i = 0; i < jsonArray.size(); i++) {
+                    JSONObject jsonObjectDetail = jsonArray.getJSONObject(i);
+                    HlgPaymentDetailExportOut hwPaymentDetailDto = new HlgPaymentDetailExportOut();
+                    hwPaymentDetailDto.setUserName(jsonObjectDetail.getString("userName"));
+                    hwPaymentDetailDto.setIdcardNumber(jsonObjectDetail.getString("idcardNumber"));
+                    hwPaymentDetailDto.setPhone(jsonObjectDetail.getString("phone"));
+                    hwPaymentDetailDto.setCardNumber(jsonObjectDetail.getString("cardNumber"));
+                    hwPaymentDetailDto.setPayment(jsonObjectDetail.getDouble("netPayment"));
+                    list.add(hwPaymentDetailDto);
+                }
+                log.info("付款申请详情列表数组==={}", list);
+            } else {
+                throw new JeecgBootException("查询数据异常");
+            }
+        } else {
+            throw new JeecgBootException("查询数据异常");
+        }
+        return list;
+    }
 }
 }