Kaynağa Gözat

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

anderx 2 yıl önce
ebeveyn
işleme
5fb21ea43e
26 değiştirilmiş dosya ile 1001 ekleme ve 71 silme
  1. 173 0
      src/main/java/com/goafanti/admin/bo/ConsultantStatisticsBo.java
  2. 76 0
      src/main/java/com/goafanti/admin/bo/ConsultantUserCount.java
  3. 20 4
      src/main/java/com/goafanti/admin/controller/AdminStatisticsController.java
  4. 1 1
      src/main/java/com/goafanti/admin/service/AdminService.java
  5. 3 1
      src/main/java/com/goafanti/admin/service/AdminStatisticsService.java
  6. 69 16
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java
  7. 74 8
      src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java
  8. 1 1
      src/main/java/com/goafanti/common/controller/PublicController.java
  9. 8 4
      src/main/java/com/goafanti/common/dao/AdminMapper.java
  10. 3 1
      src/main/java/com/goafanti/common/dao/AdminUserCountMapper.java
  11. 1 0
      src/main/java/com/goafanti/common/dao/TOrderTaskMapper.java
  12. 28 0
      src/main/java/com/goafanti/common/dao/TaskTimeMapper.java
  13. 62 0
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  14. 42 14
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml
  15. 7 4
      src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml
  16. 195 0
      src/main/java/com/goafanti/common/mapper/TaskTimeMapper.xml
  17. 136 0
      src/main/java/com/goafanti/common/model/TaskTime.java
  18. 15 2
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  19. 6 6
      src/main/java/com/goafanti/common/utils/DateUtils.java
  20. 3 0
      src/main/java/com/goafanti/customer/service/CustomerService.java
  21. 24 4
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  22. 4 1
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  23. 47 1
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  24. 1 1
      src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java
  25. 1 1
      src/main/resources/props/config_local.properties
  26. 1 1
      src/main/resources/props/config_test.properties

+ 173 - 0
src/main/java/com/goafanti/admin/bo/ConsultantStatisticsBo.java

@@ -0,0 +1,173 @@
+package com.goafanti.admin.bo;
+
+public class ConsultantStatisticsBo {
+    private String aid;
+    private Integer projectCount;
+    private Integer inProgress;
+    private Integer complete;
+    private Integer stop;
+    private Integer countPublicRelease;
+    private Integer countAssist;
+    private Integer notStarted;
+    private Integer rangeProjectCount;
+    private Integer rangeInProgress;
+    private Integer rangeComplete;
+    private Integer rangeStop;
+    private Integer rangeCountPublicRelease;
+    private Integer rangeCountAssist;
+    private Integer rangeNotStarted;
+    private Integer countChange;
+    private Integer orderPayment;
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public Integer getProjectCount() {
+        if (projectCount == null) return 0;
+        return projectCount;
+    }
+
+    public void setProjectCount(Integer projectCount) {
+        this.projectCount = projectCount;
+    }
+
+    public Integer getInProgress() {
+        if (inProgress == null) return 0;
+        return inProgress;
+    }
+
+    public void setInProgress(Integer inProgress) {
+        this.inProgress = inProgress;
+    }
+
+    public Integer getComplete() {
+        if (complete == null) return 0;
+        return complete;
+    }
+
+    public void setComplete(Integer complete) {
+        this.complete = complete;
+    }
+
+    public Integer getStop() {
+        if (stop == null) return 0;
+        return stop;
+    }
+
+    public void setStop(Integer stop) {
+        this.stop = stop;
+    }
+
+    public Integer getCountPublicRelease() {
+        if (countPublicRelease == null) return 0;
+        return countPublicRelease;
+    }
+
+    public void setCountPublicRelease(Integer countPublicRelease) {
+        this.countPublicRelease = countPublicRelease;
+    }
+
+    public Integer getCountAssist() {
+        if (countAssist == null) return 0;
+        return countAssist;
+    }
+
+    public void setCountAssist(Integer countAssist) {
+        this.countAssist = countAssist;
+    }
+
+    public Integer getNotStarted() {
+        if (notStarted == null) return 0;
+        return notStarted;
+    }
+
+    public void setNotStarted(Integer notStarted) {
+        this.notStarted = notStarted;
+    }
+
+    public Integer getRangeProjectCount() {
+        if (rangeProjectCount == null) return 0;
+        return rangeProjectCount;
+    }
+
+    public void setRangeProjectCount(Integer rangeProjectCount) {
+        this.rangeProjectCount = rangeProjectCount;
+    }
+
+    public Integer getRangeInProgress() {
+        if (rangeInProgress == null) return 0;
+        return rangeInProgress;
+    }
+
+    public void setRangeInProgress(Integer rangeInProgress) {
+        this.rangeInProgress = rangeInProgress;
+    }
+
+    public Integer getRangeComplete() {
+        if (rangeComplete == null) return 0;
+        return rangeComplete;
+    }
+
+    public void setRangeComplete(Integer rangeComplete) {
+        this.rangeComplete = rangeComplete;
+    }
+
+    public Integer getRangeStop() {
+        if (rangeStop == null) return 0;
+        return rangeStop;
+    }
+
+    public void setRangeStop(Integer rangeStop) {
+        this.rangeStop = rangeStop;
+    }
+
+    public Integer getRangeCountPublicRelease() {
+        if (rangeCountPublicRelease == null) return 0;
+        return rangeCountPublicRelease;
+    }
+
+    public void setRangeCountPublicRelease(Integer rangeCountPublicRelease) {
+        this.rangeCountPublicRelease = rangeCountPublicRelease;
+    }
+
+    public Integer getRangeCountAssist() {
+        if (rangeCountAssist == null) return 0;
+        return rangeCountAssist;
+    }
+
+    public void setRangeCountAssist(Integer rangeCountAssist) {
+        this.rangeCountAssist = rangeCountAssist;
+    }
+
+    public Integer getRangeNotStarted() {
+        if (rangeNotStarted == null) return 0;
+        return rangeNotStarted;
+    }
+
+    public void setRangeNotStarted(Integer rangeNotStarted) {
+        this.rangeNotStarted = rangeNotStarted;
+    }
+
+    public Integer getCountChange() {
+        if (countChange == null) return 0;
+        return countChange;
+    }
+
+    public void setCountChange(Integer countChange) {
+        this.countChange = countChange;
+    }
+
+    public Integer getOrderPayment() {
+        if (orderPayment == null) return 0;
+        return orderPayment;
+    }
+
+    public void setOrderPayment(Integer orderPayment) {
+        this.orderPayment = orderPayment;
+    }
+}

