Преглед изворни кода

各接口操作数据同步到客户统计表

anderx пре 3 година
родитељ
комит
fa41218b41

+ 92 - 0
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -395,4 +395,96 @@
     and a.buyer_id= #{uid}
     group by a.buyer_id
   </select>
+
+  <select id="selectSignSummaryList" resultType="com.goafanti.order.bo.OutSignSummary">
+    select a.id ,a.nickname ,b.sign_number signNumber,b.sign_amount signAmount,
+           date_format(b.first_signing_time ,'%Y-%m-%d') firstSigningTime,
+           date_format(b.last_signing_time  ,'%Y-%m-%d') lastSigningTime ,
+           b.last_sales_type  lastSalesType,c.name,b.follow_dep followDep,
+           b.last_follow_type lastFollowType,b.follow_explain followExplain ,b.follow_number followNumber ,
+           date_format(b.last_follow_time ,'%Y-%m-%d %H:%i:%S') lastFollowTime ,b.task_names taskNames ,
+           b.`member` ,b.chargeback ,b.big_customer bigCustomer
+    from user a left join user_mid b on a.id=b.uid  left join admin c on a.aid=c.id
+    where 1=1
+      <if test="userName != null">
+        and a.nickname like concat('%',#{userName},'%')
+      </if>
+    <if test="adminName != null">
+      and c.name  like concat('%',#{adminName},'%')
+    </if>
+    <if test="member != null">
+      and b.`member` = #{member}
+    </if>
+    <if test="chargeback != null">
+      and b.chargeback = #{chargeback}
+    </if>
+    <if test="bigCustomer != null">
+      and b.big_customer = #{bigCustomer}
+    </if>
+    <if test="lastFollowType != null">
+      and b.last_follow_type = #{lastFollowType}
+    </if>
+    <if test="followDep != null">
+      and b.follow_dep = #{followDep}
+    </if>
+    <if test="lastFollowTimeStart != null and lastFollowTimeEnd !=null">
+      and b.last_follow_time BETWEEN #{lastFollowTimeStart} and #{lastFollowTimeEnd}
+    </if>
+    <if test="firstSigningTimeStart != null and firstSigningTimeEnd !=null">
+      and b.first_signing_time BETWEEN #{firstSigningTimeStart} and #{firstSigningTimeEnd}
+    </if>
+    <if test="lastSigningTimeStart != null and lastSigningTimeStart !=null">
+      and b.last_signing_time BETWEEN #{lastSigningTimeStart} and #{lastSigningTimeEnd}
+    </if>
+    <if test="signNumber != null">
+      and b.sign_number = #{signNumber}
+    </if>
+    <if test="lastSalesType != null">
+      and b.last_sales_type = #{lastSalesType}
+    </if>
+    <if test="page_sql!=null">
+      ${page_sql}
+    </if>
+  </select>
+  <select id="selectSignSummaryCount" resultType="integer">
+    select count(*)
+    from user a left join user_mid b on a.id=b.uid  left join admin c on a.aid=c.id
+    where 1=1
+    <if test="userName != null">
+      and a.nickname like concat('%',#{userName},'%')
+    </if>
+    <if test="adminName != null">
+      and c.name  like concat('%',#{adminName},'%')
+    </if>
+    <if test="member != null">
+      and b.`member` = #{member}
+    </if>
+    <if test="chargeback != null">
+      and b.chargeback = #{chargeback}
+    </if>
+    <if test="bigCustomer != null">
+      and b.big_customer = #{bigCustomer}
+    </if>
+    <if test="lastFollowType != null">
+      and b.last_follow_type = #{lastFollowType}
+    </if>
+    <if test="followDep != null">
+      and b.follow_dep = #{followDep}
+    </if>
+    <if test="lastFollowTimeStart != null and lastFollowTimeEnd !=null">
+      and b.last_follow_time BETWEEN #{lastFollowTimeStart} and #{lastFollowTimeEnd}
+    </if>
+    <if test="firstSigningTimeStart != null and firstSigningTimeEnd !=null">
+      and b.first_signing_time BETWEEN #{firstSigningTimeStart} and #{firstSigningTimeEnd}
+    </if>
+    <if test="lastSigningTimeStart != null and lastSigningTimeStart !=null">
+      and b.last_signing_time BETWEEN #{lastSigningTimeStart} and #{lastSigningTimeEnd}
+    </if>
+    <if test="signNumber != null">
+      and b.sign_number = #{signNumber}
+    </if>
+    <if test="lastSalesType != null">
+      and b.last_sales_type = #{lastSalesType}
+    </if>
+  </select>
 </mapper>

+ 2 - 1
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -696,7 +696,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		UserMid um =new UserMid();
 		um.setUid(userFollow.getUid());
 		um.setLastFollowTime(userFollow.getCreateTime());
-		um.setLastSalesType(followCount);
+		um.setFollowNumber(followCount);
+		um.set
 		um.setLastFollowType(userFollow.getContactType());
 		userMidMapper.updateByUid(um);
 		userFollowMapper.insert(userFollow);

+ 158 - 0
src/main/java/com/goafanti/order/bo/InputSignSummary.java

@@ -0,0 +1,158 @@
+package com.goafanti.order.bo;
+
+public class InputSignSummary {
+
+    private String userName;
+    private String adminName;
+    private Integer member;
+    private Integer chargeback;
+    private Integer bigCustomer;
+    private Integer lastFollowType;
+    private String followDep;
+    private String lastFollowTimeStart;
+    private String lastFollowTimeEnd;
+    private String firstSigningTimeStart;
+    private String firstSigningTimeEnd;
+    private String lastSigningTimeStart;
+    private String lastSigningTimeEnd;
+    private Integer signNumber;
+    private Integer lastSalesType;
+    private Integer pageNo;
+    private Integer pageSize;
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public Integer getMember() {
+        return member;
+    }
+
+    public void setMember(Integer member) {
+        this.member = member;
+    }
+
+    public Integer getChargeback() {
+        return chargeback;
+    }
+
+    public void setChargeback(Integer chargeback) {
+        this.chargeback = chargeback;
+    }
+
+    public Integer getBigCustomer() {
+        return bigCustomer;
+    }
+
+    public void setBigCustomer(Integer bigCustomer) {
+        this.bigCustomer = bigCustomer;
+    }
+
+    public Integer getLastFollowType() {
+        return lastFollowType;
+    }
+
+    public void setLastFollowType(Integer lastFollowType) {
+        this.lastFollowType = lastFollowType;
+    }
+
+    public String getFollowDep() {
+        return followDep;
+    }
+
+    public void setFollowDep(String followDep) {
+        this.followDep = followDep;
+    }
+
+    public String getLastFollowTimeStart() {
+        return lastFollowTimeStart;
+    }
+
+    public void setLastFollowTimeStart(String lastFollowTimeStart) {
+        this.lastFollowTimeStart = lastFollowTimeStart;
+    }
+
+    public String getLastFollowTimeEnd() {
+        return lastFollowTimeEnd;
+    }
+
+    public void setLastFollowTimeEnd(String lastFollowTimeEnd) {
+        this.lastFollowTimeEnd = lastFollowTimeEnd;
+    }
+
+    public String getFirstSigningTimeStart() {
+        return firstSigningTimeStart;
+    }
+
+    public void setFirstSigningTimeStart(String firstSigningTimeStart) {
+        this.firstSigningTimeStart = firstSigningTimeStart;
+    }
+
+    public String getFirstSigningTimeEnd() {
+        return firstSigningTimeEnd;
+    }
+
+    public void setFirstSigningTimeEnd(String firstSigningTimeEnd) {
+        this.firstSigningTimeEnd = firstSigningTimeEnd;
+    }
+
+    public String getLastSigningTimeStart() {
+        return lastSigningTimeStart;
+    }
+
+    public void setLastSigningTimeStart(String lastSigningTimeStart) {
+        this.lastSigningTimeStart = lastSigningTimeStart;
+    }
+
+    public String getLastSigningTimeEnd() {
+        return lastSigningTimeEnd;
+    }
+
+    public void setLastSigningTimeEnd(String lastSigningTimeEnd) {
+        this.lastSigningTimeEnd = lastSigningTimeEnd;
+    }
+
+    public Integer getSignNumber() {
+        return signNumber;
+    }
+
+    public void setSignNumber(Integer signNumber) {
+        this.signNumber = signNumber;
+    }
+
+    public Integer getLastSalesType() {
+        return lastSalesType;
+    }
+
+    public void setLastSalesType(Integer lastSalesType) {
+        this.lastSalesType = lastSalesType;
+    }
+}

+ 176 - 0
src/main/java/com/goafanti/order/bo/OutSignSummary.java

@@ -0,0 +1,176 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+public class OutSignSummary {
+
+    private String id;
+    @Excel(name = "客户名称")
+    private String nickname;
+    @Excel(name = "签单次数")
+    private Integer signNumber;
+    @Excel(name = "签单金额")
+    private String signAmount;
+    @Excel(name = "首次签单时间")
+    private String firstSigningTime;
+    @Excel(name = "最新签单时间")
+    private String lastSigningTime;
+    @Excel(name = "签单类型")
+    private Integer lastSalesType;
+    @Excel(name = "跟进人")
+    private String name;
+    @Excel(name = "跟进部门")
+    private String followDep;
+    @Excel(name = "跟进类型")
+    private Integer lastFollowType;
+    @Excel(name = "跟进说明")
+    private String followExplain;
+    @Excel(name = "跟进次数")
+    private Integer followNumber;
+    @Excel(name = "最新跟进时间")
+    private String lastFollowTime;
+    @Excel(name = "已签项目")
+    private String taskNames;
+    @Excel(name = "会员")
+    private Integer member;
+    @Excel(name = "退单")
+    private Integer chargeback;
+    @Excel(name = "大客户")
+    private Integer bigCustomer;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public Integer getSignNumber() {
+        return signNumber;
+    }
+
+    public void setSignNumber(Integer signNumber) {
+        this.signNumber = signNumber;
+    }
+
+    public String getSignAmount() {
+        return signAmount;
+    }
+
+    public void setSignAmount(String signAmount) {
+        this.signAmount = signAmount;
+    }
+
+    public String getFirstSigningTime() {
+        return firstSigningTime;
+    }
+
+    public void setFirstSigningTime(String firstSigningTime) {
+        this.firstSigningTime = firstSigningTime;
+    }
+
+    public String getLastSigningTime() {
+        return lastSigningTime;
+    }
+
+    public void setLastSigningTime(String lastSigningTime) {
+        this.lastSigningTime = lastSigningTime;
+    }
+
+    public Integer getLastSalesType() {
+        return lastSalesType;
+    }
+
+    public void setLastSalesType(Integer lastSalesType) {
+        this.lastSalesType = lastSalesType;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getFollowDep() {
+        return followDep;
+    }
+
+    public void setFollowDep(String followDep) {
+        this.followDep = followDep;
+    }
+
+    public Integer getLastFollowType() {
+        return lastFollowType;
+    }
+
+    public void setLastFollowType(Integer lastFollowType) {
+        this.lastFollowType = lastFollowType;
+    }
+
+    public String getFollowExplain() {
+        return followExplain;
+    }
+
+    public void setFollowExplain(String followExplain) {
+        this.followExplain = followExplain;
+    }
+
+    public Integer getFollowNumber() {
+        return followNumber;
+    }
+
+    public void setFollowNumber(Integer followNumber) {
+        this.followNumber = followNumber;
+    }
+
+    public String getLastFollowTime() {
+        return lastFollowTime;
+    }
+
+    public void setLastFollowTime(String lastFollowTime) {
+        this.lastFollowTime = lastFollowTime;
+    }
+
+    public String getTaskNames() {
+        return taskNames;
+    }
+
+    public void setTaskNames(String taskNames) {
+        this.taskNames = taskNames;
+    }
+
+    public Integer getMember() {
+        return member;
+    }
+
+    public void setMember(Integer member) {
+        this.member = member;
+    }
+
+    public Integer getChargeback() {
+        return chargeback;
+    }
+
+    public void setChargeback(Integer chargeback) {
+        this.chargeback = chargeback;
+    }
+
+    public Integer getBigCustomer() {
+        return bigCustomer;
+    }
+
+    public void setBigCustomer(Integer bigCustomer) {
+        this.bigCustomer = bigCustomer;
+    }
+}

+ 13 - 4
src/main/java/com/goafanti/order/controller/StatisticsApiController.java

@@ -8,9 +8,9 @@ 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.bo.*;
 import com.goafanti.order.service.OrderStatisticsService;
+import com.goafanti.order.service.UserStaticticsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,8 +19,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.CertifyApiController;
-import com.goafanti.order.bo.InputProjectStatistics;
-import com.goafanti.order.bo.InputProvincialStatistics;
 import com.goafanti.order.service.ProjectStatisticsService;
 
 @RestController
@@ -33,6 +31,8 @@ public class StatisticsApiController extends CertifyApiController {
 	private ProjectStatisticsService	projectStatisticsService;
 	@Autowired
 	private OrderStatisticsService orderStatisticsService;
+	@Autowired
+	private UserStaticticsService userStaticticsService;
 
 
 
@@ -105,6 +105,15 @@ public class StatisticsApiController extends CertifyApiController {
 		return excelUtil.exportExcel(list,"订单销售来源统计表",uploadPath,str.toString());
 	}
 
+	/**
+	 * 签单客户汇总
+	 */
+	@RequestMapping(value = "/signSummary",method = RequestMethod.GET)
+	public Result signSummary(InputSignSummary in){
+		Result res = new Result();
+		res.data(userStaticticsService.signSummary(in));
+		return res;
+	}
 
 
 }

+ 5 - 0
src/main/java/com/goafanti/order/service/OrderStatisticsService.java

@@ -1,8 +1,11 @@
 package com.goafanti.order.service;
 
 
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.InputOrderSalesSource;
+import com.goafanti.order.bo.InputSignSummary;
 import com.goafanti.order.bo.OutOrderSalesSource;
+import com.goafanti.order.bo.OutSignSummary;
 
 import java.util.List;
 
@@ -10,4 +13,6 @@ public interface OrderStatisticsService {
 
 
 	List<OutOrderSalesSource> orderSalesSource(InputOrderSalesSource in);
+
+
 }

+ 10 - 0
src/main/java/com/goafanti/order/service/UserStaticticsService.java

@@ -0,0 +1,10 @@
+package com.goafanti.order.service;
+
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.order.bo.InputSignSummary;
+import com.goafanti.order.bo.OutSignSummary;
+
+public interface UserStaticticsService {
+
+    Pagination<OutSignSummary> signSummary(InputSignSummary in);
+}

+ 1 - 0
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -148,6 +148,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			um.setUid(tn.getBuyerId());
 			um.setTaskNames(taskNames);
 			um.setLastSigningTime(tn.getCreateTime());
+			um.setLastSalesType(tn.getSalesType());
 			um.setFirstSigningTime(use.getFirstSigningTime());
 			um.setSignAmount(use.getSignAmount());
 			um.setSignNumber(use.getSignNumber());

+ 1 - 0
src/main/java/com/goafanti/order/service/impl/OrderStatisticsServiceImpl.java

@@ -44,4 +44,5 @@ public class OrderStatisticsServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		if(in.getEndDate()!=null)in.setEndDate(in.getEndDate()+" 23:59:59");
 		return tOrderNewMapper.orderSalesSource(in);
 	}
+
 }

+ 46 - 0
src/main/java/com/goafanti/order/service/impl/UserStatisticsServiceImpl.java

@@ -0,0 +1,46 @@
+package com.goafanti.order.service.impl;
+
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.dao.UserMidMapper;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.order.bo.InputOrderSalesSource;
+import com.goafanti.order.bo.InputSignSummary;
+import com.goafanti.order.bo.OutOrderSalesSource;
+import com.goafanti.order.bo.OutSignSummary;
+import com.goafanti.order.service.OrderStatisticsService;
+import com.goafanti.order.service.UserStaticticsService;
+import groovy.util.logging.Log4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Log4j
+public class UserStatisticsServiceImpl extends BaseMybatisDao<UserMidMapper> implements UserStaticticsService {
+
+
+	@Override
+	public Pagination<OutSignSummary> signSummary(InputSignSummary in) {
+		Map<String, Object> map = new HashMap<>();
+		if (in.getUserName()!=null)map.put("userName",in.getUserName());
+		if (in.getAdminName()!=null)map.put("adminName",in.getAdminName());
+		if (in.getMember()!=null)map.put("member",in.getMember());
+		if (in.getChargeback()!=null)map.put("chargeback",in.getChargeback());
+		if (in.getBigCustomer()!=null)map.put("bigCustomer",in.getBigCustomer());
+		if (in.getLastFollowType()!=null)map.put("lastFollowType",in.getLastFollowType());
+		if (in.getFollowDep()!=null)map.put("followDep",in.getFollowDep());
+		if (in.getLastFollowTimeStart()!=null)map.put("lastFollowTimeStart",in.getLastFollowTimeStart());
+		if (in.getLastFollowTimeEnd()!=null)map.put("lastFollowTimeEnd",in.getLastFollowTimeEnd()+" 23:59:59");
+		if (in.getFirstSigningTimeStart()!=null)map.put("firstSigningTimeStart",in.getFirstSigningTimeStart());
+		if (in.getFirstSigningTimeEnd()!=null)map.put("firstSigningTimeEnd",in.getFirstSigningTimeEnd()+" 23:59:59");
+		if (in.getLastSigningTimeStart()!=null)map.put("lastSigningTimeStart",in.getLastSigningTimeStart());
+		if (in.getLastSigningTimeEnd()!=null)map.put("lastSigningTimeEnd",in.getLastSigningTimeEnd()+" 23:59:59");
+		if (in.getSignNumber()!=null)map.put("signNumber",in.getSignNumber());
+		if (in.getLastSalesType()!=null)map.put("lastSalesType",in.getLastSalesType());
+		return (Pagination<OutSignSummary>) findPage("selectSignSummaryList","selectSignSummaryCount",map,in.getPageNo(),in.getPageSize());
+	}
+}