Kaynağa Gözat

1.新增大中型统计报表-房地产台账查询/导出接口

GouGengquan 11 ay önce
ebeveyn
işleme
190bcbbef6

+ 45 - 0
biz-base/src/main/java/com/dayou/controller/MajorStatisticalStatementController.java

@@ -0,0 +1,45 @@
+package com.dayou.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.common.RestResponse;
+import com.dayou.dto.MajorStatisticalSelectDTO;
+import com.dayou.service.IMajorStatisticalStatementService;
+import com.dayou.vo.MajorLedgerVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("major/statisticalStatement")
+public class MajorStatisticalStatementController extends BaseController{
+
+    @Autowired
+    private IMajorStatisticalStatementService majorStatisticalStatementService;
+
+    /**
+     * 查询大中型台账
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<MajorLedgerVO>
+     */
+    @GetMapping("/getMajorLedgerVO")
+    public RestResponse<Page<MajorLedgerVO>> getMajorLedgerVO(Page page, MajorStatisticalSelectDTO dto) {
+        return RestResponse.data(majorStatisticalStatementService.getMajorLedgerVO(page, dto));
+    }
+
+    /**
+     * 导出大中型台账
+     * @param dto 查询条件
+     */
+    @GetMapping("/getMajorLedgerVO/export")
+    public void exportMajorLedgerVO(MajorStatisticalSelectDTO dto, HttpServletResponse response) throws IOException {
+        List<MajorLedgerVO> result = majorStatisticalStatementService.exportMajorLedgerVO(dto);
+        exportPlus(response,"房地产总台账列表",result, MajorLedgerVO.class);
+    }
+
+}

+ 27 - 0
dao/src/main/java/com/dayou/mapper/MajorStatisticalStatementMapper.java

@@ -0,0 +1,27 @@
+package com.dayou.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.dto.MajorStatisticalSelectDTO;
+import com.dayou.vo.MajorLedgerVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface MajorStatisticalStatementMapper {
+
+    /**
+     * 查询大中型台账
+     * @param page 分页
+     * @param dto 查询条件
+     * @return List<MajorLedgerVO>
+     */
+    Page<MajorLedgerVO> getMajorLedgerVO(@Param("page") Page page, @Param("dto")MajorStatisticalSelectDTO dto);
+
+    /**
+     * 导出大中型台账
+     * @param dto 查询条件
+     * @return Page<MajorLedgerVO>
+     */
+    List<MajorLedgerVO> exportMajorLedgerVO(@Param("dto")MajorStatisticalSelectDTO dto);
+
+}

+ 1 - 1
dao/src/main/resources/mapper/AssetsStatisticalStatementMapper.xml

@@ -164,7 +164,7 @@
             AND assets.principal_id = #{dto.principalId}
         </if>
         <if test="dto != null and dto.departmentId != null">
