소스 검색

feat:收款明细页面代码

ly 11 달 전
부모
커밋
548cc2d023

+ 7 - 1
src/main/java/cn/ezhizao/common/utils/PageUtils.java

@@ -24,7 +24,13 @@ public class PageUtils extends PageHelper
         Boolean reasonable = pageDomain.getReasonable();
         PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
     }
-
+    public static void custStartPage(int pageNum, int pageSize)
+    {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+        Boolean reasonable = pageDomain.getReasonable();
+        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
+    }
     /**
      * 清理分页的线程变量
      */

+ 2 - 0
src/main/java/cn/ezhizao/project/business/collection/controller/BizCollectionController.java

@@ -59,6 +59,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import static cn.ezhizao.common.utils.PageUtils.custStartPage;
+
 @RestController
 @Api(tags = "收票 数据接口")
 @RequestMapping(value = "/business/collection")

+ 54 - 0
src/main/java/cn/ezhizao/project/business/collection/controller/BizCollectionDetailController.java

@@ -0,0 +1,54 @@
+package cn.ezhizao.project.business.collection.controller;
+
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+import cn.ezhizao.project.business.collection.domain.BizCollection;
+import cn.ezhizao.project.business.collection.domain.BizCollectionDetail;
+import cn.ezhizao.project.business.collection.domain.vo.ReqStatisticsVo;
+import cn.ezhizao.project.business.collection.domain.vo.ResStatisticsVo;
+import cn.ezhizao.project.business.collection.service.IBizCollectionDetailService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+import static cn.ezhizao.common.utils.PageUtils.custStartPage;
+
+@RestController
+@Api(tags = "收款管理,收款明细表")
+@RequestMapping(value = "/business/collectionDetail")
+public class BizCollectionDetailController extends BaseController {
+    @Resource
+    IBizCollectionDetailService collectionDetailService;
+
+
+    @ApiOperation(value = "带条件List 分页查询", notes = "带条件List 分页查询")
+    @PreAuthorize("@ss.hasPermi('business:collectionDetail:list')")
+    @RequestMapping ("/DetailList")
+    @ResponseBody
+    public TableDataInfo getDetailList(@RequestBody BizCollectionDetail collectionDetail) throws NoSuchFieldException, IllegalAccessException {
+        setTenantId(collectionDetail);
+        custStartPage((Integer) collectionDetail.getParams().get("pageNum"),(Integer)collectionDetail.getParams().get("pageSize"));
+        startOrderBy();
+        List<BizCollectionDetail> list = collectionDetailService.getDetailList(collectionDetail);
+        return getDataTable(list);
+    }
+
+    @ApiOperation("导出收款明细")
+//    @PreAuthorize("@ss.hasPermi('business:salary:export')")
+    @Log(title = "导出收款明细报表", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(@RequestBody BizCollectionDetail collectionDetail, HttpServletResponse response) throws NoSuchFieldException, IllegalAccessException {
+        response.setHeader("Content-Disposition","attachment;filename="+"a.xlsx");
+        List<BizCollectionDetail> list = collectionDetailService.getDetailList(collectionDetail);
+        ExcelUtil<BizCollectionDetail> util = new ExcelUtil<BizCollectionDetail>(BizCollectionDetail.class);
+        util.exportExcel(response, list, "收款明细");
+    }
+}

+ 3 - 2
src/main/java/cn/ezhizao/project/business/collection/domain/BizCollection.java

@@ -169,7 +169,7 @@ public class BizCollection extends BaseEntity implements Serializable {
 
     @Excel(name = "实际付款时间", width = 20, dateFormat = "yyyy-MM-dd")
     @ApiModelProperty("确认到账时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Timestamp actuallyDate;
 
     @Excel(name = "收款金额")
@@ -204,7 +204,8 @@ public class BizCollection extends BaseEntity implements Serializable {
     @TableField(exist = false)
     private String party;
     private Long verifyId;
-
+    @TableField(exist = false)
+    private String verifyName;
     public String getRemark() {
         return remark;
     }

+ 30 - 1
src/main/java/cn/ezhizao/project/business/collection/domain/BizCollectionDetail.java

@@ -1,7 +1,10 @@
 package cn.ezhizao.project.business.collection.domain;
 
 import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.aspectj.lang.annotation.Excels;
 import cn.ezhizao.framework.web.domain.BaseEntity;
+import cn.ezhizao.project.business.collection.domain.vo.ArchiveVo;
+import cn.ezhizao.project.business.order.domain.BizArchiveInput;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
@@ -36,6 +39,7 @@ public class BizCollectionDetail extends BaseEntity implements Serializable {
     private Long companyId;
 
     @ApiModelProperty(value = "产品外键")
+    @Excel(sort = 5,name = "任务类型", readConverterExp = "1=代理记账,2=社保代缴,3=公积金代缴,4=返税申报,5=注册,6=变更,7=注销,8=资质,9=其他")
     private Long taskTypeId;
 
     @ApiModelProperty(value = "购买数量")
@@ -58,7 +62,7 @@ public class BizCollectionDetail extends BaseEntity implements Serializable {
 
     @ApiModelProperty(value = "预估成本")
     private BigDecimal estimateCost;
-
+    @Excel(sort = 7,name = "本次收款金额")
     @ApiModelProperty(value = "收款金额")
     private BigDecimal arriveAmount;
 
@@ -72,6 +76,7 @@ public class BizCollectionDetail extends BaseEntity implements Serializable {
     private String taskTypeName;
 
     @TableField(exist = false)
+    @Excel(sort = 11,name = "已收款金额")
     private BigDecimal arrived;
 
     @TableField(exist = false)
@@ -118,4 +123,28 @@ public class BizCollectionDetail extends BaseEntity implements Serializable {
 
     @TableField(exist = false)
     private String inputRemark;
+
+    @TableField(exist = false)
+    @Excels({
+            @Excel(sort = 1, name = "客户名称", targetAttr = "companyName", type = Excel.Type.EXPORT),
+            @Excel(sort = 9,name = "是否是项目", targetAttr = "isProject", readConverterExp = "0=项目,1=非项目", type = Excel.Type.EXPORT),
+            @Excel(sort = 10, name = "确认所属时间", targetAttr = "actuallyDate", type = Excel.Type.EXPORT),
+            @Excel(sort = 11, name = "收款账户", targetAttr = "subsidiaryName", type = Excel.Type.EXPORT),
+            @Excel(sort = 12, name = "申请人", targetAttr = "applierName",dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT),
+            @Excel(sort = 13, name = "审核人", targetAttr = "verifyName", type = Excel.Type.EXPORT),
+            @Excel(sort = 14, name = "审核时间", targetAttr = "verifyDate", type = Excel.Type.EXPORT),
+            @Excel(sort = 15, name = "项目名称", targetAttr = "projectName", type = Excel.Type.EXPORT),
+            @Excel(sort = 16, name = "项目主体名称", targetAttr = "projectMainName", type = Excel.Type.EXPORT),
+            @Excel(sort = 17, name = "到账日期", targetAttr = "arriveDate",dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT),
+    })
+    private BizCollection bizCollection;
+    @TableField(exist = false)
+    @Excels({
+            @Excel(sort = 2,name = "合同编号", targetAttr = "contractNo", type = Excel.Type.EXPORT),
+            @Excel(sort = 3,name = "甲方", targetAttr = "boss", type = Excel.Type.EXPORT),
+            @Excel(sort = 4,name = "乙方", targetAttr = "party", type = Excel.Type.EXPORT),
+            @Excel(sort = 6,name = "任务金额", targetAttr = "amount", type = Excel.Type.EXPORT),
+            @Excel(sort = 8,name = "合同类型", targetAttr = "contractType",readConverterExp = "0=新签,1=续签", type = Excel.Type.EXPORT)
+    })
+    private ArchiveVo bizArchiveInput;
 }

+ 18 - 0
src/main/java/cn/ezhizao/project/business/collection/domain/vo/ArchiveVo.java

@@ -0,0 +1,18 @@
+package cn.ezhizao.project.business.collection.domain.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class ArchiveVo {
+    private Long Id;
+    private String party;
+    private String boss;
+    private BigDecimal amount;
+    private Integer contractType;
+    private String contractNo;
+    private Map<String,List<String>> map;
+}

+ 2 - 0
src/main/java/cn/ezhizao/project/business/collection/mapper/BizCollectionDetailMapper.java

@@ -46,6 +46,8 @@ public interface BizCollectionDetailMapper extends BaseMapper<BizCollectionDetai
     Integer physicallyDelete(BizCollectionDetail conditions);
 
     void remove(List<Long> ids);
+
+    List<BizCollectionDetail> getDetailList(BizCollectionDetail collectionDetail);
 }
 
 

+ 2 - 0
src/main/java/cn/ezhizao/project/business/collection/service/IBizCollectionDetailService.java

@@ -43,4 +43,6 @@ public interface IBizCollectionDetailService extends IService<BizCollectionDetai
      * @return int 执行成功的数量
      */
     Integer physicallyDelete(BizCollectionDetail conditions);
+
+    List<BizCollectionDetail> getDetailList(BizCollectionDetail collectionDetail);
 }

+ 6 - 0
src/main/java/cn/ezhizao/project/business/collection/service/impl/BizCollectionDetailServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -39,4 +40,9 @@ public class BizCollectionDetailServiceImpl extends ServiceImpl<BizCollectionDet
     public Integer physicallyDelete(BizCollectionDetail conditions) {
         return collectionDetailDao.physicallyDelete(conditions);
     }
+
+    @Override
+    public List<BizCollectionDetail> getDetailList(BizCollectionDetail collectionDetail) {
+        return collectionDetailDao.getDetailList(collectionDetail);
+    }
 }

+ 117 - 1
src/main/resources/mybatis/business/BizCollectionDetailMapper.xml

@@ -4,7 +4,22 @@
     <!-- 基础的返回map 多表复杂的 自行组合 -->
     <resultMap id="BaseResultMap" type="cn.ezhizao.project.business.collection.domain.BizCollectionDetail">
     </resultMap>
-
+    <resultMap id="DetailResultMap" type="cn.ezhizao.project.business.collection.domain.BizCollectionDetail">
+        <id column="id" property="id"/>
+        <result column="collection_id" property="collectionId"/>
+        <result column="contract_id" property="contractId"/>
+        <association property="bizCollection" column="collection_id" select="getCollection" javaType="cn.ezhizao.project.business.collection.domain.BizCollection" />
+        <association property="bizArchiveInput" column="contract_id" select="getArchiveInput" javaType="cn.ezhizao.project.business.collection.domain.vo.ArchiveVo" />
+    </resultMap>
+    <select id="getCollection" resultType="cn.ezhizao.project.business.collection.domain.BizCollection">
+        select *,user1.nick_name as applierName,user2.nick_name as verifyName from biz_collection
+        left join sys_user user1 on user1.user_id = biz_collection.applier_id
+        left join sys_user user2 on user2.user_id = biz_collection.verify_id
+        where id = #{collection_id}
+    </select>
+    <select id="getArchiveInput" resultType="cn.ezhizao.project.business.collection.domain.vo.ArchiveVo">
+        select * from biz_archive_input where id = #{contract_id}
+    </select>
     <!--带条件的List查询-->
     <select id="getList" resultMap="BaseResultMap">
         <include refid="getListSql"/>
@@ -111,4 +126,105 @@
             AND collection_id = #{collectionId}
         </if>
     </delete>
+    <select id="getDetailList" resultMap="DetailResultMap">
+        select detail.*,(select sum(cd.arrive_amount) from biz_collection_detail cd left join biz_collection c on c.id =
+        cd.collection_id
+        where cd.contract_detail_id = detail.contract_detail_id
+        and cd.deleted = 0 and detail.contract_id = cd.contract_id and c.status = 1) arrived from biz_collection_detail
+        detail
+        LEFT JOIN biz_collection collection on collection.id = detail.collection_id
+        LEFT JOIN biz_task_type t2 on t2.id = detail.task_type_id
+        LEFT JOIN biz_archive_input_detail inputDetail on inputDetail.id = detail.contract_detail_id
+        LEFT JOIN biz_archive_input input on input.id = inputDetail.contract_id
+        LEFT JOIN biz_company company on detail.company_id = company.id
+        left join sys_user user1 on user1.user_id = collection.verify_id
+        left join sys_user user2 on user2.user_id = collection.applier_id
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            detail.deleted = 0 AND collection.status = 1
+            <if test="id != null  ">
+                AND   detail.id = #{id}
+            </if>
+            <if test="collectionId != null  ">
+                AND  detail.collection_id = #{collectionId}
+            </if>
+            <if test="tenantId != null">
+                AND  detail.tenant_id = #{tenantId}
+            </if>
+            <if test="collectionIds != null and collectionIds.size > 0 ">
+                AND   collection_id in
+                <foreach collection="collectionIds" index="index" item="item" separator=","  open="(" close=")">
+                    #{item,jdbcType=BIGINT}
+                </foreach>
+
+            </if>
+            <if test="contractDetailId != null">
+                AND detail.contract_detail_id = #{contractDetailId}
+            </if>
+
+            <if test="bizArchiveInput != null and bizArchiveInput.contractNo != null and bizArchiveInput.contractNo != ''">
+                AND input.contract_no LIKE CONCAT('%', #{bizArchiveInput.contractNo},'%')
+            </if>
+            <if test="bizArchiveInput != null and bizArchiveInput.boss != null and bizArchiveInput.boss != ''">
+                AND input.boss LIKE CONCAT('%', #{bizArchiveInput.boss},'%')
+            </if>
+            <if test="bizArchiveInput != null and bizArchiveInput.party != null and bizArchiveInput.party != ''">
+                AND input.party LIKE CONCAT('%', #{bizArchiveInput.party},'%')
+            </if>
+            <if test="bizArchiveInput != null and bizArchiveInput.contractType != null">
+                AND input.contract_type = #{bizArchiveInput.contractType}
+            </if>
+            <if test="bizCollection != null and bizCollection.verifyName != null and bizCollection.verifyName != ''">
+                AND user1.nick_name LIKE CONCAT('%', #{bizCollection.verifyName},'%')
+            </if>
+            <if test="bizCollection != null and bizCollection.applierName != null and bizCollection.applierName != ''">
+                AND user2.nick_name LIKE CONCAT('%', #{bizCollection.applierName},'%')
+            </if>
+            <if test="bizCollection != null and bizCollection.isProject != null">
+                AND collection.is_project = #{bizCollection.isProject}
+            </if>
+            <if test="bizCollection != null and bizCollection.projectMainName != null and bizCollection.projectMainName != ''">
+                AND collection.project_main_name LIKE CONCAT('%', #{bizCollection.projectMainName},'%')
+            </if>
+            <if test="bizCollection != null and bizCollection.projectName != null and bizCollection.projectName != ''">
+                AND collection.project_name LIKE CONCAT('%', #{bizCollection.projectName},'%')
+            </if>
+            <if test="verifyStatus != null">
+                AND  collection.status = #{verifyStatus}
+            </if>
+            <if test="contractId != null  ">
+                AND  detail.contract_id = #{contractId}
+            </if>
+            <if test="bizCollection != null and bizCollection.companyName != null and bizCollection.companyName != '' ">
+                AND  company.name LIKE CONCAT('%', #{bizCollection.companyName},'%')
+            </if>
+            <if test=" bizArchiveInput != null and bizArchiveInput.map != null and bizArchiveInput.map.receiptDateFilter != null">
+                AND (
+                DATE_FORMAT(collection.arrive_date,'%Y-%m-%d') &gt;= #{bizArchiveInput.map.receiptDateFilter[0]}
+                AND
+                DATE_FORMAT(collection.arrive_date,'%Y-%m-%d') &lt;= #{bizArchiveInput.map.receiptDateFilter[1]}
+                )
+            </if>
+            <if test=" bizArchiveInput != null and bizArchiveInput.map != null and bizArchiveInput.map.actuallyDateFilter != null">
+            AND(
+                DATE_FORMAT(collection.actually_date,'%Y-%m-%d') &gt;= #{bizArchiveInput.map.actuallyDateFilter[0]}
+                AND
+                DATE_FORMAT(collection.actually_date,'%Y-%m-%d') &lt;= #{bizArchiveInput.map.actuallyDateFilter[1]}
+                )
+            </if>
+            <if test="taskTypeId != null  ">
+                and detail.task_type_id = #{taskTypeId} AND
+            </if>
+            <if test="remark != null  and remark != '' ">
+                detail.remark = #{remark} AND
+            </if>
+            <if test="ids != null  ">
+                detail.contract_id IN
+                <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
+                    #{item,jdbcType=BIGINT}
+                </foreach>
+                AND
+            </if>
+        </trim>
+        order by detail.create_time desc
+    </select>
 </mapper>