+ 76 - 0
src/main/java/com/goafanti/admin/bo/ConsultantUserCount.java

@@ -0,0 +1,76 @@
+package com.goafanti.admin.bo;
+
+public class ConsultantUserCount {
+    private String dates;
+    private Integer projectCount;
+    private  Integer inProgress;
+    private  Integer notStarted;
+    private  Integer complete;
+    private  Integer stop;
+    private  Integer countPublicRelease;
+    private  Integer countAssist;
+
+    public String getDates() {
+        return dates;
+    }
+
+    public void setDates(String dates) {
+        this.dates = dates;
+    }
+
+    public Integer getProjectCount() {
+        return projectCount;
+    }
+
+    public void setProjectCount(Integer projectCount) {
+        this.projectCount = projectCount;
+    }
+
+    public Integer getInProgress() {
+        return inProgress;
+    }
+
+    public void setInProgress(Integer inProgress) {
+        this.inProgress = inProgress;
+    }
+
+    public Integer getNotStarted() {
+        return notStarted;
+    }
+
+    public void setNotStarted(Integer notStarted) {
+        this.notStarted = notStarted;
+    }
+
+    public Integer getComplete() {
+        return complete;
+    }
+
+    public void setComplete(Integer complete) {
+        this.complete = complete;
+    }
+
+    public Integer getStop() {
+        return stop;
+    }
+
+    public void setStop(Integer stop) {
+        this.stop = stop;
+    }
+
+    public Integer getCountPublicRelease() {
+        return countPublicRelease;
+    }
+
+    public void setCountPublicRelease(Integer countPublicRelease) {
+        this.countPublicRelease = countPublicRelease;
+    }
+
+    public Integer getCountAssist() {
+        return countAssist;
+    }
+
+    public void setCountAssist(Integer countAssist) {
+        this.countAssist = countAssist;
+    }
+}

+ 20 - 4
src/main/java/com/goafanti/admin/controller/AdminStatisticsController.java

@@ -41,14 +41,30 @@ public class AdminStatisticsController extends CertifyApiController {
         return res;
     }
 
+
+    /**
+     * 咨询师首页信息
+     * @param startTime  开始时间
+     * @param endTime  结束时间
+     * @return
+     */
+    @RequestMapping(value = "/consultant/info", method = RequestMethod.GET)
+    public Result consultantInfo(String startTime,String endTime) {
+        Result res =new Result();
+        res.data(adminStatisticsService.consultantInfo(startTime, endTime));
+        return res;
+
+    }
+
     /**
-     * 营销首页信息清除
+     * 咨询首页折线图
      * @return
      */
-    @RequestMapping(value = "/lists/clean", method = RequestMethod.GET)
-    public Result listsClean () {
+    @RequestMapping(value = "/consultant/lists", method = RequestMethod.GET)
+    public Result consultantLists() {
         Result res =new Result();
-        res.data(adminStatisticsService.listsClean(TokenManager.getAdminId()));
+        res.data(adminStatisticsService.consultantLists(TokenManager.getAdminId()));
         return res;
     }
+
 }

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

@@ -85,5 +85,5 @@ public interface AdminService {
 	DepCountBo selectAllUser(String depId, String startTime, String endTime, String aName);
 
 
-    Object pushStatistics();
+    Object pushStatistics() ;
 }

+ 3 - 1
src/main/java/com/goafanti/admin/service/AdminStatisticsService.java

@@ -5,5 +5,7 @@ public interface AdminStatisticsService {
 
     Object lists(String aid);
 
-    Object listsClean(String adminId);
+    Object consultantInfo(String startTime, String endTime);
+
+    Object consultantLists(String adminId);
 }

+ 69 - 16
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -1,5 +1,7 @@
 package com.goafanti.admin.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.goafanti.admin.bo.*;
 import com.goafanti.admin.service.AdminService;
 import com.goafanti.admin.service.DepartmentService;
@@ -8,6 +10,7 @@ import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
+import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
@@ -47,6 +50,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	private NewAdminService newAdminService;
 	@Autowired
 	private AdminUserCountMapper adminUserCountMapper;
+	@Autowired
+	private TaskTimeMapper taskTimeMapper;
 
 
 