-            AND assets.principal_id = #{dto.departmentId}
+            AND assets.department_id = #{dto.departmentId}
         </if>
         <if test="dto != null and dto.startTime != null and dto.endTime!= null">
             AND (assets.created BETWEEN #{dto.startTime} AND #{dto.endTime})

+ 149 - 0
dao/src/main/resources/mapper/MajorStatisticalStatementMapper.xml

@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dayou.mapper.MajorStatisticalStatementMapper">
+
+    <sql id="majorLedgerQuery">
+        SELECT (@i :=  @i + 1) AS id,
+               major.order_id AS orderId,
+               report.report_no AS reportNo,
+               department.name AS departmentName,
+               major.name AS projectName,
+               (SELECT customer_company.name FROM customer_company WHERE customer_company.id = major.clientele_id) AS customerName,
+               (SELECT customer_company.name FROM customer_company WHERE customer_company.id = major.clientele_sub_id) AS customerSubName,
+               manager.name AS clientManagerName,
+               principal.name AS principalName,
+               major.members AS members,
+               major.owner AS owner,
+               major.bailor AS bailor,
+               major.bailor_contact_tel AS bailorContactTel,
+               major.bailor_address AS bailorAddress,
+               major.evaluate_aim AS evaluateAim,
+               report.value_timing AS valueTiming,
+               GROUP_CONCAT(target.located SEPARATOR ';') AS located,
+               GROUP_CONCAT(target.land_use SEPARATOR ';') AS landUse,
+               GROUP_CONCAT(target.build_acreage SEPARATOR ';') AS buildAcreage,
+               GROUP_CONCAT(target.land_acreage SEPARATOR ';') AS landAcreage,
+               GROUP_CONCAT(DATE(target.created) SEPARATOR ';') AS reconnaissanceDate,
+               report.evaluate_price AS evaluatePrice,
+               report.evaluate_amount AS evaluateAmount,
+               fund.real_amount AS productionRealAmount,
+               report.repertory_out_time AS repertoryOutTime,
+               (SELECT name FROM user WHERE user.id = JSON_EXTRACT(report.signatory,'$[0]')) AS firstReporter,
+               (SELECT name FROM user WHERE user.id = JSON_EXTRACT(report.signatory,'$[1]')) AS secReporter,
+               (
+                   SELECT user.name
+                   FROM work_flow_node_instance AS instance,
+                        work_task_record        AS record,
+                        work_node               AS node,
+                        user
+                   WHERE instance.id = record.instance_id
+                     AND record.handler_id = user.id
+                     AND node.id = instance.node_id
+                     AND instance.business_id = major.id
+                     AND instance.business_sub_id = statement.report_no
+                     AND node.code = 'RECHECK_STATEMENT'
+                     AND instance.deleted = 0
+               ) AS secStatementChecker,
+               (
+                   SELECT user.name
+                   FROM work_flow_node_instance AS instance,
+                        work_task_record        AS record,
+                        work_node               AS node,
+                        user
+                   WHERE instance.id = record.instance_id
+                     AND record.handler_id = user.id
+                     AND node.id = instance.node_id
+                     AND instance.business_id = major.id
+                     AND instance.business_sub_id = statement.report_no
+                     AND node.code = 'THIRD_CHECK_STATEMENT'
+                     AND instance.deleted = 0
+               ) AS thirdStatementChecker,
+               (
+                   SELECT user.name
+                   FROM work_flow_node_instance AS instance,
+                        work_task_record        AS record,
+                        work_node               AS node,
+                        user
+                   WHERE instance.id = record.instance_id
+                     AND record.handler_id = user.id
+                     AND node.id = instance.node_id
+                     AND instance.business_id = major.id
+                     AND instance.business_min_id = report.report_no
+                     AND node.code = 'RECHECK_REPORT'
+                     AND instance.deleted = 0
+               ) AS secReportChecker,
+               (
+                   SELECT user.name
+                   FROM work_flow_node_instance AS instance,
+                        work_task_record        AS record,
+                        work_node               AS node,
+                        user
+                   WHERE instance.id = record.instance_id
+                     AND record.handler_id = user.id
+                     AND node.id = instance.node_id
+                     AND instance.business_id = major.id
+                     AND instance.business_min_id = report.report_no
+                     AND node.code = 'THIRD_CHECK_REPORT'
+                     AND instance.deleted = 0
+               ) AS thirdReportReChecker,
+            major.remark AS comments
+        FROM  (SELECT @i := 0) AS sort,major
+        LEFT JOIN major_target AS target ON target.major_id = major.id
+        LEFT JOIN major_production AS statement ON statement.report_no = target.statement_no AND statement.production = 'STATEMENT'
+        LEFT JOIN major_production AS report ON report.report_no = target.report_no AND report.production != 'STATEMENT'
+        LEFT JOIN production_fund AS fund ON fund.production_no = report.report_no
+        LEFT JOIN user AS manager ON manager.id = major.client_manager_id
+        LEFT JOIN user AS principal ON principal.id = major.principal_id
+        LEFT JOIN department ON department.id = major.department_id
+        LEFT JOIN (
+            SELECT node.`name`,instance.business_id,instance.business_sub_id,instance.business_min_id,instance.state
+            FROM work_flow_node_instance AS instance,
+                 work_node AS node
+            WHERE instance.node_id = node.id
+              AND node.deleted = 0
+              AND instance.deleted = 0
+              AND (instance.state = 'PENDING' OR instance.state = 'CLOSED' OR
+                   (instance.state = 'FINISHED' AND node.`code` = 'BUSINESS_ARCHIVING'))
+        ) AS nodeInfo ON nodeInfo.business_id = major.id
+            AND (IF(report.report_no IS NULL, nodeInfo.business_min_id IS NULL,
+                    report.report_no = nodeInfo.business_min_id))
+        WHERE major.deleted = 0
+        <if test="dto != null and dto.keyWord != null and dto.keyWord != '' ">
+            AND (
+            major.order_id LIKE CONCAT('%',#{dto.keyWord},'%') OR
+            major.name LIKE CONCAT('%',#{dto.keyWord},'%') OR
+            report.name LIKE CONCAT('%',#{dto.keyWord},'%')
+            )
+        </if>
+        <if test="dto != null and dto.clientManagerId">
+            AND major.client_manager_id = #{dto.clientManagerId}
+        </if>
+        <if test="dto != null and dto.principalId">
+            AND major.principal_id = #{dto.principalId}
+        </if>
+        <if test="dto != null and dto.departmentId != null">
+            AND major.department_id = #{dto.departmentId}
+        </if>
+        <if test="dto != null and dto.memberId != null">
+            AND JSON_CONTAINS(major.members, CAST(#{dto.memberId} AS JSON))
+        </if>
+        <if test="dto != null and dto.nodeCode != null">
+            AND nodeInfo.node = #{dto.nodeCode}
+        </if>
+        <if test="dto != null and dto.startTime != null and dto.endTime!= null">
+            AND (major.created BETWEEN #{dto.startTime} AND #{dto.endTime})
+        </if>
+        GROUP BY reportNo,major.id
+        ORDER BY major.created DESC
+    </sql>
+
+    <!--查询大中型台账-->
+    <select id="getMajorLedgerVO" resultType="com.dayou.vo.MajorLedgerVO">
+        <include refid="majorLedgerQuery" />
+    </select>
+
+    <!--导出大中型台账-->
+    <select id="exportMajorLedgerVO" resultType="com.dayou.vo.MajorLedgerVO">
+        <include refid="majorLedgerQuery" />
+    </select>
+</mapper>

+ 58 - 0
domain/src/main/java/com/dayou/dto/MajorStatisticalSelectDTO.java

@@ -0,0 +1,58 @@
+package com.dayou.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class MajorStatisticalSelectDTO {
+
+    /**
+     * 客户经理id(user_id)
+     */
+    private Long clientManagerId;
+
+    /**
+     * 项目负责人id(user_id)
+     */
+    private Long principalId;
+
+    /**
+     * 项目参与人id(user_id)
+     */
+    private Long memberId;
+
+    /**
+     * 接单部门id
+     */
+    private Long departmentId;
+
+    /**
+     * 市场部门id
+     */
+    private Long marketDepartmentId;
+
+    /**
+     * 关键字信息
+     */
+    private String keyWord;
+
+    /**
+     * 业务节点实例code
+     */
+    private String nodeCode;
+
+    /**
+     * 筛选开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    /**
+     * 筛选结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+}

+ 202 - 0
domain/src/main/java/com/dayou/vo/MajorLedgerVO.java

@@ -0,0 +1,202 @@
+package com.dayou.vo;
+
+import com.dayou.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+public class MajorLedgerVO {
+
+    private Long id;
+
+    /**
+     * 项目流水号
+     */
+    @Excel(name = "项目流水号")
+    private String orderId;
+
+    /**
+     * 报告号
+     */
+    @Excel(name = "报告号")
+    private String reportNo;
+
+    /**
+     * 项目部名称
+     */
+    @Excel(name = "项目部名称")
+    private String departmentName;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称")
+    private String projectName;
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String customerName;
+
+    /**
+     * 业务来源(客户子级名称)
+     */
+    @Excel(name = "业务来源")
+    private String customerSubName;
+
+    /**
+     * 客户经理名
+     */
+    @Excel(name = "客户经理")
+    private String clientManagerName;
+
+    /**
+     * 项目负责人
+     */
+    @Excel(name = "项目负责人")
+    private String principalName;
+
+    /**
+     * 项目参与人
+     */
+    @Excel(name = "项目参与人")
+    private String members;
+
+    /**
+     * 产权人
+     */
+    @Excel(name = "产权人")
+    private String owner;
+
+    /**
+     * 委托方名称
+     */
+    @Excel(name = "委托方名称")
+    private String bailor;
+
+    /**
+     * 委托方电话
+     */
+    @Excel(name = "委托方电话")
+    private String bailorContactTel;
+
+    /**
+     * 委托方地址
+     */
+    @Excel(name = "委托方地址")
+    private String bailorAddress;
+
+    /**
+     * 估价目的
+     */
+    @Excel(name = "估价目的")
+    private String evaluateAim;
+
+    /**
+     * 价值时点
+     */
+    @Excel(name = "价值时点")
+    private LocalDate valueTiming;
+
+    /**
+     * 估价对象地址
+     */
+    @Excel(name = "估价对象地址")
+    private String located;
+
+    /**
+     * 用途
+     */
+    @Excel(name = "用途")
+    private String landUse;
+
+    /**
+     * 建筑面积
+     */
+    @Excel(name = "建筑面积(㎡)")
+    private String buildAcreage;
+
+    /**
+     * 土地面积
+     */
+    @Excel(name = "土地面积(㎡)")
+    private String landAcreage;
+
+    /**
+     * 实勘时间
+     */
+    @Excel(name = "实勘时间")
+    private String reconnaissanceDate;
+
+    /**
+     * 评估单价
+     */
+    @Excel(name = "单价(元/㎡)")
+    private BigDecimal evaluatePrice;
+
+    /**
+     * 评估总价
+     */
+    @Excel(name = "评估总价(万元)")
+    private BigDecimal evaluateAmount;
+
+    /**
+     * 评估收入(产品实收款)
+     */
+    @Excel(name = "评估收入(万元)")
+    private BigDecimal productionRealAmount;
+
+    /**
+     * 出库时间
+     */
+    @Excel(name = "出库时间")
+    private LocalDate repertoryOutTime;
+
+    /**
+     * 第一报告人
+     */
+    @Excel(name = "第一报告人")
+    private String firstReporter;
+
+    /**
+     * 第二报告人
+     */
+    @Excel(name = "第二报告人")
+    private String secReporter;
+
+    /**
+     * 意见书二审人
+     */
+    @Excel(name = "意见书二审人")
+    private String secStatementChecker;
+
+    /**
+     * 意见书三审人
+     */
+    @Excel(name = "意见书三审人")
+    private String thirdStatementChecker;
+
+    /**
+     * 报告二审人
+     */
+    @Excel(name = "报告二审人")
+    private String secReportChecker;
+
+    /**
+     * 报告三审人
+     */
+    @Excel(name = "报告三审人")
+    private String thirdReportReChecker;
+
+    /**
+     * 特殊情况说明
+     */
+    @Excel(name = "特殊情况说明")
+    private String comment;
+
+
+
+}

+ 26 - 0
service/src/main/java/com/dayou/service/IMajorStatisticalStatementService.java

@@ -0,0 +1,26 @@
+package com.dayou.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.dto.MajorStatisticalSelectDTO;
+import com.dayou.vo.MajorLedgerVO;
+
+import java.util.List;
+
+public interface IMajorStatisticalStatementService {
+
+    /**
+     * 查询大中型台账
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<MajorLedgerVO>
+     */
+    Page<MajorLedgerVO> getMajorLedgerVO(Page page, MajorStatisticalSelectDTO dto);
+
+    /**
+     * 导出大中型台账
+     * @param dto 查询条件
+     * @return List<MajorLedgerVO>
+     */
+    List<MajorLedgerVO> exportMajorLedgerVO(MajorStatisticalSelectDTO dto);
+
+}

+ 73 - 0
service/src/main/java/com/dayou/service/impl/MajorStatisticalStatementServiceImpl.java

@@ -0,0 +1,73 @@
+package com.dayou.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.dayou.dto.MajorStatisticalSelectDTO;
+import com.dayou.mapper.MajorStatisticalStatementMapper;
+import com.dayou.service.IUserService;
+import com.dayou.service.IMajorStatisticalStatementService;
+import com.dayou.vo.MajorLedgerVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class MajorStatisticalStatementServiceImpl implements IMajorStatisticalStatementService {
+
+    @Autowired
+    private IUserService userService;
+
+    @Autowired
+    private MajorStatisticalStatementMapper majorStatisticalStatementMapper;
+
+    /**
+     * 查询大中型台账
+     * @param page 分页
+     * @param dto 查询条件
+     * @return Page<MajorLedgerVO>
+     */
+    @Override
+    public Page<MajorLedgerVO> getMajorLedgerVO(Page page, MajorStatisticalSelectDTO dto) {
+        Page<MajorLedgerVO> majorLedgerVOPage = majorStatisticalStatementMapper.getMajorLedgerVO(page, dto);
+        majorLedgerVOPage.setRecords(setMembers(majorLedgerVOPage.getRecords()));
+        return majorLedgerVOPage;
+    }
+
+    /**
+     * 导出大中型台账
+     * @param dto 查询条件
+     * @return List<MajorLedgerVO>
+     */
+    @Override
+    public List<MajorLedgerVO> exportMajorLedgerVO(MajorStatisticalSelectDTO dto) {
+        List<MajorLedgerVO> majorLedgerVOList = majorStatisticalStatementMapper.exportMajorLedgerVO(dto);
+        majorLedgerVOList = setMembers(majorLedgerVOList);
+        return majorLedgerVOList;
+    }
+
+    /**
+     * 设置项目参与人
+     * @param majorLedgerVOList 台账集合
+     * @return List<MajorLedgerVO>
+     */
+    public List<MajorLedgerVO> setMembers(List<MajorLedgerVO> majorLedgerVOList){
+        for (MajorLedgerVO majorLedgerVO : majorLedgerVOList){
+            if (ObjectUtil.isNotNull(majorLedgerVO.getMembers())) {
+                JSONArray jsonArray = JSONArray.parseArray(majorLedgerVO.getMembers());
+                List<Long> membersId = jsonArray.toJavaList(Long.class);
+                String names = null;
+                for (Long id : membersId) {
+                    if (ObjectUtil.isNull(names)) {
+                        names = userService.getById(id).getName() + ';';
+                    } else {
+                        names += userService.getById(id).getName() + ';';
+                    }
+                }
+                majorLedgerVO.setMembers(names);
+            }
+        }
+        return majorLedgerVOList;
+    }
+}