Browse Source

首页接口更新,采购明细报表更新更新

guq 7 years ago
parent
commit
3c5ed2c1ce

+ 53 - 2
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/HomePageController.java

@@ -21,25 +21,76 @@ public class HomePageController {
     @Autowired
     private HomePageService homePageService;
 
-
+    /**
+    * @Description 实时数据
+    * @Param: [req]
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
     @GetMapping("liveData")
     public Result liveData(ServletRequest req) {
         return homePageService.liveDate();
     }
 
+    /**
+    * @Description  采购数据
+    * @Param: [sixMonths]
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
     @GetMapping("purchaseData")
     public Result purchaseData(Boolean sixMonths) {
         return homePageService.purchaseData(sixMonths);
     }
 
+    /**
+    * @Description 仓库数据
+    * @Param: [req]
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
     @GetMapping("storageData")
     public Result storageData(ServletRequest req) {
         return homePageService.storageData();
     }
 
-
+    /**
+    * @Description 收入支出
+    * @Param: [req]
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
     @RequestMapping("payAndRecData")
     public Result payAndRecData(ServletRequest req) {
         return homePageService.payAndRecData();
     }
+
+    /**
+    * @Description 销售饼图
+    * @Param: []
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
+    @GetMapping("saleData")
+    public Result saleData() {
+        return homePageService.saleData();
+    }
+
+    /**
+     * @Description 销售趋势图折线图
+     * @Param: []
+     * @return: com.usoftchina.saas.base.Result
+     * @Author: guq
+     * @Date: 2018/11/14
+     */
+    @GetMapping("saleFutureData")
+    public Result saleFutureData() {
+        return homePageService.saleFutureData();
+    }
+
 }

+ 4 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/HomePageMapper.java

@@ -13,4 +13,8 @@ public interface HomePageMapper {
     String getStorageData(Long componyId);
 
     String getPayAndRecData(Long companyId);
+
+    String getSaleData(Long componyId);
+
+    String getSaleFutureData(Long componyId);
 }

+ 11 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/HomePageService.java

@@ -38,4 +38,15 @@ public interface HomePageService {
     * @Date: 2018/11/13
     */
     Result payAndRecData();
+
+    /**
+    * @Description 获取
+    * @Param: []
+    * @return: com.usoftchina.saas.base.Result
+    * @Author: guq
+    * @Date: 2018/11/14
+    */
+    Result saleData();
+
+    Result saleFutureData();
 }

+ 14 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/HomePageServiceImpl.java

@@ -65,6 +65,20 @@ public class HomePageServiceImpl implements HomePageService{
         return Result.success(json);
     }
 