@@ -561,23 +566,71 @@ 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());
+//营销统计处理
+//		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());
+//		}
+		List<TOrderTask> allTimeRecord = taskTimeMapper.getAllTimeRecord();
+		List<TaskTime> list=new ArrayList<>();
+		for (TOrderTask e : allTimeRecord) {
+			String timeRecord = e.getTimeRecord();
+			System.out.println(e.getTimeRecord());
+			if (StringUtils.isNotBlank(e.getTimeRecord())){
+				Map<String,Object> map = JSON.parseObject(timeRecord, Map.class);
+				for (String s : map.keySet()) {
+					if (s.equals("2")||s.equals("3")||s.equals("29")||s.equals("19")||(s.equals("27"))){
+						JSONObject js = JSON.parseObject(map.get(s).toString());
+						Object date = js.get("date");
+						Object suspendImg  = js.get("suspendImg") ;
+						Object title = js.get("title") ;
+						Object certificateNumber = js.get("certificateNumber") ;
+						Object setUpAmount = js.get("setUpAmount") ;
+						Object appropriation = js.get("appropriation") ;
+						TaskTime tt=new TaskTime();
+						tt.setTid(e.getId());
+						tt.setProjectStatus(Integer.parseInt(s));
+						if (!Objects.isNull(date)){
+							String dates=date.toString();
+							if (StringUtils.isNotBlank(dates)){
+								Date date1 = DateUtils.StringToDate(dates, AFTConstants.YYYYMMDD);
+								tt.setDateTime(date1);
+							}
+						}
+						if (!Objects.isNull(setUpAmount))tt.setSetUpAmount(setUpAmount.toString());
+						if (!Objects.isNull(suspendImg))tt.setSuspendImg(suspendImg.toString());
+						if (!Objects.isNull(title))tt.setTitle(title.toString());
+						if (!Objects.isNull(certificateNumber))tt.setCertificateNumber(certificateNumber.toString());
+						if (!Objects.isNull(appropriation))tt.setAppropriation(appropriation.toString());
+						list.add(tt);
+//					taskTimeMapper.insertSelective(tt);
+					}
+				}
+			}
+		}
+		List<TaskTime> addList = new ArrayList<>();
+		for (int i = 0; i <list.size(); i++) {
+			addList.add(list.get(i));
+			if (addList.size()==50|| i==list.size() -1){
+				taskTimeMapper.insertBatch(addList);
+				try {
+					addList.clear();
+					Thread.sleep(500);
+				} catch (InterruptedException exception) {
+					exception.printStackTrace();
+				}
+			}
 		}
-
-
-
 		return 1;
 	}
 

+ 74 - 8
src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java

@@ -1,15 +1,15 @@
 package com.goafanti.admin.service.impl;
 
 import com.goafanti.admin.bo.AdminStatisticsBo;
+import com.goafanti.admin.bo.ConsultantStatisticsBo;
+import com.goafanti.admin.bo.ConsultantUserCount;
 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;
@@ -117,16 +117,82 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
     }
 
     @Override
