Browse Source

外出面谈统计开发

anderx 4 years ago
parent
commit
9519907bed

+ 13 - 0
src/main/java/com/goafanti/common/dao/PublicReleaseCountMapper.java

@@ -1,6 +1,11 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PublicReleaseCount;
+import com.goafanti.user.bo.outFollowStatisticsList;
+import com.goafanti.user.bo.outProvinceFollowStatistic;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface PublicReleaseCountMapper {
     int deleteByPrimaryKey(Integer id);
@@ -14,4 +19,12 @@ public interface PublicReleaseCountMapper {
     int updateByPrimaryKeySelective(PublicReleaseCount record);
 
     int updateByPrimaryKey(PublicReleaseCount record);
+
+    void insertBatch(List<PublicReleaseCount> list);
+
+    List<outFollowStatisticsList> followStatisticsList(@Param("depId")String depId, @Param("date")String date,
+                                                       @Param("province")Integer province ,@Param("sort")Integer sort);
+
+    List<outProvinceFollowStatistic> provinceFollowStatisticsList(@Param("depId")String depId, @Param("date")String date,
+                                                                  @Param("province")Integer province ,@Param("sort")Integer sort);
 }

+ 2 - 1
src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java

@@ -4,6 +4,7 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
+import com.goafanti.common.model.PublicReleaseCount;
 import com.goafanti.common.model.outUserFollowCount;
 import org.apache.ibatis.annotations.Param;
 
@@ -31,5 +32,5 @@ public interface PublicReleaseMapper {
 
     void updateSignByAidAndUid(@Param("uid") String buyerId, @Param("aid") String salesmanId);
 
-    List<outUserFollowCount> getTimeUserFollow(@Param("date")Date date, @Param("now")Date now);
+    List<PublicReleaseCount> getTimeUserFollow(@Param("date")Date date, @Param("now")Date now);
 }

+ 5 - 3
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -2,9 +2,7 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.TOrderBillNew;
 import com.goafanti.common.model.TOrderNew;
-import com.goafanti.order.bo.OrderListBo;
-import com.goafanti.order.bo.OrderRefundDetailBo;
-import com.goafanti.order.bo.TOrderNewBo;
+import com.goafanti.order.bo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
@@ -42,4 +40,8 @@ public interface TOrderNewMapper {
     void updaterefund(TOrderNew o);
 
     List<BigDecimal> selectByUidAndNewUser(@Param("uid")String uid, @Param("newUser")Integer newUser, @Param("date") Date date, @Param("now")Date now);
+
+    List<outStatisticsList> statisticsList(InputStatistics in);
+
+    List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
 }

+ 81 - 9
src/main/java/com/goafanti/common/mapper/PublicReleaseCountMapper.xml

@@ -6,12 +6,13 @@
     <result column="province" jdbcType="INTEGER" property="province" />
     <result column="dep_id" jdbcType="VARCHAR" property="depId" />
     <result column="uid" jdbcType="VARCHAR" property="uid" />
-    <result column="quantity" jdbcType="VARCHAR" property="quantity" />
+    <result column="quantity" jdbcType="INTEGER" property="quantity" />
+    <result column="new_user" jdbcType="INTEGER" property="newUser" />
     <result column="total" jdbcType="DECIMAL" property="total" />
     <result column="date" jdbcType="VARCHAR" property="date" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, province, dep_id, `uid`, quantity, total, `date`
+    id, province, dep_id, `uid`, quantity, new_user, total, `date`
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select 
@@ -19,17 +20,67 @@
     from public_release_count
     where id = #{id,jdbcType=INTEGER}
   </select>
+  <select id="followStatisticsList" resultType="com.goafanti.user.bo.outFollowStatisticsList">
+    select z.*,(z.totalQuantity/z.totalInterview)totalRatio from(select name,use_interview useInterview,
+      use_quantity useQuantity,use_total useTotal,(use_quantity/use_interview)useRatio,
+      new_interview newInterview,new_quantity newQuantity,new_total newTotal,(new_quantity/new_interview)newRatio,
+      (use_interview+new_interview)totalInterview,(use_quantity+new_quantity)totalQuantity,(use_total+new_total)total
+   from (select dg.name,sum(use_interview)use_interview,sum(use_quantity)use_quantity,sum(use_total)use_total,
+         sum(new_interview)new_interview,sum(new_quantity)new_quantity,sum(new_total)new_total
+   from (select province,if(new_user=1,1,0)use_interview,if(new_user=1,a.quantity ,0)use_quantity,
+    if(new_user=1,a.total ,0)use_total,if(new_user=0,1,0)new_interview,if(new_user=0,a.quantity ,0)new_quantity,
+    if(new_user=0,a.total ,0)new_total from public_release_count a
+   where a.`date` = #{date}
+     <if test="depId !=null">
+     and a.dep_id= #{depId}
+     </if>
+    <if test="province !=null">
+      and a.province= #{province}
+    </if>
+    )x
+    left join district_glossory dg on x.province=dg.id group by dg.id )y )z
+    order by
+    <if test="sort==0">
+      totalQuantity
+    </if>
+    <if test="sort==1">
+      total
+    </if>
+    <if test="sort==2">
+      totalInterview
+    </if>
+    desc
+  </select>
+  <select id="provinceFollowStatisticsList" resultType="com.goafanti.user.bo.outProvinceFollowStatistic">
+    select x.name,c.nickname ,x.new_user newUser,d.counts interviewCount,x.quantity
+    from (select b.name,a.new_user,a.uid,sum(a.quantity)quantity from public_release_count a left join department b on a.dep_id =b.id
+          where a.date= #{date} and a.province = #{province}
+            <if test="depId !=null">
+            and a.dep_id = #{depId}
+            </if>
+          group by b.name ,a.uid ,a.new_user )x
+           left join `user` c on x.uid =c.id left join (select uid,count(*)counts from public_release group by uid) d on x.uid =d.uid
+    order by
+             <if test="sort==0">
+             d.counts
+             </if>
+    <if test="sort==1">
+             x.quantity
+    </if>
+    desc
+  </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
     delete from public_release_count
     where id = #{id,jdbcType=INTEGER}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseCount" useGeneratedKeys="true">
     insert into public_release_count (province, dep_id, `uid`, 
-      quantity, total, `date`
-      )
+      quantity, new_user, total, 
+      `date`)
     values (#{province,jdbcType=INTEGER}, #{depId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, 
-      #{quantity,jdbcType=VARCHAR}, #{total,jdbcType=DECIMAL}, #{date,jdbcType=VARCHAR}
-      )
+      #{quantity,jdbcType=INTEGER}, #{newUser,jdbcType=INTEGER}, #{total,jdbcType=DECIMAL}, 
+      #{date,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseCount" useGeneratedKeys="true">
     insert into public_release_count
