瀏覽代碼

1.新增修改罚款金额、修改情况说明以及确认罚款金额接口
2.新增逾期未收款订单/产品罚款记录导出接口
3.罚款记录查询隔离客户经理数据权限

GouGengquan 3 月之前
父節點
當前提交
56533e2319

+ 35 - 1
biz-base/src/main/java/com/dayou/controller/FinanceFineController.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.*;
+
 /**
  * 超期未收款罚款表
  *
@@ -45,6 +52,33 @@ public class FinanceFineController extends BaseController {
     }
 
     /**
+     * 导出罚款记录
+     * @param dto 查询条件
+     */
+    @GetMapping("/export")
+    public void exportList(FinanceFineSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<FinanceFineVO> financeFineVOList = financeFineService.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 + "_罚款记录",financeFineVOList, FinanceFineVO.class);
+    }
+
+    /**
+     * 确认罚款金额
+     * @return Boolean
+     */
+    @PutMapping("/confirm/{id}")
+    public RestResponse<Boolean> confirmFineAmount(@PathVariable Long id) {
+        return RestResponse.data(financeFineService.confirmFineAmount(id));
+    }
+
+    /**
      * 超期未收款罚款表详情
      */
     @GetMapping("/{id}")
@@ -65,7 +99,7 @@ public class FinanceFineController extends BaseController {
     /**
      * 超期未收款罚款表更新
      */
-    @PutMapping("")
+    @PutMapping("/update")
     public RestResponse<Boolean> update(@RequestBody FinanceFine financeFine) {
         Boolean ret = financeFineService.update(financeFine);
         return RestResponse.data(ret);

+ 13 - 0
dao/src/main/java/com/dayou/mapper/FinanceFineMapper.java

@@ -32,6 +32,19 @@ public interface FinanceFineMapper extends CustomBaseMapper<FinanceFine> {
     Page<FinanceFineVO> selectPage(@Param("page") Page page, @Param("dto") FinanceFineSelectDTO financeFineSelectDTO);
 
     /**
+     * 导出查询超期罚款
+     * @param financeFineSelectDTO 查询条件dto
+     * @return List<FinanceFineVO>
+     */
+    List<FinanceFineVO> exportList(@Param("dto") FinanceFineSelectDTO financeFineSelectDTO);
+
+    /**
+     * 根据id确认罚款金额
+     * @return Boolean
+     */
+    Boolean confirmFineAmount(@Param("id") Long id);
+
+    /**
      * 获取逾期资产产品款项信息(不包含预评)
      * @return List<CompileFineAssetsOrder>
      */

+ 59 - 31
dao/src/main/resources/mapper/FinanceFineMapper.xml

@@ -28,38 +28,46 @@
         order_fund_id, production_fund_id, fine_amount, real_fine_amount, explain, remark, status, leader_id, confirm_date
     </sql>
 
-    <!--分页查询超期罚款-->
-    <select id="selectPage" resultType="com.dayou.vo.FinanceFineVO">
+    <sql id="financeFineVOSql">
         SELECT fine.id AS id,
-               oFund.business_type AS businessType,
-               oFund.order_id AS orderId,
-               oFund.order_name AS orderName,
-               (SELECT GROUP_CONCAT(ticket_no SEPARATOR ',')
-                FROM finance_invoice
-                WHERE finance_invoice.deleted = 0
-                  AND finance_invoice.order_fund_id = fine.order_fund_id
-                  AND IF(fine.production_fund_id IS NOT NULL, finance_invoice.production_fund_id = fine.production_fund_id, TRUE)
-               ) AS invoiceNo,
-               <if test="dto != null and dto.businessType == 'ASSET_BUSINESS' or dto.businessType == 'MAJOR_BUSINESS'">
-                   pFund.production_no AS productionNo,
-                   pFund.production_type AS productionType,
-                   pFund.production_should_amount AS shouldAmount,
-                   pFund.standard_amount AS standardAmount,
-                   `order`.bailor AS bailor,
-               </if>
-               <if test="dto != null and dto.businessType == 'PERSONAL_BUSINESS'">
-                   oFund.should_amount AS shouldAmount,
-                   CONCAT(`order`.bailorA, IF(`order`.bailorB IS NOT NULL AND `order`.bailorB != '', ',', ''), `order`.bailorB) AS bailor,
-               </if>
-               user.name AS clientManagerName,
-               DATEDIFF(CURDATE(), DATE( pro.repertory_out_time )) AS overdueDay,
-               customer.name AS customerName,
-               subCustomer.name AS customerSubName,
-               fine.fine_amount AS fineAmount,
-               fine.real_fine_amount AS realFineAmount,
-               fine.status AS status,
-               fine.created AS punishDate,
-               fine.`explain` AS `explain`
+        oFund.business_type AS businessType,
+        oFund.order_id AS orderId,
+        oFund.order_name AS orderName,
+        (SELECT GROUP_CONCAT(ticket_no SEPARATOR ',')
+        FROM finance_invoice
+        WHERE finance_invoice.deleted = 0
+        AND finance_invoice.order_fund_id = fine.order_fund_id
+        AND IF(fine.production_fund_id IS NOT NULL, finance_invoice.production_fund_id = fine.production_fund_id, TRUE)
+        ) AS invoiceNo,
+        <if test="dto != null and dto.businessType == 'ASSET_BUSINESS' or dto.businessType == 'MAJOR_BUSINESS'">
+            pFund.production_no AS productionNo,
+            pFund.production_should_amount AS shouldAmount,
+            pFund.standard_amount AS standardAmount,
+            `order`.bailor 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'">
+            `order`.order_id AS productionNo,
+            oFund.should_amount AS shouldAmount,
+            CONCAT(`order`.bailorA, IF(`order`.bailorB IS NOT NULL AND `order`.bailorB != '', ',', ''), `order`.bailorB) AS bailor,
+        </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,
+        DATEDIFF(CURDATE(), DATE( pro.repertory_out_time )) AS overdueDay,
+        customer.name AS customerName,
+        subCustomer.name AS customerSubName,
+        fine.fine_amount AS fineAmount,
+        fine.real_fine_amount AS realFineAmount,
+        fine.status AS status,
+        fine.created AS punishDate,
+        fine.`explain` AS `explain`
         FROM finance_fine AS fine
         LEFT JOIN order_fund AS oFund ON oFund.deleted = 0 AND fine.order_fund_id = oFund.id
         <if test="dto != null and dto.businessType == 'ASSET_BUSINESS'">
@@ -105,11 +113,31 @@
         <if test="dto != null and dto.status != null">
             AND fine.status = #{dto.status}
         </if>
+        <if test="dto != null and dto.clientManagerId != null">
+            AND `order`.client_manager_id = #{dto.clientManagerId}
+        </if>
         <if test="dto != null and dto.startPunishDate != null and dto.endPunishDate!= null">
             AND fine.created BETWEEN #{dto.startPunishDate} AND #{dto.endPunishDate}
         </if>
+    </sql>
+
+    <!--分页查询超期罚款-->
+    <select id="selectPage" resultType="com.dayou.vo.FinanceFineVO">
+        <include refid="financeFineVOSql" />
+    </select>
+
+    <!--导出查询超期罚款-->
+    <select id="exportList" resultType="com.dayou.vo.FinanceFineVO">
+        <include refid="financeFineVOSql" />
     </select>
 
+    <!--确认罚款金额-->
+    <update id="confirmFineAmount">
+        UPDATE finance_fine SET real_fine_amount = fine_amount
+        WHERE deleted = 0
+        AND id = #{id}
+    </update>
+
     <!--获取逾期资产产品款项信息-->
     <select id="getAssetsOrder" resultType="com.dayou.vo.CompileFineAssetsOrder">
         SELECT

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

@@ -42,4 +42,9 @@ public class FinanceFineSelectDTO {
      */
     private LocalDateTime endPunishDate;
 
+    /**
+     * 客户经理id
+     */
+    private Long clientManagerId;
+
 }

+ 3 - 0
domain/src/main/java/com/dayou/entity/FinanceFine.java

@@ -1,5 +1,7 @@
 package com.dayou.entity;
 import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.dayou.common.BaseEntity;
 import java.time.LocalDateTime;
 import lombok.Data;
@@ -51,6 +53,7 @@ public class FinanceFine extends BaseEntity {
      */
     @ImportCell
     @ExportCell(columnName = "情况说明")
+    @TableField("`explain`")
     private String explain;
 
     /**

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

@@ -22,7 +22,6 @@ public class FinanceFineVO {
     /**
      * 业务类型
      */
-    @Excel(name = "业务类型")
     private String businessType;
 
     /**
@@ -112,7 +111,7 @@ public class FinanceFineVO {
     /**
      * 是否确认
      */
-    @Excel(name = "是否确认")
+    @Excel(name = "是否确认", readConverterExp ="true=已确认,false=未确认")
     private Boolean status;
 
     /**

+ 21 - 0
service/src/main/java/com/dayou/service/IFinanceFineService.java

@@ -9,6 +9,8 @@ import com.dayou.vo.FinanceFineVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * <p>
  * 超期未收款罚款表 服务类
@@ -19,8 +21,27 @@ import org.springframework.web.multipart.MultipartFile;
  */
 public interface IFinanceFineService extends IService<FinanceFine> {
 
+    /**
+     * 分页查询超期罚款
+     * @param page 分页
+     * @param financeFineSelectDTO 查询条件dto
+     * @return Page<FinanceFineVO>
+     */
     Page<FinanceFineVO> selectPage(Page page, FinanceFineSelectDTO financeFineSelectDTO);
 
+    /**
+     * 导出查询超期罚款
+     * @param financeFineSelectDTO 查询条件dto
+     * @return List<FinanceFineVO>
+     */
+    List<FinanceFineVO> exportList(FinanceFineSelectDTO financeFineSelectDTO);
+
+    /**
+     * 确认罚款金额
+     * @return Boolean
+     */
+    Boolean confirmFineAmount(Long id);
+
     FinanceFine detail(Long id);
 
     Boolean add(FinanceFine financeFine);

+ 34 - 0
service/src/main/java/com/dayou/service/impl/FinanceFineServiceImpl.java

@@ -2,10 +2,12 @@ package com.dayou.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.dayou.dto.FinanceFineSelectDTO;
+import com.dayou.dto.SimplePostModel;
 import com.dayou.entity.FinanceFine;
 import com.dayou.mapper.FinanceFineMapper;
 import com.dayou.service.IFinanceFineService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dayou.utils.LoginContext;
 import com.dayou.vo.CompileFineAssetsOrder;
 import com.dayou.vo.CompileFineMajorOrder;
 import com.dayou.vo.FinanceFineVO;
@@ -35,11 +37,43 @@ public class FinanceFineServiceImpl extends ServiceImpl<FinanceFineMapper, Finan
     @Autowired
     private FinanceFineMapper financeFineMapper;
 
+    /**
+     * 分页查询超期罚款
+     * @param page 分页
+     * @param financeFineSelectDTO 查询条件dto
+     * @return Page<FinanceFineVO>
+     */
     @Override
     public Page<FinanceFineVO> selectPage(Page page, FinanceFineSelectDTO financeFineSelectDTO) {
+        List<SimplePostModel> postModelList = LoginContext.getLoginCacheUserBO().getPostList();
+        // 此处数据权限,客户经理只能查看自己的项目
+        for (SimplePostModel postModel : postModelList) {
+            if (postModel.getName().equals("客户经理") || postModel.getName().equals("销售代表")) {
+                financeFineSelectDTO.setClientManagerId(LoginContext.getUserId());
+            }
+        }
         return financeFineMapper.selectPage(page, financeFineSelectDTO);
     }
 
+    /**
+     * 导出查询超期罚款
+     * @param financeFineSelectDTO 查询条件dto
+     * @return List<FinanceFineVO>
+     */
+    @Override
+    public List<FinanceFineVO> exportList(FinanceFineSelectDTO financeFineSelectDTO) {
+        return financeFineMapper.exportList(financeFineSelectDTO);
+    }
+
+    /**
+     * 确认罚款金额
+     * @return Boolean
+     */
+    @Override
+    public Boolean confirmFineAmount(Long id) {
+        return financeFineMapper.confirmFineAmount(id);
+    }
+
 
     @Override
     public FinanceFine detail(Long id) {