-    @CacheEvict(value = "adminStatisticeLists#300", key = "'key:'+#aid")
-    public Object listsClean(String aid) {
-        LoggerUtils.debug(getClass(), "管理员信息统计缓存清除。");
-        return 1;
+    public Object consultantInfo(String startTime, String endTime) {
+        String aid=TokenManager.getAdminId();
+        endTime=endTime+" 23:59:59";
+        Integer shiroType=2;
+        if(TokenManager.hasRole(AFTConstants.TECH)){
+            shiroType=0;
+        }else if(TokenManager.hasRole(AFTConstants.TECH_MANAGER)){
+            shiroType=1;
+        }
+        ConsultantStatisticsBo res = adminMapper.consultantStatisticsInfo(aid,shiroType);
+        if (res.getCountPublicRelease()==null)res.setCountPublicRelease(0);
+        if (res.getOrderPayment()==null)res.setOrderPayment(0);
+        ConsultantStatisticsBo asb = adminMapper.consultantStatisticsInfoByTime(aid, startTime, endTime);
+        if (asb!=null){
+            res.setRangeProjectCount(asb.getProjectCount());
+            res.setRangeInProgress(asb.getInProgress());
+            res.setRangeNotStarted(asb.getNotStarted());
+            res.setRangeComplete(asb.getComplete());
+            res.setRangeStop(asb.getStop());
+            res.setRangeCountPublicRelease(asb.getCountPublicRelease());
+            res.setRangeCountAssist(asb.getCountAssist());
+        }
+        return res;
+    }
+
+    @Override
+    public Object consultantLists(String aid) {
+        //获取当月的列表
+        Map<String,Object> map=new LinkedHashMap<>();
+        Days days = new Days();
+        List<String> thisMonth = getThisMonth(days);
+        List<ConsultantUserCount> list = adminMapper.consultantthisMonthUser(days.firstDay,days.endDay, aid);
+        List<Integer>  projectCountList =new ArrayList<>();
+        List<Integer>  inProgressList =new ArrayList<>();
+        List<Integer>  notStartedList =new ArrayList<>();
+        List<Integer>  completeList =new ArrayList<>();
+        List<Integer>  stopList =new ArrayList<>();
+        List<Integer>  publicReleaseCountList =new ArrayList<>();
+        List<Integer>  assistCountList =new ArrayList<>();
+        int projectCount=0,inProgressCount=0,notStartedCount=0,completeCount=0,stopCount=0,publicReleaseCount=0,
+                assistCount=0;
+        for (String dates : thisMonth) {
+            for (ConsultantUserCount e : list) {
+                if (e.getDates().equals(dates)){
+                    projectCount=projectCount+e.getProjectCount();
+                    inProgressCount=inProgressCount+e.getInProgress();
+                    notStartedCount=notStartedCount+e.getNotStarted();
+                    completeCount=completeCount+e.getComplete();
+                    stopCount=stopCount+e.getStop();
+                    publicReleaseCount=publicReleaseCount+e.getCountPublicRelease();
+                    assistCount=assistCount+e.getCountAssist();
+                }
+            }
+            projectCountList.add(projectCount);
+            inProgressList.add(inProgressCount);
+            notStartedList.add(notStartedCount);
+            completeList.add(completeCount);
+            stopList.add(stopCount);
+            publicReleaseCountList.add(publicReleaseCount);
+            assistCountList.add(assistCount);
+        }
+        map.put("dates",thisMonth);
+        map.put("projectCountList",projectCountList);
+        map.put("inProgressList",inProgressList);
+        map.put("notStartedList",notStartedList);
+        map.put("completeList",completeList);
+        map.put("stopList",stopList);
+        map.put("publicReleaseCountList",publicReleaseCountList);
+        map.put("assistCountList",assistCountList);
+        return map;
     }
 
+
     public  List<String> getThisMonth(Days days) {
-        //获取当月的第一天
+        //获取三十天前的日期
         Date date=new Date();
-
         Calendar ca=Calendar.getInstance();
         ca.setTime(date);
         ca.add(Calendar.DAY_OF_MONTH,-30);

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

@@ -941,7 +941,7 @@ public class PublicController extends CertifyApiController {
 	}
 
 
-	@RequestMapping("/pushStatistics")
+	@RequestMapping("/pushStatistics2")
 	public Result pushStatistics (){
 		Result res =new Result();
 		res.data(adminService.pushStatistics());

+ 8 - 4
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -1,9 +1,6 @@
 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.admin.bo.*;
 import com.goafanti.common.bo.AdminNoticeBo;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.AdminUserCount;
@@ -193,4 +190,11 @@ public interface AdminMapper {
     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);
+
+    ConsultantStatisticsBo consultantStatisticsInfo(@Param("aid") String aid,@Param("type") Integer type);
+
+    ConsultantStatisticsBo consultantStatisticsInfoByTime(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<ConsultantUserCount> consultantthisMonthUser(@Param("firstDay")String firstDay, @Param("endDay")String endDay,
+                                                      @Param("aid")String aid);
 }

+ 3 - 1
src/main/java/com/goafanti/common/dao/AdminUserCountMapper.java

@@ -3,6 +3,8 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.AdminUserCount;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 public interface AdminUserCountMapper {
     int deleteByPrimaryKey(Integer id);
 
@@ -21,7 +23,7 @@ public interface AdminUserCountMapper {
     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);
+    List<AdminUserCount> selectByaidAndDate(@Param("aid") String aid, @Param("startTime") String startTime);
 
     void updateUserCountResetting(String aid);
 }

+ 1 - 0
src/main/java/com/goafanti/common/dao/TOrderTaskMapper.java

@@ -89,4 +89,5 @@ public interface TOrderTaskMapper {
     void updateDimissionTransferManager(@Param("aid")String aid, @Param("transferId")String transferId);
 
     List<String> selectOrderNoAllByaid(String aid);
+
 }

+ 28 - 0
src/main/java/com/goafanti/common/dao/TaskTimeMapper.java

@@ -0,0 +1,28 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.TOrderTask;
+import com.goafanti.common.model.TaskTime;
+
+import java.util.List;
+
+public interface TaskTimeMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(TaskTime record);
+
+    int insertSelective(TaskTime record);
+
+    TaskTime selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(TaskTime record);
+
+    int updateByPrimaryKey(TaskTime record);
+
+    int updateByTidAndProjectSelective(TaskTime tt);
+
+    List<TaskTime> selectByTidAndProject(TaskTime tt);
+
+    List<TOrderTask> getAllTimeRecord();
+
+    void insertBatch(List<TaskTime> addList);
+}

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

@@ -1320,4 +1320,66 @@
       and b.salesman_id = #{aid}
       and a.start_time  between #{startTime} and #{endTime}
   </select>
+  <select id="consultantStatisticsInfo" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
+    SELECT x.aid,x.projectCount,x.inProgress,x.complete,x.notStarted,x.stop,y.countPublicRelease,y.countAssist,z.countChange,v.orderPayment
+    from (select a.task_receiver aid,sum(commodity_quantity) projectCount, sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
+         sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
+         sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
+        from t_order_task a  where a.split_status in (0,2) and a.task_receiver = #{aid} group by a.task_receiver)x
+    left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
+        from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
+    left join (SELECT b.aid,count(DISTINCT a.order_no) countChange from new_order_change a
+        left join order_examine b on a.order_no =b.order_no where 1=1
+    <if test="type==2">
+      and a.process_state in (3,4)
+    </if>
+    <if test="type==0">
+      and a.process_state in (3)
+    </if>
+    <if test="type==1">
+      and a.process_state in (4)
+    </if>
+    and b.aid=#{aid} and b.status =0  group by b.aid)z on x.aid=z.aid
+    LEFT join (select b.task_receiver aid, count(*) orderPayment from t_order_payment a
+        left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
+        where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
+  </select>
+  <select id="consultantStatisticsInfoByTime" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
+    select x.aid,x.projectCount,x.inProgress,x.notStarted,y.complete,y.stop,z.countPublicRelease,z.countAssist
+    from (select a.task_receiver aid,sum(commodity_quantity) projectCount, sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
+        sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a  where a.split_status in (0,2)
+        and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x
+    left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
+        sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
+        where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
+        and b.date_time  BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on x.aid=y.aid
+    left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
+        from public_release a left join public_release_details b on a.id=b.prid where aid=  #{aid} and a.status =2
+        and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on x.aid=z.aid
+  </select>
+  <select id="consultantthisMonthUser" resultType="com.goafanti.admin.bo.ConsultantUserCount">
+    select x.dates,sum(projectCount)projectCount,sum(inProgress)inProgress,sum(notStarted)notStarted
+         ,0 complete,0 stop,0 countPublicRelease,0 countAssist
+    from (select commodity_quantity projectCount, if(a.project_status=1,commodity_quantity,0)inProgress,
+        if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
+        from t_order_task a  where a.split_status in (0,2) and a.task_receiver = #{aid}
+        and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+    union
+    select x.dates,0 projectCount,0 inProgress,0 notStarted,sum(complete)complete,sum(stop)stop,0,0
+    from (SELECT if(a.project_status in (19,27) ,commodity_quantity,0) complete,
+        if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
+        from t_order_task a left join task_time b on a.id=b.tid
+        where a.split_status in (0,2) and b.project_status =a.project_status
+        and a.task_receiver = #{aid} and b.date_time  BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+    union
+    select x.dates,0,0,0,0,0,sum(countPublicRelease)countPublicRelease,sum(countAssist)countAssist
+    from ( select if(a.`type` in (0,1,2),1,0) countPublicRelease,if(a.`type` in (3),1,0) countAssist,
+        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 aid= #{aid}
+    and a.status =2
+    and a.release_start  BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+  </select>
 </mapper>

+ 42 - 14
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -501,11 +501,25 @@ select
   a.process_state processState,a.back_status backStatus from new_order_change  noc left join  new_order_change a on noc.id=a.id
   left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id
   left join department e on b.order_dep=e.id
- 	<if test="processState==3">
- 	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
+    <if test="processState==3">
+      left join (select order_no, aid from order_examine where`type`=0
+      <if test="complete ==1">
+     and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+ 	group by order_no,aid)x on a.order_no = x.order_no
 	</if>
-	<if test="processState==4">
-	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
+    <if test="processState==4">
+      left join (select order_no, aid from order_examine where`type`=1
+      <if test="complete ==1">
+     and status=0
+     </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+	group by order_no,aid)x on a.order_no = x.order_no
 	</if>
 	where 1=1
 	<if test="processState==0">
@@ -580,7 +594,7 @@ select
 	<if test="complete ==1 and processState == 9">
 	 and (a.process_state = #{processState}  and a.status =1)
 	</if>
-	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
+	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
 	 and a.process_state &gt; #{processState}
 	</if>
 	<if test="complete ==2 and processState == 6">
@@ -614,12 +628,26 @@ select
   select count(*) from new_order_change noc left join  new_order_change a on noc.id=a.id
   left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id
   left join admin d on b.salesman_id=d.id left join department e on b.order_dep=e.id
-		<if test="processState==3">
- 	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
-	</if>
-	<if test="processState==4">
-	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
-	</if>
+    <if test="processState==3">
+      left join (select order_no, aid from order_examine where`type`=0
+      <if test="complete ==1">
+        and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+      group by order_no,aid)x on a.order_no = x.order_no
+    </if>
+    <if test="processState==4">
+      left join (select order_no, aid from order_examine where`type`=1
+      <if test="complete ==1">
+        and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+      group by order_no,aid)x on a.order_no = x.order_no
+    </if>
 	where 1=1
     <if test="processState==0">
       and b.salesman_id= #{aid}
@@ -693,9 +721,9 @@ select
     <if test="complete ==1 and processState == 9">
       and (a.process_state = #{processState} and   a.status =1)
     </if>
-	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
-	 and a.process_state &gt; #{processState}
-	</if>
+    <if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
+      and a.process_state &gt; #{processState}
+    </if>
 	<if test="complete ==2 and processState == 6">
 	 and a.process_state &gt; 6 and a.process_state &lt; 10
 	</if>

+ 7 - 4
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1059,11 +1059,12 @@
     e.approval,l.refund_status outsourceStatus,l.start_type outsourceType,ttm.certificates_count  alreadyNumber,f.nickname as userName,h.name as depName, l.company_name as outsourceName ,
     ifnull(k.hours,0) hours,a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId,b.`type` projectType,ttm.cost_amount costAmount,tm.salesman_name salesmanName ,
     ttm.party_amount  partyAmount,a.commodity_price commodityPrice,a.outsource,date_format(a.task_end_time,'%Y-%m-%d') taskEndTime,date_format(e.sign_time,'%Y-%m-%d') signTime,
-    date_format(e.create_time ,'%Y-%m-%d')creteTime,a.patent_type  patentType
+    date_format(e.create_time ,'%Y-%m-%d')creteTime,a.patent_type  patentType,tmer.service_year serviceYear
     from t_order_task a left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
     left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id left join t_order_mid tm on a.order_no =tm.order_no
     left join department h on e.order_dep=h.id  left join task_hours_count k on a.id=k.tid and a.task_receiver=k.aid left join t_order_outsource l
-    on a.id=l.tid  left join t_task_mid ttm  on a.id=ttm.tid where  e.delete_sign in (0,2,3)  and e.order_status in (2,4)
+    on a.id=l.tid  left join t_task_mid ttm  on a.id=ttm.tid left join t_task_member tmer on a.id=tmer.tid
+    where  e.delete_sign in (0,2,3)  and e.order_status in (2,4)
     and a.outsource= #{outsource,jdbcType=INTEGER}
     <if test="role == 0 ">
       and a.task_receiver= #{aid,jdbcType=VARCHAR}
@@ -1322,13 +1323,14 @@
     select  a.id,a.commodity_name as taskName,a.order_no as orderNo,c.cname,d.name as receiverName,
     a.project_status as projectStatus,a.task_status as taskStatus,date_format(a.task_distribution_time,'%Y-%m-%d') as taskDate,
     a.commodity_quantity as commodityQuantity,f.nickname as userName,h.name as depName,ifnull(i.alreadyNumber,0)as alreadyNumber,
-    a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId
+    a.split_status splitStatus,a.split_super splitSuper, a.split_id splitId,ttm.contract_term contractTerm,ttm.service_year serviceYear
     from (select task_id from t_task_log a where task_receiver=#{aid ,jdbcType=VARCHAR} UNION select task_id from t_task_log a
     where task_allocator=#{aid ,jdbcType=VARCHAR}) x left join  t_order_task a on x.task_id=a.id
     left join business_project b on a.commodity_id=b.id left join business_category c on b.cid=c.id
     left join admin d on a.task_receiver=d.id left join t_order_new e on a.order_no=e.order_no
     left join user f on e.buyer_id=f.id left join department h on e.order_dep=h.id
     left join (select task_id , sum(already_number) as alreadyNumber from task_progress group by task_id) i on a.id=i.task_id
+    left join t_task_member ttm on a.id=ttm.tid
     where e.delete_sign in(0,2,3)
     <if test="orderNo != null">
       and a.order_no= #{orderNo,jdbcType=VARCHAR}
@@ -2379,7 +2381,8 @@
   </select>
 
 
-  <delete id="deleteBySplitId" parameterType="java.lang.Integer">
+
+    <delete id="deleteBySplitId" parameterType="java.lang.Integer">
     delete from t_order_task
     where split_super = #{id,jdbcType=INTEGER}
   </delete>

+ 195 - 0
src/main/java/com/goafanti/common/mapper/TaskTimeMapper.xml

@@ -0,0 +1,195 @@
+<?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.TaskTimeMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TaskTime">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="tid" jdbcType="INTEGER" property="tid" />
+    <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
+    <result column="date_time" jdbcType="DATE" property="dateTime" />
+    <result column="suspend_img" jdbcType="VARCHAR" property="suspendImg" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="certificate_number" jdbcType="VARCHAR" property="certificateNumber" />
+    <result column="set_up_amount" jdbcType="VARCHAR" property="setUpAmount" />
+    <result column="appropriation" jdbcType="VARCHAR" property="appropriation" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, tid, project_status, date_time, suspend_img, title, certificate_number, set_up_amount,
+    appropriation, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from task_time
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from task_time
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskTime" useGeneratedKeys="true">
+    insert into task_time (tid, project_status, date_time,
+      suspend_img, title, certificate_number,
+      set_up_amount, appropriation, create_time
+      )
+    values (#{tid,jdbcType=INTEGER}, #{projectStatus,jdbcType=INTEGER}, #{dateTime,jdbcType=DATE},
+      #{suspendImg,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{certificateNumber,jdbcType=VARCHAR},
+      #{setUpAmount,jdbcType=VARCHAR}, #{appropriation,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TaskTime" useGeneratedKeys="true">
+    insert into task_time
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="tid != null">
+        tid,
+      </if>
+      <if test="projectStatus != null">
+        project_status,
+      </if>
+      <if test="dateTime != null">
+        date_time,
+      </if>
+      <if test="suspendImg != null">
+        suspend_img,
+      </if>
+      <if test="title != null">
+        title,
+      </if>
+      <if test="certificateNumber != null">
+        certificate_number,
+      </if>
+      <if test="setUpAmount != null">
+        set_up_amount,
+      </if>
+      <if test="appropriation != null">
+        appropriation,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="tid != null">
+        #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="projectStatus != null">
+        #{projectStatus,jdbcType=INTEGER},
+      </if>
+      <if test="dateTime != null">
+        #{dateTime,jdbcType=DATE},
+      </if>
+      <if test="suspendImg != null">
+        #{suspendImg,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="certificateNumber != null">
+        #{certificateNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="setUpAmount != null">
+        #{setUpAmount,jdbcType=VARCHAR},
+      </if>
+      <if test="appropriation != null">
+        #{appropriation,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TaskTime">
+    update task_time
+    <set>
+      <if test="tid != null">
+        tid = #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="projectStatus != null">
+        project_status = #{projectStatus,jdbcType=INTEGER},
+      </if>
+      <if test="dateTime != null">
+        date_time = #{dateTime,jdbcType=DATE},
+      </if>
+      <if test="suspendImg != null">
+        suspend_img = #{suspendImg,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        title = #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="certificateNumber != null">
+        certificate_number = #{certificateNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="setUpAmount != null">
+        set_up_amount = #{setUpAmount,jdbcType=VARCHAR},
+      </if>
+      <if test="appropriation != null">
+        appropriation = #{appropriation,jdbcType=VARCHAR},
+      </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.TaskTime">
+    update task_time
+    set tid = #{tid,jdbcType=INTEGER},
+      project_status = #{projectStatus,jdbcType=INTEGER},
+      date_time = #{dateTime,jdbcType=DATE},
+      suspend_img = #{suspendImg,jdbcType=VARCHAR},
+      title = #{title,jdbcType=VARCHAR},
+      certificate_number = #{certificateNumber,jdbcType=VARCHAR},
+      set_up_amount = #{setUpAmount,jdbcType=VARCHAR},
+      appropriation = #{appropriation,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+    <update id="updateByTidAndProjectSelective">
+      update task_time
+      <set>
+        <if test="dateTime != null">
+          date_time = #{dateTime,jdbcType=DATE},
+        </if>
+        <if test="suspendImg != null">
+          suspend_img = #{suspendImg,jdbcType=VARCHAR},
+        </if>
+        <if test="title != null">
+          title = #{title,jdbcType=VARCHAR},
+        </if>
+        <if test="certificateNumber != null">
+          certificate_number = #{certificateNumber,jdbcType=VARCHAR},
+        </if>
+        <if test="setUpAmount != null">
+          set_up_amount = #{setUpAmount,jdbcType=VARCHAR},
+        </if>
+        <if test="appropriation != null">
+          appropriation = #{appropriation,jdbcType=VARCHAR},
+        </if>
+      </set>
+      where tid = #{tid,jdbcType=INTEGER} and project_status =  #{projectStatus,jdbcType=INTEGER}
+    </update>
+  <select id="selectByTidAndProject" parameterType="com.goafanti.common.model.TaskTime" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from task_time
+    where tid = #{tid,jdbcType=INTEGER}
+  </select>
+  <select id="getAllTimeRecord" resultType="com.goafanti.common.model.TOrderTask">
+      SELECT id,time_record timeRecord
+      from t_order_task
+      where time_record is not null and split_status in (0,2)
+  </select>
+
+  <insert id="insertBatch">
+  insert into task_time (tid, project_status, date_time,
+  suspend_img, title, certificate_number,
+  set_up_amount, appropriation
+  ) values
+  <foreach collection="list" index="index" item="item" separator=",">
+    ( #{item.tid}, #{item.projectStatus},#{item.dateTime,jdbcType=DATE},
+    #{item.suspendImg},#{item.title},#{item.certificateNumber},
+    #{item.setUpAmount},#{item.appropriation}
+    )
+  </foreach>
+  </insert>
+</mapper>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 136 - 0
src/main/java/com/goafanti/common/model/TaskTime.java


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

@@ -74,7 +74,7 @@ public class AsyncUtils {
 	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);
+			AdminUserCount selectAUC = getAdminUserCount(e.getAid(),startTime);
 			if (selectAUC==null){
 				adminUserCountMapper.insertSelective(e);
 			}else {
@@ -91,6 +91,19 @@ public class AsyncUtils {
 		}
 	}
 
+	private AdminUserCount getAdminUserCount(String aid, String startTime) {
+		List<AdminUserCount> selectList = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+		AdminUserCount selectAUC=null;
+		if (selectList.size()==1){
+			selectAUC=selectList.get(0);
+		}else if (selectList.size()>1){
+			for (int i=1;i<selectList.size();i++){
+				adminUserCountMapper.deleteByPrimaryKey(selectList.get(i).getId());
+			}
+		}
+		return selectAUC;
+	}
+
 
     public void patentSend(EmailBo bo) throws UnsupportedEncodingException, MessagingException {
 		SendEmailUtil.getInstance().patentSend(bo);
@@ -664,7 +677,7 @@ public class AsyncUtils {
 	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);
+			AdminUserCount selectAUC = getAdminUserCount(e.getAid(),startTime);
 			if (selectAUC==null){
 				adminUserCountMapper.insertSelective(e);
 			}else {

+ 6 - 6
src/main/java/com/goafanti/common/utils/DateUtils.java

@@ -1,16 +1,15 @@
 package com.goafanti.common.utils;
 
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.error.BusinessException;
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.*;
 import java.util.Calendar;
 import java.util.Date;
 
-
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.error.BusinessException;
-import org.apache.commons.lang3.time.DateFormatUtils;
-
 public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 
 	public static final String	YEAR_SPAN		= "yearSpan";
@@ -464,7 +463,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 		try {
 			 date2=new SimpleDateFormat(format).parse(date);
 		} catch (ParseException e) {
-			throw new BusinessException("时间转换失败",e);
+			throw new BusinessException("时间转换失败,date="+date,e);
 		}
 		return date2;
 	}
@@ -527,4 +526,5 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
 		int days=(int)((now.getTime()-date.getTime())/(1000*3600*24));
 		return days;
 	}
+
 }

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

@@ -4,6 +4,7 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.error.BusinessException;
 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.core.mybatis.page.Pagination;
@@ -581,4 +582,6 @@ public interface CustomerService {
 	void updateAdminUserCount(String aid,Date transferTime);
 
 	void updateAdminUserCountByAid(String aid);
+
+	AdminUserCount getAdminUserCount(String aid, String startTime);
 }

+ 24 - 4
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -465,7 +465,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	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);
+		AdminUserCount adminUserCount=getAdminUserCount(aid,endTime);
 		if (adminUserCount==null){
 			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
 			if(selectAUC!=null) adminUserCountMapper.insertSelective(selectAUC);
@@ -494,7 +494,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		List<AdminUserCount> list = userMapper.selectListByaidAndDate(aid);
 			for (AdminUserCount e : list) {
 				String startTime=DateUtils.formatDate(e.getDateTime(),AFTConstants.YYYYMMDD);
-				AdminUserCount selectAUC = adminUserCountMapper.selectByaidAndDate(e.getAid(), startTime);
+				AdminUserCount selectAUC = getAdminUserCount(aid, startTime);
+
 				if (selectAUC==null){
 					adminUserCountMapper.insertSelective(e);
 				}else {
@@ -511,6 +512,26 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			}
 	}
 
+	/**
+	 * 用于处理异常多产生数据,删除多余数据修改原本数据
+	 * @param aid
+	 * @param startTime
+	 * @return
+	 */
+	@Override
+	public AdminUserCount getAdminUserCount(String aid, String startTime) {
+		List<AdminUserCount> selectList = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+		AdminUserCount selectAUC=null;
+		if (selectList.size()==1){
+			selectAUC=selectList.get(0);
+		}else if (selectList.size()>1){
+			for (int i=1;i<selectList.size();i++){
+				adminUserCountMapper.deleteByPrimaryKey(selectList.get(i).getId());
+			}
+		}
+		return selectAUC;
+	}
+
 	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(), ""));
@@ -929,7 +950,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		{
 			String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
 			String endTime=startTime+" 23:59:59";
-			AdminUserCount adminUserCount = adminUserCountMapper.selectByaidAndDate(aid, startTime);
+			AdminUserCount adminUserCount = getAdminUserCount(aid,startTime);
 			int count = userFollowMapper.selectByaidAndDate(aid, startTime, endTime);
 			if (adminUserCount==null){
 				AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
@@ -955,7 +976,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 					newAUC.setChannelCount(selectAUC.getChannelCount());
 					newAUC.setSignCount(selectAUC.getSignCount());
 				}
-
 				adminUserCountMapper.updateByPrimaryKeySelective(newAUC);
 			}
 

+ 4 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -23,6 +23,7 @@ import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.LockingReleaseBo;
+import com.goafanti.customer.service.CustomerService;
 import com.goafanti.order.bo.*;
 import com.goafanti.order.enums.*;
 import com.goafanti.order.service.OrderNewService;
@@ -123,6 +124,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	@Autowired
 	private DepartmentService departmentService;
 	@Autowired
+	private CustomerService	customerService;
+	@Autowired
 	private TOrderPaymentMapper tOrderPaymentMapper;
 	@Autowired
 	private TOrderHighTechMapper tOrderHighTechMapper;
@@ -620,7 +623,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	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);
+		AdminUserCount adminUserCount = customerService.getAdminUserCount(aid,startTime);
 		Integer orderCount = tOrderNewMapper.selectAidAndDate(aid, startTime, endTime);
 		if (adminUserCount==null){
 			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);

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

@@ -124,6 +124,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private TaskStopLogMapper taskStopLogMapper;
 	@Autowired
 	private CustomerService customerService;
+	@Autowired
+	private TaskTimeMapper taskTimeMapper;
 
 
 
@@ -422,6 +424,18 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	@Override
 	public TOrderTaskDetailBo orderTaskDetail(Integer id) {
 		TOrderTaskDetailBo t=tOrderTaskMapper.getOrderTaskDetail(id);
+		TaskTime tt=new TaskTime();
+		tt.setTid(t.getId());
+		tt.setProjectStatus(t.getProjectStatus());
+		List<TaskTime> taskTimes = taskTimeMapper.selectByTidAndProject(tt);
+		Map<String,Object> map=new HashMap<>();
+		for (TaskTime e : taskTimes) {
+			Map<String,Object> param=new HashMap<>();
+			param.put("date",DateUtils.formatDate(e.getDateTime(),AFTConstants.YYYYMMDD));
+			param.put("title",NewProjectStatus.getValueByCode(e.getProjectStatus()));
+			map.put(e.getProjectStatus().toString(),param);
+		}
+		t.setTimeRecord(JSON.toJSONString(map));
 		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)
 				||TokenManager.hasRole(AFTConstants.CUSTOMER_SERVICE)
 					||TokenManager.getAdminId().equals(t.getTaskReceiver())) {
@@ -552,7 +566,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		if(b.getSetUpAmount()!=null)t.setSetUpAmount(new BigDecimal(b.getSetUpAmount()));
 		if (b.getPubicityUrl()!=null)t.setPubicityUrl(b.getPubicityUrl());
 		TOrderTask task2=tOrderTaskMapper.selectByPrimaryKey(b.getTid());//查询出项目信息
-		if(b.getProjectStatus()!=task2.getProjectStatus()){
+		if(b.getProjectStatus()!=task2.getProjectStatus()||!b.getTimeRecord().equals(task2.getTimeRecord())){
 				TTaskMid taskMid = new TTaskMid();
 				taskMid.setTid(b.getTid());
 			if(b.getProjectStatus()==NewProjectStatus.YLX.getCode()||b.getProjectStatus()==NewProjectStatus.YNGS.getCode()){
@@ -578,6 +592,8 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 					taskMid.getCompleteCount()!=null ||taskMid.getStockCount()!=null){
 				tTaskMidMapper.updateByTid(taskMid);
 			}
+			//做计时处理
+			pushTaskTimes(t);
 			tOrderTaskMapper.updateByPrimaryKeySelective(t);
 			projectSplitPush(b.getTid(), b.getProjectStatus(),task2);
 			pushTaskLog(b.getTid(), b.getProjectStatus());
@@ -586,6 +602,22 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		return 1;
 	}
 
+	private void pushTaskTimes(TOrderTask t) {
+		Map<String,Object> map = JSON.parseObject(t.getTimeRecord(), Map.class);
+		for (String key : map.keySet()) {
+			Map map1 = JSON.parseObject(map.get(key).toString(), Map.class);
+				TaskTime tt=new TaskTime();
+				tt.setTid(t.getId());
+				tt.setProjectStatus(Integer.valueOf(key));
+			String date = map1.get("date").toString();
+			tt.setDateTime(DateUtils.StringToDate(date,AFTConstants.YYYYMMDD));
+			int i = taskTimeMapper.updateByTidAndProjectSelective(tt);
+			if (i==0){
+				taskTimeMapper.insertSelective(tt);
+			}
+		}
+	}
+
 	private void completeSendCustomerService(Integer id) {
 		OrderOperator orderOperator = tOrderTaskMapper.selectAidByParam(id);
 		String content=String.format("[%s]企业[%s]项目已完成,订单编号[%s]。",orderOperator.getBuyerName(),orderOperator.getProjectName(),orderOperator.getOrderNo());
@@ -1630,6 +1662,9 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			if (use.getType()==0){
 				task.setProjectStatus(NewProjectStatus.ZT.getCode());
 				str=str.append("已暂停");
+				//处理时间
+				pushExamineTaskTimes(task);
+
 			}else {
 				task.setProjectStatus(NewProjectStatus.JXZ.getCode());
 				str=str.append("进行中");
@@ -1643,6 +1678,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			TOrderTask task2 =new TOrderTask();
 			task2.setId(task.getId());
 			task2.setProjectStatus(task.getProjectStatus());
+
 			tOrderTaskMapper.updateByPrimaryKeySelective(task2);
 			tOrderMidMapper.updateStopProjectByOrderNo(task.getOrderNo());
 			if (task.getSplitStatus()==1){
@@ -1671,6 +1707,16 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		return taskStopMapper.updateByPrimaryKeySelective(t);
 	}
 
+	private void pushExamineTaskTimes(TOrderTask task) {
+		TaskTime tt=new TaskTime();
+		tt.setTid(task.getId());
+		tt.setProjectStatus(task.getProjectStatus());
+		tt.setDateTime(new Date());
+		int i = taskTimeMapper.updateByTidAndProjectSelective(tt);
+		if (i==0){
+			taskTimeMapper.insertSelective(tt);
+		}
+	}
 
 
 	private void examineProjectSotpAddNotice(TOrderTask task,Integer status,Integer sotpType) {

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

@@ -672,7 +672,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	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);
+		AdminUserCount adminUserCount = customerService.getAdminUserCount(aid,startTime);
 		Integer count = publicReleaseMapper.selectByaidAndDate(aid, startTime, endTime);
 		if (count==null){
             count=0;

+ 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.85
+static.host=//static.jishutao.com/1.2.87
 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.86
+static.host=//static.jishutao.com/1.2.87
 rd.static.host=//static.jishutao.com/RD/1.0.01
 avatar.upload.host=//static.jishutao.com/upload