Browse Source

Merge branch 'test' of jishutao/kede-server into prod

anderx 2 years ago
parent
commit
4f2359625d
48 changed files with 2118 additions and 171 deletions
  1. 7 1
      pom.xml
  2. 184 0
      src/main/java/com/goafanti/admin/bo/AdminStatisticsBo.java
  3. 54 0
      src/main/java/com/goafanti/admin/controller/AdminStatisticsController.java
  4. 4 5
      src/main/java/com/goafanti/admin/service/AdminService.java
  5. 9 0
      src/main/java/com/goafanti/admin/service/AdminStatisticsService.java
  6. 46 22
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java
  7. 174 0
      src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java
  8. 27 0
      src/main/java/com/goafanti/common/bo/InputPoverty.java
  9. 147 0
      src/main/java/com/goafanti/common/bo/OutPoverty.java
  10. 28 0
      src/main/java/com/goafanti/common/bo/OutPovertyFlag.java
  11. 182 4
      src/main/java/com/goafanti/common/controller/PublicController.java
  12. 16 12
      src/main/java/com/goafanti/common/controller/WebpageController.java
  13. 21 0
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  14. 27 0
      src/main/java/com/goafanti/common/dao/AdminUserCountMapper.java
  15. 2 1
      src/main/java/com/goafanti/common/dao/PublicReleaseMapper.java
  16. 3 0
      src/main/java/com/goafanti/common/dao/TOrderNewMapper.java
  17. 2 1
      src/main/java/com/goafanti/common/dao/UserFollowMapper.java
  18. 6 0
      src/main/java/com/goafanti/common/dao/UserMapper.java
  19. 74 0
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  20. 216 0
      src/main/java/com/goafanti/common/mapper/AdminUserCountMapper.xml
  21. 11 1
      src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml
  22. 9 1
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  23. 7 0
      src/main/java/com/goafanti/common/mapper/UserFollowMapper.xml
  24. 19 1
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  25. 139 0
      src/main/java/com/goafanti/common/model/AdminUserCount.java
  26. 162 0
      src/main/java/com/goafanti/common/service/PovertyService.java
  27. 55 2
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  28. 37 15
      src/main/java/com/goafanti/common/utils/HttpUtils.java
  29. 86 3
      src/main/java/com/goafanti/common/utils/StringUtils.java
  30. 2 0
      src/main/java/com/goafanti/core/cache/serializer/FastJsonRedisSerializer.java
  31. 8 0
      src/main/java/com/goafanti/customer/service/CustomerService.java
  32. 145 19
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  33. 1 1
      src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java
  34. 10 1
      src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java
  35. 13 10
      src/main/java/com/goafanti/order/controller/OrderChangeApiController.java
  36. 14 5
      src/main/java/com/goafanti/order/controller/OrderProjectApiController.java
  37. 2 0
      src/main/java/com/goafanti/order/service/OrderNewService.java
  38. 1 1
      src/main/java/com/goafanti/order/service/OrderProjectService.java
  39. 1 0
      src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java
  40. 63 11
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  41. 23 9
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  42. 8 8
      src/main/java/com/goafanti/permission/controller/NewRoleApiController.java
  43. 6 12
      src/main/java/com/goafanti/permission/service/NewRoleService.java
  44. 9 23
      src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java
  45. 38 0
      src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java
  46. 1 1
      src/main/resources/props/config_local.properties
  47. 1 1
      src/main/resources/props/config_test.properties
  48. 18 0
      src/main/webapp/WEB-INF/views/admin/povertyInquiry.html

+ 7 - 1
pom.xml

@@ -437,7 +437,13 @@
 			<artifactId>thumbnailator</artifactId>
 			<version>0.4.8</version>
 		</dependency>
-
+		<!-- 爬虫JsoupXpath-->
+		<dependency>
+			<groupId>cn.wanghaomiao</groupId>
+			<artifactId>JsoupXpath</artifactId>
+			<version>2.5.3</version>
+			<type>pom</type>
+		</dependency>
 
 
 	</dependencies>

+ 184 - 0
src/main/java/com/goafanti/admin/bo/AdminStatisticsBo.java

@@ -0,0 +1,184 @@
+package com.goafanti.admin.bo;
+
+import java.math.BigDecimal;
+
+public class AdminStatisticsBo {
+    private Integer privateSum;
+    private Integer channelSum;
+    private Integer signSum;
+    private Integer rangePrivateSum;
+    private Integer rangeChannelSum;
+    private Integer rangeSignSum;
+    private Integer publicReleaseSum;
+    private Integer rangePublicReleaseSum;
+    private Integer followSum;
+    private Integer rangeFollowSum;
+    private Integer orderSum;
+    private BigDecimal receivables;
+    private BigDecimal rangeReceivables;
+    private Integer rejectSum;
+    private Integer changeSum;
+    private Integer rangeOrderSum;
+    private Integer projectStopSum;
+    private Integer projectCheckSum;
+
+    public BigDecimal getReceivables() {
+        return receivables;
+    }
+
+    public void setReceivables(BigDecimal receivables) {
+        this.receivables = receivables;
+    }
+
+    public BigDecimal getRangeReceivables() {
+        return rangeReceivables;
+    }
+
+    public void setRangeReceivables(BigDecimal rangeReceivables) {
+        this.rangeReceivables = rangeReceivables;
+    }
+
+    public Integer getPrivateSum() {
+        if (privateSum == null) return 0;
+        return privateSum;
+    }
+
+    public Integer getChannelSum() {
+        if (channelSum == null) return 0;
+        return channelSum;
+    }
+
+    public Integer getSignSum() {
+        if (signSum == null) return 0;
+        return signSum;
+    }
+
+    public Integer getRangePrivateSum() {
+        if (rangePrivateSum == null) return 0;
+        return rangePrivateSum;
+    }
+
+    public Integer getRangeChannelSum() {
+        if (rangeChannelSum == null) return 0;
+        return rangeChannelSum;
+    }
+
+    public Integer getRangeSignSum() {
+        if (rangeSignSum == null) return 0;
+        return rangeSignSum;
+    }
+
+    public Integer getPublicReleaseSum() {
+        if (publicReleaseSum == null) return 0;
+        return publicReleaseSum;
+    }
+
+    public Integer getRangePublicReleaseSum() {
+        if (rangePublicReleaseSum == null) return 0;
+        return rangePublicReleaseSum;
+    }
+
+    public Integer getFollowSum() {
+        if (followSum == null) return 0;
+        return followSum;
+    }
+
+    public Integer getRangeFollowSum() {
+        if (rangeFollowSum == null) return 0;
+        return rangeFollowSum;
+    }
+
+    public Integer getOrderSum() {
+        if (orderSum == null) return 0;
+        return orderSum;
+    }
+
+    public Integer getRejectSum() {
+        if (rejectSum == null) return 0;
+        return rejectSum;
+    }
+
+    public Integer getChangeSum() {
+        if (changeSum == null) return 0;
+        return changeSum;
+    }
+
+    public Integer getRangeOrderSum() {
+        if (rangeOrderSum == null) return 0;
+        return rangeOrderSum;
+    }
+
+    public Integer getProjectStopSum() {
+        if (projectStopSum == null) return 0;
+        return projectStopSum;
+    }
+
+    public Integer getProjectCheckSum() {
+        if (projectCheckSum == null) return 0;
+        return projectCheckSum;
+    }
+
+    public void setPrivateSum(Integer privateSum) {
+        this.privateSum = privateSum;
+    }
+
+    public void setChannelSum(Integer channelSum) {
+        this.channelSum = channelSum;
+    }
+
+    public void setSignSum(Integer signSum) {
+        this.signSum = signSum;
+    }
+
+    public void setRangePrivateSum(Integer rangePrivateSum) {
+        this.rangePrivateSum = rangePrivateSum;
+    }
+
+    public void setRangeChannelSum(Integer rangeChannelSum) {
+        this.rangeChannelSum = rangeChannelSum;
+    }
+
+    public void setRangeSignSum(Integer rangeSignSum) {
+        this.rangeSignSum = rangeSignSum;
+    }
+
+    public void setPublicReleaseSum(Integer publicReleaseSum) {
+        this.publicReleaseSum = publicReleaseSum;
+    }
+
+    public void setRangePublicReleaseSum(Integer rangePublicReleaseSum) {
+        this.rangePublicReleaseSum = rangePublicReleaseSum;
+    }
+
+    public void setFollowSum(Integer followSum) {
+        this.followSum = followSum;
+    }
+
+    public void setRangeFollowSum(Integer rangeFollowSum) {
+        this.rangeFollowSum = rangeFollowSum;
+    }
+
+    public void setOrderSum(Integer orderSum) {
+        this.orderSum = orderSum;
+    }
+
+    public void setRejectSum(Integer rejectSum) {
+        this.rejectSum = rejectSum;
+    }
+
+    public void setChangeSum(Integer changeSum) {
+        this.changeSum = changeSum;
+    }
+
+    public void setRangeOrderSum(Integer rangeOrderSum) {
+        this.rangeOrderSum = rangeOrderSum;
+    }
+
+    public void setProjectStopSum(Integer projectStopSum) {
+        this.projectStopSum = projectStopSum;
+    }
+
+    public void setProjectCheckSum(Integer projectCheckSum) {
+        this.projectCheckSum = projectCheckSum;
+    }
+}

+ 54 - 0
src/main/java/com/goafanti/admin/controller/AdminStatisticsController.java

@@ -0,0 +1,54 @@
+package com.goafanti.admin.controller;
+
+import com.goafanti.admin.service.AdminStatisticsService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.core.shiro.token.TokenManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping(value = "/api/admin/statistics")
+public class AdminStatisticsController extends CertifyApiController {
+
+    @Autowired
+    private AdminStatisticsService adminStatisticsService;
+
+    /**
+     * 营销首页信息
+     * @param startTime  开始时间
+     * @param endTime  结束时间
+     * @return
+     */
+    @RequestMapping(value = "/info", method = RequestMethod.GET)
+    public Result info(String startTime,String endTime) {
+        Result res =new Result();
+        res.data(adminStatisticsService.info(startTime, endTime));
+        return res;
+
+    }
+
+    /**
+     * 营销首页折线图
+     * @return
+     */
+    @RequestMapping(value = "/lists", method = RequestMethod.GET)
+    public Result lists() {
+        Result res =new Result();
+        res.data(adminStatisticsService.lists(TokenManager.getAdminId()));
+        return res;
+    }
+
+    /**
+     * 营销首页信息清除
+     * @return
+     */
+    @RequestMapping(value = "/lists/clean", method = RequestMethod.GET)
+    public Result listsClean () {
+        Result res =new Result();
+        res.data(adminStatisticsService.listsClean(TokenManager.getAdminId()));
+        return res;
+    }
+}

+ 4 - 5
src/main/java/com/goafanti/admin/service/AdminService.java

@@ -1,13 +1,12 @@
 package com.goafanti.admin.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.goafanti.admin.bo.*;
-import com.goafanti.admin.bo.DepCountBo;
 import com.goafanti.common.model.Admin;
 import com.goafanti.core.mybatis.page.Pagination;
 
