Browse Source

销售相关表报接口

guq 7 years ago
parent
commit
4be7edc253

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

@@ -0,0 +1,36 @@
+package com.usoftchina.saas.sale.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.sale.service.SaleReportService;
+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-09 11:23
+ **/
+@RestController
+@RequestMapping("/report")
+public class SaleReportController {
+
+    @Autowired
+    private SaleReportService saleReportService;
+
+    @GetMapping("/SaleProfit")
+    public Result SaleProfit(PageRequest page, ListReqDTO req) {
+        PageInfo listData = saleReportService.getSaleProfitData(page, req);
+        return Result.success(listData);
+    }
+
+    @GetMapping("/SaleRec")
+    public Result SaleRec(PageRequest page, ListReqDTO req) {
+        PageInfo listData = saleReportService.getSaleRecData(page, req);
+        return Result.success(listData);
+    }
+
+}

+ 3 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleListMapper.java

@@ -8,7 +8,8 @@ import java.util.List;
 
 
 public interface SaleListMapper {
 public interface SaleListMapper {
 
 
-    List<SaleList> selectPurchaseBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<SaleList> selectSaleListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    List<SaleList> selectSaleByCondition(@Param("con") String con, @Param("companyId") Long companyId);
 
 
-    List<SaleList> selectPurchaseListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
 }
 }

+ 11 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleProfitViewMapper.java

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

+ 11 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SalerecViewMapper.java

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

+ 3 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleList.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.sale.po;
 package com.usoftchina.saas.sale.po;
 
 
+import com.usoftchina.saas.document.dto.ProductDTO;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -102,4 +103,6 @@ public class SaleList implements Serializable{
     private String sd_text4;
     private String sd_text4;
 
 
     private String sd_text5;
     private String sd_text5;
+
+    private ProductDTO productDTO;
 }
 }

+ 53 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SaleProfitView.java

@@ -0,0 +1,53 @@
+package com.usoftchina.saas.sale.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 10:55
+ **/
+@Data
+public class SaleProfitView {
+
+    private Integer companyid;
+
+    private String sa_custcode;
+
+    private String sa_custname;
+
+    private String sa_sellercode;
+
+    private String sa_seller;
+
+    private Date sa_date;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private String pr_kind;
+
+    private String pr_code;
+
+    private String pr_detail;
+
+    private String pr_spec;
+
+    private String pr_unit;
+
+    private Double pd_outqty;
+
+    private Double pd_sendprice;
+
+    private Double pd_taxrate;
+
+    private Double pd_ordertotal;
+
+    private Double pd_total;
+
+    private Double pd_profit;
+
+    private Double pd_profitpresent;
+}

+ 38 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/report/SalerecView.java

@@ -0,0 +1,38 @@
+package com.usoftchina.saas.sale.po.report;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 11:16
+ **/
+@Data
+public class SalerecView {
+    private Integer rb_id;
+
+    private String rb_code;
+
+    private String rb_custcode;
+
+    private String rb_custname;
+
+    private String rb_manname;
+
+    private Date rb_date;
+
+    private String rbd_slcode;
+
+    private String rbd_slkind;
+
+    private Double rbd_nowbalance;
+
+    private Double rb_rbdamount;
+
+    private Double rb_backrate;
+
+    private String rb_remark;
+
+    private Integer companyid;
+}

+ 12 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/SaleReportService.java

@@ -0,0 +1,12 @@
+package com.usoftchina.saas.sale.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.po.report.SalerecView;
+
+public interface SaleReportService {
+    PageInfo getSaleProfitData(PageRequest page, ListReqDTO req);
+
+    PageInfo getSaleRecData(PageRequest page, ListReqDTO req);
+}

+ 67 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleReportServiceImpl.java

@@ -0,0 +1,67 @@
+package com.usoftchina.saas.sale.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.sale.mapper.SaleProfitViewMapper;
+import com.usoftchina.saas.sale.mapper.SalerecViewMapper;
+import com.usoftchina.saas.sale.service.SaleReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2018-11-09 11:43
+ **/
+@Service
+public class SaleReportServiceImpl implements SaleReportService{
+
+    @Autowired
+    private SaleProfitViewMapper saleProfitViewMapper;
+    @Autowired
+    private SalerecViewMapper salerecViewMapper;
+
+    @Override
+    public PageInfo getSaleProfitData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "SaleProfit");
+    }
+
+    @Override
+    public PageInfo getSaleRecData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "SaleRec");
+    }
+
+    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 ("SaleProfit".equals(type)) {
+            list = saleProfitViewMapper.selectByCondition(con, companyId);
+        } else if ("SaleRec".equals(type)){
+            list = salerecViewMapper.selectByCondition(con, companyId);
+        }
+        return list;
+    }
+}

+ 3 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -334,10 +334,11 @@ public class SaleServiceImpl implements SaleService{
         if (null == con) {
         if (null == con) {
             con = "1=1";
             con = "1=1";
         }
         }
+
         if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
         if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
-            list = saleListMapper.selectPurchaseBycondition(con, companyId);
+            list = saleListMapper.selectSaleByCondition(con, companyId);
         } else {
         } else {
-            list = saleListMapper.selectPurchaseListByCondition(con, companyId);
+            list = saleListMapper.selectSaleListByCondition(con, companyId);
         }
         }
         return list;
         return list;
     }
     }