@@ -46,6 +97,9 @@
       <if test="quantity != null">
         quantity,
       </if>
+      <if test="newUser != null">
+        new_user,
+      </if>
       <if test="total != null">
         total,
       </if>
@@ -64,7 +118,10 @@
         #{uid,jdbcType=VARCHAR},
       </if>
       <if test="quantity != null">
-        #{quantity,jdbcType=VARCHAR},
+        #{quantity,jdbcType=INTEGER},
+      </if>
+      <if test="newUser != null">
+        #{newUser,jdbcType=INTEGER},
       </if>
       <if test="total != null">
         #{total,jdbcType=DECIMAL},
@@ -74,6 +131,17 @@
       </if>
     </trim>
   </insert>
+  <insert id="insertBatch">
+    insert into public_release_count (province, dep_id, `uid`,
+                                      quantity, new_user, total,
+                                      `date`)
+    values
+    <foreach collection="list" index="index" item="item" separator=",">
+           (#{item.province,jdbcType=INTEGER}, #{item.depId,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR},
+            #{item.quantity,jdbcType=INTEGER}, #{item.newUser,jdbcType=INTEGER}, #{item.total,jdbcType=DECIMAL},
+            #{item.date,jdbcType=VARCHAR})
+    </foreach>
+  </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseCount">
     update public_release_count
     <set>
@@ -87,7 +155,10 @@
         `uid` = #{uid,jdbcType=VARCHAR},
       </if>
       <if test="quantity != null">
-        quantity = #{quantity,jdbcType=VARCHAR},
+        quantity = #{quantity,jdbcType=INTEGER},
+      </if>
+      <if test="newUser != null">
+        new_user = #{newUser,jdbcType=INTEGER},
       </if>
       <if test="total != null">
         total = #{total,jdbcType=DECIMAL},
@@ -103,7 +174,8 @@
     set province = #{province,jdbcType=INTEGER},
       dep_id = #{depId,jdbcType=VARCHAR},
       `uid` = #{uid,jdbcType=VARCHAR},
-      quantity = #{quantity,jdbcType=VARCHAR},
+      quantity = #{quantity,jdbcType=INTEGER},
+      new_user = #{newUser,jdbcType=INTEGER},
       total = #{total,jdbcType=DECIMAL},
       `date` = #{date,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}

+ 2 - 2
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -616,8 +616,8 @@ a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.latitude ,
   or  (release_start &lt; #{start} and release_end &gt; #{start})
   or  (release_start &lt; #{end} and release_end &gt; #{end}))
   </select>
-    <select id="getTimeUserFollow" resultType="com.goafanti.common.model.outUserFollowCount">
-      select e.id province,uid,new_user newUser from public_release a left join admin c on a.aid=c.id
+    <select id="getTimeUserFollow" resultType="com.goafanti.common.model.PublicReleaseCount">
+      select e.id province,d.id depId,a.uid,a.new_user newUser from public_release a left join admin c on a.aid=c.id
           left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
       where a.main_status =1 and a.create_time between #{date} and #{now} group by aid,uid,new_user
     </select>

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

@@ -845,6 +845,9 @@
       left join (select order_no from new_order_change group by order_no)g on a.order_no=g.order_no
     </if>
     where a.delete_sign !=1
+    <if test="specially ==7">
+     and a.process_status > 4
+    </if>
     <if test="outsource != null">
       and a.outsource= #{outsource,jdbcType=INTEGER}
     </if>
@@ -952,6 +955,9 @@
     from t_order_new a  left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
     left join department dep on a.order_dep=dep.id
     where a.delete_sign !=1
+    <if test="specially ==7">
+      and a.process_status > 4
+    </if>
     <if test="outsource != null">
       and a.outsource= #{outsource,jdbcType=INTEGER}
     </if>
@@ -1403,4 +1409,64 @@
     and new_user = #{newUser}
     and create_time  between #{date} and #{now}
   </select>
+    <select id="statisticsList" resultType="com.goafanti.order.bo.outStatisticsList">
+      select * from (select y.id,y.province,count(aid)counts,sum(quantity)quantity,sum(total)total from
+        (select x.id,x.province,x.aid,sum(quantity)quantity, sum(x.total)total from
+          (select d.id,d.name province,a.order_no,a.salesman_id aid,if(a.total_amount>0.5,1,0) quantity,a.total_amount total
+           from t_order_new a left join admin b on a.salesman_id =b.id
+                              left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
+           where a.process_status >4
+           <if test="depId !=null">
+			and  b.department_id = #{depId}
+           </if>
+           <if test="province !=null">
+			and c.province = #{province}
+           </if>
+          <if test="startCreate !=null and endCreate !=null">
+            and a.create_time between #{startCreate} and #{endCreate}
+          </if>
+          <if test="startSign !=null and endSign !=null">
+            and a.sign_time  between #{startSign} and #{endSign}
+          </if>
+
+          )x
+         group by x.id,x.province,x.aid)y
+                     group by y.province)z
+      order by
+      <if test="sort ==0">
+        total
+      </if>
+      <if test="sort ==1">
+        quantity
+      </if>
+      <if test="sort ==2">
+        counts
+      </if>
+       desc
+    </select>
+  <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.outProvinceStatisticsList">
+    select * from ( select x.depName,x.aid,x.name,sum(quantity)quantity,sum(total)total from (
+         select c.name depName,a.order_no,b.id aid,b.name name,if(a.total_amount>0.5,1,0) quantity,a.total_amount total
+         from t_order_new a left join admin b on a.salesman_id =b.id
+                            left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
+         where a.process_status >4
+    <if test="depId !=null">
+      and  b.department_id = #{depId}
+    </if>
+    <if test="orderNo !=null">
+      and a.order_no = #{orderNo}
+    </if>
+    <if test="province !=null">
+      and c.province = #{province}
+    </if>
+    <if test="startCreate !=null and endCreate !=null">
+      and a.create_time between #{startCreate} and #{endCreate}
+    </if>
+    <if test="startSign !=null and endSign !=null">
+      and a.sign_time  between #{startSign} and #{endSign}
+    </if>
+    )x
+    group by x.depName,x.name
+    )z order by total desc
+  </select>
 </mapper>

+ 16 - 3
src/main/java/com/goafanti/common/model/PublicReleaseCount.java

@@ -31,7 +31,12 @@ public class PublicReleaseCount implements Serializable {
     /**
      * 数量
      */
-    private String quantity;
+    private Integer quantity;
+
+    /**
+     * 客户类型 0新客户 1老客户
+     */
+    private Integer newUser;
 
     /**
      * 金额
@@ -77,14 +82,22 @@ public class PublicReleaseCount implements Serializable {
         this.uid = uid;
     }
 
-    public String getQuantity() {
+    public Integer getQuantity() {
         return quantity;
     }
 
-    public void setQuantity(String quantity) {
+    public void setQuantity(Integer quantity) {
         this.quantity = quantity;
     }
 
+    public Integer getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(Integer newUser) {
+        this.newUser = newUser;
+    }
+
     public BigDecimal getTotal() {
         return total;
     }

+ 50 - 5
src/main/java/com/goafanti/common/task/UserFollowTask.java

@@ -1,24 +1,34 @@
 package com.goafanti.common.task;
 
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.PublicReleaseCountMapper;
 import com.goafanti.common.dao.PublicReleaseMapper;
 import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.model.PublicRelease;
+import com.goafanti.common.model.PublicReleaseCount;
 import com.goafanti.common.model.outUserFollowCount;
+import com.goafanti.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 
 @Component
+@RestController
 public class UserFollowTask {
 
     @Autowired
     private PublicReleaseMapper publicReleaseMapper;
     @Autowired
+    private PublicReleaseCountMapper publicReleaseCountMapper;
+    @Autowired
     private TOrderNewMapper tOrderNewMapper;
 
     /**
@@ -27,14 +37,16 @@ public class UserFollowTask {
      */
 
     @Scheduled(cron = "0 0 5 1 * ?")
-    @RequestMapping(value = "/open/pushOrderArrearsDun", method = RequestMethod.GET)
-    public void 	userFollowStatistics(){
+    @RequestMapping(value = "/open/userFollowStatistics", method = RequestMethod.GET)
+    public void 	userFollowStatistics() throws InterruptedException {
         //获取上月1号到本月1号的外出
         Calendar now=getNowDate();
         Calendar date=getNowDate();
+        String ym=getYearMonth();
         date.set(Calendar.MONTH,now.get(Calendar.MONTH)-1);
-        List<outUserFollowCount> list =publicReleaseMapper.getTimeUserFollow(date.getTime(),now.getTime());
-        for (outUserFollowCount out : list) {
+        List<PublicReleaseCount> list =publicReleaseMapper.getTimeUserFollow(date.getTime(),now.getTime());
+        for (PublicReleaseCount out : list) {
+            out.setDate(ym);
             List<BigDecimal> aList=tOrderNewMapper.selectByUidAndNewUser(out.getUid(),out.getNewUser(),date.getTime(),now.getTime());
             if (aList.isEmpty()){
                 out.setQuantity(0);
@@ -48,6 +60,19 @@ public class UserFollowTask {
                 out.setTotal(total);
             }
         }
+        List<PublicReleaseCount> newList=new ArrayList<>();
+        if (list != null && list.size() > 0) {
+            for (int i = 0; i < list.size(); i++) {
+                newList.add(list.get(i));
+                if (50 == newList.size() || i == list.size() - 1) {
+                    if (newList.size() > 0) {
+                        publicReleaseCountMapper.insertBatch(list);
+                    }
+                    newList.clear();
+                    Thread.sleep(2000);
+                }
+            }
+        }
 
 
     }
@@ -59,6 +84,26 @@ public class UserFollowTask {
         now.clear(Calendar.SECOND);
         return now;
     }
+    public String getYearMonth(){
+        Calendar now=Calendar.getInstance();
+        int y=now.get(Calendar.YEAR);
+        int m=now.get(Calendar.MONTH);
+        if(m<1){
+            m=12;
+            y--;
+        }
+        return y+"-"+m;
+    }
 
-    public static void main(String[] args) {}
+    public static void main(String[] args) {
+        Calendar now=Calendar.getInstance();
+        now.set(2021,0,1);
+        int y=now.get(Calendar.YEAR);
+        int m=now.get(Calendar.MONTH);
+        if(m<1){
+            m=12;
+            y--;
+        }
+        System.out.println(y+"-"+m);
+    }
 }

+ 79 - 0
src/main/java/com/goafanti/order/bo/InputStatistics.java

@@ -0,0 +1,79 @@
+package com.goafanti.order.bo;
+
+public class InputStatistics {
+    private String depId;
+    private Integer province;
+    private String orderNo;
+    private String startCreate;
+    private String endCreate;
+    private String startSign;
+    private String endSign;
+    /**
+     * 0签单量 1签单人数 2年度完成率
+     */
+    private Integer sort;
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getDepId() {
+        return depId;
+    }
+
+    public void setDepId(String depId) {
+        this.depId = depId;
+    }
+
+    public Integer getProvince() {
+        return province;
+    }
+
+    public void setProvince(Integer province) {
+        this.province = province;
+    }
+
+    public String getStartCreate() {
+        return startCreate;
+    }
+
+    public void setStartCreate(String startCreate) {
+        this.startCreate = startCreate;
+    }
+
+    public String getEndCreate() {
+        return endCreate;
+    }
+
+    public void setEndCreate(String endCreate) {
+        this.endCreate = endCreate;
+    }
+
+    public String getStartSign() {
+        return startSign;
+    }
+
+    public void setStartSign(String startSign) {
+        this.startSign = startSign;
+    }
+
+    public String getEndSign() {
+        return endSign;
+    }
+
+    public void setEndSign(String endSign) {
+        this.endSign = endSign;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+}

+ 49 - 0
src/main/java/com/goafanti/order/bo/outProvinceStatisticsList.java

@@ -0,0 +1,49 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+import java.math.BigDecimal;
+
+public class outProvinceStatisticsList {
+
+    @Excel(name = "订单部门")
+    private String depName;
+    @Excel(name = "签单人")
+    private String name;
+    @Excel(name = "总单量(个)")
+    private Integer quantity;
+    @Excel(name = "总签单额(万元)")
+    private BigDecimal total;
+
+    public String getDepName() {
+        return depName;
+    }
+
+    public void setDepName(String depName) {
+        this.depName = depName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Integer quantity) {
+        this.quantity = quantity;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+}

+ 49 - 0
src/main/java/com/goafanti/order/bo/outStatisticsList.java

@@ -0,0 +1,49 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+import java.math.BigDecimal;
+
+public class outStatisticsList {
+
+    @Excel(name = "省")
+    private String province;
+    @Excel(name = "签单人数(人)")
+    private Integer counts;
+    @Excel(name = "总单量(个)")
+    private Integer quantity;
+    @Excel(name = "总签单额(万元)")
+    private BigDecimal total;
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public Integer getCounts() {
+        return counts;
+    }
+
+    public void setCounts(Integer counts) {
+        this.counts = counts;
+    }
+
+    public Integer getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Integer quantity) {
+        this.quantity = quantity;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+}

+ 27 - 12
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -10,6 +10,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.goafanti.order.bo.InputStatistics;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -102,7 +103,6 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	
 	/**
 	 * 删除订单项目
-	 * @param detailId
 	 * @return
 	 */
 	@RequestMapping(value = "/deleteOrderTask",method = RequestMethod.POST)
@@ -116,7 +116,6 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	}
 	/**
 	 * 删除订单
-	 * @param detailId
 	 * @return
 	 */
 	@RequestMapping(value = "/deleteOrderNew",method = RequestMethod.POST)
@@ -241,15 +240,15 @@ public class AdminNewOrderApiController extends CertifyApiController {
 	/**
 	 * 订单列表
 	 * 
-	 *specially  0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询 6客服查询
+	 *specially  0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询 6客服查询 7统计签单订单
 	 *distribution	(咨询师管理列表 0 未分配 1部分 2全部
 	 *amountStatus 0 10万元以下 1 10万~20万 2 20万~30万 3 30万~40万  4 40万以上
 	 */
 	@RequestMapping(value="/orderNewList", method = RequestMethod.GET)
-	public Result orderNewList(String name,String orderNo,String starTime,String endTime ,Integer specially ,Integer approval,
+	public Result orderNewList(String aid,String name,String orderNo,String starTime,String endTime ,Integer specially ,Integer approval,
 			Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus,Integer amountStatus,Integer pageNo,Integer pageSize){
 		Result res=new Result();
-		res.data(orderNewService.orderNewList(name, orderNo, starTime, endTime, specially ,approval, distribution,depId, 
+		res.data(orderNewService.orderNewList(aid,name, orderNo, starTime, endTime, specially ,approval, distribution,depId,
 				contractNo,outsource, liquidationStatus,amountStatus,pageNo, pageSize));
 		return res;
 	}
@@ -519,20 +518,36 @@ public class AdminNewOrderApiController extends CertifyApiController {
 		NewExcelUtil<TOrderTaskBo>excel=new NewExcelUtil<>(TOrderTaskBo.class);
 		 return  excel.exportExcel(list,"订单项目列表",response);
 	}
-	
-	
+
+
 	/**
 	 * 	催款信息下载 
-	 * @throws IOException 
+	 * @throws IOException
 	 */
 	@RequestMapping(value = "/exportArrearsDunListData", method = RequestMethod.GET)
 	public Result exportArrearsDunListData(InputArrearsDunListBo in,HttpServletResponse response){
 		@SuppressWarnings("unchecked")
 		List<OutArrearsDunListBo> list=(List<OutArrearsDunListBo>) orderNewService.arrearsDunList(in).getList();
 		NewExcelUtil<OutArrearsDunListBo>excel=new NewExcelUtil<>(OutArrearsDunListBo.class);
-		 return  excel.exportExcel(list,"欠款催款列表",response);
+		return  excel.exportExcel(list,"欠款催款列表",response);
 	}
-	
-	
-	
+
+	/**
+	 * 	签单统计表
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/statisticsList", method = RequestMethod.GET)
+	public Result statisticsList(InputStatistics in){
+		return res().data(orderNewService.statisticsList(in));
+	}
+
+	/**
+	 * 	省份签单统计表
+	 * @throws IOException
+	 */
+	@RequestMapping(value = "/provinceStatisticsList", method = RequestMethod.GET)
+	public Result provinceStatisticsList(InputStatistics in){
+		return res().data(orderNewService.provinceStatisticsList(in));
+	}
+
 }

+ 7 - 16
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -7,6 +7,7 @@ import javax.mail.MessagingException;
 import javax.servlet.http.HttpServletResponse;
 
 
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.model.TOrderDun;
 import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderNewWithBLOBs;
@@ -14,17 +15,7 @@ import com.goafanti.common.model.TOrderOutsource;
 import com.goafanti.common.model.TOrderRefundWithBLOBs;
 import com.goafanti.common.model.TOrderTask;
 import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.order.bo.InputArrearsDunListBo;
-import com.goafanti.order.bo.OrderDunTaskBo;
-import com.goafanti.order.bo.OrderRefundDetailBo;
-import com.goafanti.order.bo.OutArrearsDunListBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.bo.TDunLogListBo;
-import com.goafanti.order.bo.TOrderLogBo;
-import com.goafanti.order.bo.TOrderNewBo;
-import com.goafanti.order.bo.TOrderRefundBo;
-import com.goafanti.order.bo.TOrderTaskBo;
-import com.goafanti.order.bo.outOrderDunListBo;
+import com.goafanti.order.bo.*;
 
 public interface OrderNewService {
 	
@@ -43,7 +34,6 @@ public interface OrderNewService {
 	/**
 	 * 修改项目信息
 	 * @param t
-	 * @param change 
 	 * @return
 	 */
 	int updateOrderTask(TOrderTask t);
@@ -84,13 +74,12 @@ public interface OrderNewService {
 	 * @param orderNo
 	 * @param starTime
 	 * @param endTime
-	 * @param orderStatus
 	 * @param pageNo
 	 * @param pageSize
 	 * @param amountStatus 
 	 * @return
 	 */
-	Pagination<TOrderNewBo> orderNewList(String name, String orderNo, String starTime, String endTime,Integer specially ,Integer approval,Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,Integer pageNo, Integer pageSize);
+	Pagination<TOrderNewBo> orderNewList(String aid,String name, String orderNo, String starTime, String endTime,Integer specially ,Integer approval,Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus,Integer pageNo, Integer pageSize);
 	/**
 	 * 订单审核
 	 * @param orderNo
@@ -106,7 +95,6 @@ public interface OrderNewService {
 	 * @param orderNo
 	 * @param starTime
 	 * @param endTime
-	 * @param orderStatus
 	 * @param pageNo
 	 * @param pageSize
 	 * @return
@@ -205,5 +193,8 @@ public interface OrderNewService {
 	void pushOrderDun(String orderNo);
 	boolean checkOfficialType(TOrderOutsource o);
 	void updateOrderCostAmount(Integer tid,Integer type);
-	
+
+    List<outStatisticsList> statisticsList(InputStatistics in);
+
+	List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in);
 }

+ 25 - 15
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -19,6 +19,8 @@ import java.util.UUID;
 
 import javax.mail.MessagingException;
 import javax.servlet.http.HttpServletResponse;
+
+import com.goafanti.order.bo.*;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.xssf.usermodel.XSSFCell;
 import org.apache.poi.xssf.usermodel.XSSFRow;
@@ -101,18 +103,6 @@ import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.LockingReleaseBo;
-import com.goafanti.order.bo.InputArrearsDunListBo;
-import com.goafanti.order.bo.OrderDunTaskBo;
-import com.goafanti.order.bo.OrderRefundDetailBo;
-import com.goafanti.order.bo.OutArrearsDunListBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.bo.TDunLogListBo;
-import com.goafanti.order.bo.TOrderLogBo;
-import com.goafanti.order.bo.TOrderNewBo;
-import com.goafanti.order.bo.TOrderRefundBo;
-import com.goafanti.order.bo.TOrderTaskBo;
-import com.goafanti.order.bo.TOrderTaskDetailBo;
-import com.goafanti.order.bo.outOrderDunListBo;
 import com.goafanti.order.enums.ActiveState;
 import com.goafanti.order.enums.ApprovalNewState;
 import com.goafanti.order.enums.LiquidationNewState;
@@ -615,15 +605,19 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<TOrderNewBo> orderNewList(String name, String orderNo, String starTime, String endTime,Integer specially,Integer approval,
+	public Pagination<TOrderNewBo> orderNewList(String aid,String name, String orderNo, String starTime, String endTime,Integer specially,Integer approval,
 			Integer distribution,String depId,String contractNo,Integer outsource,Integer liquidationStatus, Integer amountStatus, Integer pageNo, Integer pageSize) {
 		Map<String, Object> params = new HashMap<String, Object>();
 		if(pageSize==null||pageSize<0)pageSize=10;
 		if(pageNo==null||pageNo<0)pageNo=1;
-		if (specially!=null&&(specially==0||specially==1||specially==2||specially==4||specially==5)) {
+		if (specially!=null&&(specially==0||specially==1||specially==2||specially==4||specially==5||specially==7)) {
 			//0 个人 1 营销员管理 2 驳回 3 特批 4 咨询师管理 5部门订单查询
 			if (specially!=3&&specially!=4) {
-				params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
+				if (aid ==null){
+					params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
+				}else{
+					params.put("aid", aid);
+				}
 			}
 			//(咨询师管理列表 0 未分配 1部分   2全部)
 			if(specially==4) params.put("distribution",distribution);
@@ -1394,6 +1388,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		tOrderMidMapper.updateCostAmount(tid,oCount,null);
 	}
 
+	@Override
+	public List<outStatisticsList> statisticsList(InputStatistics in) {
+		if(in.getSort()==null)in.setSort(0);
+		if(in.getEndCreate()!=null)in.setEndCreate(in.getEndCreate()+" 23:59:59");
+		if(in.getEndSign()!=null)in.setEndSign(in.getEndSign()+" 23:59:59");
+		return tOrderNewMapper.statisticsList(in);
+	}
+
+	@Override
+	public List<outProvinceStatisticsList> provinceStatisticsList(InputStatistics in) {
+		if(in.getSort()==null)in.setSort(0);
+		if(in.getEndCreate()!=null)in.setEndCreate(in.getEndCreate()+" 23:59:59");
+		if(in.getEndSign()!=null)in.setEndSign(in.getEndSign()+" 23:59:59");
+		return tOrderNewMapper.provinceStatisticsList(in);
+	}
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<OutArrearsDunListBo> arrearsDunList(InputArrearsDunListBo in) {

+ 138 - 0
src/main/java/com/goafanti/user/bo/outFollowStatisticsList.java

@@ -0,0 +1,138 @@
+package com.goafanti.user.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+import java.math.BigDecimal;
+
+public class outFollowStatisticsList {
+    @Excel(name = "面谈部门")
+    private String name;
+    @Excel(name = "老客户面谈数")
+    private Integer useInterview;
+    @Excel(name = "老客户签单数")
+    private Integer useQuantity;
+    @Excel(name = "老客户金额")
+    private BigDecimal useTotal;
+    @Excel(name = "老客户面谈率")
+    private String useRatio;
+    @Excel(name = "新客户面谈数")
+    private Integer newInterview;
+    @Excel(name = "新客户签单数")
+    private Integer newQuantity;
+    @Excel(name = "新客户金额")
+    private BigDecimal newTotal;
+    @Excel(name = "新客户面谈率")
+    private String newRatio;
+    @Excel(name = "总面谈数")
+    private Integer totalInterview;
+    @Excel(name = "总签单数")
+    private Integer totalQuantity;
+    @Excel(name = "总金额")
+    private BigDecimal total;
+    @Excel(name = "总面谈率")
+    private String totalRatio;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getUseInterview() {
+        return useInterview;
+    }
+
+    public void setUseInterview(Integer useInterview) {
+        this.useInterview = useInterview;
+    }
+
+    public Integer getUseQuantity() {
+        return useQuantity;
+    }
+
+    public void setUseQuantity(Integer useQuantity) {
+        this.useQuantity = useQuantity;
+    }
+
+    public BigDecimal getUseTotal() {
+        return useTotal;
+    }
+
+    public void setUseTotal(BigDecimal useTotal) {
+        this.useTotal = useTotal;
+    }
+
+    public String getUseRatio() {
+        return useRatio;
+    }
+
+    public void setUseRatio(String useRatio) {
+        this.useRatio = useRatio;
+    }
+
+    public Integer getNewInterview() {
+        return newInterview;
+    }
+
+    public void setNewInterview(Integer newInterview) {
+        this.newInterview = newInterview;
+    }
+
+    public Integer getNewQuantity() {
+        return newQuantity;
+    }
+
+    public void setNewQuantity(Integer newQuantity) {
+        this.newQuantity = newQuantity;
+    }
+
+    public BigDecimal getNewTotal() {
+        return newTotal;
+    }
+
+    public void setNewTotal(BigDecimal newTotal) {
+        this.newTotal = newTotal;
+    }
+
+    public String getNewRatio() {
+        return newRatio;
+    }
+
+    public void setNewRatio(String newRatio) {
+        this.newRatio = newRatio;
+    }
+
+    public Integer getTotalInterview() {
+        return totalInterview;
+    }
+
+    public void setTotalInterview(Integer totalInterview) {
+        this.totalInterview = totalInterview;
+    }
+
+    public Integer getTotalQuantity() {
+        return totalQuantity;
+    }
+
+    public void setTotalQuantity(Integer totalQuantity) {
+        this.totalQuantity = totalQuantity;
+    }
+
+    public BigDecimal getTotal() {
+        return total;
+    }
+
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+
+    public String getTotalRatio() {
+        return totalRatio;
+    }
+
+    public void setTotalRatio(String totalRatio) {
+        this.totalRatio = totalRatio;
+    }
+}

+ 49 - 0
src/main/java/com/goafanti/user/bo/outProvinceFollowStatistic.java

@@ -0,0 +1,49 @@
+package com.goafanti.user.bo;
+
+public class outProvinceFollowStatistic {
+    private String name;
+    private String nickname;
+    private String newUser;
+    private String interviewCount;
+    private String quantity;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public String getNewUser() {
+        return newUser;
+    }
+
+    public void setNewUser(String newUser) {
+        this.newUser = newUser;
+    }
+
+    public String getInterviewCount() {
+        return interviewCount;
+    }
+
+    public void setInterviewCount(String interviewCount) {
+        this.interviewCount = interviewCount;
+    }
+
+    public String getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(String quantity) {
+        this.quantity = quantity;
+    }
+}

+ 22 - 0
src/main/java/com/goafanti/user/controller/UserFollowController.java

@@ -46,5 +46,27 @@ public class UserFollowController extends BaseApiController {
         NewExcelUtil<outUserFollowList> excel=new NewExcelUtil<>(outUserFollowList.class);
         return excel.exportExcel(list,"客户跟进列表",uploadPath);
     }
+
+    /**
+     * 面谈跟进统计
+     * @return
+     */
+    @RequestMapping(value = "/followStatisticsList", method = RequestMethod.GET)
+    public Result  followStatisticsList(String depId,String date,Integer province,Integer sort){
+        Result res =new Result();
+        return res.data(userFollowService.followStatisticsList(depId,date,province,sort));
+    }
+
+
+    /**
+     * 省份面谈跟进统计
+     * @return
+     */
+    @RequestMapping(value = "/provinceFollowStatisticsList", method = RequestMethod.GET)
+    public Result  provinceFollowStatisticsList(String depId,String date,Integer province,Integer sort){
+        Result res =new Result();
+        return res.data(userFollowService.provinceFollowStatisticsList(depId,date,province,sort));
+    }
+
 }
 

+ 6 - 0
src/main/java/com/goafanti/user/service/UserFollowService.java

@@ -2,6 +2,8 @@ package com.goafanti.user.service;
 
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.user.bo.InputUserFollowList;
+import com.goafanti.user.bo.outFollowStatisticsList;
+import com.goafanti.user.bo.outProvinceFollowStatistic;
 import com.goafanti.user.bo.outUserFollowList;
 
 import java.util.List;
@@ -10,4 +12,8 @@ public interface UserFollowService {
      Pagination<outUserFollowList> userFollowList(InputUserFollowList in);
 
     List<outUserFollowList> userFollowListExport(InputUserFollowList in);
+
+    List<outFollowStatisticsList> followStatisticsList(String depId, String date,Integer province, Integer sort);
+
+    List<outProvinceFollowStatistic> provinceFollowStatisticsList(String depId, String date, Integer province, Integer sort);
 }

+ 17 - 0
src/main/java/com/goafanti/user/service/impl/UserFollowServiceImpl.java

@@ -1,12 +1,15 @@
 package com.goafanti.user.service.impl;
 
 import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.PublicReleaseCountMapper;
 import com.goafanti.common.dao.UserFollowMapper;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.user.bo.InputUserFollowList;
+import com.goafanti.user.bo.outFollowStatisticsList;
+import com.goafanti.user.bo.outProvinceFollowStatistic;
 import com.goafanti.user.bo.outUserFollowList;
 import com.goafanti.user.service.UserFollowService;
 import jdk.nashorn.internal.parser.Token;
@@ -25,6 +28,8 @@ public class UserFollowServiceImpl extends BaseMybatisDao<UserFollowMapper>  imp
 
     @Autowired
     private AdminMapper adminMapper;
+    @Autowired
+    private PublicReleaseCountMapper publicReleaseCountMapper;
 
 
     @Override
@@ -68,4 +73,16 @@ public class UserFollowServiceImpl extends BaseMybatisDao<UserFollowMapper>  imp
 
         return list;
     }
+
+    @Override
+    public List<outFollowStatisticsList> followStatisticsList(String depId, String date,Integer province, Integer sort) {
+        if(sort==null)sort=0;
+        return publicReleaseCountMapper.followStatisticsList(depId,date,province,sort);
+    }
+
+    @Override
+    public List<outProvinceFollowStatistic> provinceFollowStatisticsList(String depId, String date, Integer province, Integer sort) {
+        if(sort==null)sort=0;
+        return publicReleaseCountMapper.provinceFollowStatisticsList(depId,date,province,sort);
+    }
 }