+import java.util.List;
+import java.util.Map;
+
 public interface AdminService {
 
 	List<Admin> selectAllAdmin();
@@ -86,5 +85,5 @@ public interface AdminService {
 	DepCountBo selectAllUser(String depId, String startTime, String endTime, String aName);
 
 
-
+    Object pushStatistics();
 }

+ 9 - 0
src/main/java/com/goafanti/admin/service/AdminStatisticsService.java

@@ -0,0 +1,9 @@
+package com.goafanti.admin.service;
+
+public interface AdminStatisticsService {
+    Object info( String startTime,String endTime);
+
+    Object lists(String aid);
+
+    Object listsClean(String adminId);
+}

+ 46 - 22
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -1,29 +1,13 @@
 package com.goafanti.admin.service.impl;
 
-import java.util.*;
-
-import javax.annotation.Resource;
-
+import com.goafanti.admin.bo.*;
+import com.goafanti.admin.service.AdminService;
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.admin.service.NewAdminService;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
-import com.goafanti.common.model.Department;
-import com.goafanti.common.utils.RedisUtil;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.goafanti.admin.bo.AdminContacts;
-import com.goafanti.admin.bo.AdminCustomerBo;
-import com.goafanti.admin.bo.AdminCustomerDetailBo;
-import com.goafanti.admin.bo.AdminDetail;
-import com.goafanti.admin.bo.AdminListBo;
-import com.goafanti.admin.bo.DepCountBo;
-import com.goafanti.admin.service.AdminService;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.UserBusiness;
+import com.goafanti.common.model.*;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
@@ -32,6 +16,12 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.BusinessListBo;
 import com.goafanti.organization.bo.OrganizationListOut;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
 
 @Service
 public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements AdminService {
@@ -55,9 +45,11 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	private PasswordUtil					passwordUtil;
 	@Autowired
 	private NewAdminService newAdminService;
-
 	@Autowired
-	private RedisUtil	redisUtil;
+	private AdminUserCountMapper adminUserCountMapper;
+
+
+
 	@Override
 	public List<Admin> selectAllAdmin() {
 		return adminMapper.selectAllAdmin(null);
@@ -423,6 +415,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return acb;
 	}
 
+
+
 	private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime,Integer seniorStaff) {
 		List<AdminCustomerBo> admins = adminMapper.selectByDeps(depIds,seniorStaff);
 		if(!admins.isEmpty()){
@@ -565,7 +559,37 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	}
 
 
+	@Override
+	public Object pushStatistics() {
+		List<String> roles=new ArrayList<>();
+		roles.add(AFTConstants.SALESMAN);
+		roles.add(AFTConstants.SALESMAN_MANAGER);
+		List<Admin> adminList = adminMapper.getAdminRoleTypesList(roles);
+		for (Admin admin : adminList) {
+		List<AdminUserCount> list =adminMapper.selectAdminPublicRelease(admin.getId());
+		List<AdminUserCount> list2 =adminMapper.selectAdminUserFollow(admin.getId());
+		List<AdminUserCount> list3 =adminMapper.selectAdminOrder(admin.getId());
+		if (list.isEmpty())list=new ArrayList<>();
+		if (!list.isEmpty())list.addAll(list2);
+		if (!list.isEmpty())list.addAll(list3);
+		publiAdminUserCount(list);
+		System.out.println("list="+list.size());
+		}
+
 
 
+		return 1;
+	}
+
+	private void publiAdminUserCount(List<AdminUserCount> list) {
+		for (AdminUserCount e : list) {
+
+			int i=adminUserCountMapper.updateByAidAndDateSelective(e);
+			if (i==0){
+				adminUserCountMapper.insertSelective(e);
+			}
+		}
+	}
+
 
 }

+ 174 - 0
src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java

@@ -0,0 +1,174 @@
+package com.goafanti.admin.service.impl;
+
+import com.goafanti.admin.bo.AdminStatisticsBo;
+import com.goafanti.admin.service.AdminStatisticsService;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.model.AdminUserCount;
+import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.core.shiro.token.TokenManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+@Service
+public class AdminStatisticsServiceImpl implements AdminStatisticsService {
+
+
+
+    @Autowired
+    private AdminMapper adminMapper;
+
+
+    @Override
+    public Object info( String startTime, String endTime) {
+        String aid=TokenManager.getAdminId();
+        endTime=endTime+" 23:59:59";
+        AdminStatisticsBo adminStatisticsBo = adminMapper.adminStatisticsInfo(aid);
+        if (adminStatisticsBo==null)adminStatisticsBo=new AdminStatisticsBo();
+        if (adminStatisticsBo.getReceivables()==null) adminStatisticsBo.setReceivables(new BigDecimal(0));
+        AdminStatisticsBo asb = adminMapper.adminStatisticsInfoByTime(aid, startTime, endTime);
+        if (asb==null) {
+            adminStatisticsBo.setRangePrivateSum(0);
+            adminStatisticsBo.setRangeSignSum(0);
+            adminStatisticsBo.setRangeChannelSum(0);
+            adminStatisticsBo.setRangeFollowSum(0);
+            adminStatisticsBo.setRangeOrderSum(0);
+        }else {
+            adminStatisticsBo.setRangePrivateSum(asb.getRangePrivateSum());
+            adminStatisticsBo.setRangeSignSum(asb.getRangeSignSum());
+            adminStatisticsBo.setRangeChannelSum(asb.getRangeChannelSum());
+            adminStatisticsBo.setRangeFollowSum(asb.getRangeFollowSum());
+            adminStatisticsBo.setRangeOrderSum(asb.getRangeOrderSum());
+        }
+        Integer rangePublicReleaseSum=adminMapper.adminStatisticsPublicReleaseByAidAndTime(aid, startTime, endTime);
+        if (rangePublicReleaseSum==null)rangePublicReleaseSum=0;
+        adminStatisticsBo.setRangePublicReleaseSum(rangePublicReleaseSum);
+        BigDecimal rangeReceivables=adminMapper.addAdminContactsRangeReceivables(aid,startTime,endTime);
+        adminStatisticsBo.setRangeReceivables(rangeReceivables);
+        return adminStatisticsBo;
+    }
+
+    @Override
+//    @Cacheable(value = "adminStatisticeLists#300", key = "'key:'+#aid")
+    public Object lists(String aid) {
+        //获取当月的列表
+        Map<String,Object> map=new HashMap<>();
+        Days days = new Days();
+        List<String> thisMonth = getThisMonth(days);
+        List<AdminUserCount> userList = adminMapper.thisMonthUser(days.firstDay,days.endDay, aid);
+        List<Integer> signList=new ArrayList<>();
+        List<Integer> privateList=new ArrayList<>();
+        List<Integer> channelList=new ArrayList<>();
+        List<Integer> userFollowList=new ArrayList<>();
+        List<Integer> orderList=new ArrayList<>();
+        List<Integer> publicReleaseList=new ArrayList<>();
+            int signCount=0,privateCount=0,channelCount=0,followCount=0,orderCount=0,publicReleaseCount=0;
+        for (String dates : thisMonth) {
+            boolean flag=true;
+            for (AdminUserCount e : userList) {
+                String formatDate = DateUtils.formatDate(e.getDateTime(), AFTConstants.YYYYMMDD);
+                if (dates.equals(formatDate)){
+                    signCount=signCount+e.getSignCount();
+                    int newSign=signCount;
+                    signList.add(newSign);
+                    privateCount=privateCount+e.getPrivateCount();
+                    int newPrivate=privateCount;
+                    privateList.add(newPrivate);
+                    channelCount=channelCount+e.getChannelCount();
+                    int newChannel=channelCount;
+                    channelList.add(newChannel);
+                    followCount=followCount+e.getFollowCount();
+                    int newFollow=followCount;
+                    userFollowList.add(newFollow);
+                    orderCount=orderCount+e.getOrderCount();
+                    int newOrder=orderCount;
+                    orderList.add(newOrder);
+                    publicReleaseCount=publicReleaseCount+e.getPublicReleaseCount();
+                    int newPublicRelease=publicReleaseCount;
+                    publicReleaseList.add(newPublicRelease);
+                    flag=false;
+                }
+            }
+            if (flag){
+                signList.add(signCount);
+                privateList.add(privateCount);
+                channelList.add(channelCount);
+                userFollowList.add(followCount);
+                orderList.add(orderCount);
+                publicReleaseList.add(publicReleaseCount);
+            }
+        }
+        map.put("dates",thisMonth);
+        map.put("signList",signList);
+        map.put("privateList",privateList);
+        map.put("channelList",channelList);
+        //跟进数
+        map.put("userFollowList",userFollowList);
+        //订单数
+        map.put("orderList",orderList);
+        //公出企业数
+        map.put("publicReleaseList",publicReleaseList);
+        return map;
+    }
+
+    @Override
+    @CacheEvict(value = "adminStatisticeLists#300", key = "'key:'+#aid")
+    public Object listsClean(String aid) {
+        LoggerUtils.debug(getClass(), "管理员信息统计缓存清除。");
+        return 1;
+    }
+
+    public  List<String> getThisMonth(Days days) {
+        //获取当月的第一天
+        Date date=new Date();
+
+        Calendar ca=Calendar.getInstance();
+        ca.setTime(date);
+        ca.add(Calendar.DAY_OF_MONTH,-30);
+        days.setFirstDay(DateUtils.formatDate(ca.getTime(),AFTConstants.YYYYMMDD));
+        List<String> list=new ArrayList<>();
+        for (int i=0;i<31;i++){
+            if (i==0){
+                Calendar newc=Calendar.getInstance();
+                newc.setTime(ca.getTime());
+                list.add(DateUtils.formatDate(newc.getTime(), AFTConstants.YYYYMMDD));
+            }else {
+                ca.add(Calendar.DAY_OF_MONTH,1);
+                ca.set(Calendar.HOUR_OF_DAY,0);
+                if (ca.getTimeInMillis()<date.getTime()){
+                    Calendar newc=Calendar.getInstance();
+                    newc.setTime(ca.getTime());
+                    days.setEndDay(DateUtils.formatDate(newc.getTime(), AFTConstants.YYYYMMDD));
+                    list.add(days.getEndDay());
+                }
+            }
+        }
+    return list;
+
+    }
+    class Days{
+        private String firstDay;
+        private String endDay;
+
+        public String getFirstDay() {
+            return firstDay;
+        }
+
+        public void setFirstDay(String firstDay) {
+            this.firstDay = firstDay;
+        }
+
+        public String getEndDay() {
+            return endDay;
+        }
+
+        public void setEndDay(String endDay) {
+            this.endDay = endDay;
+        }
+    }
+}

+ 27 - 0
src/main/java/com/goafanti/common/bo/InputPoverty.java

@@ -0,0 +1,27 @@
+package com.goafanti.common.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+public class InputPoverty {
+
+    @Excel(name = "姓名")
+    private String name;
+    @Excel(name = "身份证号码")
+    private String idCard;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIdCard() {
+        return idCard;
+    }
+
+    public void setIdCard(String idCard) {
+        this.idCard = idCard;
+    }
+}

+ 147 - 0
src/main/java/com/goafanti/common/bo/OutPoverty.java

@@ -0,0 +1,147 @@
+package com.goafanti.common.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+public class OutPoverty {
+    //序号 市 县 乡镇 村 人口数  姓名 与户主关系  脱贫年度
+    @Excel(name = "序号")
+    private String id;
+    @Excel(name = "名称")
+    private String name;
+    @Excel(name = "市")
+    private String city;
+    @Excel(name = "县")
+    private String county;
+    @Excel(name = "乡镇")
+    private String township;
+    @Excel(name = "村")
+    private String village;
+    @Excel(name = "人口数")
+    private String peopleSum;
+    @Excel(name = "与户主关系")
+    private String relationship;
+    @Excel(name = "脱贫年度")
+    private String povertyYear;
+    @Excel(name = "户类型")
+    private String householdType;
+    @Excel(name = "监测对象类别")
+    private String monitoringObjectType;
+    @Excel(name = "风险是否已消除")
+    private String riskStatus;
+    @Excel(name = "识别监测时间")
+    private String identifyMonitoringTime;
+    @Excel(name = "消除监测时间")
+    private String eliminateMonitoringTime;
+
+    public String getHouseholdType() {
+        return householdType;
+    }
+
+    public void setHouseholdType(String householdType) {
+        this.householdType = householdType;
+    }
+
+    public String getMonitoringObjectType() {
+        return monitoringObjectType;
+    }
+
+    public void setMonitoringObjectType(String monitoringObjectType) {
+        this.monitoringObjectType = monitoringObjectType;
+    }
+
+    public String getRiskStatus() {
+        return riskStatus;
+    }
+
+    public void setRiskStatus(String riskStatus) {
+        this.riskStatus = riskStatus;
+    }
+
+    public String getIdentifyMonitoringTime() {
+        return identifyMonitoringTime;
+    }
+
+    public void setIdentifyMonitoringTime(String identifyMonitoringTime) {
+        this.identifyMonitoringTime = identifyMonitoringTime;
+    }
+
+    public String getEliminateMonitoringTime() {
+        return eliminateMonitoringTime;
+    }
+
+    public void setEliminateMonitoringTime(String eliminateMonitoringTime) {
+        this.eliminateMonitoringTime = eliminateMonitoringTime;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getCounty() {
+        return county;
+    }
+
+    public void setCounty(String county) {
+        this.county = county;
+    }
+
+    public String getTownship() {
+        return township;
+    }
+
+    public void setTownship(String township) {
+        this.township = township;
+    }
+
+    public String getVillage() {
+        return village;
+    }
+
+    public void setVillage(String village) {
+        this.village = village;
+    }
+
+    public String getPeopleSum() {
+        return peopleSum;
+    }
+
+    public void setPeopleSum(String peopleSum) {
+        this.peopleSum = peopleSum;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getRelationship() {
+        return relationship;
+    }
+
+    public void setRelationship(String relationship) {
+        this.relationship = relationship;
+    }
+
+    public String getPovertyYear() {
+        return povertyYear;
+    }
+
+    public void setPovertyYear(String povertyYear) {
+        this.povertyYear = povertyYear;
+    }
+}

+ 28 - 0
src/main/java/com/goafanti/common/bo/OutPovertyFlag.java

@@ -0,0 +1,28 @@
+package com.goafanti.common.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+public class OutPovertyFlag {
+
+    @Excel(name = "名称")
+    private String name;
+    @Excel(name = "查询结果")
+    private String povertyStatus;
+
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPovertyStatus() {
+        return povertyStatus;
+    }
+
+    public void setPovertyStatus(String povertyStatus) {
+        this.povertyStatus = povertyStatus;
+    }
+}

+ 182 - 4
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -3,18 +3,18 @@ package com.goafanti.common.controller;
 import com.goafanti.admin.service.AdminService;
 import com.goafanti.admin.service.AttachmentService;
 import com.goafanti.common.bo.Error;
-import com.goafanti.common.bo.OutUser;
-import com.goafanti.common.bo.Result;
+import com.goafanti.common.bo.*;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.dao.TOrderMidMapper;
 import com.goafanti.common.enums.UserType;
 import com.goafanti.common.model.User;
 import com.goafanti.common.service.DistrictGlossoryService;
 import com.goafanti.common.service.IndustryCategoryService;
+import com.goafanti.common.service.PovertyService;
 import com.goafanti.common.utils.*;
 import com.goafanti.common.utils.excel.FileUtils;
 import com.goafanti.common.utils.excel.NewExcelUtil;
+import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
@@ -81,7 +81,7 @@ public class PublicController extends CertifyApiController {
 	private AdminService	adminService;
 
 	@Resource
-	private TOrderMidMapper			tOrderMidMapper;
+	private PovertyService povertyService;
 
 	@Autowired
 	private IndustryCategoryService	industryCategoryService;
@@ -95,6 +95,9 @@ public class PublicController extends CertifyApiController {
 	@Value(value = "${patentTemplate}")
 	private String					patentTemplate		= null;
 
+	@Autowired
+	private JDBCIdGenerator jdbcIdGenerator;
+
 	@Resource(name = "passwordUtil")
 	private PasswordUtil			passwordUtil;
 
@@ -763,10 +766,185 @@ public class PublicController extends CertifyApiController {
 	}
 
 
+	/**
+	 * 补充发票报销查询编号
+	 * @return
+	 */
 	@RequestMapping("/supplementCheckNo")
 	public Result supplementCheckNo() {
 		Result res=new Result();
 		res.data(expenseAccountService.pushSupplementCheckNo());
 		return res;
 	}
+
+	/**
+	 * 查询贫困信息
+	 * @return
+	 */
+	@RequestMapping("/selectPoverty")
+	public Result selectPoverty(@RequestParam(value = "file", required = false) MultipartFile file) {
+		Result res=new Result();
+		//判断文件是否存在
+		if(null == file){
+			res.getError().add(buildError("文件不存在!","文件不存在!"));
+			return res;
+		}
+		String fileName = file.getOriginalFilename();
+		if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+			res.getError().add(buildError("格式不正确","格式不正确"));
+			return res;
+		}
+		String id = jdbcIdGenerator.generateId().toString();
+		res.data(povertyService.selectPoverty(file,id));
+		return res;
+	}
+
+
+	/**
+	 * 查询贫困信息
+	 * @param id 贫困信息编号
+	 * @param type 0=所有 ,1=只看有效数据
+	 * @return
+	 */
+	@RequestMapping("/selectPovertyById/export")
+	public Result selectPovertyByIdExport(String id,Integer type) {
+		Map<String,Object> o = povertyService.selectPoverty(null, id);
+		if (type==null)type=0;
+		List<OutPoverty> resList=new ArrayList<>();
+		if (type==1){
+			List<OutPoverty> list = (List<OutPoverty>) o.get("list");
+			for (OutPoverty outPoverty : list) {
+				if (com.goafanti.common.utils.StringUtils.isNotEmpty(outPoverty.getId())){
+					resList.add(outPoverty);
+				}
+			}
+
+		}else {
+			resList = (List<OutPoverty>) o.get("list");
+		}
+		NewExcelUtil<OutPoverty> newExcelUtil=new NewExcelUtil<>(OutPoverty.class);
+		return newExcelUtil.exportExcel(resList,"广西贫困信息表",uploadPath);
+	}
+
+
+	@RequestMapping("/selectPovertyById")
+	public Result selectPovertyById(String id,Integer type) {
+		Result res=new Result();
+		Map<String,Object> o = povertyService.selectPoverty(null, id);
+		if (type==null)type=0;
+		if (type==1){
+			List<OutPoverty> list = (List<OutPoverty>) o.get("list");
+			List<OutPoverty> resList=new ArrayList<>();
+			for (OutPoverty outPoverty : list) {
+				if (com.goafanti.common.utils.StringUtils.isNotEmpty(outPoverty.getId())){
+					resList.add(outPoverty);
+				}
+			}
+			o.remove("list");
+			o.put("list",resList);
+		}
+		res.data(o);
+		return res;
+	}
+
+	/**
+	 * 	批量导入回款模版
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/downloadPovertyTemplate", method = RequestMethod.GET)
+	public void downloadTemplate(HttpServletResponse response) {
+		Result res = new Result();
+		StringBuffer url= new StringBuffer(uploadPath);
+		url=url.append("/tmp").append("/poverty_template.xls");
+		try {
+			response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+			FileUtils.setAttachmentResponseHeader(response, url.toString(),"poverty导入模版.xls");
+			FileUtils.writeBytes(url.toString(), response.getOutputStream());
+		}
+		catch (Exception e) {
+			LoggerUtils.error(PublicController.class,"下载文件失败", e);
+		}
+	}
+
+	/**
+	 * 查询贫困信息
+	 * @return
+	 */
+	@RequestMapping("/selectFlag")
+	public Result selectFlag(@RequestParam(value = "file", required = false) MultipartFile file) {
+		Result res=new Result();
+		//判断文件是否存在
+		if(null == file){
+			res.getError().add(buildError("文件不存在!","文件不存在!"));
+			return res;
+		}
+		String fileName = file.getOriginalFilename();
+		if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+			res.getError().add(buildError("格式不正确","格式不正确"));
+			return res;
+		}
+		String id = jdbcIdGenerator.generateId().toString();
+		Map<String, Object> map = povertyService.selectFlag(file, id);
+		List<OutPovertyFlag> falseList = (List<OutPovertyFlag>) map.get("falseList");
+		List<OutPovertyFlag> list = (List<OutPovertyFlag>) map.get("trueList");
+		list.addAll(falseList);
+		map.put("list",list);
+		map.remove("falseList");
+		map.remove("trueList");
+		res.data(map);
+		return res;
+	}
+
+	/**
+	 * 查询贫困信息
+	 * @param id 贫困信息编号
+	 * @param type 0=所有 ,1=只看有效数据
+	 * @return
+	 */
+	@RequestMapping("/selectPovertyFlagById")
+	public Result selectPovertyFlagById(String id,Integer type) {
+		Result res =new Result();
+		Map<String,Object> map = povertyService.selectFlag(null, id);
+		if (type==null)type=0;
+		List<OutPovertyFlag> resList=new ArrayList<>();
+		if (type==1){
+			map.put("list",map.get("trueList"));
+		}else {
+			map.put("list",map.get("falseList"));
+		}
+		map.remove("trueList");
+		map.remove("falseList");
+		return res.data(map);
+	}
+	/**
+	 * 查询贫困信息
+	 * @param id 贫困信息编号
+	 * @param type 0=所有 ,1=只看有效数据
+	 * @return
+	 */
+	@RequestMapping("/selectPovertyFlagById/export")
+	public Result selectPovertyFlagByIdExport(String id,Integer type) {
+		Map<String,Object> map = povertyService.selectFlag(null, id);
+		if (type==null)type=0;
+		List<OutPovertyFlag> resList=new ArrayList<>();
+		if (type==1){
+			map.put("list",map.get("trueList"));
+
+		}else {
+			map.put("list",map.get("falseList"));
+		}
+		map.remove("trueList");
+		map.remove("falseList");
+		NewExcelUtil<OutPovertyFlag> newExcelUtil=new NewExcelUtil<>(OutPovertyFlag.class);
+		return newExcelUtil.exportExcel(resList,"全国贫困信息表",uploadPath);
+	}
+
+
+	@RequestMapping("/pushStatistics")
+	public Result pushStatistics (){
+		Result res =new Result();
+		res.data(adminService.pushStatistics());
+		return res;
+	}
 }

+ 16 - 12
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -1,26 +1,24 @@
 package com.goafanti.common.controller;
 
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.servlet.ModelAndView;
-
 import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.model.Banners;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.service.DemandService;
-import com.goafanti.user.service.OrganizationIdentityService;
-import com.goafanti.user.service.UserIdentityService;
 import com.goafanti.news.bo.NewsPortalList;
 import com.goafanti.news.enums.NewsType;
 import com.goafanti.news.service.NewsService;
+import com.goafanti.user.service.OrganizationIdentityService;
+import com.goafanti.user.service.UserIdentityService;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 
 @Controller
 public class WebpageController extends BaseController {
@@ -504,5 +502,11 @@ public class WebpageController extends BaseController {
 		modelview.setViewName("/portal/index");
 		return modelview;
 	}
+	@RequestMapping(value = "/admin/povertyInquiry", method = RequestMethod.GET)
+	public ModelAndView povertyInquiry(HttpServletRequest request, ModelAndView modelview) {
+		modelview.setViewName("/admin/povertyInquiry");
+		return modelview;
+	}
+
 
 }

+ 21 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -3,12 +3,15 @@ package com.goafanti.common.dao;
 import com.goafanti.admin.bo.AdminContacts;
 import com.goafanti.admin.bo.AdminCustomerBo;
 import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.bo.AdminStatisticsBo;
 import com.goafanti.common.bo.AdminNoticeBo;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.AdminUserCount;
 import com.goafanti.common.model.Department;
 import com.goafanti.common.model.Role;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 public interface AdminMapper {
@@ -172,4 +175,22 @@ public interface AdminMapper {
 
 
     List<Integer> selectRoleTypeByid(String aid);
+    AdminStatisticsBo adminStatisticsInfo(@Param("aid") String aid);
+    AdminStatisticsBo adminStatisticsInfoByTime(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<AdminUserCount> thisMonthUser( @Param("firstDay")String firstDay, @Param("endDay")String endDay,
+                                    @Param("aid")String aid);
+
+
+
+
+
+    List<AdminUserCount> selectAdminPublicRelease(String aid);
+    List<AdminUserCount> selectAdminUserFollow(String aid);
+    List<AdminUserCount> selectAdminOrder(String aid);
+
+
+    Integer adminStatisticsPublicReleaseByAidAndTime(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    BigDecimal addAdminContactsRangeReceivables(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

+ 27 - 0
src/main/java/com/goafanti/common/dao/AdminUserCountMapper.java

@@ -0,0 +1,27 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.AdminUserCount;
+import org.apache.ibatis.annotations.Param;
+
+public interface AdminUserCountMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(AdminUserCount record);
+
+    int insertSelective(AdminUserCount record);
+
+    AdminUserCount selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(AdminUserCount record);
+
+    int updateByPrimaryKey(AdminUserCount record);
+
+    int updateByAidAndDateSelective(AdminUserCount e);
+
+    int updateByaidAndDate(@Param("aid") String aid,@Param("startTime") String startTime,
+                           @Param("endTime")String endTime,@Param("type")Integer type);
+
+    AdminUserCount selectByaidAndDate(@Param("aid") String aid,@Param("startTime") String startTime);
+
+    void updateUserCountResetting(String aid);
+}

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

@@ -2,7 +2,6 @@ package com.goafanti.common.dao;
 
 import com.goafanti.common.model.OutPublicReleaseCount;
 import com.goafanti.common.model.PublicRelease;
-import com.goafanti.common.model.PublicReleaseCount;
 import com.goafanti.weChat.bo.OutPublicRelease;
 import com.goafanti.weChat.bo.OutPublicReleaseAndDetails;
 import org.apache.ibatis.annotations.Param;
@@ -50,4 +49,6 @@ public interface PublicReleaseMapper {
     void updateStatusByMainId(@Param("status") Integer status, @Param("type") Integer type,@Param("mainId") Integer mainId,@Param("aid") String aid);
 
     OutPublicReleaseAndDetails selectDtailsByFid(@Param("ufid")String ufid);
+
+    int selectByaidAndDate(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 }

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

@@ -83,4 +83,7 @@ public interface TOrderNewMapper {
     List<UserOrder>  matchingOrderNoOrUserName(@Param("orderNo") String orderNo, @Param("userName")String userName);
 
     void updateTagByListOrderNo(List<String> orderNos, Integer tag);
+
+    int selectAidAndDate(@Param("aid") String aid, @Param("startTime") String startTime,
+                         @Param("endTime")String endTime);
 }

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

@@ -58,4 +58,5 @@ public interface UserFollowMapper {
 	List<UserFollow> selectbyUid(@Param("uid")String uid, @Param("aid")String aid);
 
 
-}
+    int selectByaidAndDate(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
+}

+ 6 - 0
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -5,6 +5,7 @@ import com.goafanti.app.bo.UserBasicInfo;
 import com.goafanti.common.bo.OutUser;
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.AdminUserCount;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.customer.bo.*;
@@ -237,4 +238,9 @@ public interface UserMapper {
     List<AdminCustomerBo> selectChannelByaids(@Param("admins")List<AdminCustomerBo> admins,@Param("startTime") String startTime,@Param("endTime") String endTime);
 
     List<String> selectBelongByaid(String aid);
+
+    AdminUserCount selectByaidAndDate(@Param("aid") String aid, @Param("startTime") String startTime,
+                                      @Param("endTime")String endTime);
+
+    List<AdminUserCount>selectListByaidAndDate(String  aid);
 }

+ 74 - 0
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -921,6 +921,8 @@
     (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
   </insert>
 
+
+
   <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
     select a.id,b.id as contactId,b.name,b.position,b.contact_mobile as contactMobile,c.name as departmentName,y.role_name as roleName
     from admin_contacts a left join admin b
@@ -1246,4 +1248,76 @@
     left join admin c on b.finance_id=c.id
     where a.id= #{aid}
   </select>
+  <select id="adminStatisticsInfo" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
+    select *
+    from (select aid ,sum(private_count)privateSum ,sum(channel_count)channelSum ,sum(sign_count)signSum ,
+                 sum(public_release_count)publicReleaseSum ,sum(follow_count) followSum,sum(order_count) orderSum
+          from admin_user_count a where aid=#{aid} group by aid)x
+    left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
+            sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
+            on a.order_no =b.order_no where a.salesman_id =  #{aid})y on x.aid=y.aid
+    left join (  select salesman_id aid,  sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
+            from t_order_new where delete_sign in (0,2,3) and process_status >0
+            and salesman_id =  #{aid})g on x.aid=g.aid
+    left join (  select salesman_id aid,  sum(if(order_status=3 or order_status=5,1,0))rejectSum
+            from t_order_new where delete_sign in (0,2,3)
+            and salesman_id =  #{aid})z on x.aid=z.aid
+    left join (  SELECT b.salesman_id aid ,sum(a.money)  receivables
+                 from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+                 where a.status =1   and b.delete_sign in (0,2,3)
+                   and b.salesman_id = #{aid})t on x.aid=t.aid
+  </select>
+
+  <select id="adminStatisticsInfoByTime" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
+    select sum(private_count)rangePrivateSum ,sum(channel_count)rangeChannelSum ,sum(sign_count)rangeSignSum ,
+           sum(follow_count) rangeFollowSum,sum(order_count) rangeOrdersum
+    from admin_user_count a where aid=#{aid} and  date_time BETWEEN #{startTime} and #{endTime}
+    group by aid
+  </select>
+  <select id="thisMonthUser" resultType="com.goafanti.common.model.AdminUserCount">
+    select id,aid,private_count privateCount,sign_count signCount,channel_count channelCount,public_release_count publicReleaseCount,
+           follow_count followCount,order_count orderCount, DATE_FORMAT(date_time , '%Y-%m-%d') dateTime
+    from admin_user_count
+    where  date_time BETWEEN #{firstDay} and  #{endDay}
+      and aid= #{aid}
+    order by date_time
+  </select>
+
+
+  <select id="selectAdminPublicRelease" resultType="com.goafanti.common.model.AdminUserCount">
+    select aid,count(*)publicReleaseCount, dates dateTime
+    from (select aid,DATE_FORMAT(a.release_start , '%Y-%m-%d') dates
+          from public_release a left join public_release_details b on a.id=b.prid
+          where status =2 and aid= #{aid})x
+    group by aid,dates
+  </select>
+  <select id="selectAdminUserFollow" resultType="com.goafanti.common.model.AdminUserCount">
+    select aid  ,count(*)followCount, dateTime
+    from (select aid,DATE_FORMAT(create_time , '%Y-%m-%d') dateTime
+          from user_follow where aid= #{aid} )a
+    group by aid,dateTime
+  </select>
+  <select id="selectAdminOrder" resultType="com.goafanti.common.model.AdminUserCount">
+    select salesman_id aid ,count(*)orderCount, dateTime
+    from (select salesman_id, DATE_FORMAT(create_time , '%Y-%m-%d') dateTime
+          from t_order_new
+          where delete_sign in (0,2,3) and process_status >0
+            and salesman_id= #{aid} )x
+    group by salesman_id ,dateTime
+  </select>
+  <select id="adminStatisticsPublicReleaseByAidAndTime" resultType="java.lang.Integer">
+    select sum(1) rangePublicReleaseSum
+     from public_release a left join public_release_details b on a.id=b.prid
+     where status =2 and a.aid =  #{aid}
+       and((a.release_start &gt;  #{startTime} and a.release_start &lt;  #{endTime})or
+           (a.release_end &gt;  #{startTime} and a.release_end &lt;  #{endTime})or
+           (a.release_start &lt;  #{startTime} and a.release_end &gt;  #{endTime}))
+  </select>
+  <select id="addAdminContactsRangeReceivables" resultType="java.math.BigDecimal">
+    SELECT  ifnull(sum(a.money),0)  receivables
+    from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+    where a.status =1   and b.delete_sign in (0,2,3)
+      and b.salesman_id = #{aid}
+      and a.start_time  between #{startTime} and #{endTime}
+  </select>
 </mapper>

+ 216 - 0
src/main/java/com/goafanti/common/mapper/AdminUserCountMapper.xml

@@ -0,0 +1,216 @@
+<?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.goafanti.common.dao.AdminUserCountMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.AdminUserCount">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="private_count" jdbcType="INTEGER" property="privateCount" />
+    <result column="sign_count" jdbcType="INTEGER" property="signCount" />
+    <result column="channel_count" jdbcType="INTEGER" property="channelCount" />
+    <result column="public_release_count" jdbcType="INTEGER" property="publicReleaseCount" />
+    <result column="follow_count" jdbcType="INTEGER" property="followCount" />
+    <result column="order_count" jdbcType="INTEGER" property="orderCount" />
+    <result column="date_time" jdbcType="DATE" property="dateTime" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, aid, private_count, sign_count, channel_count, public_release_count, follow_count,
+    order_count, date_time, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin_user_count
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+
+
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from admin_user_count
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AdminUserCount" useGeneratedKeys="true">
+    insert into admin_user_count (aid, private_count, sign_count,
+      channel_count, public_release_count, follow_count,
+      order_count, date_time, create_time
+      )
+    values (#{aid,jdbcType=VARCHAR}, #{privateCount,jdbcType=INTEGER}, #{signCount,jdbcType=INTEGER},
+      #{channelCount,jdbcType=INTEGER}, #{publicReleaseCount,jdbcType=INTEGER}, #{followCount,jdbcType=INTEGER},
+      #{orderCount,jdbcType=INTEGER}, #{dateTime,jdbcType=DATE}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AdminUserCount" useGeneratedKeys="true">
+    insert into admin_user_count
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="privateCount != null">
+        private_count,
+      </if>
+      <if test="signCount != null">
+        sign_count,
+      </if>
+      <if test="channelCount != null">
+        channel_count,
+      </if>
+      <if test="publicReleaseCount != null">
+        public_release_count,
+      </if>
+      <if test="followCount != null">
+        follow_count,
+      </if>
+      <if test="orderCount != null">
+        order_count,
+      </if>
+      <if test="dateTime != null">
+        date_time,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="privateCount != null">
+        #{privateCount,jdbcType=INTEGER},
+      </if>
+      <if test="signCount != null">
+        #{signCount,jdbcType=INTEGER},
+      </if>
+      <if test="channelCount != null">
+        #{channelCount,jdbcType=INTEGER},
+      </if>
+      <if test="publicReleaseCount != null">
+        #{publicReleaseCount,jdbcType=INTEGER},
+      </if>
+      <if test="followCount != null">
+        #{followCount,jdbcType=INTEGER},
+      </if>
+      <if test="orderCount != null">
+        #{orderCount,jdbcType=INTEGER},
+      </if>
+      <if test="dateTime != null">
+        #{dateTime,jdbcType=DATE},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AdminUserCount">
+    update admin_user_count
+    <set>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="privateCount != null">
+        private_count = #{privateCount,jdbcType=INTEGER},
+      </if>
+      <if test="signCount != null">
+        sign_count = #{signCount,jdbcType=INTEGER},
+      </if>
+      <if test="channelCount != null">
+        channel_count = #{channelCount,jdbcType=INTEGER},
+      </if>
+      <if test="publicReleaseCount != null">
+        public_release_count = #{publicReleaseCount,jdbcType=INTEGER},
+      </if>
+      <if test="followCount != null">
+        follow_count = #{followCount,jdbcType=INTEGER},
+      </if>
+      <if test="orderCount != null">
+        order_count = #{orderCount,jdbcType=INTEGER},
+      </if>
+      <if test="dateTime != null">
+        date_time = #{dateTime,jdbcType=DATE},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.AdminUserCount">
+    update admin_user_count
+    set aid = #{aid,jdbcType=VARCHAR},
+      private_count = #{privateCount,jdbcType=INTEGER},
+      sign_count = #{signCount,jdbcType=INTEGER},
+      channel_count = #{channelCount,jdbcType=INTEGER},
+      public_release_count = #{publicReleaseCount,jdbcType=INTEGER},
+      follow_count = #{followCount,jdbcType=INTEGER},
+      order_count = #{orderCount,jdbcType=INTEGER},
+      date_time = #{dateTime,jdbcType=DATE},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+    <update id="updateByAidAndDateSelective">
+      update admin_user_count
+      <set>
+        <if test="privateCount != null">
+          private_count = #{privateCount,jdbcType=INTEGER},
+        </if>
+        <if test="signCount != null">
+          sign_count = #{signCount,jdbcType=INTEGER},
+        </if>
+        <if test="channelCount != null">
+          channel_count = #{channelCount,jdbcType=INTEGER},
+        </if>
+        <if test="publicReleaseCount != null">
+          public_release_count = #{publicReleaseCount,jdbcType=INTEGER},
+        </if>
+        <if test="followCount != null">
+          follow_count = #{followCount,jdbcType=INTEGER},
+        </if>
+        <if test="orderCount != null">
+          order_count = #{orderCount,jdbcType=INTEGER},
+        </if>
+      </set>
+      where aid = #{aid,jdbcType=VARCHAR} and date_time = #{dateTime,jdbcType=DATE}
+    </update>
+
+
+  <update id="updateByaidAndDate" >
+    update admin_user_count a,(select aid,dates,count(*)counts
+        from (select aid,DATE_FORMAT(a.transfer_time , '%Y-%m-%d') dates
+        from user a where status =0 and source in(1,2,3)
+        <if test="type==0 or type==3">
+          and share_type=0 and new_channel=0
+        </if>
+        <if test="type==1 or type==4">
+          and share_type=0 and new_channel=1
+        </if>
+        <if test="type==5 or type==6">
+          and share_type=2
+        </if>
+        and aid=  #{aid}
+        and transfer_time BETWEEN #{startTime} and  #{endTime})x group by aid,dates)b
+    set
+    <if test="type==0 or type==3">
+        a.private_count =b.counts
+    </if>
+    <if test="type==1 or type==4">
+      a.channel_count =b.counts
+    </if>
+    <if test="type==5 or type==6">
+      a.sign_count =b.counts
+    </if>
+    where a.aid=b.aid and a.date_time=b.dates
+  </update>
+
+
+  <select id="selectByaidAndDate"  resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin_user_count
+    where aid= #{aid} and date_time=#{startTime}
+  </select>
+
+  <update id="updateUserCountResetting">
+    update admin_user_count
+    set  private_count=0,sign_count=0,channel_count=0,order_count=0
+    where aid= #{aid}
+  </update>
+</mapper>

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

@@ -851,7 +851,8 @@
       and aid= #{aid}
     </if>
   </select>
-  <update id="updateStatusByMainId">
+
+    <update id="updateStatusByMainId">
     update public_release set status= #{status}
     where main_id= #{mainId}
     <if test="type !=null">
@@ -861,4 +862,13 @@
       and aid= #{aid}
     </if>
   </update>
+
+  <select id="selectByaidAndDate" resultType="java.lang.Integer">
+    select count(*)publicReleaseCount
+    from (select aid
+          from public_release a left join public_release_details b on a.id=b.prid
+          where status =2 and aid= #{aid}
+            and a.release_start BETWEEN #{startTime} and #{endTime} )x
+    group by aid
+  </select>
 </mapper>

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

@@ -2118,7 +2118,8 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     </if>
     limit 0,20
   </select>
-  <update id="updateTagByListOrderNo">
+
+    <update id="updateTagByListOrderNo">
     update t_order_new
     set tag = #{param2}
     where order_no in
@@ -2127,4 +2128,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     </foreach>
   </update>
 
+  <select id="selectAidAndDate" resultType="java.lang.Integer">
+    select count(*)
+    from t_order_new
+    where process_status >0
+    and salesman_id = #{aid}
+    and create_time  BETWEEN #{startTime} and  #{endTime}
+  </select>
 </mapper>

+ 7 - 0
src/main/java/com/goafanti/common/mapper/UserFollowMapper.xml

@@ -377,4 +377,11 @@
         </foreach>
       </if>
 	</select>
+    <select id="selectByaidAndDate" resultType="java.lang.Integer">
+      select count(*)followCount
+      from (select aid
+        from user_follow where aid= #{aid}
+        and create_time BETWEEN #{startTime} and #{endTime})a
+      group by aid
+    </select>
 </mapper>

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

@@ -1987,7 +1987,7 @@ inner join(
 		and share_type=2
 	</select>
 	<update id="updateShareType">
-	update user set share_type =2,sign_bills =1,aid = #{aid}
+	update user set share_type =2,sign_bills =1,aid = #{aid},transfer_time= now()
 	where id= #{uid}
 	</update>
 
@@ -2343,4 +2343,22 @@ inner join(
 		SELECT id     from user
 		where aid= #{aid} and share_type in (0,2)
 	</select>
+
+	<select id="selectByaidAndDate" resultType="com.goafanti.common.model.AdminUserCount">
+		SELECT aid,dateTime,sum(privateCount)privateCount,sum(channelCount)channelCount,sum(signCount)signCount
+		from ( select aid,DATE_FORMAT(a.transfer_time , '%Y-%m-%d') dateTime,
+					  if(share_type=0 and new_channel=0,1,0) privateCount,
+					  if(share_type=0 and new_channel=1,1,0)channelCount, if(share_type=2,1,0)signCount
+			   from user a where status =0 and source in(1,2,3) and aid= #{aid}
+				and transfer_time  BETWEEN #{startTime} and #{endTime}
+		    )x group by aid,dateTime
+	</select>
+	<select id="selectListByaidAndDate" resultType="com.goafanti.common.model.AdminUserCount">
+		SELECT aid,dateTime,sum(privateCount)privateCount,sum(channelCount)channelCount,sum(signCount)signCount
+		from ( select aid,DATE_FORMAT(a.transfer_time , '%Y-%m-%d') dateTime,
+		if(share_type=0 and new_channel=0,1,0) privateCount,
+		if(share_type=0 and new_channel=1,1,0)channelCount, if(share_type=2,1,0)signCount
+		from user a where status =0 and source in(1,2,3) and aid= #{aid}
+		)x group by aid,dateTime
+	</select>
 </mapper>

+ 139 - 0
src/main/java/com/goafanti/common/model/AdminUserCount.java

@@ -0,0 +1,139 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * admin_user_count
+ * @author 
+ */
+public class AdminUserCount implements Serializable {
+    private Integer id;
+
+    /**
+     * 管理员编号
+     */
+    private String aid;
+
+    /**
+     * 私有数
+     */
+    private Integer privateCount;
+
+    /**
+     * 签单数
+     */
+    private Integer signCount;
+
+    /**
+     * 渠道数
+     */
+    private Integer channelCount;
+
+    /**
+     * 公出数
+     */
+    private Integer publicReleaseCount;
+
+    /**
+     * 跟进数
+     */
+    private Integer followCount;
+
+    /**
+     * 订单数
+     */
+    private Integer orderCount;
+
+    /**
+     * 日期
+     */
+    private Date dateTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public Integer getPrivateCount() {
+        return privateCount;
+    }
+
+    public void setPrivateCount(Integer privateCount) {
+        this.privateCount = privateCount;
+    }
+
+    public Integer getSignCount() {
+        return signCount;
+    }
+
+    public void setSignCount(Integer signCount) {
+        this.signCount = signCount;
+    }
+
+    public Integer getChannelCount() {
+        return channelCount;
+    }
+
+    public void setChannelCount(Integer channelCount) {
+        this.channelCount = channelCount;
+    }
+
+    public Integer getPublicReleaseCount() {
+        return publicReleaseCount;
+    }
+
+    public void setPublicReleaseCount(Integer publicReleaseCount) {
+        this.publicReleaseCount = publicReleaseCount;
+    }
+
+    public Integer getFollowCount() {
+        return followCount;
+    }
+
+    public void setFollowCount(Integer followCount) {
+        this.followCount = followCount;
+    }
+
+    public Integer getOrderCount() {
+        return orderCount;
+    }
+
+    public void setOrderCount(Integer orderCount) {
+        this.orderCount = orderCount;
+    }
+
+    public Date getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(Date dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 162 - 0
src/main/java/com/goafanti/common/service/PovertyService.java

@@ -0,0 +1,162 @@
+package com.goafanti.common.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.bo.InputPoverty;
+import com.goafanti.common.bo.OutPoverty;
+import com.goafanti.common.bo.OutPovertyFlag;
+import com.goafanti.common.utils.HttpUtils;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class PovertyService {
+
+
+    private static final String   gx_url="http://fpb.gxxw.cn/index.php?m=check&c=index&a=list_jdlk&name=";
+    private static final String   gx_jiance_url="http://fpb.gxxw.cn/index.php?m=check&c=index&a=list_fpjc&name=";
+
+
+    @Cacheable(value = "selectPoverty#300", key = "'selectPoverty:key='+#id")
+    public Map<String,Object> selectPoverty(MultipartFile file,String id) {
+
+        NewExcelUtil<InputPoverty> newExcelUtil=new NewExcelUtil<>(InputPoverty.class);
+        List<InputPoverty> list = null;
+        try {
+            list = newExcelUtil.importExcel(file.getInputStream(),0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        List<OutPoverty> res=new ArrayList<>();
+        Integer totalcount =0;
+        Integer effectiveCount =0;
+        for (InputPoverty e : list) {
+            OutPoverty outPoverty = selectAggravationHttpPoverty(e);
+            if (outPoverty.getId()!=null){
+                effectiveCount++;
+            }
+            totalcount++;
+            res.add(outPoverty);
+        }
+        Map<String ,Object> map=new HashMap<>();
+        map.put("list",res);
+        map.put("totalcount",totalcount);
+        map.put("effectiveCount",effectiveCount);
+        map.put("id",id);
+        return map;
+    }
+    private OutPoverty selectAggravationHttpPoverty(InputPoverty in){
+        OutPoverty outPoverty = selectHttpPoverty(in, 0);
+        if (StringUtils.isBlank(outPoverty.getId()))outPoverty=selectHttpPoverty(in,1);
+        if (StringUtils.isBlank(outPoverty.getName()))outPoverty.setName(in.getName());
+        return outPoverty;
+    }
+
+    private OutPoverty selectHttpPoverty(InputPoverty in,Integer type) {
+        OutPoverty out=new OutPoverty();
+        try {
+
+            String name= StringUtils.deleteWhitespace(in.getName());
+            String idcard=in.getIdCard();
+            StringBuffer url=new StringBuffer();
+            if (type==0)url=url.append(gx_url);
+            else url=url.append(gx_jiance_url);
+            url=url.append(name).append("&idcard=").append(idcard);
+            Document document = Jsoup
+                    .connect(url.toString()).get();
+            Elements filequery_table = document.getElementsByClass("Filequery_table");
+            Elements tr = filequery_table.select("tr");
+            if (tr.size()>1){
+                Element element = tr.get(1);
+                Elements td = element.select("td");
+                if (type==0){
+                    out.setId(td.get(0).text());
+                    out.setCity(td.get(1).text());
+                    out.setCounty(td.get(2).text());
+                    out.setTownship(td.get(3).text());
+                    out.setVillage(td.get(4).text());
+                    out.setPeopleSum(td.get(5).text());
+                    out.setName(td.get(6).text());
+                    out.setRelationship(td.get(7).text());
+                    out.setPovertyYear(td.get(8).text());
+                }else {
+                    out.setId(td.get(0).text());
+                    out.setCity(td.get(1).text());
+                    out.setCounty(td.get(2).text());
+                    out.setTownship(td.get(3).text());
+                    out.setVillage(td.get(4).text());
+                    out.setName(td.get(5).text());
+                    out.setRelationship(td.get(6).text());
+                    out.setPeopleSum(td.get(7).text());
+                    out.setHouseholdType(td.get(8).text());
+                    out.setMonitoringObjectType(td.get(9).text());
+                    out.setRiskStatus(td.get(10).text());
+                    out.setIdentifyMonitoringTime(td.get(11).text());
+                    out.setEliminateMonitoringTime(td.get(12).text());
+                }
+
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return out;
+    }
+    private static final String flag_url="https://cpadis.cpad.gov.cn:1443/cpad_par/app/observeHouse/checkIdentity?loginToken=&userId=&version=";
+
+    @Cacheable(value = "selectPovertytFlag#300", key = "'selectPovertytFlag:key='+#id")
+    public Map<String, Object> selectFlag(MultipartFile file, String id) {
+        NewExcelUtil<InputPoverty> newExcelUtil=new NewExcelUtil<>(InputPoverty.class);
+        List<InputPoverty> list = null;
+        try {
+            list = newExcelUtil.importExcel(file.getInputStream(),0);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        List<OutPovertyFlag> trueList=new ArrayList<>();
+        List<OutPovertyFlag> falseList=new ArrayList<>();
+        Map<String, Object> param=new HashMap<>();
+        Map<String, Object> res=new HashMap<>();
+        Integer totalcount =0;
+        Integer effectiveCount =0;
+        for (InputPoverty in : list) {
+            String name=StringUtils.deleteWhitespace(in.getName());
+            String idCode=StringUtils.deleteWhitespace(in.getIdCard());
+            param.put("name",name);
+            param.put("idCode",idCode);
+            JSONObject jsonObject = HttpUtils.httpPostBody(flag_url, param);
+            String data = jsonObject.getString("data");
+            OutPovertyFlag outPovertyFlag=new OutPovertyFlag();
+            outPovertyFlag.setName(name);
+            if (StringUtils.equals(data,"true")){
+                outPovertyFlag.setPovertyStatus("是");
+                trueList.add(outPovertyFlag);
+            effectiveCount++;
+            }else if (StringUtils.equals(data,"false")){
+                outPovertyFlag.setPovertyStatus("否");
+                falseList.add(outPovertyFlag);
+            }else {
+                outPovertyFlag.setPovertyStatus("查询错误");
+                falseList.add(outPovertyFlag);
+            }
+            totalcount++;
+        }
+        res.put("trueList",trueList);
+        res.put("falseList",falseList);
+        res.put("totalcount",totalcount);
+        res.put("effectiveCount",effectiveCount);
+        res.put("id",id);
+        return res;
+    }
+}

+ 55 - 2
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -56,12 +56,43 @@ public class AsyncUtils {
 	private TOrderMidMapper tOrderMidMapper;
 	@Autowired
 	private RoleMapper roleMapper;
+@Autowired
+	private UserMapper userMapper;
+@Autowired
+	private AdminUserCountMapper adminUserCountMapper;
 
+	/**
+	 * 处理离职意见转交客户
+	 * 	转出去则全部为0,转入则判定当天有没有,有则修改没有新增
+	 * @param aid
+	 */
+    public  void updateAdminUserCount(String aid, List<AdminUserCount> tramsferList) {
+		adminUserCountMapper.updateUserCountResetting(aid);
+		pushAdminUserCount(tramsferList);
+	}
 
+	private void pushAdminUserCount(List<AdminUserCount> list) {
+		for (AdminUserCount e : list) {
+			String startTime=DateUtils.formatDate(e.getDateTime(),AFTConstants.YYYYMMDD);
+			AdminUserCount selectAUC = adminUserCountMapper.selectByaidAndDate(e.getAid(), startTime);
+			if (selectAUC==null){
+				adminUserCountMapper.insertSelective(e);
+			}else {
+				AdminUserCount newAUC=new AdminUserCount();
+				newAUC.setId(selectAUC.getId());
+				if (e.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+				if (e.getChannelCount()==null)selectAUC.setChannelCount(0);
+				if (e.getSignCount()==null)selectAUC.setSignCount(0);
+				newAUC.setPrivateCount(e.getPrivateCount());
+				newAUC.setChannelCount(e.getChannelCount());
+				newAUC.setSignCount(e.getSignCount());
+				adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+			}
+		}
+	}
 
 
-
-	public void patentSend(EmailBo bo) throws UnsupportedEncodingException, MessagingException {
+    public void patentSend(EmailBo bo) throws UnsupportedEncodingException, MessagingException {
 		SendEmailUtil.getInstance().patentSend(bo);
 	}
 
@@ -629,4 +660,26 @@ public class AsyncUtils {
 		updateFinanceExamine( id);
 		tOrderMidMapper.updateFinanceId(id,financeId);
 	}
+
+	public void updateAdminUserOrderCount(List<AdminUserCount> tramsferList) {
+		for (AdminUserCount e : tramsferList) {
+			String startTime=DateUtils.formatDate(e.getDateTime(),AFTConstants.YYYYMMDD);
+			AdminUserCount selectAUC = adminUserCountMapper.selectByaidAndDate(e.getAid(), startTime);
+			if (selectAUC==null){
+				adminUserCountMapper.insertSelective(e);
+			}else {
+				AdminUserCount newAUC=new AdminUserCount();
+				newAUC.setId(selectAUC.getId());
+				if (e.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+				if (e.getChannelCount()==null)selectAUC.setChannelCount(0);
+				if (e.getSignCount()==null)selectAUC.setSignCount(0);
+				if (e.getOrderCount()==null)selectAUC.setOrderCount(0);
+				newAUC.setPrivateCount(e.getPrivateCount());
+				newAUC.setChannelCount(e.getChannelCount());
+				newAUC.setSignCount(e.getSignCount());
+				newAUC.setOrderCount(e.getOrderCount());
+				adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+			}
+		}
+	}
 }

+ 37 - 15
src/main/java/com/goafanti/common/utils/HttpUtils.java

@@ -1,9 +1,7 @@
 package com.goafanti.common.utils;
 
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Map;
-
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.ParseException;
@@ -15,13 +13,15 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.util.EntityUtils;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.Map;
+import java.util.Set;
 
 public class HttpUtils {
-	
-	
-	
+
+
+
 	 public static JSONObject httpGet(String url) {
 			JSONObject jsonResult = null;
 			try {
@@ -39,19 +39,33 @@ public class HttpUtils {
 			}
 			return jsonResult;
 		}
-	    
+
+
+	public static JSONObject httpPost(String url,Map<String, Object>map){
+		return httpPost(url,map,0);
+	}
+	public static JSONObject httpPostBody(String url,Map<String, Object>map){
+		return httpPost(url,map,1);
+	}
 		 /**
-		  *  
+		  *
 		  * @param url 地址
 		  * @param map 参数
+		  * @param type  0 json  1body
 		  * @return
 		  */
-		public static JSONObject httpPost(String url,Map<String, Object>map){
+		public static JSONObject httpPost(String url,Map<String, Object>map,Integer type) {
 			HttpClient httpClient = HttpClientBuilder.create().build();
 			HttpPost httpPost = new HttpPost(url);
-			httpPost.addHeader("Content-type", "application/json");
 			httpPost.setHeader("Accept", "application/json");
-			httpPost.setEntity(new StringEntity(JSON.toJSONString(map), Charset.forName("UTF-8")));
+			if (type==0){
+				httpPost.addHeader("Content-type", "application/json");
+				httpPost.setEntity(new StringEntity(JSON.toJSONString(map), Charset.forName("UTF-8")));
+			}else{
+				httpPost.addHeader("Content-type", "application/x-www-form-urlencoded");
+				httpPost.setEntity(new StringEntity(ParamMap(map), Charset.forName("UTF-8")));
+			}
+
 			HttpResponse response = null;
 			try {
 				response = httpClient.execute(httpPost);
@@ -77,7 +91,15 @@ public class HttpUtils {
 			return jsonObj;
 			}
 
+	private static String ParamMap(Map<String, Object> map) {
+		StringBuffer str =new StringBuffer();
+		Set<String> strings = map.keySet();
+		for (String string : strings) {
+			str=str.append(string).append("=").append(map.get(string)).append("&");
+		}
+		String substring = str.substring(0, str.length() - 1);
+		return substring;
+	}
 
-		
 
 }

+ 86 - 3
src/main/java/com/goafanti/common/utils/StringUtils.java

@@ -6,7 +6,7 @@ import java.util.regex.Pattern;
 public class StringUtils extends org.apache.commons.lang3.StringUtils {
 	private static Pattern FRACTIONAL_NUMERIC = Pattern.compile("^[\\-+]?\\d+(\\.\\d+)?$");
 
-	private static Pattern CHINESE_CODE=Pattern.compile("[\u4e00-\u9fa5]");
+	private static Pattern CHINESE_CODE=Pattern.compile("^[\\u4e00-\\u9fa5]{0,}$");
 	public static boolean isFractionalNumeric(String val) {
 		return FRACTIONAL_NUMERIC.matcher(val).matches();
 	}
@@ -63,9 +63,92 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
 		}
 		return false;
 	}
+	private static Pattern CONTACT_MOBILE=Pattern.compile("^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$");
+	private static Pattern FIXED_MOBILE=Pattern.compile("\\d{3}-\\d{8}|\\d{4}-\\d{7}");
+	public static boolean isContactMobile(String str){
+		if (CONTACT_MOBILE.matcher(str).find()){
+			return true;
+		}else if (FIXED_MOBILE.matcher(str).find()){
+			return true;
+		}
+		return false;
+	}
 
 	public static void main(String[] args) {
-
-		System.out.println(isContainChinese("91430100060111212G"));
+		System.out.println(isContactMobile("17680140612"));
 	}
+
+
+	/*
+1.校验数字的表达式:
+数字:^[0-9]*$
+n位的数字:^\d{n}$
+至少n位的数字:^\d{n,}$
+m-n位的数字:^\d{m,n}$
+零和非零开头的数字:^(0|[1-9][0-9]*)$
+非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(\.[0-9]{1,2})?$
+带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,2})$
+正数、负数、和小数:^(\-|\+)?\d+(\.\d+)?$
+有两位小数的正实数:^[0-9]+(\.[0-9]{2})?$
+有1~3位小数的正实数:^[0-9]+(\.[0-9]{1,3})?$
+非零的正整数:^[1-9]\d*$ 或 ^([1-9][0-9]*){1,3}$ 或 ^\+?[1-9][0-9]*$
+非零的负整数:^\-[1-9][]0-9"*$ 或 ^-[1-9]\d*$
+非负整数:^\d+$ 或 ^[1-9]\d*|0$
+非正整数:^-[1-9]\d*|0$ 或 ^((-\d+)|(0+))$
+非负浮点数:^\d+(\.\d+)?$ 或 ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$
+非正浮点数:^((-\d+(\.\d+)?)|(0+(\.0+)?))$ 或 ^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$
+正浮点数:^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 或 ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
+负浮点数:^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 或 ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
+浮点数:^(-?\d+)(\.\d+)?$ 或 ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$
+
+2.校验字符的表达式:
+汉字:^[\u4e00-\u9fa5]{0,}$
+英文和数字:^[A-Za-z0-9]+$ 或 ^[A-Za-z0-9]{4,40}$
+长度为3-20的所有字符:^.{3,20}$
+由26个英文字母组成的字符串:^[A-Za-z]+$
+由26个大写英文字母组成的字符串:^[A-Z]+$
+由26个小写英文字母组成的字符串:^[a-z]+$
+由数字和26个英文字母组成的字符串:^[A-Za-z0-9]+$
+由数字、26个英文字母或者下划线组成的字符串:^\w+$ 或 ^\w{3,20}$
+中文、英文、数字包括下划线:^[\u4E00-\u9FA5A-Za-z0-9_]+$
+中文、英文、数字但不包括下划线等符号:^[\u4E00-\u9FA5A-Za-z0-9]+$ 或 ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$
+可以输入含有^%&',;=?$\"等字符:[^%&',;=?$\x22]+
+禁止输入含有~的字符:[^~\x22]+
+
+3:特殊需求表达式:
+Email地址:^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
+域名:[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?
+InternetURL:[a-zA-z]+://[^\s]* 或 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
+手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
+电话号码("XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX):^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
+国内电话号码(0511-4405222、021-87888822):\d{3}-\d{8}|\d{4}-\d{7}
+电话号码正则表达式(支持手机号码,3-4位区号,7-8位直播号码,1-4位分机号): ((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)
+身份证号(15位、18位数字),最后一位是校验位,可能为数字或字符X:(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)
+帐号是否合法(字母开头,允许5-16字节,允许字母数字下划线):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
+密码(以字母开头,长度在6~18之间,只能包含字母、数字和下划线):^[a-zA-Z]\w{5,17}$
+强密码(必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-10 之间):^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,10}$
+强密码(必须包含大小写字母和数字的组合,可以使用特殊字符,长度在8-10之间):^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
+日期格式:^\d{4}-\d{1,2}-\d{1,2}
+一年的12个月(01~09和1~12):^(0?[1-9]|1[0-2])$
+一个月的31天(01~09和1~31):^((0?[1-9])|((1|2)[0-9])|30|31)$
+钱的输入格式:
+有四种钱的表示形式我们可以接受:"10000.00" 和 "10,000.00", 和没有 "分" 的 "10000" 和 "10,000":^[1-9][0-9]*$
+这表示任意一个不以0开头的数字,但是,这也意味着一个字符"0"不通过,所以我们采用下面的形式:^(0|[1-9][0-9]*)$
+一个0或者一个不以0开头的数字.我们还可以允许开头有一个负号:^(0|-?[1-9][0-9]*)$
+这表示一个0或者一个可能为负的开头不为0的数字.让用户以0开头好了.把负号的也去掉,因为钱总不能是负的吧。下面我们要加的是说明可能的小数部分:^[0-9]+(.[0-9]+)?$
+必须说明的是,小数点后面至少应该有1位数,所以"10."是不通过的,但是 "10" 和 "10.2" 是通过的:^[0-9]+(.[0-9]{2})?$
+这样我们规定小数点后面必须有两位,如果你认为太苛刻了,可以这样:^[0-9]+(.[0-9]{1,2})?$
+这样就允许用户只写一位小数.下面我们该考虑数字中的逗号了,我们可以这样:^[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$
+1到3个数字,后面跟着任意个 逗号+3个数字,逗号成为可选,而不是必须:^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$
+备注:这就是最终结果了,别忘了"+"可以用"*"替代如果你觉得空字符串也可以接受的话(奇怪,为什么?)最后,别忘了在用函数时去掉去掉那个反斜杠,一般的错误都在这里
+xml文件:^([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
+中文字符的正则表达式:[\u4e00-\u9fa5]
+双字节字符:[^\x00-\xff] (包括汉字在内,可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1))
+空白行的正则表达式:\n\s*\r (可以用来删除空白行)
+HTML标记的正则表达式:<(\S*?)[^>]*>.*?|<.*? /> ( 首尾空白字符的正则表达式:^\s*|\s*$或(^\s*)|(\s*$) (可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等),非常有用的表达式)
+腾讯QQ号:[1-9][0-9]{4,} (腾讯QQ号从10000开始)
+中国邮政编码:[1-9]\d{5}(?!\d) (中国邮政编码为6位数字)
+IPv4地址:((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}
+
+*/
 }

+ 2 - 0
src/main/java/com/goafanti/core/cache/serializer/FastJsonRedisSerializer.java

@@ -29,6 +29,8 @@ public class FastJsonRedisSerializer implements RedisSerializer<Object> {
 		pc.addAccept("com.goafanti.permission.bo.PermissionBo");
 		pc.addAccept("com.goafanti.expenseAccount.bo.OutExpenseAccountStatistics");
 		pc.addAccept("java.util.Map");
+		pc.addAccept("com.goafanti.common.bo.OutPoverty");
+		pc.addAccept("com.goafanti.common.bo.OutPovertyFlag");
 
 	}
 

+ 8 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -571,4 +571,12 @@ public interface CustomerService {
 
 
 	void transferUser(List<String> uList, String aid, String uid);
+
+
+	/**
+	 *
+	 * @param aid
+	 * @param transferTime
+	 */
+	void updateAdminUserCount(String aid,Date transferTime);
 }

+ 145 - 19
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -106,7 +106,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	private PublicReleaseMapper publicReleaseMapper;
 	@Autowired
 	private SystemWebSocketHandler systemWebSocketHandler;
-
+	@Autowired
+	private AdminUserCountMapper adminUserCountMapper;
 	@Autowired
 	private	AsyncUtils asyncUtils;
 
@@ -450,9 +451,44 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		}
 		addUserLock(uid, TokenManager.getAdminId(), now, uList);
 		addUserTransferLog(uid, TokenManager.getAdminId(), null,0, null, now, uList);
+
+		updateAdminUserCount(user.getAid(),user.getTransferTime());
 		return 1;
 	}
 
+	/**
+	 *
+	 * @param  aid    管理员编号
+	 * @param  transferTime  客户转换时间
+	 */
+	@Override
+	public void updateAdminUserCount(String aid ,Date transferTime) {
+		String startTime=DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
+		String endTime=startTime+" 23:59:59";
+		AdminUserCount adminUserCount = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+		if (adminUserCount==null){
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			if(selectAUC!=null) adminUserCountMapper.insertSelective(selectAUC);
+		}else {
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			AdminUserCount newAUC=new AdminUserCount();
+			newAUC.setId(adminUserCount.getId());
+			if (selectAUC==null){
+				newAUC.setPrivateCount(0);
+				newAUC.setChannelCount(0);
+				newAUC.setSignCount(0);
+			}else {
+				if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+				if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
+				if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
+				newAUC.setPrivateCount(selectAUC.getPrivateCount());
+				newAUC.setChannelCount(selectAUC.getChannelCount());
+				newAUC.setSignCount(selectAUC.getSignCount());
+			}
+			adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+		}
+	}
+
 	private void checkUserName(InputAddCustomer in) {
 		if (userMapper.checkUser("", in.getName(), "", in.getType(), null, null).size() > 0)
 			throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, in.getName(), ""));
@@ -711,7 +747,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	@Transactional
 	public int addFollow(FollowBusinessBo fbb,String ufid,Integer mainStatus) throws BusinessException {
 		// 更新跟进记录表
-		SimpleDateFormat format = new SimpleDateFormat(AFTConstants.YYYYMMDDHHMMSS);
+		Date followTime=DateUtils.StringToDate(fbb.getFollowTime(),AFTConstants.YYYYMMDDHHMMSS);
 		UserFollow userFollow = new UserFollow();
 		String followId = ufid==null?UUID.randomUUID().toString():ufid;
 		userFollow.setId(followId);
@@ -722,11 +758,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		userFollow.setFollowDep(a.getDepartmentName());
 		userFollow.setContactType(Integer.parseInt(fbb.getContactType()));
 		userFollow.setEffective(DeleteStatus.UNDELETE.getCode());
-		try {
-			userFollow.setCreateTime(format.parse(fbb.getFollowTime()));
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
+		userFollow.setCreateTime(followTime);
 		userFollow.setOcbId(fbb.getOcbId());
 		userFollow.setResult(fbb.getResult());
 		userFollow.setUid(fbb.getUid());
@@ -801,11 +833,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					userBusiness.setFollowSituation(ub.getFollowSituation());
 					userBusiness.setRemarks(ub.getRemarks());
 					userBusiness.setUid(fbb.getUid());
-					try {
-						userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
-					} catch (ParseException e) {
-						e.printStackTrace();
-					}
+					userBusiness.setUpdateTime(followTime);
 					userBusiness.setAid(TokenManager.getAdminId());
 					userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
 					// 更新业务中间表
@@ -847,12 +875,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					// 更新业务表
 					userBusiness.setId(ubId);
 					userBusiness.setBusinessProjectId(ub.getBusinessProjectId());
-					try {
-						userBusiness.setCreateTime(format.parse(fbb.getFollowTime()));
-						userBusiness.setUpdateTime(format.parse(fbb.getFollowTime()));
-					} catch (ParseException e) {
-						e.printStackTrace();
-					}
+					userBusiness.setCreateTime(followTime);
+					userBusiness.setUpdateTime(followTime);
 					userBusiness.setCustomerStatus(ub.getCustomerStatus());
 					userBusiness.setFollowSituation(ub.getFollowSituation());
 					userBusiness.setUid(fbb.getUid());
@@ -875,9 +899,47 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		if (mainStatus==1){
 		followProject(fbb.getUid());
 		}
+		updateADminUserCountFollow(aid,followTime);
 		return 1;
 	}
 
+	private void updateADminUserCountFollow(String aid, Date transferTime) {
+		{
+			String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
+			String endTime=startTime+" 23:59:59";
+			AdminUserCount adminUserCount = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+			int count = userFollowMapper.selectByaidAndDate(aid, startTime, endTime);
+			if (adminUserCount==null){
+				AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+				if (selectAUC==null)selectAUC=new AdminUserCount();
+				selectAUC.setFollowCount(count);
+				selectAUC.setAid(aid);
+				selectAUC.setDateTime(transferTime);
+				adminUserCountMapper.insertSelective(selectAUC);
+			}else {
+				AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+				AdminUserCount newAUC=new AdminUserCount();
+				newAUC.setId(adminUserCount.getId());
+				newAUC.setFollowCount(count);
+				if (selectAUC==null){
+					newAUC.setPrivateCount(0);
+					newAUC.setChannelCount(0);
+					newAUC.setSignCount(0);
+				}else {
+					if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+					if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
+					if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
+					newAUC.setPrivateCount(selectAUC.getPrivateCount());
+					newAUC.setChannelCount(selectAUC.getChannelCount());
+					newAUC.setSignCount(selectAUC.getSignCount());
+				}
+
+				adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+			}
+
+		}
+	}
+
 	/**
 	 * 跟进更新用户中间表
 	 *
@@ -1234,6 +1296,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		user.setId(uid);
 		user.setTransferTime(now);
 		int flag = 0;
+		//记录旧数据值,与新数据值 将旧数据与新数据都需要更新
+		List<User> useList=new ArrayList<>();
+		List<User> newList=new ArrayList<>();
 		//领取
 		if (AFTConstants.USER_RECEIVE.equals(operatorType)) {
 			user.setAid(TokenManager.getAdminId());
@@ -1248,6 +1313,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
 				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER .equals(operatorType)
 				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER .equals(operatorType)) {
+
 			if (!isUs) {
 				user.setAid(aid);
 				if (data==1||data==3){
@@ -1270,6 +1336,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 						throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
 				}
 				updateUserMid(aid,uid,0,null);
+				//单客户转交,需要将客户原来得数据修改,需要将新数据刷新
+				User use = userMapper.selectByPrimaryKey(uid);
+				useList.add(use);
+				User newUser=new User();
+				newUser.setAid(aid);
+				newUser.setTransferTime(now);
+				newUser.setShareType(use.getShareType());
+				newList.add(newUser);
 			} else {
 				for (String us : uList) {
 					if (userMapper.getAidAndUser(us, TokenManager.getAdminId()) <= 0){
@@ -1281,6 +1355,14 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					if (data==2||data==3){
 						updateOrderHandOver(uid,aid,oldAid);
 					}
+					//单客户转交,需要将客户原来得数据修改,需要将新数据刷新
+					User use = userMapper.selectByPrimaryKey(us);
+					useList.add(use);
+					User newUser=new User();
+					newUser.setAid(aid);
+					newUser.setTransferTime(use.getTransferTime());
+					newUser.setShareType(use.getShareType());
+					newList.add(newUser);
 				}
 				if (AFTConstants.USER_TRANSFER_TO_OTHER == operatorType) {
 					flag = updateUsersLock(uList, oldAid, UserLockReleaseStatus.LOCKED.getCode(),
@@ -1309,9 +1391,35 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		} else {
 			userMapper.updateByPrimaryKeySelective(user);
 		}
+		//处理用户客户统计
+		if (AFTConstants.USER_RECEIVE.equals(operatorType)){
+			updateAdminUserCount(user.getAid(),user.getTransferTime());
+		}
+		if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
+				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER .equals(operatorType)
+				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER .equals(operatorType)) {
+			updateAdminUserCountTransfer(useList,newList);
+		}
 		return errors;
 	}
 
+	/**
+	 *
+	 * @param useList
+	 * @param newList
+	 */
+	private void updateAdminUserCountTransfer(List<User> useList, List<User> newList) {
+		for (User u : useList) {
+
+			updateAdminUserCount(u.getAid(),u.getTransferTime());
+		}
+		for (User u : newList) {
+
+			updateAdminUserCount(u.getAid(),u.getTransferTime());
+		}
+
+	}
+
 	@Override
 	public void transferUser(List<String> uList, String aid, String uid) {
 		if(uList.isEmpty())uList.add(uid);
@@ -1411,6 +1519,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	@Override
 	public int pushReceiveAsChannel(String uid) {
 		Date date = new Date();
+		User use=userMapper.selectByPrimaryKey(uid);
 		User u =new User();
 		String aid=TokenManager.getAdminId();
 		u.setId(uid);
@@ -1424,7 +1533,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		addUserLock(uid,aid, date, null); // 指定用户锁定客户
 		updateUserMid(aid,uid,0,null);
 		addUserTransferLog(uid, aid,null, 15, null, date, null);
-		return userMapper.updateByPrimaryKeySelective(u);
+		userMapper.updateByPrimaryKeySelective(u);
+		updateAdminUserCount(use.getAid(),use.getTransferTime());
+		return 1;
 	}
 
 	@Override
@@ -2266,9 +2377,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			utl.setUid(id);
 			userTransferLogMapper.insertSelective(utl);
 			userLockReleaseMapper.updateUserTypeLock(u.getId(), TokenManager.getAdminId(), 0, 2, date);
+			//用户客户统计移除时修改
+			updateAdminUserCount(u.getAid(),u.getTransferTime());
+
 		} else {
 			List<String> list = Arrays.asList(id.split(","));
 			List<UserTransferLog> ulList = new ArrayList<UserTransferLog>();
+			List<User> userList=new ArrayList<>();
 			for (String str : list) {
 				User u = userMapper.selectByPrimaryKey(str);
 				if (!u.getAid().equals(TokenManager.getAdminId())) {
@@ -2280,14 +2395,25 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 				utl.setType(6);
 				utl.setUid(str);
 				ulList.add(utl);
+				userList.add(u);
 			}
+
 			userTransferLogMapper.insertList(ulList);
 			userMapper.updateList(null, null, null, date, 1, list,null);
 			userLockReleaseMapper.updateUserTypeLockList(list, TokenManager.getAdminId(), 0, 2, date);
+			//批量移除客户,需要单独处理客户每天得计算。
+			updateAdminUserAllCount(userList);
 		}
 		return 1;
 	}
 
+	private void updateAdminUserAllCount(List<User> userList) {
+		for (User user : userList) {
+			updateAdminUserCount(user.getAid(),user.getTransferTime());
+		}
+	}
+
+
 	@Override
 	public List<userDaysBo> selectReleaseUserDays(String id) {
 		//渠道

+ 1 - 1
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -771,7 +771,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     @Override
     @CacheEvict(value = "expenseAccountStatistics#300", allEntries = true)
     public void statisticsEvict(String name, String depId, String startTime, String endTime) {
-        LoggerUtils.debug(getClass(), "报销统计清楚缓存。");
+        LoggerUtils.debug(getClass(), "报销统计缓存清除。");
     }
 
     @Override

+ 10 - 1
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -11,6 +11,7 @@ import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderNewWithBLOBs;
 import com.goafanti.common.model.TOrderRefundWithBLOBs;
 import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.*;
@@ -19,7 +20,6 @@ import com.goafanti.order.enums.OrderNewState;
 import com.goafanti.order.enums.SalesTypes;
 import com.goafanti.order.service.OrderAssistService;
 import com.goafanti.order.service.OrderNewService;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -213,6 +213,15 @@ public class AdminNewOrderApiController extends CertifyApiController {
 			if (StringUtils.isBlank(t.getContacts())||StringUtils.isBlank(t.getContactMobile())){
 				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "联系人与电话"));
 				return res;
+			}else {
+				if (!StringUtils.isContainChinese(t.getContacts())){
+					res.getError().add(buildError("联系人名称必须是中文。"));
+					return res;
+				}
+				if (!StringUtils.isContactMobile(t.getContactMobile())){
+					res.getError().add(buildError(ErrorConstants.MOBILE_PATTERN_ERROR));
+					return res;
+				}
 			}
 			if (orderNewService.checkORderTask(t.getOrderNo())) {
 				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "主项目"));

+ 13 - 10
src/main/java/com/goafanti/order/controller/OrderChangeApiController.java

@@ -1,15 +1,6 @@
 package com.goafanti.order.controller;
 
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
@@ -21,9 +12,14 @@ import com.goafanti.order.bo.InputNewOrderRefund;
 import com.goafanti.order.bo.InputTChangeTask;
 import com.goafanti.order.bo.NewOrderChangeBo;
 import com.goafanti.order.service.OrderChangeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.List;
 
 @RestController
 @RequestMapping(value = "/api/admin/orderChange")
@@ -253,6 +249,13 @@ public class OrderChangeApiController extends CertifyApiController {
 	}
 	/**
 	 *   变更审核
+	 *  赠送:营销-经理-总经理审核-财务(已收款情况)-总裁
+	 *  重报:营销-经理-总经理审核-技术员-财务-财务总监-总裁
+	 * 	仅项目:营销-经理-总经理审核-技术员-技术总监-财务-财务总监-总裁
+	 *  项目&金额:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁
+	 *  退单退款:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁-董事长(大于2K,需董事长审核)-财务退票
+	 *  退单不退款:营销-经理-总经理审核-技术员-经理经理-技术总监-财务-财务总监-总裁-财务退票
+	 * 	仅金额:营销-经理-总经理审核-技术总监-财务-财务总监-总裁
 	 */
 	@RequestMapping(value = "/orderChangeAudit", method = RequestMethod.POST)
 	public Result orderChangeAudit(String changeId,String remarks,Integer status,Integer processState,Integer rejectState){

+ 14 - 5
src/main/java/com/goafanti/order/controller/OrderProjectApiController.java

@@ -141,6 +141,14 @@ public class OrderProjectApiController extends CertifyApiController {
 	@RequestMapping(value="/updateOrderTask" ,method = RequestMethod.POST)
 	public Result updateOrderTask(TOrderTaskDetailBo t){
 		Result res=new Result();
+		if (!StringUtils.isContainChinese(t.getContacts())){
+			res.getError().add(buildError("联系人名称必须是中文。"));
+			return res;
+		}
+		if (!StringUtils.isContactMobile(t.getContactMobile())){
+			res.getError().add(buildError(ErrorConstants.MOBILE_PATTERN_ERROR));
+			return res;
+		}
 		res.setData(orderProjectService.updateOrderTask(t));
 		return res;
 	}
@@ -700,15 +708,16 @@ public class OrderProjectApiController extends CertifyApiController {
 
 	/**
 	 * 项目暂停列表
-	 *
+	 * @param shiroType  0=我的列表 1=审核列表
 	 */
 	@RequestMapping(value = "/selectProjectStop" ,method = RequestMethod.GET)
 	public Result selectProjectStop(String orderNo,String userName,String depId,String contractNo, String projectName,Integer status,
-									String startTime, String endTime, String receiverId, Integer pageNo,Integer pageSize){
+									String startTime, String endTime, String receiverId,
+									Integer shiroType,Integer pageNo,Integer pageSize){
 		Result res = new Result();
 
 		return res.data(orderProjectService.selectProjectStop(  orderNo, userName, depId, contractNo,
-				projectName, status,startTime,endTime,receiverId, pageNo, pageSize));
+				projectName, status,startTime,endTime,receiverId,  shiroType,pageNo, pageSize));
 	}
 
 	/**
@@ -717,10 +726,10 @@ public class OrderProjectApiController extends CertifyApiController {
 	 */
 	@RequestMapping(value = "/selectProjectStop/export" ,method = RequestMethod.GET)
 	public Result selectProjectSotpExport(String orderNo,String userName,String depId,String contractNo, String projectName,Integer status,
-									String startTime, String endTime, String receiverId, Integer pageNo,Integer pageSize){
+									String startTime, String endTime, String receiverId,Integer shiroType, Integer pageNo,Integer pageSize){
 		NewExcelUtil newExcelUtil=new NewExcelUtil(OutselectProjectSotpBo.class);
 		Pagination<?> p = orderProjectService.selectProjectStop(orderNo, userName, depId, contractNo,
-				projectName, status, startTime, endTime, receiverId, pageNo, pageSize);
+				projectName, status, startTime, endTime, receiverId, shiroType, pageNo, pageSize);
 		List<OutselectProjectSotp> list = (List<OutselectProjectSotp>) p.getList();
 		List<OutselectProjectSotpBo> list2=new ArrayList<>();
 			for (OutselectProjectSotp use : list) {

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -221,4 +221,6 @@ public interface OrderNewService {
 	 void addTTaskMember(Integer id, String serviceLife, String serviceYear, Integer yearSum, String contractTerm);
 
 	int updateTag(String orderNo, Integer tag);
+
+	void updateAdminUserCountOrder(String aid,Date transferTime);
 }

+ 1 - 1
src/main/java/com/goafanti/order/service/OrderProjectService.java

@@ -139,7 +139,7 @@ public interface OrderProjectService {
 	Integer updateProjectStop(InputProjectStop in);
 
 	Pagination<?> selectProjectStop(String orderNo, String userName, String depId, String contractNo, String projectName,
-							 Integer status,String startTime,String endTime,String receiverId, Integer pageNo, Integer pageSize);
+							 Integer status,String startTime,String endTime,String receiverId, Integer shiroType,Integer pageNo, Integer pageSize);
 
 	List<TaskStopLogBo> projectStopList(Integer taskStopId);
 

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

@@ -221,6 +221,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
 			pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_NO.getCode(),order, TokenManager.getAdminId(),t.getApproval());
 		}
+		orderNewService.updateAdminUserCountOrder(t.getSalesmanId(),t.getCreateTime());
 		return c;
 	}
 	public void pushGeneralSendNoticeAndEmail(List<String> alist, Integer type,TOrderNewBo o,String adminId,Integer approval){

+ 63 - 11
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -16,10 +16,7 @@ import com.goafanti.common.enums.OfficialPatentType;
 import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
-import com.goafanti.common.utils.AsyncUtils;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.common.utils.SendEmailUtil;
-import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.*;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
@@ -129,6 +126,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private TOrderPaymentMapper tOrderPaymentMapper;
 	@Autowired
 	private TOrderHighTechMapper tOrderHighTechMapper;
+	@Autowired
+	private AdminUserCountMapper adminUserCountMapper;
+
 
 	@Value(value = "${upload.path}")
 	private String					uploadPath			= null;
@@ -138,8 +138,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	@Override
 	public int createServiceOrder(String uid,Integer userType, Integer orderType,Integer salesType,String channelId,String other) {
 		BigDecimal initial = new BigDecimal(0);
+		Date date=new Date();
 		TOrderNew t=new TOrderNew();
-        Date date = new Date();
         String orderNo=idGenerator.generateId().toString();
 		t.setOrderNo(orderNo);
 		t.setOrderType(orderType);
@@ -467,7 +467,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	}
 
 	@Override
+	@Transactional
 	public int updateServiceOrder(TOrderNewWithBLOBs t, Integer isSubmit) {
+		Date date=new Date();
 		TOrderNew t2=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
 		//判断手机号码是否存在
 		if (StringUtils.isNotBlank(t.getContacts())&&StringUtils.isNotBlank(t.getContactMobile())&&
@@ -582,11 +584,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
 		}
+		//驳回重新发起,需要刷新当天和今天
+		boolean newOrderFlag=false;
 		if (t2.getApproval().equals(ApprovalNewState.ZCBH.getCode()) ||
 				t2.getApproval().equals(ApprovalNewState.DSZBH.getCode()) ||
 				t2.getOrderStatus().equals(OrderNewState.QDSHJJ.getCode()) ||
 				t2.getOrderStatus().equals(OrderNewState.YBH.getCode())) {
-			t.setCreateTime(new Date());
+			t.setCreateTime(date);
+			newOrderFlag=true;
 			tOrderBackMapper.updateByOrderNoAndBackStatus(t.getOrderNo());
 		}
 		// 0 相等
@@ -603,7 +608,49 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
 		}
-		return tOrderNewMapper.updateByPrimaryKeySelective(t);
+		tOrderNewMapper.updateByPrimaryKeySelective(t);
+		updateAdminUserCountOrder(t2.getSalesmanId(),t2.getCreateTime());
+		if (newOrderFlag){
+			updateAdminUserCountOrder(t2.getSalesmanId(),date);
+		}
+		return 1;
+	}
+
+	@Override
+	public void updateAdminUserCountOrder(String aid,Date transferTime) {
+		String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
+		String endTime=startTime+" 23:59:59";
+		AdminUserCount adminUserCount = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+		Integer orderCount = tOrderNewMapper.selectAidAndDate(aid, startTime, endTime);
+		if (adminUserCount==null){
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			if (selectAUC==null)selectAUC=new AdminUserCount();
+			selectAUC.setOrderCount(orderCount);
+			selectAUC.setAid(aid);
+			selectAUC.setDateTime(transferTime);
+			adminUserCountMapper.insertSelective(selectAUC);
+		}else {
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			AdminUserCount newAUC=new AdminUserCount();
+			newAUC.setId(adminUserCount.getId());
+			if (selectAUC==null){
+				newAUC.setPrivateCount(0);
+				newAUC.setChannelCount(0);
+				newAUC.setSignCount(0);
+				newAUC.setOrderCount(orderCount);
+			}else {
+				if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+				if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
+				if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
+				newAUC.setPrivateCount(selectAUC.getPrivateCount());
+				newAUC.setChannelCount(selectAUC.getChannelCount());
+				newAUC.setSignCount(selectAUC.getSignCount());
+				newAUC.setOrderCount(orderCount);
+			}
+
+			adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+		}
+
 	}
 
 	private void updateOrderMid(TOrderNew t) {
@@ -1069,6 +1116,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		}
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 		pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t2.getApproval());
+		updateAdminUserCountOrder(t2.getSalesmanId(),t2.getCreateTime());
 		return 1;
 	}
 
@@ -1159,7 +1207,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		List<OutNewOrderDunBo>  list =newOrderDunMapper.selectListNewOrderDun(orderNo,1);
 		BigDecimal cout=new BigDecimal(0);
 		for (OutNewOrderDunBo bo : list) {
-			cout=cout.add(bo.getMoney());
+			BigDecimal money = bo.getMoney();
+			if (money!=null)cout=cout.add(money);
 		}
 		tm.setOrderReceivables(cout);
 		BigDecimal sum=tm.getOrderReceivables().subtract(settlementAmount);
@@ -1429,7 +1478,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		order.setProcessStatus(t.getProcessStatus());
 		pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t2.getApproval());
 		//新增特批催款信息
-		return tOrderNewMapper.updateByPrimaryKeySelective(t);
+		tOrderNewMapper.updateByPrimaryKeySelective(t);
+		updateAdminUserCountOrder(t2.getSalesmanId(),t2.getCreateTime());
+		return 1;
 	}
 
 	@Override
@@ -1656,7 +1707,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	@Override
 	public int updatetechnicianBackOrder(String orderNo,String reason) {
 		TOrderNew t = checkDeleteSign(orderNo);
-
 		t.setOrderStatus(OrderNewState.YBH.getCode());
 		t.setProcessStatus(ProcessStatus.YPYXY.getCode());
 		t.setFinanceId("");
@@ -1665,7 +1715,9 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		aids.add(t.getSalesmanId());
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(orderNo);
 		pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_NO.getCode(),order, TokenManager.getAdminId(),t.getApproval());
-		return tOrderNewMapper.updateByPrimaryKeySelective(t);
+		tOrderNewMapper.updateByPrimaryKeySelective(t);
+		updateAdminUserCountOrder(t.getSalesmanId(),t.getCreateTime());
+		return 1;
 	}
 
 	private TOrderNew checkDeleteSign(String orderNo) {

+ 23 - 9
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -21,6 +21,7 @@ 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.customer.service.CustomerService;
 import com.goafanti.order.bo.*;
 import com.goafanti.order.controller.InputTaskStopLog;
 import com.goafanti.order.enums.*;
@@ -121,6 +122,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private TaskStopMapper taskStopMapper;
 	@Autowired
 	private TaskStopLogMapper taskStopLogMapper;
+	@Autowired
+	private CustomerService customerService;
 
 
 
@@ -188,6 +191,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		//处理订单信息
 		checkProjiectAllocation(t.getOrderNo());
 		pushTaskChange(TokenManager.getAdminId(),taskReceiverId,type,t.getOrderNo());
+		//派单后设置用户客户统计
+		if (type==0){
+			customerService.updateAdminUserCount(tn.getSalesmanId(),date);
+
+		}
 		return 1;
 	}
 
@@ -1572,7 +1580,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 
 	@Override
 	public Pagination<?> selectProjectStop(String orderNo, String userName, String depId, String contractNo, String projectName,
-										   Integer status,String startTime,String endTime,String receiverId, Integer pageNo, Integer pageSize) {
+										   Integer status,String startTime,String endTime,String receiverId,
+										   Integer shiroType,Integer pageNo, Integer pageSize) {
 		Map<String,Object>params =new HashMap<>();
 		if (orderNo!=null)params.put("orderNo",orderNo);
 		if (userName!=null)params.put("userName",userName);
@@ -1583,17 +1592,22 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		if (startTime!=null)params.put("startTime",startTime);
 		if (endTime!=null)params.put("endTime",endTime+" 23:59:59");
 		if (receiverId!=null)params.put("receiverId",receiverId);
-		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
-			params.put("shiro",0);
-		}else if (TokenManager.hasRole(AFTConstants.SALESMAN)||TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
-			params.put("shiro",1);
-			params.put("aid",TokenManager.getAdminId());
-		}else if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
-			params.put("shiro",2);
-			params.put("deps",departmentService.selectMyDeps());
+		if (shiroType==0){
+			if (TokenManager.hasRole(AFTConstants.SALESMAN)||TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
+				params.put("shiro",1);
+				params.put("aid",TokenManager.getAdminId());
+			}
+		}else if (shiroType==1){
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+				params.put("shiro",0);
+			}else  if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
+				params.put("shiro",2);
+				params.put("deps",departmentService.selectMyDeps());
+			}
 		}else {
 			return new Pagination<>();
 		}
+
 		return findPage("selectProjectSotpList","selectProjectSotpCount",params,pageNo,pageSize);
 	}
 

+ 8 - 8
src/main/java/com/goafanti/permission/controller/NewRoleApiController.java

@@ -47,27 +47,27 @@ public class NewRoleApiController extends BaseApiController{
 		JSONObject jo = (JSONObject) JSON.parse(data);
 		if (jo != null) {
 			JSONArray permissions = jo.getJSONArray("permissions");
-			List<String> permisionIds = new ArrayList<>();
+			List<String> permissionIds = new ArrayList<>();
 			for (int idx = 0; idx < permissions.size(); idx++) {
 				String pid = permissions.getString(idx);
-					if(pid!=null)permisionIds.add(pid);
+					if(pid!=null)permissionIds.add(pid);
 			}
 			Role records = jo.toJavaObject(Role.class);
 			String newName=roleMapper.selectNameById(records.getId());
 			if(newName==null){
-				String newid=roleMapper.selectIdByName(records.getRoleName());
-				if(newid!=null){
+				String newId=roleMapper.selectIdByName(records.getRoleName());
+				if(newId!=null){
 					res.getError().add(buildError("","角色已存在"));
 					return res;
 				}
 			}else{
-				String newid=roleMapper.selectIdByNamei(records);
-				if(newid!=null){
+				String newId=roleMapper.selectIdByNamei(records);
+				if(newId!=null){
 					res.getError().add(buildError("","角色已存在,请更换名称"));
 					return res;
 				}
 			}
-			res.setData(newRoleService.insert(records, permisionIds));
+			res.setData(newRoleService.insert(records, permissionIds));
 		} else {
 			res.getError().add(buildError("", "参数格式不正确"));
 		}
@@ -179,7 +179,7 @@ public class NewRoleApiController extends BaseApiController{
 			res.getError().add(buildError("","转移角色错误"));
 			return res;
 		}
-		res.setData(newRoleService.updatedimission(aid,transferId));
+		res.setData(newRoleService.updateDimission(aid,transferId));
 		return res;
 	}
 }

+ 6 - 12
src/main/java/com/goafanti/permission/service/NewRoleService.java

@@ -2,42 +2,36 @@ package com.goafanti.permission.service;
 
 
 
-import java.util.List;
-import java.util.Set;
-
-
 import com.goafanti.common.model.Role;
 import com.goafanti.common.model.RoleResources;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.permission.bo.RoleBo;
 import com.goafanti.permission.bo.RolePermissionBo;
 
+import java.util.List;
+
 public interface NewRoleService {
 	Pagination<RoleBo>findRoles(RoleBo role, Integer pageNo,
 			Integer pageSize);
-	
+
 	int insert(List<Role> records);
 
-	// 根据用户ID查询角色(role),放入到Authorization里。
-	Set<String> findRoleByUserId(String userId);
 
 	int deleteByPrimaryKeys(List<String> records);
 
 	int bindPermission(String roleId, String permissionId);
 
-	int unbindPermission(String roleId, String permissionId);
 
 	int bindUser(String roleId, String userId);
 
-	int unbindUser(String roleId, String userId);
 
 	int insert(Role record, List<String> permissions);
-	
+
 	List<RolePermissionBo> selectRolePList(String id);
-	
+
 	int addResources(String rid, String resources);
 
-	int updatedimission(String aid, String transferId);
+	int updateDimission(String aid, String transferId);
 
 	List<RoleResources> ResourcesDetail(String rid);
 }

+ 9 - 23
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
+
 @Service
 public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements NewRoleService {
 	@Autowired
@@ -76,10 +77,6 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 
 	}
 
-	@Override
-	public Set<String> findRoleByUserId(String userId) {
-		return roleMapper.findRoleByUserId(userId);
-	}
 
 
 
@@ -110,23 +107,6 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 		return userRoleMapper.insert(new UserRole(uid, rid));
 	}
 
-	@Override
-	public int unbindPermission(String roleId, String permissionId) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("rid", roleId);
-		params.put("pid", permissionId);
-		TokenManager.clearUserAuthByUserId((String[]) userRoleMapper.findUserIdByRoleId(roleId).toArray());
-		return rolePermissionMapper.deleteByPrimaryKey(params);
-	}
-
-	@Override
-	public int unbindUser(String roleId, String userId) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("rid", roleId);
-		params.put("uid", userId);
-		TokenManager.clearUserAuthByUserId(new String[] { userId });
-		return 0;
-	}
 
 	@Override
 	public int insert(Role record, List<String> permissions) {
@@ -177,7 +157,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 	}
 
 	@Override
-	public int updatedimission(String aid, String transferId) {
+	public int updateDimission(String aid, String transferId) {
 		List<Integer> list=roleResourcesMapper.selectAdminRoleResources(aid);
 		if (list.isEmpty()||list.get(0)==null) {
 			throw new BusinessException(new Error("","用户角色资源不存在"));
@@ -194,17 +174,20 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 				//所有客户转交给接受者
 				transferUserUpdateExamine(aid,transferId);
 				userMapper.updateDimissionTransfer(aid,transferId);
+				List<AdminUserCount> tramsferList = userMapper.selectListByaidAndDate(transferId);
+				asyncUtils.updateAdminUserCount(aid,tramsferList);
 			}else if (s==roleResources.QDYW.getCode()) {
 				userTransferLogMapper.insertUserLockLog(aid,transferId,date);
 				patentNewMapper.updateAdmin(aid,transferId);
 				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
-
 			}else if (s == roleResources.YQDD.getCode()) {
 				StringBuffer str=new StringBuffer();
 				str.append(admin.getName()).append("离职转交到").append(tadmin.getName());
 				tOrderLogMapper.insertOrderLog(aid,TokenManager.getAdminId(),date,str.toString());
 				tOrderNewMapper.updateSalesmanId(aid, transferId);
 				tOrderMidMapper.updateSalesmanId(aid, transferId);
+				List<AdminUserCount> tramsferList =adminMapper.selectAdminOrder(transferId);
+				asyncUtils.updateAdminUserOrderCount(tramsferList);
 			}else if (s == roleResources.XMRW.getCode()) {
 				// 获取被转角色判断修改对应任务角色
 				asyncUtils.pushTechTransfer(admin,tadmin,date);
@@ -216,6 +199,9 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 		return 1;
 	}
 
+
+
+
 	/**
 	 *
 	 * @param aid 离职id

+ 38 - 0
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -59,6 +59,8 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	private DepartmentService	departmentService;
 	@Autowired
 	private PublicExamineMapper publicExamineMapper;
+	@Autowired
+	private AdminUserCountMapper adminUserCountMapper;
 
 	@Override
 	@Transactional
@@ -650,6 +652,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		}
 		if (p.getStatus()!=null||p.getPublicType()!=null){
 			publicReleaseMapper.updateByPrimaryKeySelective(p);
+			updateAdminUserCountPublicRelease(use.getAid(),date);
 		}
 		if (a.getOpenId()!=null) {
 			if (remarks.length()>19) {
@@ -666,6 +669,41 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			return 1;
 	}
 
+	private void updateAdminUserCountPublicRelease(String aid, Date transferTime) {
+		String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
+		String endTime=startTime+" 23:59:59";
+		AdminUserCount adminUserCount = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+		int count = publicReleaseMapper.selectByaidAndDate(aid, startTime, endTime);
+		if (adminUserCount==null){
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			if (selectAUC==null)selectAUC=new AdminUserCount();
+			selectAUC.setPublicReleaseCount(count);
+			selectAUC.setAid(aid);
+			selectAUC.setDateTime(transferTime);
+			adminUserCountMapper.insertSelective(selectAUC);
+		}else {
+			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+			AdminUserCount newAUC=new AdminUserCount();
+			newAUC.setId(adminUserCount.getId());
+			newAUC.setPublicReleaseCount(count);
+			if (selectAUC==null){
+				newAUC.setPrivateCount(0);
+				newAUC.setChannelCount(0);
+				newAUC.setSignCount(0);
+			}else {
+				if (selectAUC.getPrivateCount()==null)selectAUC.setPrivateCount(0);
+				if (selectAUC.getChannelCount()==null)selectAUC.setChannelCount(0);
+				if (selectAUC.getSignCount()==null)selectAUC.setSignCount(0);
+				newAUC.setPrivateCount(selectAUC.getPrivateCount());
+				newAUC.setChannelCount(selectAUC.getChannelCount());
+				newAUC.setSignCount(selectAUC.getSignCount());
+			}
+
+			adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
+		}
+
+	}
+
 	private void addpublicLog(Integer id, Integer status, String remarks) {
 		PublicReleaseLog log = new PublicReleaseLog(id, TokenManager.getAdminId(), status, remarks, new Date());
 		publicReleaseLogMapper.insertSelective(log);

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -52,7 +52,7 @@ yxjl_max=100
 amb.maxLvl=6
 
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.81
+static.host=//static.jishutao.com/1.2.85
 rd.static.host=//static.jishutao.com/RD/1.0.00
 #avatar.host=//172.16.0.255:3000
 #static.host=//172.16.0.255:3000/1.2.62

+ 1 - 1
src/main/resources/props/config_test.properties

@@ -52,7 +52,7 @@ amb.maxLvl=6
 
 portal.host=//static.jishutao.com/portal/2.0.6
 avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.81
+static.host=//static.jishutao.com/1.2.85
 rd.static.host=//static.jishutao.com/RD/1.0.01
 avatar.upload.host=//static.jishutao.com/upload
 

+ 18 - 0
src/main/webapp/WEB-INF/views/admin/povertyInquiry.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:th="http://www.thymeleaf.org">
+<head th:replace="common::header(~{::title},~{::link})">
+	<title>管理中心首页</title>
+	<link th:href="${staticHost+'/dll/dll.css'}" rel="stylesheet">
+	<link th:href="${staticHost+'/admin/povertyInquiry.css'}" rel="stylesheet">
+</head>
+<body>
+	<div id="root"></div>
+
+	<div th:replace="common::footer(~{::script})">
+		<script type="text/javascript" th:src="${staticHost+'/vendors.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/dll/dll.js'}"></script>
+		<script type="text/javascript" th:src="${staticHost+'/admin/povertyInquiry.js'}"></script>
+	</div>
+</body>
+</html>