Browse Source

科德系统渠道模块开发

anderx 3 years ago
parent
commit
4c9e1bab45

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1606,7 +1606,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       from t_order_new  where delete_sign in (0,2) and  buyer_id = #{uid}
     </select>
   <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
-    select y.province,dg.name ,y.total_amount,y.counts,y.dh,y.dh/y.counts dhl,y.wl,y.wl/y.counts wll,
+    select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dh,y.dh/y.counts dhl,y.wl,y.wl/y.counts wll,
     y.qd,y.qd/y.counts qdl,y.zjs,y.zjs/y.counts zjsl,y.qt,y.qt/y.counts qtl,
     y.gxfg,y.gxfg/y.counts gxfgl,y.qtfg,y.qtfg/y.counts qtfgl
     from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,

+ 18 - 0
src/main/java/com/goafanti/order/bo/InputOrderSalesSource.java

@@ -5,12 +5,30 @@ public class InputOrderSalesSource {
     private String startDate;
     private String endDate;
     private String depId;
+    private String depName;
+    private String provinceName;
     private Integer province;
     /**
      * 排序
      */
     private Integer sort;
 
+    public String getDepName() {
+        return depName;
+    }
+
+    public void setDepName(String depName) {
+        this.depName = depName;
+    }
+
+    public String getProvinceName() {
+        return provinceName;
+    }
+
+    public void setProvinceName(String provinceName) {
+        this.provinceName = provinceName;
+    }
+
     public String getStartDate() {
         return startDate;
     }

+ 24 - 5
src/main/java/com/goafanti/order/bo/OutOrderSalesSource.java

@@ -1,25 +1,44 @@
 package com.goafanti.order.bo;
 
+import com.goafanti.common.utils.excel.Excel;
+
 import java.math.BigDecimal;
 
 public class OutOrderSalesSource {
     private Integer province;
+    @Excel(name = "省份")
     private String name;
-    private BigDecimal total_amount;
+    @Excel(name = "签单金额(万元)")
+    private BigDecimal totalAmount;
+    @Excel(name = "签单数(个)")
     private Integer counts;
+    @Excel(name = "电话")
     private Integer dh;
+    @Excel(name = "电话占比")
     private String dhl;
+    @Excel(name = "网络")
     private Integer wl;
+    @Excel(name = "网络占比")
     private String wll;
+    @Excel(name = "渠道")
     private Integer qd;
+    @Excel(name = "渠道占比")
     private String qdl;
+    @Excel(name = "转介绍")
     private Integer zjs;
+    @Excel(name = "转介绍占比")
     private String zjsl;
+    @Excel(name = "其他")
     private Integer qt;
+    @Excel(name = "其他占比")
     private String qtl;
+    @Excel(name = "高新复购")
     private Integer gxfg;
+    @Excel(name = "高新复购占比")
     private String gxfgl;
+    @Excel(name = "其他复购")
     private Integer qtfg;
+    @Excel(name = "其他复购占比")
     private String qtfgl;
 
     public Integer getProvince() {
@@ -38,12 +57,12 @@ public class OutOrderSalesSource {
         this.name = name;
     }
 
-    public BigDecimal getTotal_amount() {
-        return total_amount;
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
     }
 
-    public void setTotal_amount(BigDecimal total_amount) {
-        this.total_amount = total_amount;
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
     }
 
     public Integer getCounts() {

+ 22 - 0
src/main/java/com/goafanti/order/controller/StatisticsApiController.java

@@ -3,12 +3,16 @@ package com.goafanti.order.controller;
 
 
 import java.io.IOException;
+import java.util.List;
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.order.bo.InputOrderSalesSource;
+import com.goafanti.order.bo.OutOrderSalesSource;
 import com.goafanti.order.service.OrderStatisticsService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -23,6 +27,8 @@ import com.goafanti.order.service.ProjectStatisticsService;
 @RequestMapping(value = "/api/admin/statistis")
 public class StatisticsApiController extends CertifyApiController {
 
+	@Value(value = "${upload.path}")
+	private String			uploadPath	= null;
 	@Autowired
 	private ProjectStatisticsService	projectStatisticsService;
 	@Autowired
@@ -93,6 +99,22 @@ public class StatisticsApiController extends CertifyApiController {
 		return res;
 	}
 
+	/**
+	 * 	订单销售来源统计
+	 */
+	@RequestMapping(value="/orderSalesSource/export" ,method = RequestMethod.GET)
+	public Result orderSalesSourceExport(InputOrderSalesSource in){
+		List<OutOrderSalesSource>  list =orderStatisticsService.orderSalesSource( in);
+		NewExcelUtil<OutOrderSalesSource> excelUtil=new NewExcelUtil<>(OutOrderSalesSource.class);
+		StringBuffer str=new StringBuffer("搜索条件=》");
+		if (in.getDepName()!=null)str=str.append("部门:").append(in.getDepName()).append(";");
+		if(in.getProvinceName()!=null)str=str.append("省份:").append(in.getProvinceName()).append(";");
+		if (in.getSort()!=null)str=str.append("排序:").append(in.getSort()==1?"签单数":"签单金额").append(";");
+		if (in.getStartDate()!=null &&in.getEndDate()!=null)str=str.append("时间:").append(in.getStartDate()).append("~")
+				.append(in.getEndDate()).append(";");
+		return excelUtil.exportExcel(list,"订单销售来源统计表",uploadPath,str.toString());
+	}
+
 
 
 }