Bläddra i källkod

采购订单报表功能完善

guq 7 år sedan
förälder
incheckning
a24bfc7c55

+ 30 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseReportController.java

@@ -0,0 +1,30 @@
+package com.usoftchina.saas.purchase.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.purchase.service.PurchaseReportService;
+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;
+
+/**
+ * @author: guq
+ * @create: 2018-11-08 19:18
+ **/
+@RestController
+@RequestMapping("/report")
+public class PurchaseReportController {
+
+    @Autowired
+    private PurchaseReportService purchaseReportService;
+
+    @GetMapping("/purchasePay")
+    public Result PurchasePay(PageRequest page, ListReqDTO req) {
+        PageInfo listData = purchaseReportService.getPurchasePayData(page, req);
+        return Result.success(listData);
+    }
+
+}

+ 10 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasePayMapper.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.purchase.mapper;
+
+import com.usoftchina.saas.purchase.po.report.PurchasePay;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface PurchasePayMapper {
+    List<PurchasePay> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 3 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java

@@ -2,6 +2,7 @@ package com.usoftchina.saas.purchase.po;
 
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -116,4 +117,6 @@ public class PurchaseList extends CommonBaseEntity implements Serializable {
     private String pd_text5;
 
     private Double pd_yqty;
+
+    private ProductDTO productDTO;
 }

+ 40 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/report/PurchasePay.java

@@ -0,0 +1,40 @@
+package com.usoftchina.saas.purchase.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 14:22
+ **/
+@Data
+public class PurchasePay {
+    private Integer pb_id;
+
+    private String pb_code;
+
+    private String pu_vendcode;
+
+    private String pu_vendname;
+
+    private String pb_recorder;
+
+    private Date pb_recorddate;
+
+    private String pbd_slcode;
+
+    private String pbd_slkind;
+
+    private Double pbd_amount;
+
+    private Double pbd_nowbalance;
+
+    private Double pb_pbdamount;
+
+    private Double pb_payrate;
+
+    private String pd_remark;
+
+    private Integer companyid;
+}

+ 10 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseReportService.java

@@ -0,0 +1,10 @@
+package com.usoftchina.saas.purchase.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+public interface PurchaseReportService {
+
+    PageInfo getPurchasePayData(PageRequest page, ListReqDTO req);
+}

+ 56 - 0
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseReportServiceImpl.java

@@ -0,0 +1,56 @@
+package com.usoftchina.saas.purchase.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.purchase.mapper.PurchasePayMapper;
+import com.usoftchina.saas.purchase.service.PurchaseReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 14:33
+ **/
+@Service
+public class PurchaseReportServiceImpl implements PurchaseReportService{
+
+    @Autowired
+    private PurchasePayMapper purchasePayMapper;
+    @Override
+    public PageInfo getPurchasePayData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "PurchasePay");
+    }
+
+    private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List lists = getListByType(req, type);
+        //取分页信息
+        PageInfo pageInfo = new PageInfo(lists);
+        return pageInfo;
+    }
+
+    private List getListByType(ListReqDTO req, String type) {
+        List list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if ("PurchasePay".equals(type)) {
+            list = purchasePayMapper.selectByCondition(con, companyId);
+        }
+        return list;
+    }
+}

+ 31 - 1
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml

@@ -54,11 +54,41 @@
         <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
         <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
         <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+        <association property="productDTO" javaType="com.usoftchina.saas.document.dto.ProductDTO">
+            <id column="pr_id" property="id"/>
+            <result column="pr_code" property="pr_code"/>
+            <result column="pr_detail" property="pr_detail"/>
+            <result column="pr_spec" property="pr_spec"/>
+            <result column="pr_unit" property="pr_unit"/>
+            <result column="pr_kind" property="pr_kind"/>
+            <result column="pr_orispeccode" property="pr_orispeccode"/>
+            <result column="pr_whid" property="pr_whid"/>
+            <result column="pr_whcode" property="pr_whcode"/>
+            <result column="pr_whname" property="pr_whname"/>
+            <result column="pr_zxbzs" property="pr_zxbzs"/>
+            <result column="pr_leadtime" property="pr_leadtime"/>
+            <result column="pr_brand" property="pr_brand"/>
+            <result column="pr_standardprice" property="pr_standardprice"/>
+            <result column="pr_purcprice" property="pr_purcprice"/>
+            <result column="pr_saleprice" property="pr_saleprice"/>
+            <result column="pr_vendid" property="pr_vendid"/>
+            <result column="pr_vendname" property="pr_vendname"/>
+            <result column="pr_vendcode" property="pr_vendcode"/>
+            <result column="pr_docdate" property="pr_docdate"/>
+            <result column="pr_recordmanid" property="pr_recordmanid"/>
+            <result column="pr_recordman" property="pr_recordman"/>
+            <result column="pr_status" property="pr_status"/>
+            <result column="pr_statuscode" property="pr_statuscode"/>
+            <result column="pr_text1" property="pr_text1"/>
+            <result column="pr_text2" property="pr_text2"/>
+            <result column="pr_text3" property="pr_text3"/>
+            <result column="pr_text4" property="pr_text4"/>
+        </association>
     </resultMap>
 
     <select id="selectPurchaseListByCondition"  resultMap="BaseResultMap">
         select  *  from purchase left join purchasedetail on pu_id=pd_puid
-        left join product on pd_prodcode=pr_code
+        left join product on pd_prodid=pr_id
         <where>
             <if test="con != null">
                  ${con}

+ 32 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchasePayMapper.xml

@@ -0,0 +1,32 @@
+<?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.usoftchina.saas.purchase.mapper.PurchasePayMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.report.PurchasePay" >
+    <result column="pb_id" property="pb_id" jdbcType="INTEGER" />
+    <result column="pb_code" property="pb_code" jdbcType="VARCHAR" />
+    <result column="pu_vendcode" property="pu_vendcode" jdbcType="VARCHAR" />
+    <result column="pu_vendname" property="pu_vendname" jdbcType="VARCHAR" />
+    <result column="pb_recorder" property="pb_recorder" jdbcType="VARCHAR" />
+    <result column="pb_recorddate" property="pb_recorddate" jdbcType="TIMESTAMP" />
+    <result column="pbd_slcode" property="pbd_slcode" jdbcType="VARCHAR" />
+    <result column="pbd_slkind" property="pbd_slkind" jdbcType="VARCHAR" />
+    <result column="pbd_amount" property="pbd_amount" jdbcType="DOUBLE" />
+    <result column="pbd_nowbalance" property="pbd_nowbalance" jdbcType="DOUBLE" />
+    <result column="pb_pbdamount" property="pb_pbdamount" jdbcType="DOUBLE" />
+    <result column="pb_payrate" property="pb_payrate" jdbcType="DOUBLE" />
+    <result column="pd_remark" property="pd_remark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from purchasepay_view
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by pb_recorddate desc
+  </select>
+</mapper>

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleReportController.java

@@ -21,13 +21,13 @@ public class SaleReportController {
     @Autowired
     private SaleReportService saleReportService;
 
-    @GetMapping("/SaleProfit")
+    @GetMapping("/saleProfit")
     public Result SaleProfit(PageRequest page, ListReqDTO req) {
         PageInfo listData = saleReportService.getSaleProfitData(page, req);
         return Result.success(listData);
     }
 
-    @GetMapping("/SaleRec")
+    @GetMapping("/saleRec")
     public Result SaleRec(PageRequest page, ListReqDTO req) {
         PageInfo listData = saleReportService.getSaleRecData(page, req);
         return Result.success(listData);