+    @Override
+    public Result saleData() {
+        Long componyId = BaseContextHolder.getCompanyId();
+        Object json = parseJsonArray(homePageMapper.getSaleData(componyId));
+        return Result.success(json);
+    }
+
+    @Override
+    public Result saleFutureData() {
+        Long componyId = BaseContextHolder.getCompanyId();
+        Object json = parseJsonArray(homePageMapper.getSaleFutureData(componyId));
+        return Result.success(json);
+    }
+
     private Object parseJson(String text) {
         Object json = null;
         if (null != text) {

+ 33 - 13
applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml

@@ -17,46 +17,66 @@
 
     <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">
     select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
-(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
  </select>
 
 
     <select id="getStorageData" parameterType="long" resultType="string">
       select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
 
-(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
+(select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
 
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
 
-(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
+(select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"y":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
     </select>
 
 
     <select id="getPayAndRecData" parameterType="long" resultType="string">
-     select concat('[{"x":"支出","y":',ifnull(si_amount_pay,'0'),'},{"x":"收入","y":',ifnull(si_amount_rec,'0'),'}]') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
+    select concat('[{"x":"收入","main":',ifnull(round(si_amount_rec/10000,2),'0'),',"other":',ifnull(round(si_amount_otherrec/10000,2),'0'),'},{"x":"支出","main":',ifnull(round(si_amount_pay/10000,2),'0'),',"other":',ifnull(round(si_amount_otherpay/10000,2),'0'),'}]') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
     </select>
 
+    <select id="getSaleData" parameterType="long" resultType="string">
+        select concat('[',GROUP_CONCAT(concat('{"x":"',si_custname,'","y":',IFNULL(si_amount,0),'}')),']')  from statsinfo
+        where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc
+    </select>
+
+    <select id="getSaleFutureData" parameterType="long" resultType="string">
+       	select concat('[',d1,',',d2,',',d3,',',d4,',',d5,',',d6,']') from (
+        (select concat('{"x":',DATE_FORMAT(now(),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d1 from   statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='SALE' ORDER BY si_amount desc) data_1,
+
+        (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d2 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc)data_2,
+
+
+        (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d3 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc)data_3,
+
+        (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d4 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc) data_4,
+
+
+        (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d5 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc)data_5,
 
+        (select concat('{"x":',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),',"sale":',ifnull(ROUND(sum((ifnull(si_amount/10000,0))),2),'0'),',"saleback":',ifnull(ROUND(sum((ifnull(si_amount_rec/10000,0))),2),'0'),'}') d6 from  statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='SALERETURN' ORDER BY si_amount desc)data_6)
+       </select>
 </mapper>

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

@@ -27,4 +27,10 @@ public class PurchaseReportController {
         return Result.success(listData);
     }
 
+    @GetMapping("/purchaseDetail")
+    public Result PurchaseDetail(PageRequest page, ListReqDTO req) {
+        PageInfo listData = purchaseReportService.getPurchaseDetailData(page, req);
+        return Result.success(listData);
+    }
+
 }

+ 4 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasePayMapper.java → applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseReportMapper.java

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

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

@@ -0,0 +1,151 @@
+package com.usoftchina.saas.purchase.po.report;
+
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author: guq
+ * @create: 2018-10-10 16:42
+ **/
+@Data
+public class PurchaseReportDetail extends CommonBaseEntity implements Serializable {
+
+    //主表信息
+    private  Integer pu_id;
+
+    private String pu_code;
+
+    private Date pu_date;
+
+    private Integer pu_vendid;
+
+    private String pu_vendcode;
+
+    private String pu_vendname;
+
+    private Integer pu_buyerid;
+
+    private String pu_buyercode;
+
+    private String pu_buyername;
+
+    private Date pu_delivery;
+
+
+    private Double pu_taxtotal;
+
+    private Double pu_total;
+
+    private String pu_remark;
+
+    private String pu_totalupper;
+
+    private String pu_printstatus;
+
+    private String pu_printstatuscode;
+
+    private String pu_acceptstatuscode;
+
+    private String pu_acceptstatus;
+
+    private String pu_statuscode;
+
+    private String pu_status;
+
+    private String pu_text1;
+
+    private String pu_text2;
+
+    private String pu_text3;
+
+    private String pu_text4;
+
+    private String pu_text5;
+
+    private String pu_shipaddresscode;
+
+    //从表字段
+    private Long pd_id;
+
+    private  Long pd_puid;
+
+    private String pd_code;
+
+    private Integer pd_detno;
+
+    private Integer pd_prodid;
+
+    private String pd_prodcode;
+
+    private String pd_unit;
+
+    private Double pd_qty;
+
+    private Double pd_price;
+
+    private Double pd_taxprice;
+
+    private Double pd_total;
+
+    private Double pd_taxrate;
+
+    private Double pd_taxtotal;
+
+    private Double pd_acceptqty;
+
+    private Date pd_delivery;
+
+    private String pd_salecode;
+
+    private Integer pd_saledetno;
+
+    private Integer pd_sdid;
+
+    private String pd_text1;
+
+    private String pd_text2;
+
+    private String pd_text3;
+
+    private String pd_text4;
+
+    private String pd_text5;
+
+    private Double pd_yqty;
+
+    private Double pd_accepttotal;
+
+    //private ProductDTO productDTO;
+    private Long pr_id;
+    private String pr_code;
+    private String pr_detail;
+    private String pr_spec;
+    private String pr_unit;
+    private String pr_kind;
+    private String pr_orispeccode;
+    private long pr_whid;
+    private String pr_whcode;
+    private String pr_whname;
+    private long pr_zxbzs;
+    private long pr_leadtime;
+    private String pr_brand;
+    private String pr_standardprice;
+    private String pr_purcprice;
+    private String pr_saleprice;
+    private long pr_vendid;
+    private String pr_vendname;
+    private String pr_vendcode;
+    private Date pr_docdate;
+    private long pr_recordmanid;
+    private String pr_recordman;
+    private String pr_status;
+    private String pr_statuscode;
+    private String pr_text1;
+    private String pr_text2;
+    private String pr_text3;
+    private String pr_text4;
+}

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

@@ -7,4 +7,6 @@ import com.usoftchina.saas.page.PageRequest;
 public interface PurchaseReportService {
 
     PageInfo getPurchasePayData(PageRequest page, ListReqDTO req);
+
+    PageInfo getPurchaseDetailData(PageRequest page, ListReqDTO req);
 }

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

@@ -5,7 +5,7 @@ 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.mapper.PurchaseReportMapper;
 import com.usoftchina.saas.purchase.service.PurchaseReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -20,12 +20,18 @@ import java.util.List;
 public class PurchaseReportServiceImpl implements PurchaseReportService{
 
     @Autowired
-    private PurchasePayMapper purchasePayMapper;
+    private PurchaseReportMapper purchaseReportMapper;
+
     @Override
     public PageInfo getPurchasePayData(PageRequest page, ListReqDTO req) {
         return getListDATA(page, req, "PurchasePay");
     }
 
+    @Override
+    public PageInfo getPurchaseDetailData(PageRequest page, ListReqDTO req) {
+        return getListDATA(page, req, "PurchaseReportDetail");
+    }
+
     private PageInfo getListDATA(PageRequest page, ListReqDTO req, String type) {
         //设置默认分页
         if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
@@ -44,12 +50,15 @@ public class PurchaseReportServiceImpl implements PurchaseReportService{
     private List getListByType(ListReqDTO req, String type) {
         List list = null;
         Long companyId = BaseContextHolder.getCompanyId();
+        companyId = 1l;
         String con = req.getFinalCondition();
         if (null == con) {
             con = "1=1";
         }
         if ("PurchasePay".equals(type)) {
-            list = purchasePayMapper.selectByCondition(con, companyId);
+            list = purchaseReportMapper.selectByCondition(con, companyId);
+        } else if ("PurchaseReportDetail".equals(type)){
+            list = purchaseReportMapper.selectDetailByCondition(con, companyId);
         }
         return list;
     }

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

@@ -1,32 +0,0 @@
-<?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>

+ 128 - 0
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseReportMapper.xml

@@ -0,0 +1,128 @@
+<?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.PurchaseReportMapper" >
+  <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>
+  <resultMap id="ListMap" type="com.usoftchina.saas.purchase.po.report.PurchaseReportDetail">
+    <id column="pu_id" property="pu_id" jdbcType="INTEGER" />
+    <result column="pu_code" property="pu_code" jdbcType="VARCHAR" />
+    <result column="pu_date" property="pu_date" jdbcType="TIMESTAMP" />
+    <result column="pu_vendid" property="pu_vendid" jdbcType="INTEGER" />
+    <result column="PU_VENDCODE" property="pu_vendcode" jdbcType="VARCHAR" />
+    <result column="PU_VENDNAME" property="pu_vendname" jdbcType="VARCHAR" />
+    <result column="PU_BUYERID" property="pu_buyerid" jdbcType="INTEGER" />
+    <result column="PU_BUYERCODE" property="pu_buyercode" jdbcType="VARCHAR" />
+    <result column="PU_BUYERNAME" property="pu_buyername" jdbcType="VARCHAR" />
+    <result column="PU_DELIVERY" property="pu_delivery" jdbcType="TIMESTAMP" />
+    <result column="PU_TAXTOTAL" property="pu_taxtotal" jdbcType="DOUBLE" />
+    <result column="PU_TOTAL" property="pu_total" jdbcType="DOUBLE" />
+    <result column="PU_REMARK" property="pu_remark" jdbcType="VARCHAR" />
+    <result column="PU_TOTALUPPER" property="pu_totalupper" jdbcType="VARCHAR" />
+    <result column="PU_INDATE" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="PU_PRINTSTATUS" property="pu_printstatus" jdbcType="VARCHAR" />
+    <result column="PU_PRINTSTATUSCODE" property="pu_printstatuscode" jdbcType="VARCHAR" />
+    <result column="PU_ACCEPTSTATUSCODE" property="pu_acceptstatuscode" jdbcType="VARCHAR" />
+    <result column="PU_ACCEPTSTATUS" property="pu_acceptstatus" jdbcType="VARCHAR" />
+    <result column="PU_STATUSCODE" property="pu_statuscode" jdbcType="VARCHAR" />
+    <result column="PU_STATUS" property="pu_status" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyId" jdbcType="BIGINT" />
+    <result column="updatemanid" property="updaterId" jdbcType="INTEGER" />
+    <result column="updatedate" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="pu_text1" property="pu_text1" jdbcType="VARCHAR" />
+    <result column="pu_text2" property="pu_text2" jdbcType="VARCHAR" />
+    <result column="pu_text3" property="pu_text3" jdbcType="VARCHAR" />
+    <result column="pu_text4" property="pu_text4" jdbcType="VARCHAR" />
+    <result column="pu_text5" property="pu_text5" jdbcType="VARCHAR" />
+    <result column="PD_ID" property="pd_id" jdbcType="INTEGER" />
+    <result column="PD_PUID" property="pd_puid" jdbcType="INTEGER" />
+    <result column="PD_CODE" property="pd_code" jdbcType="VARCHAR" />
+    <result column="PD_DETNO" property="pd_detno" jdbcType="INTEGER" />
+    <result column="PD_PRODID" property="pd_prodid" jdbcType="INTEGER" />
+    <result column="PD_PRODCODE" property="pd_prodcode" jdbcType="VARCHAR" />
+    <result column="PD_UNIT" property="pd_unit" jdbcType="VARCHAR" />
+    <result column="PD_QTY" property="pd_qty" jdbcType="DOUBLE" />
+    <result column="PD_PRICE" property="pd_price" jdbcType="DOUBLE" />
+    <result column="PD_TAXPRICE" property="pd_taxprice" jdbcType="DOUBLE" />
+    <result column="PD_TOTAL" property="pd_total" jdbcType="DOUBLE" />
+    <result column="PD_TAXTOTAL" property="pd_taxtotal" jdbcType="DOUBLE" />
+    <result column="PD_ACCEPTQTY" property="pd_acceptqty" jdbcType="DOUBLE" />
+    <result column="PD_DELIVERY" property="pd_delivery" jdbcType="TIMESTAMP" />
+    <result column="PD_SALECODE" property="pd_salecode" jdbcType="VARCHAR" />
+    <result column="PD_SALEDETNO" property="pd_saledetno" jdbcType="INTEGER" />
+    <result column="PD_SDID" property="pd_sdid" jdbcType="INTEGER" />
+    <result column="pd_text1" property="pd_text1" jdbcType="VARCHAR" />
+    <result column="pd_text2" property="pd_text2" jdbcType="VARCHAR" />
+    <result column="pd_text3" property="pd_text3" jdbcType="VARCHAR" />
+    <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" />
+    <result column="pr_id" property="pr_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"/>
+    <result column="pd_accepttotal" property="pd_accepttotal"/>
+  </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>
+
+  <select id="selectDetailByCondition"  resultMap="ListMap">
+    select  *,ifnull(purchasedetail.PD_ACCEPTQTY,0)*ifnull(purchasedetail.PD_PRICE,0) pd_accepttotal  from purchase left join purchasedetail on pu_id=pd_puid
+    left join product on pd_prodid=pr_id
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   purchase.companyId = #{companyId}
+      </if>
+    </where>  order by pu_date desc
+  </select>
+</mapper>