+ 32 - 2
applications/sale/sale-server/src/main/resources/mapper/SaleListMapper.xml

@@ -48,9 +48,39 @@
         <result column="sd_text3" property="sd_text3" jdbcType="VARCHAR" />
         <result column="sd_text3" property="sd_text3" jdbcType="VARCHAR" />
         <result column="sd_text4" property="sd_text4" jdbcType="VARCHAR" />
         <result column="sd_text4" property="sd_text4" jdbcType="VARCHAR" />
         <result column="sd_text5" property="sd_text5" jdbcType="VARCHAR" />
         <result column="sd_text5" property="sd_text5" jdbcType="VARCHAR" />
+        <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>
     </resultMap>
 
 
-    <select id="selectPurchaseListByCondition" resultMap="BaseResultMap">
+    <select id="selectSaleListByCondition" resultMap="BaseResultMap">
         select  *  from sale left join saledetail on sa_id=sd_said left join product
         select  *  from sale left join saledetail on sa_id=sd_said left join product
         on sd_prodid = pr_id and sale.companyId = product.companyid
         on sd_prodid = pr_id and sale.companyId = product.companyid
         <where>
         <where>
@@ -63,7 +93,7 @@
         </where>  order by sd_detno desc
         </where>  order by sd_detno desc
     </select>
     </select>
 
 
-    <select id="selectPurchaseBycondition" resultMap="BaseResultMap">
+    <select id="selectSaleByCondition" resultMap="BaseResultMap">
         select  *  from sale
         select  *  from sale
         <where>
         <where>
             <if test="con != null">
             <if test="con != null">

+ 38 - 0
applications/sale/sale-server/src/main/resources/mapper/SaleProfitViewMapper.xml

@@ -0,0 +1,38 @@
+<?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.sale.mapper.SaleProfitViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.sale.po.report.SaleProfitView" >
+    <result column="sa_custcode" property="sa_custcode" jdbcType="VARCHAR" />
+    <result column="sa_custname" property="sa_custname" jdbcType="VARCHAR" />
+    <result column="sa_sellercode" property="sa_sellercode" jdbcType="VARCHAR" />
+    <result column="sa_seller" property="sa_seller" jdbcType="VARCHAR" />
+    <result column="sa_date" property="sa_date" jdbcType="TIMESTAMP" />
+    <result column="pd_inoutno" property="pd_inoutno" jdbcType="VARCHAR" />
+    <result column="pd_piclass" property="pd_piclass" jdbcType="VARCHAR" />
+    <result column="pr_kind" property="pr_kind" jdbcType="VARCHAR" />
+    <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
+    <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
+    <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
+    <result column="pr_unit" property="pr_unit" jdbcType="VARCHAR" />
+    <result column="pd_outqty" property="pd_outqty" jdbcType="DOUBLE" />
+    <result column="pd_sendprice" property="pd_sendprice" jdbcType="DOUBLE" />
+    <result column="pd_taxrate" property="pd_taxrate" jdbcType="DOUBLE" />
+    <result column="pd_ordertotal" property="pd_ordertotal" jdbcType="DOUBLE" />
+    <result column="pd_total" property="pd_total" jdbcType="DOUBLE" />
+    <result column="pd_profit" property="pd_profit" jdbcType="DOUBLE" />
+    <result column="pd_profitpresent" property="pd_profitpresent" jdbcType="DOUBLE" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from Sale_Profit_View
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by sa_date desc
+  </select>
+ </mapper>

+ 31 - 0
applications/sale/sale-server/src/main/resources/mapper/SalerecViewMapper.xml

@@ -0,0 +1,31 @@
+<?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.sale.mapper.SalerecViewMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.sale.po.report.SalerecView" >
+    <result column="rb_id" property="rb_id" jdbcType="INTEGER" />
+    <result column="rb_code" property="rb_code" jdbcType="VARCHAR" />
+    <result column="rb_custcode" property="rb_custcode" jdbcType="VARCHAR" />
+    <result column="rb_custname" property="rb_custname" jdbcType="VARCHAR" />
+    <result column="rb_manname" property="rb_manname" jdbcType="VARCHAR" />
+    <result column="rb_date" property="rb_date" jdbcType="TIMESTAMP" />
+    <result column="rbd_slcode" property="rbd_slcode" jdbcType="VARCHAR" />
+    <result column="rbd_slkind" property="rbd_slkind" jdbcType="VARCHAR" />
+    <result column="rbd_nowbalance" property="rbd_nowbalance" jdbcType="DOUBLE" />
+    <result column="rb_rbdamount" property="rb_rbdamount" jdbcType="DOUBLE" />
+    <result column="rb_backrate" property="rb_backrate" jdbcType="DOUBLE" />
+    <result column="rb_remark" property="rb_remark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+  </resultMap>
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from Salerec_View
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by rb_date desc
+  </select>
+</mapper>