Ver código fonte

1.新增条件分页查询罚款退款记录接口

GouGengquan 3 meses atrás
pai
commit
553bc62d1f

+ 11 - 5
biz-base/src/main/java/com/dayou/controller/FinanceFineRefundController.java

@@ -1,5 +1,7 @@
 package com.dayou.controller;
 
+import com.dayou.dto.FinanceFineRefundSelectDTO;
+import com.dayou.vo.FinanceFineRefundVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,15 +32,19 @@ import org.springframework.web.multipart.MultipartFile;
 @RequestMapping("financeFineRefund")
 @Slf4j
 public class FinanceFineRefundController extends BaseController {
+
     @Autowired
     private IFinanceFineRefundService financeFineRefundService;
 
     /**
-    * 罚款退款表列表
-    */
-    @GetMapping("")
-    public RestResponse<Page<FinanceFineRefund>> page(FinanceFineRefund financeFineRefund, Page page){
-        Page<FinanceFineRefund> pages=financeFineRefundService.selectPage(page,financeFineRefund);
+     * 条件分页查询罚款退款记录
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<FinanceFineRefundVO>
+     */
+    @GetMapping("/page")
+    public RestResponse<Page<FinanceFineRefundVO>> page(Page page, FinanceFineRefundSelectDTO dto){
+        Page<FinanceFineRefundVO> pages=financeFineRefundService.selectPage(page,dto);
         return RestResponse.data(pages);
     }
 

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

@@ -1,7 +1,11 @@
 package com.dayou.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.dto.FinanceFineRefundSelectDTO;
 import com.dayou.entity.FinanceFineRefund;
 import com.dayou.dao.CustomBaseMapper;
+import com.dayou.vo.FinanceFineRefundVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -13,4 +17,12 @@ import com.dayou.dao.CustomBaseMapper;
  */
 public interface FinanceFineRefundMapper extends CustomBaseMapper<FinanceFineRefund> {
 
+    /**
+     * 条件分页查询罚款退款记录
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<FinanceFineRefundVO>
+     */
+    Page<FinanceFineRefundVO> selectPage(@Param("page") Page page, @Param("dto") FinanceFineRefundSelectDTO dto);
+
 }

+ 87 - 1
dao/src/main/resources/mapper/FinanceFineRefundMapper.xml

@@ -11,7 +11,7 @@
         <result column="fine_id" property="fineId" />
         <result column="refund_amount" property="refundAmount" />
         <result column="refund_reason" property="refundReason" />
-        <result column="statue" property="statue" />
+        <result column="status" property="status" />
         <result column="user_id" property="userId" />
         <result column="refund_date" property="refundDate" />
     </resultMap>
@@ -25,4 +25,90 @@
         fine_id, refund_amount, refund_reason, statue, user_id, refund_date
     </sql>
 
+    <!--条件分页查询罚款退款记录-->
+    <select id="selectPage" resultType="com.dayou.vo.FinanceFineRefundVO">
+        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
+        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
+        <if test="dto != null and dto.businessType == 'ASSET_BUSINESS'">
+            LEFT JOIN production_fund AS pFund ON pFund.deleted = 0 AND pFund.id = fine.production_fund_id AND pFund.order_fund_id = fine.order_fund_id
+            LEFT JOIN ( SELECT business_id, production_no, repertory_out_time FROM assets_production WHERE deleted = 0 AND repertory_out_time IS NOT NULL AND production_type != 'STATEMENT') AS pro
+            ON pFund.business_id = pro.business_id AND pFund.production_no = pro.production_no
+            LEFT JOIN assets AS `order` ON `order`.deleted = 0 AND `order`.id = pFund.business_id
+        </if>
+        <if test="dto != null and dto.businessType == 'MAJOR_BUSINESS'">
+            LEFT JOIN production_fund AS pFund ON pFund.deleted = 0 AND pFund.id = fine.production_fund_id AND pFund.order_fund_id = fine.order_fund_id
+            LEFT JOIN ( SELECT major_id AS business_id, report_no AS production_no, repertory_out_time, production FROM major_production WHERE deleted = 0 AND repertory_out_time IS NOT NULL) AS pro
+            ON pFund.business_id = pro.business_id AND pFund.production_no = pro.production_no AND production = pFund.production_type
+            LEFT JOIN major AS `order` ON `order`.deleted = 0 AND `order`.id = pFund.business_id
+        </if>
+        <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
+            LEFT JOIN personal_target pt ON pt.personal_id = oFund.business_id
+            LEFT JOIN ( SELECT target_id,repertory_out_time, production FROM personal_production WHERE repertory_out_time IS NOT NULL GROUP BY target_id ) AS pro ON pro.target_id = pt.id
+            LEFT JOIN personal AS `order` ON `order`.deleted = 0 AND `order`.id = oFund.business_id
+        </if>
+        LEFT JOIN customer_company AS customer ON customer.id = `order`.clientele_id
+        LEFT JOIN customer_company AS subCustomer ON subCustomer.id = `order`.clientele_sub_id
+        LEFT JOIN user ON `order`.client_manager_id = user.id AND user.deleted = 0
+        LEFT JOIN user AS operator ON user.deleted = 0 AND user.id = refund.user_id
+        WHERE oFund.business_type = #{dto.businessType}
+        <if test="dto != null and dto.keyWord != null and dto.keyWord != ''">
+            AND (`order`.order_id LIKE CONCAT('%', #{dto.keyWord},'%')
+            <if test="dto != null and dto.businessType == 'ASSET_BUSINESS' or dto.businessType == 'MAJOR_BUSINESS'">
+                OR pFund.production_no LIKE CONCAT('%', #{dto.keyWord},'%')
+            </if>
+            )
+        </if>
+        <if test="dto != null and dto.finedAmount != null">
+            AND fine.real_fine_amount = #{dto.finedAmount}
+        </if>
+        <if test="dto != null and dto.refundAmount != null">
+            AND refund.refund_amount = #{dto.refundAmount}
+        </if>
+        <if test="dto != null and dto.clientManagerName != null and dto.clientManagerName != ''">
+            AND user.name = #{dto.clientManagerName}
+        </if>
+        <if test="dto != null and dto.status != null">
+            AND fine.status = #{dto.status}
+        </if>
+        <if test="dto != null and dto.startPunishDate != null and dto.endPunishDate!= null">
+            AND fine.created BETWEEN #{dto.startPunishDate} AND #{dto.endPunishDate}
+        </if>
+        <if test="dto != null and dto.startRefundDate != null and dto.startRefundDate!= null">
+            AND refund.refund_date BETWEEN #{dto.startRefundDate} AND #{dto.startRefundDate}
+        </if>
+    </select>
+
 </mapper>

+ 64 - 0
domain/src/main/java/com/dayou/dto/FinanceFineRefundSelectDTO.java

@@ -0,0 +1,64 @@
+package com.dayou.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 罚款退款记录查询条件
+ */
+@Data
+public class FinanceFineRefundSelectDTO {
+
+    /**
+     * 业务类型
+     */
+    private String businessType;
+
+    /**
+     * 关键字(项⽬编号或产品号)
+     */
+    private String keyWord;
+
+    /**
+     * 已罚金额(罚款表实际罚款金额)
+     */
+    private BigDecimal finedAmount;
+
+    /**
+     * 退款金额(罚款表实际罚款金额)
+     */
+    private BigDecimal refundAmount;
+
+    /**
+     * 客户经理
+     */
+    private String clientManagerName;
+
+    /**
+     * 是否确认
+     */
+    private Boolean status;
+
+    /**
+     * 罚款日期-起始
+     */
+    private LocalDateTime startPunishDate;
+
+    /**
+     * 罚款日期-结束
+     */
+    private LocalDateTime endPunishDate;
+
+    /**
+     * 退款日期-起始
+     */
+    private LocalDateTime startRefundDate;
+
+    /**
+     * 退款日期-结束
+     */
+    private LocalDateTime endRefundDate;
+
+}

+ 5 - 2
domain/src/main/java/com/dayou/dto/FinanceFineSelectDTO.java

@@ -4,6 +4,9 @@ import lombok.Data;
 
 import java.time.LocalDateTime;
 
+/**
+ * 超期项目罚款记录查询条件
+ */
 @Data
 public class FinanceFineSelectDTO {
 
@@ -33,12 +36,12 @@ public class FinanceFineSelectDTO {
     private Boolean status;
 
     /**
-     * 罚款期-起始
+     * 罚款期-起始
      */
     private LocalDateTime startPunishDate;
 
     /**
-     * 罚款期-结束
+     * 罚款期-结束
      */
     private LocalDateTime endPunishDate;
 

+ 3 - 3
domain/src/main/java/com/dayou/enums/workflow/FineRefundReason.java

@@ -1,9 +1,9 @@
-package com.dayou.enums.workflow;
+package com.dayou.enums;
 
 /**
  * 财务罚款后退款记录枚举原因
  */
-public enum FineRefundReason {
+public enum FineRefundReasonEnum {
 
     RETURN_PRODUCTION("退产品","RETURN_PRODUCTION"),
     RETURN_MONEY("退款","RETURN_MONEY"),
@@ -14,7 +14,7 @@ public enum FineRefundReason {
 
     private String code;
 
-    FineRefundReason(String name, String code) {
+    FineRefundReasonEnum(String name, String code) {
         this.name = name;
         this.code = code;
     }

+ 117 - 0
domain/src/main/java/com/dayou/vo/FinanceFineRefundVO.java

@@ -0,0 +1,117 @@
+package com.dayou.vo;
+
+import com.dayou.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+public class FinanceFineRefundVO {
+
+    /**
+     * 罚款退款记录id
+     */
+    private Long id;
+
+    /**
+     * 罚款表id
+     */
+    private Long fineId;
+
+    /**
+     * 业务id
+     */
+    private Long businessId;
+
+    /**
+     * 业务类型
+     */
+    private String businessType;
+
+    /**
+     * 项⽬编号
+     */
+    @Excel(name = "项⽬编号")
+    private String orderId;
+
+    /**
+     * 项⽬名称
+     */
+    @Excel(name = "项⽬名称")
+    private String orderName;
+
+    /**
+     * 产品号
+     */
+    @Excel(name = "产品号")
+    private String productionNo;
+
+    /**
+     * 产品类型
+     */
+    @Excel(name = "产品类型")
+    private String productionType;
+
+    /**
+     * 客户经理
+     */
+    @Excel(name = "客户经理")
+    private String clientManagerName;
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String customerName;
+
+    /**
+     * 业务来源
+     */
+    @Excel(name = "业务来源")
+    private String customerSubName;
+
+    /**
+     * 委托方
+     */
+    @Excel(name = "委托方")
+    private String bailor;
+
+    /**
+     * 已罚金额(罚款表实际罚款金额)
+     */
+    @Excel(name = "已罚金额")
+    private BigDecimal finedAmount;
+
+    /**
+     * 退款金额(罚款表实际罚款金额)
+     */
+    @Excel(name = "退款金额(罚款表实际罚款金额)")
+    private BigDecimal refundAmount;
+
+    /**
+     * 退款原因(RETURN_PRODUCTION: 退产品,RETURN_MONEY:退款,RETURN_PRODUCTION_INVOICE:退产品并退发票)
+     */
+    @Excel(name = "退款原因", readConverterExp ="RETURN_PRODUCTION=退产品,RETURN_MONEY=退款,RETURN_PRODUCTION_INVOICE=退产品并退发票")
+    private String refundReason;
+
+    /**
+     * 退款状态(RETURNED:已退 NOT_RETURNED:未退 IGNORE:不退)
+     */
+    @Excel(name = "退款状态", readConverterExp ="RETURNED=已退,NOT_RETURNED=未退,IGNORE=不退")
+    private String status;
+
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人")
+    private String operator;
+
+    /**
+     * 退款日期
+     */
+    @Excel(name = "退款日期")
+    private LocalDateTime refundDate;
+
+
+}

+ 2 - 2
domain/src/main/java/com/dayou/vo/FinanceFineVO.java

@@ -115,9 +115,9 @@ public class FinanceFineVO {
     private Boolean status;
 
     /**
-     * 罚款
+     * 罚款
      */
-    @Excel(name = "罚款期")
+    @Excel(name = "罚款期")
     private LocalDate punishDate;
 
     /**

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

@@ -1,8 +1,10 @@
 package com.dayou.service;
+import com.dayou.dto.FinanceFineRefundSelectDTO;
 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.vo.FinanceFineRefundVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
 /**
@@ -15,7 +17,13 @@ import org.springframework.web.multipart.MultipartFile;
  */
 public interface IFinanceFineRefundService extends IService<FinanceFineRefund> {
 
-        Page<FinanceFineRefund> selectPage(Page page,FinanceFineRefund financeFineRefund);
+        /**
+         * 条件分页查询罚款退款记录
+         * @param page 分页
+         * @param dto 查询条件
+         * @return Page<FinanceFineRefundVO>
+         */
+        Page<FinanceFineRefundVO> selectPage(Page page, FinanceFineRefundSelectDTO dto);
 
         FinanceFineRefund detail(Long id);
 

+ 1 - 2
service/src/main/java/com/dayou/service/impl/AssetsProductionServiceImpl.java

@@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
 import java.util.ArrayList;
@@ -30,10 +29,10 @@ import java.util.Objects;
 
 import org.springframework.transaction.annotation.Transactional;
 
+import static com.dayou.enums.FineRefundReasonEnum.RETURN_MONEY;
 import static com.dayou.enums.FineRefundStatusEnum.NOT_RETURNED;
 import static com.dayou.enums.MainBusinessEnum.ASSET_BUSINESS;
 import static com.dayou.enums.ProductionEnum.STATEMENT;
-import static com.dayou.enums.workflow.FineRefundReason.RETURN_MONEY;
 
 /**
  * <p>

+ 13 - 3
service/src/main/java/com/dayou/service/impl/FinanceFineRefundServiceImpl.java

@@ -1,9 +1,12 @@
 package com.dayou.service.impl;
 
+import com.dayou.dto.FinanceFineRefundSelectDTO;
 import com.dayou.entity.FinanceFineRefund;
 import com.dayou.mapper.FinanceFineRefundMapper;
 import com.dayou.service.IFinanceFineRefundService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.vo.FinanceFineRefundVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -35,11 +38,18 @@ import com.dayou.enums.BatchTaskTypeEnum;
 @Service
 public class FinanceFineRefundServiceImpl extends ServiceImpl<FinanceFineRefundMapper, FinanceFineRefund> implements IFinanceFineRefundService {
 
+    @Autowired
+    private FinanceFineRefundMapper financeFineRefundMapper;
 
+    /**
+     * 条件分页查询罚款退款记录
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<FinanceFineRefundVO>
+     */
     @Override
-    @SuppressWarnings("unchecked")
-    public Page<FinanceFineRefund> selectPage(Page page,FinanceFineRefund financeFineRefund){
-        return this.page(page, new QueryWrapper<FinanceFineRefund>(financeFineRefund));
+    public Page<FinanceFineRefundVO> selectPage(Page page, FinanceFineRefundSelectDTO dto) {
+        return financeFineRefundMapper.selectPage(page, dto);
     }
 
 

+ 1 - 1
service/src/main/java/com/dayou/service/impl/MajorProductionServiceImpl.java

@@ -36,9 +36,9 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.dayou.common.Constants.*;
+import static com.dayou.enums.FineRefundReasonEnum.RETURN_MONEY;
 import static com.dayou.enums.FineRefundStatusEnum.NOT_RETURNED;
 import static com.dayou.enums.ProductionEnum.*;
-import static com.dayou.enums.workflow.FineRefundReason.RETURN_MONEY;
 import static com.dayou.message.MessageTypeEnum.*;
 
 /**

+ 1 - 4
service/src/main/java/com/dayou/service/impl/PersonalServiceImpl.java

@@ -17,8 +17,6 @@ import com.dayou.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.dayou.service.workflow.IWorkFlowNodeInstanceService;
 import com.dayou.service.workflow.IWorkFlowService;
-import com.dayou.service.workflow.IWorkNodeService;
-import com.dayou.service.workflow.IWorkNodeTaskService;
 import com.dayou.utils.LoginContext;
 import com.dayou.vo.PersonalVO;
 import com.dayou.vo.TaskTodoVO;
@@ -29,7 +27,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -38,9 +35,9 @@ import org.springframework.transaction.annotation.Transactional;
 
 import static com.dayou.common.Constants.OUTWARD_TO_PRICE;
 import static com.dayou.common.Constants.PERSONAL_INWARD;
+import static com.dayou.enums.FineRefundReasonEnum.RETURN_MONEY;
 import static com.dayou.enums.FineRefundStatusEnum.NOT_RETURNED;
 import static com.dayou.enums.MainBusinessEnum.PERSONAL_BUSINESS;
-import static com.dayou.enums.workflow.FineRefundReason.RETURN_MONEY;
 import static com.dayou.enums.workflow.NodeLogEnum.PASS;
 import static com.dayou.enums.workflow.NodeStateEnum.PENDING;
 

+ 1 - 1
service/src/main/java/com/dayou/task/FinanceFineScheduled.java

@@ -14,7 +14,7 @@ public class FinanceFineScheduled {
     private IFinanceFineService financeFineService;
 
     /**
-     * 每⽉23凌晨0点 将逾期订单/产品信息新增到finance_fine表
+     * 每⽉23凌晨0点 将逾期订单/产品信息新增到finance_fine表
      */
     @Scheduled(cron = "0 0 0 23 * ?")
     public void compileFineOrderTask() {