0.5.1 更新首页
This commit is contained in:
parent
5676466435
commit
44953fbaf3
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.bst.customer.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
@ -30,7 +31,23 @@ public class CustomerQuery extends CustomerVO{
|
|||
@ApiModelProperty("参与人ID")
|
||||
private Long joinUserId;
|
||||
|
||||
@ApiModelProperty("上次跟进日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate lastFollowDate;
|
||||
|
||||
@ApiModelProperty("下次跟进日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate nextFollowDate;
|
||||
|
||||
@ApiModelProperty("创建日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> createDateRange;
|
||||
|
||||
@ApiModelProperty("下次跟进时间开始")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime nextFollowTimeStart;
|
||||
|
||||
@ApiModelProperty("下次跟进时间结束")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime nextFollowTimeEnd;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,8 @@ public interface CustomerMapper
|
|||
* 更新客户跟进时间
|
||||
*/
|
||||
int updateFollowTime(@Param("customerId") Long customerId,
|
||||
@Param("lastFollowTime") LocalDateTime lastFollowTime,
|
||||
@Param("nextFollowTime") LocalDateTime nextFollowTime
|
||||
);
|
||||
@Param("lastFollowTime") LocalDateTime lastFollowTime
|
||||
);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
|
|
|
@ -61,13 +61,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.pain != null and query.pain != ''"> and bc.pain like concat('%', #{query.pain}, '%')</if>
|
||||
<if test="query.attention != null and query.attention != ''"> and bc.attention like concat('%', #{query.attention}, '%')</if>
|
||||
<if test="query.demand != null and query.demand != ''"> and bc.demand like concat('%', #{query.demand}, '%')</if>
|
||||
<if test="query.lastFollowDate != null "> and date(bc.last_follow_time) = #{query.lastFollowDate}</if>
|
||||
<if test="query.nextFollowDate != null "> and date(bc.next_follow_time) = #{query.nextFollowDate}</if>
|
||||
<if test="query.nextFollowTimeStart != null "> and bc.next_follow_time >= #{query.nextFollowTimeStart}</if>
|
||||
<if test="query.nextFollowTimeEnd != null "> and bc.next_follow_time <= #{query.nextFollowTimeEnd}</if>
|
||||
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
|
||||
and date(bc.create_time) >= #{query.createDateRange[0]}
|
||||
and date(bc.create_time) <= #{query.createDateRange[1]}
|
||||
</if>
|
||||
<if test="query.joinUserId != null ">
|
||||
<if test="query.joinUserId != null ">
|
||||
and (
|
||||
bc.create_id = #{query.joinUserId}
|
||||
bc.create_id = #{query.joinUserId}
|
||||
or bc.follow_id = #{query.joinUserId}
|
||||
)
|
||||
</if>
|
||||
|
@ -202,18 +206,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<update id="updateFollowTime">
|
||||
update bst_customer
|
||||
update bst_customer bc
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="lastFollowTime != null">
|
||||
last_follow_time = if (last_follow_time is null or (#{lastFollowTime} >= last_follow_time),
|
||||
#{lastFollowTime},
|
||||
bc.last_follow_time = if (last_follow_time is null or (#{lastFollowTime} >= last_follow_time),
|
||||
#{lastFollowTime},
|
||||
last_follow_time),
|
||||
</if>
|
||||
<if test="nextFollowTime != null">
|
||||
next_follow_time = if (next_follow_time is null or (#{nextFollowTime} < next_follow_time and #{nextFollowTime} > now()),
|
||||
#{nextFollowTime},
|
||||
next_follow_time),
|
||||
</if>
|
||||
bc.next_follow_time = (
|
||||
select min(bcf.next_follow_time) from bst_customer_follow bcf
|
||||
where bcf.customer_id = #{customerId}
|
||||
and bcf.next_follow_time > now()
|
||||
)
|
||||
</trim>
|
||||
where id = #{customerId}
|
||||
</update>
|
||||
|
@ -230,7 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and deleted = false
|
||||
</update>
|
||||
|
||||
<!-- selectDailyCreateCount -->
|
||||
<!-- selectDailyCreateCount -->
|
||||
|
||||
<select id="selectDailyCreateCount" parameterType="CustomerQuery" resultMap="com.ruoyi.common.mapper.CommonMapper.LocalDateIntegerVO">
|
||||
select
|
||||
|
@ -242,5 +246,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
group by `key`
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -78,10 +78,9 @@ public interface CustomerService
|
|||
*
|
||||
* @param customerId 客户ID
|
||||
* @param lastFollowTime 新的跟进时间
|
||||
* @param nextFollowTime 新的下次跟进时间
|
||||
* @return
|
||||
*/
|
||||
int updateFollowTime(Long customerId, LocalDateTime lastFollowTime, LocalDateTime nextFollowTime);
|
||||
int updateFollowTime(Long customerId, LocalDateTime lastFollowTime);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
|
|
|
@ -146,11 +146,11 @@ public class CustomerServiceImpl implements CustomerService
|
|||
}
|
||||
|
||||
@Override
|
||||
public int updateFollowTime(Long customerId, LocalDateTime lastFollowTime, LocalDateTime nextFollowTime) {
|
||||
public int updateFollowTime(Long customerId, LocalDateTime lastFollowTime) {
|
||||
if (customerId == null) {
|
||||
return 0;
|
||||
}
|
||||
return customerMapper.updateFollowTime(customerId, lastFollowTime, nextFollowTime);
|
||||
return customerMapper.updateFollowTime(customerId, lastFollowTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CustomerFollowServiceImpl implements CustomerFollowService
|
|||
|
||||
if (insert > 0) {
|
||||
// 更新客户最近跟进时间
|
||||
customerService.updateFollowTime(data.getCustomerId(), data.getFollowTime(), data.getNextFollowTime());
|
||||
customerService.updateFollowTime(data.getCustomerId(), data.getFollowTime());
|
||||
}
|
||||
|
||||
return insert;
|
||||
|
@ -104,7 +104,7 @@ public class CustomerFollowServiceImpl implements CustomerFollowService
|
|||
|
||||
if (update > 0) {
|
||||
// 更新客户最近跟进时间
|
||||
customerService.updateFollowTime(data.getCustomerId(), data.getFollowTime(), data.getNextFollowTime());
|
||||
customerService.updateFollowTime(data.getCustomerId(), data.getFollowTime());
|
||||
}
|
||||
|
||||
return update;
|
||||
|
|
|
@ -86,8 +86,8 @@ public class Project extends BaseEntity
|
|||
@ApiModelProperty("完成时间")
|
||||
private LocalDateTime completeTime;
|
||||
|
||||
@Excel(name = "预计完成日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("预计完成日期")
|
||||
@Excel(name = "预计开发完成日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("预计开发完成日期")
|
||||
private LocalDate expectedCompleteDate;
|
||||
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ruoyi.bst.project.domain;
|
|||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -31,16 +33,20 @@ public class ProjectQuery extends ProjectVO {
|
|||
@ApiModelProperty("开始年份")
|
||||
private Integer startYear;
|
||||
|
||||
@ApiModelProperty("预计完成日期开始")
|
||||
@ApiModelProperty("预计开发完成日期开始")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate expectedCompleteDateStart;
|
||||
|
||||
@ApiModelProperty("预计完成日期结束")
|
||||
@ApiModelProperty("预计开发完成日期结束")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate expectedCompleteDateEnd;
|
||||
|
||||
@ApiModelProperty("维护到期日期开始")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate maintenanceEndDateStart;
|
||||
|
||||
@ApiModelProperty("维护到期日期结束")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate maintenanceEndDateEnd;
|
||||
|
||||
@ApiModelProperty("参与人ID")
|
||||
|
|
|
@ -32,8 +32,8 @@ public class ProjectVO extends Project{
|
|||
@ApiModelProperty("任务通过数量(需组装)")
|
||||
private Integer taskPassCount;
|
||||
|
||||
@ApiModelProperty("任务待确认数量(需组装)")
|
||||
private Integer taskWaitConfirmCount;
|
||||
@ApiModelProperty("任务进行中数量(需组装)")
|
||||
private Integer taskProcessCount;
|
||||
|
||||
@ApiModelProperty("项目成员列表(需组装)")
|
||||
private List<SysUserNameVO> memberList;
|
||||
|
|
|
@ -60,7 +60,7 @@ public enum ProjectStatus {
|
|||
* @return
|
||||
*/
|
||||
public static List<String> completedList() {
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
COMPLETED,
|
||||
ACCEPTED,
|
||||
MAINTENANCE,
|
||||
|
@ -71,8 +71,8 @@ public enum ProjectStatus {
|
|||
/**
|
||||
* 未完成开发的项目状态
|
||||
*/
|
||||
public static List<String> devNotFinish() {
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
public static List<String> devUnCompleted() {
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
WAIT_START,
|
||||
IN_PROGRESS
|
||||
);
|
||||
|
@ -83,7 +83,7 @@ public enum ProjectStatus {
|
|||
* @return
|
||||
*/
|
||||
public static List<String> canMaintenanceOverdue() {
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
return CollectionUtils.map(ProjectStatus::getStatus,
|
||||
MAINTENANCE
|
||||
);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface ProjectAssembler {
|
|||
* 组装任务待确认数量
|
||||
* @param list
|
||||
*/
|
||||
void assembleTaskWaitConfirmCount(List<ProjectVO> list);
|
||||
void assembleTaskProcessCount(List<ProjectVO> list);
|
||||
|
||||
/**
|
||||
* 组装项目成员列表
|
||||
|
|
|
@ -61,18 +61,18 @@ public class ProjectAssemblerImpl implements ProjectAssembler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void assembleTaskWaitConfirmCount(List<ProjectVO> list) {
|
||||
public void assembleTaskProcessCount(List<ProjectVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
Map<Long, Integer> taskCountMap = this.selectTaskCountByProjects(list, TaskStatus.WAIT_CONFIRM.getStatus());
|
||||
Map<Long, Integer> taskCountMap = this.selectTaskCountByProjects(list, TaskStatus.PROCESSING.getStatus());
|
||||
|
||||
for (ProjectVO project : list) {
|
||||
Integer count = taskCountMap.get(project.getId());
|
||||
if (count == null) {
|
||||
count = 0;
|
||||
}
|
||||
project.setTaskWaitConfirmCount(count);
|
||||
project.setTaskProcessCount(count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int selectCount(ProjectQuery query) {
|
||||
return projectMapper.selectCount(query);
|
||||
|
@ -260,7 +260,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
data.setStatus(ProjectStatus.DEVELOPMENT_OVERDUE.getStatus());
|
||||
|
||||
// 查询所有未完成开发的项目
|
||||
query.setStatusList(ProjectStatus.devNotFinish());
|
||||
query.setStatusList(ProjectStatus.devUnCompleted());
|
||||
query.setExpectedCompleteDateEnd(LocalDate.now());
|
||||
query.setDevOverdue(false);
|
||||
return this.updateByQuery(data, query);
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.ruoyi.bst.task.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -20,4 +24,20 @@ public class TaskQuery extends TaskVO{
|
|||
@ApiModelProperty("任务id列表")
|
||||
private List<Long> ids;
|
||||
|
||||
@ApiModelProperty("完成日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate passDate;
|
||||
|
||||
@ApiModelProperty("完成日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> passDateRange;
|
||||
|
||||
@ApiModelProperty("过期时间开始")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime expireTimeStart;
|
||||
|
||||
@ApiModelProperty("过期时间结束")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime expireTimeEnd;
|
||||
|
||||
}
|
||||
|
|
|
@ -69,6 +69,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<if test="query.projectOwnerId != null"> and bp.owner_id = #{query.projectOwnerId}</if>
|
||||
<if test="query.projectFollowId != null"> and bp.follow_id = #{query.projectFollowId}</if>
|
||||
<if test="query.passDate != null"> and date(bt.pass_time) = #{query.passDate}</if>
|
||||
<if test="query.expireTimeStart != null"> and bt.expire_time >= #{query.expireTimeStart}</if>
|
||||
<if test="query.expireTimeEnd != null"> and bt.expire_time <= #{query.expireTimeEnd}</if>
|
||||
<if test="query.passDateRange != null and query.passDateRange.size() > 0">
|
||||
and date(bt.pass_time) >= #{query.passDateRange[0]}
|
||||
and date(bt.pass_time) <= #{query.passDateRange[1]}
|
||||
</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and bt.status in
|
||||
<foreach item="item" collection="query.statusList" open="(" separator="," close=")">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.dashboard.customer.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -8,8 +9,9 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.ruoyi.bst.customer.domain.CustomerQuery;
|
||||
import com.ruoyi.bst.customer.service.CustomerService;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.vo.StringIntegerVO;
|
||||
import com.ruoyi.dashboard.customer.mapper.DashboardCustomerMapper;
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefKeys;
|
||||
import com.ruoyi.dashboard.index.domain.brief.CustomerBriefVO;
|
||||
|
||||
@Service
|
||||
|
@ -18,23 +20,72 @@ public class DashboardCustomerService {
|
|||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private DashboardCustomerMapper dashboardCustomerMapper;
|
||||
|
||||
public CustomerBriefVO selectCustomerBrief(CustomerQuery query) {
|
||||
List<StringIntegerVO> customerMap = customerService.selectCountGroupByStatus(query);
|
||||
CustomerBriefVO customerBriefVO = new CustomerBriefVO(customerMap);
|
||||
// 今日新增客户
|
||||
customerBriefVO.setToday(this.selectTodayCustomerCount(query));
|
||||
return customerBriefVO;
|
||||
public CustomerBriefVO selectCustomerBrief(CustomerQuery query, List<String> keyList) {
|
||||
CustomerBriefVO vo = new CustomerBriefVO();
|
||||
|
||||
if (keyList != null) {
|
||||
// 状态Map
|
||||
if (keyList.contains(BriefKeys.CUSTOMER_STATUS)) {
|
||||
List<StringIntegerVO> customerMap = this.selectCountGroupByStatus(query);
|
||||
vo.setStatus(customerMap);
|
||||
}
|
||||
// 今日新增客户
|
||||
if (keyList.contains(BriefKeys.CUSTOMER_TODAY_CREATE)) {
|
||||
vo.setToday(this.selectTodayCustomerCount(query));
|
||||
}
|
||||
// 今日已跟进客户
|
||||
if (keyList.contains(BriefKeys.CUSTOMER_TODAY_FOLLOWED)) {
|
||||
vo.setTodayFollowed(this.selectTodayFollowedCustomerCount(query));
|
||||
}
|
||||
// 今日待跟进客户
|
||||
if (keyList.contains(BriefKeys.CUSTOMER_TODAY_WAIT_FOLLOW)) {
|
||||
vo.setTodayWaitFollow(this.selectTodayWaitFollowCustomerCount(query));
|
||||
}
|
||||
// 即将跟进客户
|
||||
if (keyList.contains(BriefKeys.CUSTOMER_SOON_FOLLOW)) {
|
||||
vo.setSoonFollow(this.selectSoonFollowCustomerCount(query));
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
// 查询即将跟进客户数(下次跟进时间在1~2天)
|
||||
private int selectSoonFollowCustomerCount(CustomerQuery customerQuery) {
|
||||
CustomerQuery query = new CustomerQuery();
|
||||
BeanUtils.copyBeanProp(query, customerQuery);
|
||||
query.setNextFollowTimeStart(LocalDate.now().plusDays(1).atStartOfDay());
|
||||
query.setNextFollowTimeEnd(LocalDateTime.now().plusDays(2));
|
||||
return customerService.selectCount(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询今日新增客户数
|
||||
* @return
|
||||
*/
|
||||
private int selectTodayCustomerCount(CustomerQuery query) {
|
||||
// 查询今日待跟进客户数
|
||||
private int selectTodayWaitFollowCustomerCount(CustomerQuery customerQuery) {
|
||||
CustomerQuery query = new CustomerQuery();
|
||||
BeanUtils.copyBeanProp(query, customerQuery);
|
||||
query.setNextFollowDate(LocalDate.now());
|
||||
return customerService.selectCount(query);
|
||||
}
|
||||
|
||||
// 查询客户状态数量
|
||||
private List<StringIntegerVO> selectCountGroupByStatus(CustomerQuery customerQuery) {
|
||||
CustomerQuery query = new CustomerQuery();
|
||||
BeanUtils.copyBeanProp(query, customerQuery);
|
||||
return customerService.selectCountGroupByStatus(query);
|
||||
}
|
||||
|
||||
// 查询今日已跟进客户数
|
||||
private int selectTodayFollowedCustomerCount(CustomerQuery customerQuery) {
|
||||
CustomerQuery query = new CustomerQuery();
|
||||
BeanUtils.copyBeanProp(query, customerQuery);
|
||||
query.setLastFollowDate(LocalDate.now());
|
||||
return customerService.selectCount(query);
|
||||
}
|
||||
|
||||
// 查询今日新增客户数
|
||||
private int selectTodayCustomerCount(CustomerQuery customerQuery) {
|
||||
CustomerQuery query = new CustomerQuery();
|
||||
BeanUtils.copyBeanProp(query, customerQuery);
|
||||
query.setCreateDate(LocalDate.now());
|
||||
return customerService.selectCount(query);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.ruoyi.dashboard.index.domain.brief;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/2/24
|
||||
*/
|
||||
@Data
|
||||
public class BriefKeys {
|
||||
|
||||
// 项目
|
||||
// 项目状态
|
||||
public static final String PROJECT_STATUS = "projectStatus";
|
||||
// 项目开发完成
|
||||
public static final String PROJECT_DEV_COMPLETED = "projectDevCompleted";
|
||||
// 项目逾期开发未完成
|
||||
public static final String PROJECT_OVERDUE_DEV_UNCOMPLETED = "projectOverdueDevUncompleted";
|
||||
// 项目逾期开发完成
|
||||
public static final String PROJECT_OVERDUE_DEV_COMPLETED = "projectOverdueDevCompleted";
|
||||
// 项目开发逾期
|
||||
public static final String PROJECT_DEV_OVERDUE = "projectDevOverdue";
|
||||
// 开发即将到期项目
|
||||
public static final String PROJECT_DEV_SOON_EXPIRE = "projectDevSoonExpire";
|
||||
|
||||
// 任务
|
||||
// 状态数据
|
||||
public static final String TASK_STATUS = "taskStatus";
|
||||
// 类型分组数据
|
||||
public static final String TASK_TYPE = "taskType";
|
||||
// 逾期未完成
|
||||
public static final String TASK_OVERDUE_UNCOMPLETED = "taskOverdueUncompleted";
|
||||
// 逾期完成
|
||||
public static final String TASK_OVERDUE_COMPLETED = "taskOverdueCompleted";
|
||||
// 今日完成任务
|
||||
public static final String TASK_TODAY_COMPLETED = "taskTodayCompleted";
|
||||
// 即将到期任务
|
||||
public static final String TASK_SOON_EXPIRE = "taskSoonExpire";
|
||||
|
||||
// 客户
|
||||
// 状态分组数据
|
||||
public static final String CUSTOMER_STATUS = "customerStatus";
|
||||
// 今日新增客户
|
||||
public static final String CUSTOMER_TODAY_CREATE = "customerTodayCreate";
|
||||
// 今日已跟进客户
|
||||
public static final String CUSTOMER_TODAY_FOLLOWED = "customerTodayFollowed";
|
||||
// 今日待跟进客户
|
||||
public static final String CUSTOMER_TODAY_WAIT_FOLLOW = "customerTodayWaitFollow";
|
||||
// 即将跟进客户
|
||||
public static final String CUSTOMER_SOON_FOLLOW = "customerSoonFollow";
|
||||
}
|
|
@ -7,6 +7,8 @@ import com.ruoyi.bst.task.domain.TaskQuery;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BriefQuery {
|
||||
|
||||
|
@ -16,6 +18,9 @@ public class BriefQuery {
|
|||
@ApiModelProperty("数据隔离")
|
||||
private Boolean scope;
|
||||
|
||||
@ApiModelProperty("统计数据键值")
|
||||
private List<String> keys;
|
||||
|
||||
public ProjectQuery toProjectQuery() {
|
||||
ProjectQuery projectQuery = new ProjectQuery();
|
||||
projectQuery.setJoinUserId(joinUserId);
|
||||
|
@ -36,5 +41,5 @@ public class BriefQuery {
|
|||
customerQuery.setScope(scope);
|
||||
return customerQuery;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,31 +7,36 @@ import com.ruoyi.common.vo.StringIntegerVO;
|
|||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CustomerBriefVO {
|
||||
|
||||
@ApiModelProperty("客户总数")
|
||||
private Integer total;
|
||||
|
||||
@ApiModelProperty("今日新增客户数")
|
||||
private Integer today;
|
||||
|
||||
//状态
|
||||
@ApiModelProperty("潜在客户")
|
||||
private Integer potential;
|
||||
|
||||
@ApiModelProperty("意向客户")
|
||||
private Integer intention;
|
||||
|
||||
@ApiModelProperty("已成交")
|
||||
private Integer transaction;
|
||||
|
||||
@ApiModelProperty("失效客户")
|
||||
private Integer invalid;
|
||||
|
||||
public CustomerBriefVO(List<StringIntegerVO> statusMap) {
|
||||
@ApiModelProperty("今日新增客户数")
|
||||
private Integer today;
|
||||
|
||||
@ApiModelProperty("今日已跟进客户数")
|
||||
private Integer todayFollowed;
|
||||
|
||||
@ApiModelProperty("今日待跟进客户数")
|
||||
private Integer todayWaitFollow;
|
||||
|
||||
@ApiModelProperty("即将跟进客户数")
|
||||
private Integer soonFollow;
|
||||
|
||||
public void setStatus(List<StringIntegerVO> statusMap) {
|
||||
this.potential = statusMap.stream()
|
||||
.filter(vo -> CustomerStatus.POTENTIAL.getStatus().equals(vo.getKey()))
|
||||
.findFirst().map(StringIntegerVO::getValue).orElse(0);
|
||||
|
|
|
@ -36,6 +36,12 @@ public class ProjectBriefVO {
|
|||
@ApiModelProperty("开发逾期完成")
|
||||
private Integer devOverdueCompleted;
|
||||
|
||||
@ApiModelProperty("开发逾期")
|
||||
private Integer devOverdue;
|
||||
|
||||
@ApiModelProperty("开发即将到期")
|
||||
private Integer devSoonExpire;
|
||||
|
||||
public void setStatusGroup(List<StringIntegerVO> statusMap) {
|
||||
this.completed = statusMap.stream()
|
||||
.filter(vo -> ProjectStatus.COMPLETED.getStatus().equals(vo.getKey()))
|
||||
|
|
|
@ -13,7 +13,7 @@ public class TaskBriefVO {
|
|||
|
||||
@ApiModelProperty("任务总数")
|
||||
private Integer total;
|
||||
|
||||
|
||||
// 状态分组
|
||||
@ApiModelProperty("待完成")
|
||||
private Integer waitCompleted;
|
||||
|
@ -40,6 +40,12 @@ public class TaskBriefVO {
|
|||
@ApiModelProperty("逾期完成")
|
||||
private Integer overdueCompleted;
|
||||
|
||||
@ApiModelProperty("今日完成数")
|
||||
private Integer todayCompleted;
|
||||
|
||||
@ApiModelProperty("即将到期数")
|
||||
private Integer soonExpire;
|
||||
|
||||
// 设置状态分组数据
|
||||
public void setStatusGroup(List<StringIntegerVO> statusMap) {
|
||||
this.waitCompleted = statusMap.stream()
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package com.ruoyi.dashboard.index.service;
|
||||
|
||||
import com.ruoyi.bst.customer.domain.CustomerQuery;
|
||||
import com.ruoyi.bst.project.domain.ProjectQuery;
|
||||
import com.ruoyi.bst.task.domain.TaskQuery;
|
||||
import com.ruoyi.dashboard.customer.service.DashboardCustomerService;
|
||||
import com.ruoyi.dashboard.project.service.DashboardProjectService;
|
||||
import com.ruoyi.dashboard.task.service.DashboardTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefQuery;
|
||||
|
@ -8,7 +15,30 @@ import com.ruoyi.dashboard.index.domain.brief.BriefVO;
|
|||
@Service
|
||||
public class DashboardService {
|
||||
|
||||
@Autowired
|
||||
private DashboardProjectService dashboardProjectService;
|
||||
|
||||
@Autowired
|
||||
private DashboardTaskService dashboardTaskService;
|
||||
|
||||
@Autowired
|
||||
private DashboardCustomerService dashboardCustomerService;
|
||||
|
||||
public BriefVO selectBrief(BriefQuery query) {
|
||||
BriefVO result = new BriefVO();
|
||||
|
||||
// 项目概览
|
||||
ProjectQuery projectQuery = query.toProjectQuery();
|
||||
result.setProject(dashboardProjectService.selectProjectBrief(projectQuery, query.getKeys()));
|
||||
|
||||
// 任务概览
|
||||
TaskQuery taskQuery = query.toTaskQuery();
|
||||
result.setTask(dashboardTaskService.selectTaskBrief(taskQuery, query.getKeys()));
|
||||
|
||||
// 客户概览
|
||||
CustomerQuery customerQuery = query.toCustomerQuery();
|
||||
result.setCustomer(dashboardCustomerService.selectCustomerBrief(customerQuery, query.getKeys()));
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.ruoyi.dashboard.project.domain.brief;
|
||||
|
||||
|
||||
public class ProjectBriefKeys {
|
||||
|
||||
// 项目状态
|
||||
public static final String STATUS = "status";
|
||||
|
||||
// 项目开发完成
|
||||
public static final String DEV_COMPLETED = "devCompleted";
|
||||
|
||||
// 项目逾期开发未完成
|
||||
public static final String OVERDUE_DEV_UNCOMPLETED = "overdueDevUncompleted";
|
||||
|
||||
// 项目逾期开发完成
|
||||
public static final String OVERDUE_DEV_COMPLETED = "overdueDevCompleted";
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.ruoyi.dashboard.project.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -14,8 +14,8 @@ import com.ruoyi.bst.project.service.ProjectService;
|
|||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.vo.IntegerIntegerVO;
|
||||
import com.ruoyi.common.vo.StringIntegerVO;
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefKeys;
|
||||
import com.ruoyi.dashboard.index.domain.brief.ProjectBriefVO;
|
||||
import com.ruoyi.dashboard.project.domain.brief.ProjectBriefKeys;
|
||||
import com.ruoyi.dashboard.project.domain.monthProject.MonthProjectQuery;
|
||||
import com.ruoyi.dashboard.project.domain.monthProject.MonthProjectVO;
|
||||
import com.ruoyi.dashboard.project.domain.projectRate.ProjectRateVO;
|
||||
|
@ -64,34 +64,57 @@ public class DashboardProjectService {
|
|||
}
|
||||
|
||||
// 查询项目概览
|
||||
public ProjectBriefVO selectProjectBrief(ProjectQuery query, String ...keys) {
|
||||
public ProjectBriefVO selectProjectBrief(ProjectQuery query, List<String> keyList) {
|
||||
|
||||
ProjectBriefVO vo = new ProjectBriefVO();
|
||||
|
||||
if (keys != null) {
|
||||
List<String> keyList = Arrays.asList(keys);
|
||||
|
||||
if (keyList.contains(ProjectBriefKeys.STATUS)) {
|
||||
if (keyList != null) {
|
||||
if (keyList.contains(BriefKeys.PROJECT_STATUS)) {
|
||||
List<StringIntegerVO> projectMap = projectService.selectCountGroupByStatus(query);
|
||||
vo.setStatusGroup(projectMap);
|
||||
}
|
||||
if (keyList.contains(ProjectBriefKeys.DEV_COMPLETED)) {
|
||||
if (keyList.contains(BriefKeys.PROJECT_DEV_COMPLETED)) {
|
||||
int devCompleted = this.selectDevCompletedCount(query);
|
||||
vo.setDevCompleted(devCompleted);
|
||||
}
|
||||
if (keyList.contains(ProjectBriefKeys.OVERDUE_DEV_UNCOMPLETED)) {
|
||||
if (keyList.contains(BriefKeys.PROJECT_OVERDUE_DEV_UNCOMPLETED)) {
|
||||
int devOverdueUncompleted = this.selectDevOverdueUncompletedCount(query);
|
||||
vo.setDevOverdueUncompleted(devOverdueUncompleted);
|
||||
}
|
||||
if (keyList.contains(ProjectBriefKeys.OVERDUE_DEV_COMPLETED)) {
|
||||
if (keyList.contains(BriefKeys.PROJECT_OVERDUE_DEV_COMPLETED)) {
|
||||
int devOverdueCompleted = this.selectDevOverdueCompletedCount(query);
|
||||
vo.setDevOverdueCompleted(devOverdueCompleted);
|
||||
}
|
||||
if (keyList.contains(BriefKeys.PROJECT_DEV_OVERDUE)) {
|
||||
int devOverdue = this.selectDevOverdueCount(query);
|
||||
vo.setDevOverdue(devOverdue);
|
||||
}
|
||||
if (keyList.contains(BriefKeys.PROJECT_DEV_SOON_EXPIRE)) {
|
||||
int soonExpire = this.selectDevSoonExpireCount(query);
|
||||
vo.setDevSoonExpire(soonExpire);
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
// 查询开发即将到期项目数
|
||||
private int selectDevSoonExpireCount(ProjectQuery projectQuery) {
|
||||
ProjectQuery query = new ProjectQuery();
|
||||
BeanUtils.copyBeanProp(query, projectQuery);
|
||||
query.setStatusList(ProjectStatus.devUnCompleted());
|
||||
query.setExpectedCompleteDateEnd(LocalDate.now().plusDays(2)); // 剩余2天,即视为即将到期
|
||||
return projectService.selectCount(query);
|
||||
}
|
||||
|
||||
// 查询开发逾期项目数
|
||||
private int selectDevOverdueCount(ProjectQuery projectQuery) {
|
||||
ProjectQuery query = new ProjectQuery();
|
||||
BeanUtils.copyBeanProp(query, projectQuery);
|
||||
query.setDevOverdue(true);
|
||||
return projectService.selectCount(query);
|
||||
}
|
||||
|
||||
// 按月查询新增项目数
|
||||
public List<IntegerIntegerVO> selectCountGroupByCreateMonth(MonthProjectQuery query) {
|
||||
ProjectQuery projectQuery = new ProjectQuery();
|
||||
|
@ -162,7 +185,7 @@ public class DashboardProjectService {
|
|||
ProjectQuery query = new ProjectQuery();
|
||||
BeanUtils.copyBeanProp(query, projectQuery);
|
||||
query.setDevOverdue(true);
|
||||
query.setStatusList(ProjectStatus.devNotFinish());
|
||||
query.setStatusList(ProjectStatus.devUnCompleted());
|
||||
return projectService.selectCount(query);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package com.ruoyi.dashboard.task.domain.brief;
|
||||
|
||||
public class TaskBriefKeys {
|
||||
|
||||
// 状态数据
|
||||
public static final String STATUS = "status";
|
||||
|
||||
// 类型分组数据
|
||||
public static final String TYPE = "type";
|
||||
|
||||
// 逾期未完成
|
||||
public static final String OVERDUE_UNCOMPLETED = "overdueUncompleted";
|
||||
|
||||
// 逾期完成
|
||||
public static final String OVERDUE_COMPLETED = "overdueCompleted";
|
||||
|
||||
}
|
|
@ -1,48 +1,79 @@
|
|||
package com.ruoyi.dashboard.task.service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.task.domain.TaskQuery;
|
||||
import com.ruoyi.bst.task.domain.enums.TaskStatus;
|
||||
import com.ruoyi.bst.task.service.TaskService;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.vo.StringIntegerVO;
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefKeys;
|
||||
import com.ruoyi.dashboard.index.domain.brief.TaskBriefVO;
|
||||
import com.ruoyi.dashboard.task.domain.brief.TaskBriefKeys;
|
||||
|
||||
@Service
|
||||
public class DashboardTaskService {
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
public TaskBriefVO selectTaskBrief(TaskQuery query, String ...keys) {
|
||||
public TaskBriefVO selectTaskBrief(TaskQuery query, List<String> keyList) {
|
||||
TaskBriefVO vo = new TaskBriefVO();
|
||||
if (keys != null) {
|
||||
List<String> keyList = Arrays.asList(keys);
|
||||
if (keyList.contains(TaskBriefKeys.STATUS)) {
|
||||
if (keyList != null) {
|
||||
if (keyList.contains(BriefKeys.TASK_STATUS)) {
|
||||
List<StringIntegerVO> statusMap = taskService.selectCountGroupByStatus(query);
|
||||
vo.setStatusGroup(statusMap);
|
||||
}
|
||||
if (keyList.contains(TaskBriefKeys.TYPE)) {
|
||||
if (keyList.contains(BriefKeys.TASK_TYPE)) {
|
||||
List<StringIntegerVO> typeMap = taskService.selectCountGroupByType(query);
|
||||
vo.setTypeGroup(typeMap);
|
||||
}
|
||||
if (keyList.contains(TaskBriefKeys.OVERDUE_UNCOMPLETED)) {
|
||||
if (keyList.contains(BriefKeys.TASK_OVERDUE_UNCOMPLETED)) {
|
||||
vo.setOverdueUncompleted(this.selectCountOverdueUncompleted(query));
|
||||
}
|
||||
if (keyList.contains(TaskBriefKeys.OVERDUE_COMPLETED)) {
|
||||
if (keyList.contains(BriefKeys.TASK_OVERDUE_COMPLETED)) {
|
||||
vo.setOverdueCompleted(this.selectCountOverdueCompleted(query));
|
||||
}
|
||||
if (keyList.contains(BriefKeys.TASK_TODAY_COMPLETED)) {
|
||||
vo.setTodayCompleted(this.selectCountTodayCompleted(query));
|
||||
}
|
||||
if (keyList.contains(BriefKeys.TASK_SOON_EXPIRE)) {
|
||||
vo.setSoonExpire(this.selectCountSoonExpire(query));
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询即将过期的任务数
|
||||
* @param taskQuery
|
||||
* @return
|
||||
*/
|
||||
private int selectCountSoonExpire(TaskQuery taskQuery) {
|
||||
TaskQuery query = new TaskQuery ();
|
||||
BeanUtils.copyBeanProp(query, taskQuery);
|
||||
query.setStatusList(TaskStatus.unComplete());
|
||||
query.setExpireTimeEnd(LocalDateTime.now().plusDays(2)); // 查询剩余过期时间小于48小时,且未完成的任务
|
||||
return taskService.selectCount(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询今日完成任务数
|
||||
* @param taskQuery
|
||||
* @return
|
||||
*/
|
||||
private int selectCountTodayCompleted(TaskQuery taskQuery) {
|
||||
TaskQuery query = new TaskQuery();
|
||||
BeanUtils.copyBeanProp(query, taskQuery);
|
||||
query.setStatusList(TaskStatus.complete());
|
||||
query.setPassDate(LocalDate.now());
|
||||
return taskService.selectCount(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询逾期未完成任务数
|
||||
* @param taskQuery
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.notice.domain.Notice;
|
||||
import com.ruoyi.bst.notice.domain.NoticeQuery;
|
||||
import com.ruoyi.bst.notice.domain.NoticeVO;
|
||||
|
@ -53,6 +54,7 @@ public class NoticeController extends BaseController
|
|||
public TableDataInfo list(NoticeQuery query)
|
||||
{
|
||||
startPage();
|
||||
PageHelper.orderBy("top desc, create_time desc");
|
||||
startOrderBy();
|
||||
List<NoticeVO> list = noticeService.selectNoticeListScope(query);
|
||||
noticeAssembler.assembleReceiveUserList(list);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ProjectController extends BaseController
|
|||
List<ProjectVO> list = projectService.selectProjectList(query);
|
||||
projectAssembler.assembleTaskCount(list);
|
||||
projectAssembler.assembleTaskPassCount(list);
|
||||
projectAssembler.assembleTaskWaitConfirmCount(list);
|
||||
projectAssembler.assembleTaskProcessCount(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,19 +5,10 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.customer.domain.CustomerQuery;
|
||||
import com.ruoyi.bst.project.domain.ProjectQuery;
|
||||
import com.ruoyi.bst.task.domain.TaskQuery;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.dashboard.customer.service.DashboardCustomerService;
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefQuery;
|
||||
import com.ruoyi.dashboard.index.domain.brief.BriefVO;
|
||||
import com.ruoyi.dashboard.index.service.DashboardService;
|
||||
import com.ruoyi.dashboard.project.domain.brief.ProjectBriefKeys;
|
||||
import com.ruoyi.dashboard.project.service.DashboardProjectService;
|
||||
import com.ruoyi.dashboard.task.domain.brief.TaskBriefKeys;
|
||||
import com.ruoyi.dashboard.task.service.DashboardTaskService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard")
|
||||
|
@ -26,62 +17,11 @@ public class DashboardController extends BaseController {
|
|||
@Autowired
|
||||
private DashboardService dashboardService;
|
||||
|
||||
@Autowired
|
||||
private DashboardProjectService dashboardProjectService;
|
||||
|
||||
@Autowired
|
||||
private DashboardTaskService dashboardTaskService;
|
||||
|
||||
@Autowired
|
||||
private DashboardCustomerService dashboardCustomerService;
|
||||
|
||||
// 获取本人的统计数据
|
||||
@GetMapping("/mineBrief")
|
||||
public AjaxResult mineBrief(BriefQuery query) {
|
||||
query.setJoinUserId(getUserId());
|
||||
query.setScope(true);
|
||||
|
||||
BriefVO result = new BriefVO();
|
||||
|
||||
// 项目概览
|
||||
ProjectQuery projectQuery = query.toProjectQuery();
|
||||
result.setProject(dashboardProjectService.selectProjectBrief(projectQuery, ProjectBriefKeys.STATUS));
|
||||
|
||||
// 任务概览
|
||||
TaskQuery taskQuery = query.toTaskQuery();
|
||||
result.setTask(dashboardTaskService.selectTaskBrief(taskQuery, TaskBriefKeys.STATUS));
|
||||
|
||||
// 客户概览
|
||||
CustomerQuery customerQuery = query.toCustomerQuery();
|
||||
result.setCustomer(dashboardCustomerService.selectCustomerBrief(customerQuery));
|
||||
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
// 获取统计数据
|
||||
@GetMapping("/brief")
|
||||
public AjaxResult brief(BriefQuery query) {
|
||||
BriefVO result = new BriefVO();
|
||||
|
||||
// 项目概览
|
||||
ProjectQuery projectQuery = query.toProjectQuery();
|
||||
result.setProject(dashboardProjectService.selectProjectBrief(projectQuery,
|
||||
ProjectBriefKeys.STATUS,
|
||||
ProjectBriefKeys.DEV_COMPLETED,
|
||||
ProjectBriefKeys.OVERDUE_DEV_UNCOMPLETED,
|
||||
ProjectBriefKeys.OVERDUE_DEV_COMPLETED
|
||||
));
|
||||
|
||||
// 任务概览
|
||||
TaskQuery taskQuery = query.toTaskQuery();
|
||||
result.setTask(dashboardTaskService.selectTaskBrief(taskQuery,
|
||||
TaskBriefKeys.STATUS,
|
||||
TaskBriefKeys.TYPE,
|
||||
TaskBriefKeys.OVERDUE_UNCOMPLETED,
|
||||
TaskBriefKeys.OVERDUE_COMPLETED
|
||||
));
|
||||
|
||||
return AjaxResult.success(result);
|
||||
query.setScope(true);
|
||||
return AjaxResult.success(dashboardService.selectBrief(query));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user