Pārlūkot izejas kodu

1.新增导出罚款退款记录接口
2.新增修改罚款记录状态接口
3.新增工具方法 dateToLocalDateTime Date类型转LocalDateTime类型

GouGengquan 3 mēneši atpakaļ
vecāks
revīzija
e504ad8ee2

+ 31 - 4
biz-base/src/main/java/com/dayou/controller/FinanceFineRefundController.java

@@ -17,11 +17,18 @@ import org.springframework.web.bind.annotation.*;
 import com.dayou.utils.ConvertUtil;
 import com.dayou.utils.HttpKit;
 import com.dayou.exception.ErrorCode;
+
+import java.io.IOException;
 import java.util.Date;
 import java.util.List;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.http.MediaType;
 import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+
+import static com.dayou.enums.MainBusinessEnum.*;
+
 /**
  * 罚款退款表
  *
@@ -49,6 +56,24 @@ public class FinanceFineRefundController extends BaseController {
     }
 
     /**
+     * 导出罚款记录
+     * @param dto 查询条件
+     */
+    @GetMapping("/export")
+    public void exportList(FinanceFineRefundSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<FinanceFineRefundVO> financeFineRefundVOList = financeFineRefundService.exportList(dto);
+        String businessName = null;
+        if (dto.getBusinessType().equals(ASSET_BUSINESS.getCode())) {
+            businessName = ASSET_BUSINESS.getMsg();
+        } else if (dto.getBusinessType().equals(MAJOR_BUSINESS.getCode())) {
+            businessName = MAJOR_BUSINESS.getMsg();
+        } else {
+            businessName = PERSONAL_BUSINESS.getMsg();
+        }
+        exportPlus(response,businessName + "_退款记录",financeFineRefundVOList, FinanceFineRefundVO.class);
+    }
+
+    /**
      * 罚款退款表详情
      */
     @GetMapping("/{id}")
@@ -67,11 +92,13 @@ public class FinanceFineRefundController extends BaseController {
     }
 
     /**
-     * 罚款退款表更新
+     * 更新罚款记录状态
+     * @param financeFineRefund 更新内容
+     * @return Boolean
      */
-    @PutMapping("")
-    public RestResponse<Boolean> update(@RequestBody FinanceFineRefund financeFineRefund) {
-        Boolean ret = financeFineRefundService.update(financeFineRefund);
+    @PutMapping("/updateStatus")
+    public RestResponse<Boolean> updateStatus(@RequestBody FinanceFineRefund financeFineRefund) {
+        Boolean ret = financeFineRefundService.updateStatus(financeFineRefund);
         return RestResponse.data(ret);
     }
 

+ 14 - 0
common/src/main/java/com/dayou/utils/DateUtils.java

@@ -440,6 +440,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     }
 
     /**
+     * Date类型转LocalDateTime类型
+     * @param date
+     * @return
+     */
+    public static LocalDateTime dateToLocalDateTime(Date date) {
+        // 将 Date 转换为 Instant
+        Instant instant = date.toInstant();
+        // 获取系统默认时区
+        ZoneId zoneId = ZoneId.systemDefault();
+        // 将 Instant 转换为 LocalDateTime
+        return instant.atZone(zoneId).toLocalDateTime();
+    }
+
+    /**
      * LocalDate类型转Date类型
      * @param localDate
      * @return Date

+ 9 - 0
dao/src/main/java/com/dayou/mapper/FinanceFineRefundMapper.java

@@ -7,6 +7,8 @@ import com.dayou.dao.CustomBaseMapper;
 import com.dayou.vo.FinanceFineRefundVO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  * 罚款退款表 Mapper 接口
@@ -25,4 +27,11 @@ public interface FinanceFineRefundMapper extends CustomBaseMapper<FinanceFineRef
      */
     Page<FinanceFineRefundVO> selectPage(@Param("page") Page page, @Param("dto") FinanceFineRefundSelectDTO dto);
 
+    /**
+     * 导出罚款退款记录
+     * @param dto 查询条件
+     * @return List<FinanceFineRefundVO>
+     */
+    List<FinanceFineRefundVO> exportList(@Param("dto") FinanceFineRefundSelectDTO dto);
+
 }

+ 43 - 33
dao/src/main/resources/mapper/FinanceFineRefundMapper.xml

@@ -25,40 +25,40 @@
         fine_id, refund_amount, refund_reason, statue, user_id, refund_date
     </sql>
 
-    <!--条件分页查询罚款退款记录-->
-    <select id="selectPage" resultType="com.dayou.vo.FinanceFineRefundVO">
+    <sql id="financeFineRefundVOSql">
         SELECT refund.id AS id,
