Quellcode durchsuchen

1.开票列表查询新增查询条件产品收款id
2.一对多导出调整

GouGengquan vor 1 Jahr
Ursprung
Commit
f4ed0fd632

+ 3 - 3
biz-base/src/main/java/com/dayou/controller/FinanceInvoiceController.java

@@ -88,9 +88,9 @@ public class FinanceInvoiceController extends BaseController {
      * @param id
      * @return
      */
-    @GetMapping("/fund/{id}")
-    public RestResponse<List<FinanceInvoice>> getList(@PathVariable("id") Long id){
-        List<FinanceInvoice> result = financeInvoiceService.getList(id);
+    @GetMapping("/fund/{id}/{productionFundId}")
+    public RestResponse<List<FinanceInvoice>> getList(@PathVariable("id") Long id, @PathVariable("productionFundId") Long productionFundId){
+        List<FinanceInvoice> result = financeInvoiceService.getList(id, productionFundId);
         return RestResponse.data(result);
     }
 

+ 9 - 10
biz-base/src/main/java/com/dayou/controller/FinanceRealFundController.java

@@ -1,7 +1,7 @@
 package com.dayou.controller;
 
 import cn.hutool.core.collection.CollectionUtil;
-import com.dayou.utils.ExcelOneToManyExport;
+import com.dayou.utils.ExcelOneToManyExportUtils;
 import com.dayou.vo.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,7 +14,6 @@ import com.dayou.common.RestResponse;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 import javax.servlet.http.HttpServletResponse;
@@ -121,10 +120,10 @@ public class FinanceRealFundController extends BaseController {
      * @return
      */
     @GetMapping("/major/evaluator/settle/export")
-    public void majorEvaluatorSettleExport(SettleMajorProductionVO production, HttpServletResponse response)throws IOException {
+    public void majorEvaluatorSettleExport(SettleMajorProductionVO production, HttpServletResponse response) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<SettleMajorProductionVO> result = financeRealFundService.majorEvaluatorSettleExport(production);
 //        exportPlus(response,"大中型评估人员结算项目",result, SettleMajorProductionVO.class);
-        ExcelOneToManyExport.exportWithParentChild(response,result, SettleMajorProductionVO.class, SettleProInvoiceVo.class,"大中型评估人员结算项目", "invoices");
+        ExcelOneToManyExportUtils.exportOneToMany(response,result, SettleMajorProductionVO.class, SettleProInvoiceVo.class,"大中型评估人员结算项目", "invoices");
     }
 
     /**
@@ -145,10 +144,10 @@ public class FinanceRealFundController extends BaseController {
      * @return
      */
     @GetMapping("/major/market/settle/export")
-    public void majorMarketSettleExport(SettleMajorProductionVO production, HttpServletResponse response)throws IOException {
+    public void majorMarketSettleExport(SettleMajorProductionVO production, HttpServletResponse response) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<SettleMajorProductionVO> result = financeRealFundService.majorMarketSettleExport(production);
 //        exportPlus(response,"大中型市场人员结算项目",result, SettleMajorProductionVO.class);
-        ExcelOneToManyExport.exportWithParentChild(response,result, SettleMajorProductionVO.class, SettleProInvoiceVo.class,"大中型市场人员结算项目", "invoices");
+        ExcelOneToManyExportUtils.exportOneToMany(response,result, SettleMajorProductionVO.class, SettleProInvoiceVo.class,"大中型市场人员结算项目", "invoices");
     }
 
     /**
@@ -453,10 +452,10 @@ public class FinanceRealFundController extends BaseController {
      * @param settleVO vo
      */
     @GetMapping("/assets/market/settle/export")
-    public void assetsMarketSettleExport(SettleAssetsProductionVO settleVO, HttpServletResponse response)throws IOException {
+    public void assetsMarketSettleExport(SettleAssetsProductionVO settleVO, HttpServletResponse response) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<SettleAssetsProductionVO> result = financeRealFundService.assetsMarketSettleExport(settleVO);
 //        exportPlus(response,"资产市场人员结算项目",result, SettleAssetsProductionVO.class);
-        ExcelOneToManyExport.exportWithParentChild(response,result, SettleAssetsProductionVO.class, SettleProInvoiceVo.class,"资产市场人员结算项目", "invoices");
+        ExcelOneToManyExportUtils.exportOneToMany(response,result, SettleAssetsProductionVO.class, SettleProInvoiceVo.class,"资产市场人员结算项目", "invoices");
     }
 
     /**
@@ -476,10 +475,10 @@ public class FinanceRealFundController extends BaseController {
      * @param settleVO vo
      */
     @GetMapping("/assets/evaluator/settle/export")
-    public void assetsEvaluatorSettleExport(SettleAssetsProductionVO settleVO, HttpServletResponse response)throws IOException {
+    public void assetsEvaluatorSettleExport(SettleAssetsProductionVO settleVO, HttpServletResponse response) throws IOException, NoSuchFieldException, IllegalAccessException {
         List<SettleAssetsProductionVO> result = financeRealFundService.assetsEvaluatorSettleExport(settleVO);
 //        exportPlus(response,"资产评估人员结算项目",result, SettleAssetsProductionVO.class);
-        ExcelOneToManyExport.exportWithParentChild(response,result, SettleAssetsProductionVO.class, SettleProInvoiceVo.class,"资产评估人员结算项目", "invoices");
+        ExcelOneToManyExportUtils.exportOneToMany(response,result, SettleAssetsProductionVO.class, SettleProInvoiceVo.class,"资产评估人员结算项目", "invoices");
     }
 }
 

+ 10 - 14
common/src/main/java/com/dayou/utils/ExcelOneToManyExport.java

@@ -14,7 +14,7 @@ import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.List;
 
-public class ExcelOneToManyExport {
+public class ExcelOneToManyExportUtils {
 
     /**
      * 导出一对多excel
@@ -26,7 +26,7 @@ public class ExcelOneToManyExport {
      * @param title       标题
      * @param listName    子级的集合字段(属性)名
      */
-    public static void exportWithParentChild(HttpServletResponse response, List<?> parentList, Class<?> parentClazz, Class<?> childClazz, String title, String listName) throws IOException {
+    public static void exportOneToMany(HttpServletResponse response, List<?> parentList, Class<?> parentClazz, Class<?> childClazz, String title, String listName) throws IOException, NoSuchFieldException, IllegalAccessException {
         // 获取注解信息
         List<Excel> annoFieldInfo = new ArrayList<>();
         annoFieldInfo.addAll(getAnnotatedFieldNames(parentClazz));
@@ -147,9 +147,7 @@ public class ExcelOneToManyExport {
      * @param fieldName 字段名
      * @return String
      */
-    public static Object getFieldValueByName(Object obj, String fieldName) {
-        Object fieldValue = null;
-        try {
+    public static Object getFieldValueByName(Object obj, String fieldName) throws NoSuchFieldException, IllegalAccessException {
             // 获取对象的Class对象
             Class<?> clazz = obj.getClass();
             // 通过反射获取指定名称的字段
@@ -157,13 +155,7 @@ public class ExcelOneToManyExport {
             // 设置字段可访问,以便能够访问私有字段
             field.setAccessible(true);
             // 获取字段值
-            fieldValue = field.get(obj);
-        } catch (NoSuchFieldException e) {
-            System.out.println("字段 " + fieldName + " 在类 " + obj.getClass().getName() + " 中不存在.");
-        } catch (IllegalAccessException e) {
-            System.out.println("无法访问字段 " + fieldName + " 的值.");
-        }
-        return fieldValue;
+            return field.get(obj);
     }
 
     /**
@@ -216,17 +208,21 @@ public class ExcelOneToManyExport {
      * @return CellStyle
      */
     public static CellStyle getCellStyleBorderWithColor(XSSFWorkbook workbook, Short backColor, Short textColor) {
-        // 设置边框样式
+        // 设置单元格背景色
         CellStyle style = workbook.createCellStyle();
         if (ObjectUtil.isNotNull(backColor)) {
-            style.setFillBackgroundColor(backColor);
+            style.setFillForegroundColor(backColor);
+            style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
         }
+        // 设置字体样式
         Font headerFont = workbook.createFont();
         headerFont.setFontName("Arial");
         headerFont.setFontHeightInPoints((short) 10);
         if (ObjectUtil.isNotNull(textColor)) {
             headerFont.setBold(true);
+            headerFont.setColor(IndexedColors.WHITE.getIndex());
         }
+        // 设置边框样式
         style.setFont(headerFont);
         style.setAlignment(HorizontalAlignment.CENTER);
         style.setVerticalAlignment(VerticalAlignment.CENTER);

+ 3 - 3
domain/src/main/java/com/dayou/vo/SettleAssetsProductionVO.java

@@ -15,7 +15,7 @@ public class SettleAssetsProductionVO {
     @Excel(name = "项目编号")
     private String orderId;
 
-    @Excel(name = "产品号")
+    @Excel(name = "产品号", width = 30)
     private String productionNo;
 
     @Excel(name = "结算日期")
@@ -30,7 +30,7 @@ public class SettleAssetsProductionVO {
     @Excel(name = "送达日期")
     private LocalDate deliveryDate;
 
-    @Excel(name = "项目名称")
+    @Excel(name = "项目名称", width = 30)
     private String projectName;
 
     @Excel(name = "客户名称")
@@ -57,7 +57,7 @@ public class SettleAssetsProductionVO {
     @Excel(name = "结算金额(元)")
     private BigDecimal claimAmount;
 
-    @Excel(name = "评估价值(元)")
+    @Excel(name = "评估价值(元)")
     private BigDecimal evaluateAmount;
 
     /**

+ 4 - 4
domain/src/main/java/com/dayou/vo/SettleProInvoiceVo.java

@@ -9,14 +9,14 @@ import java.time.LocalDate;
 @Data
 public class SettleProInvoiceVo {
 
-    @Excel(name = "开票日期")
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private LocalDate invoiceDate;
-
     @Excel(name = "开票人")
     private String invoiceUser;
 
     @Excel(name = "发票号", width = 30)
     private String invoiceNo;
 
+    @Excel(name = "开票日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate invoiceDate;
+
 }

+ 1 - 1
service/src/main/java/com/dayou/service/IFinanceInvoiceService.java

@@ -32,7 +32,7 @@ public interface IFinanceInvoiceService extends IService<FinanceInvoice> {
 
         Boolean delete(Long id);
 
-    List<FinanceInvoice> getList(Long id);
+    List<FinanceInvoice> getList(Long id, Long productionFundId);
 
         Boolean cancellation(Long id);
 

+ 6 - 2
service/src/main/java/com/dayou/service/impl/FinanceInvoiceServiceImpl.java

@@ -1,6 +1,7 @@
 package com.dayou.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.dayou.common.BaseEntity;
 import com.dayou.dto.MajorProductionSimpleDTO;
 import com.dayou.entity.FinanceInvoice;
@@ -98,8 +99,11 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
     }
 
     @Override
-    public List<FinanceInvoice> getList(Long id) {
-        List<FinanceInvoice> list = this.list(new LambdaQueryWrapper<FinanceInvoice>().eq(FinanceInvoice::getOrderFundId, id).orderByDesc(BaseEntity::getCreated));
+    public List<FinanceInvoice> getList(Long id, Long productionFundId) {
+        List<FinanceInvoice> list = this.list(new LambdaQueryWrapper<FinanceInvoice>()
+                .eq(FinanceInvoice::getOrderFundId, id)
+                .eq(ObjectUtil.isNotNull(productionFundId),FinanceInvoice::getProductionFundId, productionFundId)
+                .orderByDesc(BaseEntity::getCreated));
         return list;
     }