-               refund.fine_id AS fineId,
-               oFund.order_id AS orderId,
-               oFund.order_name AS orderName,
-               <if test="dto != null and dto.businessType == 'ASSET_BUSINESS' or dto.businessType == 'MAJOR_BUSINESS'">
-                    pFund.production_no AS productionNo,
-                   `order`.bailor AS bailor,
-               </if>
-               <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
-                   `order`.order_id AS productionNo,
-                   CONCAT(`order`.bailorA, IF(`order`.bailorB IS NOT NULL AND `order`.bailorB != '', ',', ''), `order`.bailorB) AS bailor,
-               </if>
-               <if test="dto != null and dto.businessType == 'ASSET_BUSINESS'">
-                   CASE pFund.production_type WHEN 'LETTER' THEN '意见函' WHEN 'CONSULT' THEN '咨询报告' WHEN 'REPORT' THEN '评估报告' ELSE '-' END AS productionType,
-               </if>
-               <if test="dto != null and dto.businessType == 'MAJOR_BUSINESS'">
-                   CASE pFund.production_type WHEN 'LETTER' THEN '复评函' WHEN 'REPORT' THEN '报告' WHEN 'STATEMENT' THEN '价值意见书' ELSE '-' END AS productionType,
-               </if>
-               <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
-                   CASE pro.production WHEN 'FINAL' THEN '结果报告' WHEN 'TECHNIC' THEN '技术报告' ELSE '-' END AS productionType,
-               </if>
-               user.name AS clientManagerName,
-               customer.name AS customerName,
-               subCustomer.name AS customerSubName,
-               fine.real_fine_amount AS finedAmount,
-               refund.refund_amount AS refundAmount,
-               refund.refund_date AS refundDate,
-               refund.refund_amount AS refundAmount,
-               refund.refund_reason AS refundReason,
-               refund.status AS status,
-               operator.name AS operator,
-               refund.refund_date AS refundDate
+        refund.fine_id AS fineId,
+        oFund.order_id AS orderId,
+        oFund.order_name AS orderName,
+        <if test="dto != null and dto.businessType == 'ASSET_BUSINESS' or dto.businessType == 'MAJOR_BUSINESS'">
+            pFund.production_no AS productionNo,
+            `order`.bailor AS bailor,
+        </if>
+        <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
+            `order`.order_id AS productionNo,
+            CONCAT(`order`.bailorA, IF(`order`.bailorB IS NOT NULL AND `order`.bailorB != '', ',', ''), `order`.bailorB) AS bailor,
+        </if>
+        <if test="dto != null and dto.businessType == 'ASSET_BUSINESS'">
+            CASE pFund.production_type WHEN 'LETTER' THEN '意见函' WHEN 'CONSULT' THEN '咨询报告' WHEN 'REPORT' THEN '评估报告' ELSE '-' END AS productionType,
+        </if>
+        <if test="dto != null and dto.businessType == 'MAJOR_BUSINESS'">
+            CASE pFund.production_type WHEN 'LETTER' THEN '复评函' WHEN 'REPORT' THEN '报告' WHEN 'STATEMENT' THEN '价值意见书' ELSE '-' END AS productionType,
+        </if>
+        <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
+            CASE pro.production WHEN 'FINAL' THEN '结果报告' WHEN 'TECHNIC' THEN '技术报告' ELSE '-' END AS productionType,
+        </if>
+        user.name AS clientManagerName,
+        customer.name AS customerName,
+        subCustomer.name AS customerSubName,
+        fine.real_fine_amount AS finedAmount,
+        fine.created AS punishDate,
+        refund.refund_amount AS refundAmount,
+        refund.refund_date AS refundDate,
+        refund.refund_amount AS refundAmount,
+        refund.refund_reason AS refundReason,
+        refund.status AS status,
+        operator.name AS operator,
+        refund.refund_date AS refundDate
         FROM finance_fine_refund AS refund
         LEFT JOIN finance_fine AS fine ON fine.deleted = 0 AND fine.id = refund.fine_id
         LEFT JOIN order_fund AS oFund ON oFund.deleted = 0 AND oFund.id = fine.order_fund_id
@@ -109,6 +109,16 @@
         <if test="dto != null and dto.startRefundDate != null and dto.startRefundDate!= null">
             AND refund.refund_date BETWEEN #{dto.startRefundDate} AND #{dto.startRefundDate}
         </if>
+    </sql>
+
+    <!--条件分页查询罚款退款记录-->
+    <select id="selectPage" resultType="com.dayou.vo.FinanceFineRefundVO">
+        <include refid="financeFineRefundVOSql" />
+    </select>
+
+    <!--导出罚款退款记录-->
+    <select id="exportList" resultType="com.dayou.vo.FinanceFineRefundVO">
+        <include refid="financeFineRefundVOSql" />
     </select>
 
 </mapper>

+ 4 - 3
domain/src/main/java/com/dayou/entity/FinanceFineRefund.java

@@ -3,12 +3,11 @@ import java.math.BigDecimal;
 import com.dayou.common.BaseEntity;
 import java.time.LocalDateTime;
 
-import lombok.Builder;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
+import lombok.*;
 import com.dayou.annotation.ExcelSheet;
 import com.dayou.annotation.ExportCell;
 import com.dayou.annotation.ImportCell;
+
 /**
  * <p>
  * 罚款退款表
@@ -21,6 +20,8 @@ import com.dayou.annotation.ImportCell;
 @EqualsAndHashCode(callSuper = true)
 @ExcelSheet(sheetName = "罚款退款表")
 @Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public class FinanceFineRefund extends BaseEntity {
 
     private static final long serialVersionUID=1L;

+ 8 - 1
domain/src/main/java/com/dayou/vo/FinanceFineRefundVO.java

@@ -4,6 +4,7 @@ import com.dayou.annotation.Excel;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 @Data
@@ -84,9 +85,15 @@ public class FinanceFineRefundVO {
     private BigDecimal finedAmount;
 
     /**
+     * 罚款日期
+     */
+    @Excel(name = "罚款日期")
+    private LocalDate punishDate;
+
+    /**
      * 退款金额(罚款表实际罚款金额)
      */
-    @Excel(name = "退款金额(罚款表实际罚款金额)")
+    @Excel(name = "退款金额")
     private BigDecimal refundAmount;
 
     /**

+ 17 - 1
service/src/main/java/com/dayou/service/IFinanceFineRefundService.java

@@ -4,9 +4,13 @@ import com.dayou.entity.FinanceFineRefund;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.dayou.enums.FineRefundStatusEnum;
 import com.dayou.vo.FinanceFineRefundVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
 /**
  * <p>
  * 罚款退款表 服务类
@@ -25,11 +29,23 @@ public interface IFinanceFineRefundService extends IService<FinanceFineRefund> {
          */
         Page<FinanceFineRefundVO> selectPage(Page page, FinanceFineRefundSelectDTO dto);
 
+        /**
+         * 导出罚款退款记录
+         * @param dto 查询条件
+         * @return List<FinanceFineRefundVO>
+         */
+        List<FinanceFineRefundVO> exportList(FinanceFineRefundSelectDTO dto);
+
         FinanceFineRefund detail(Long id);
 
         Boolean add(FinanceFineRefund financeFineRefund);
 
-        Boolean update(FinanceFineRefund financeFineRefund);
+        /**
+         * 更新罚款记录状态
+         * @param financeFineRefund 更新内容
+         * @return Boolean
+         */
+        Boolean updateStatus(FinanceFineRefund financeFineRefund);
 
         Boolean delete(Long id);
 

+ 24 - 2
service/src/main/java/com/dayou/service/impl/FinanceFineRefundServiceImpl.java

@@ -2,9 +2,12 @@ package com.dayou.service.impl;
 
 import com.dayou.dto.FinanceFineRefundSelectDTO;
 import com.dayou.entity.FinanceFineRefund;
+import com.dayou.enums.FineRefundStatusEnum;
 import com.dayou.mapper.FinanceFineRefundMapper;
 import com.dayou.service.IFinanceFineRefundService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.utils.DateUtils;
+import com.dayou.utils.LoginContext;
 import com.dayou.vo.FinanceFineRefundVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,6 +25,8 @@ import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
 import java.util.List;
 import java.util.ArrayList;
 import org.springframework.transaction.annotation.Transactional;
@@ -52,6 +57,16 @@ public class FinanceFineRefundServiceImpl extends ServiceImpl<FinanceFineRefundM
         return financeFineRefundMapper.selectPage(page, dto);
     }
 
+    /**
+     * 导出罚款退款记录
+     * @param dto 查询条件
+     * @return List<FinanceFineRefundVO>
+     */
+    @Override
+    public List<FinanceFineRefundVO> exportList(FinanceFineRefundSelectDTO dto) {
+        return financeFineRefundMapper.exportList(dto);
+    }
+
 
     @Override
     public FinanceFineRefund detail(Long id){
@@ -63,9 +78,16 @@ public class FinanceFineRefundServiceImpl extends ServiceImpl<FinanceFineRefundM
         return  this.save(financeFineRefund);
     }
 
+    /**
+     * 更新罚款记录状态
+     * @param financeFineRefund 更新内容
+     * @return Boolean
+     */
     @Override
-    public Boolean update(FinanceFineRefund financeFineRefund){
-        return  this.updateById(financeFineRefund);
+    public Boolean updateStatus(FinanceFineRefund financeFineRefund){
+        financeFineRefund.setUserId(LoginContext.getUserId());
+        financeFineRefund.setRefundDate(DateUtils.dateToLocalDateTime(new Date()));
+        return this.updateById(financeFineRefund);
     }
 
     @Override