20 changed files with 959 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||
package com.epmet.dto.extract.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc: 工作人员巡查统计参数 |
|||
* |
|||
* @author LiuJanJun |
|||
* @date 2021/6/29 10:19 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffPatrolStatsFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3639860733213306581L; |
|||
private String customerId; |
|||
private String dateId; |
|||
private String staffId; |
|||
private String gridId; |
|||
private String roleType; |
|||
} |
@ -0,0 +1,137 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.user.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 政府工作人员表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-04-18 |
|||
*/ |
|||
@Data |
|||
public class CustomerStaffDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 关联User表的主键Id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 性别0.未知,1男,2.女 |
|||
*/ |
|||
private Integer gender; |
|||
|
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String email; |
|||
|
|||
/** |
|||
* 手机号-唯一键 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 删除标识 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* fulltime专职parttime兼职 |
|||
*/ |
|||
private String workType; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* inactive未激活,active已激活 |
|||
*/ |
|||
private String activeFlag; |
|||
|
|||
/** |
|||
* 激活时间 |
|||
*/ |
|||
private Date activeTime; |
|||
|
|||
/** |
|||
* 未禁用enable,已禁用diabled |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String roleName; |
|||
|
|||
} |
@ -0,0 +1,147 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.user.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* [天]工作人员巡查记录统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-06-29 |
|||
*/ |
|||
@Data |
|||
public class StatsStaffPatrolRecordDailyDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 季ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 工作人员所属组织id=网格所属的组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格所有上级id |
|||
*/ |
|||
private String gridPids; |
|||
|
|||
/** |
|||
* 工作人员用户id |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 巡查次数 |
|||
*/ |
|||
private Integer patrolTotal; |
|||
|
|||
/** |
|||
* 巡查时长 单位:秒 |
|||
*/ |
|||
private Integer totalTime; |
|||
|
|||
/** |
|||
* 巡查期间直接立项项目数 |
|||
*/ |
|||
private Integer reportProjectCount; |
|||
|
|||
/** |
|||
* 最新的巡查开始时间 |
|||
*/ |
|||
private Date latestPatrolTime; |
|||
|
|||
/** |
|||
* 最新的巡查状态 正在巡查中:patrolling;结束:end |
|||
*/ |
|||
private String latestPatrolStatus; |
|||
|
|||
/** |
|||
* 删除标识 0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Description 用户统计 |
|||
* @ClassName StatsUserController |
|||
* @Auth wangc |
|||
* @Date 2020-06-23 15:18 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("bizData/stats") |
|||
public class BizDataStatsController { |
|||
|
|||
@Autowired |
|||
private BizDataStatsService bizDataStatsService; |
|||
|
|||
/** |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @param formDTO |
|||
* @description 工作端数据一期,用户分析:参与用户、注册用户分析 |
|||
* @Date 2021/3/26 13:27 |
|||
**/ |
|||
@RequestMapping("patrol") |
|||
public Result execute(@RequestBody StaffPatrolStatsFormDTO formDTO) { |
|||
bizDataStatsService.initStaffPatrolStats(formDTO); |
|||
return new Result(); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.org; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
import com.epmet.entity.org.CustomerStaffGridEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 客户网格人员关系表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Mapper |
|||
public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> { |
|||
|
|||
List<StatsStaffPatrolRecordDailyDTO> selectGridStaffList(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -0,0 +1,38 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.user; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
import com.epmet.entity.user.StatsStaffPatrolRecordDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* [天]工作人员巡查记录统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-06-29 |
|||
*/ |
|||
@Mapper |
|||
public interface StatsStaffPatrolRecordDailyDao extends BaseDao<StatsStaffPatrolRecordDailyEntity> { |
|||
|
|||
Integer insertBatch(@Param("list") List<StatsStaffPatrolRecordDailyDTO> insertList); |
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.org; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 客户网格表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("customer_staff_grid") |
|||
public class CustomerStaffGridEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
private String customerId; |
|||
private String gridId; |
|||
private String userId; |
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.user; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* [天]工作人员巡查记录统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-06-29 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("stats_staff_patrol_record_daily") |
|||
public class StatsStaffPatrolRecordDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 统计日期 关联日期dim表 |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 周ID |
|||
*/ |
|||
private String weekId; |
|||
|
|||
/** |
|||
* 月ID |
|||
*/ |
|||
private String monthId; |
|||
|
|||
/** |
|||
* 季ID |
|||
*/ |
|||
private String quarterId; |
|||
|
|||
/** |
|||
* 年ID |
|||
*/ |
|||
private String yearId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 工作人员所属组织id=网格所属的组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 网格所有上级id |
|||
*/ |
|||
private String gridPids; |
|||
|
|||
/** |
|||
* 工作人员用户id |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 巡查次数 |
|||
*/ |
|||
private Integer patrolTotal; |
|||
|
|||
/** |
|||
* 巡查时长 单位:秒 |
|||
*/ |
|||
private Integer totalTime; |
|||
|
|||
/** |
|||
* 巡查期间直接立项项目数 |
|||
*/ |
|||
private Integer reportProjectCount; |
|||
|
|||
/** |
|||
* 最新的巡查开始时间 |
|||
*/ |
|||
private Date latestPatrolTime; |
|||
|
|||
/** |
|||
* 最新的巡查状态 正在巡查中:patrolling;结束:end |
|||
*/ |
|||
private String latestPatrolStatus; |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.evaluationindex.extract.biz; |
|||
|
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
|
|||
/** |
|||
* [天]工作人员巡查记录统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-06-29 |
|||
*/ |
|||
public interface BizDataStatsService { |
|||
|
|||
void initStaffPatrolStats(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -0,0 +1,87 @@ |
|||
package com.epmet.service.evaluationindex.extract.biz.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
import com.epmet.dto.user.result.CustomerStaffDTO; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
import com.epmet.service.evaluationindex.extract.biz.BizDataStatsService; |
|||
import com.epmet.service.org.CustomerStaffService; |
|||
import com.epmet.service.user.StatsStaffPatrolService; |
|||
import com.epmet.service.user.UserService; |
|||
import com.epmet.util.DimIdGenerator; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* desc:【天】网格员巡查统计 |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2021/6/29 3:08 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class BizDataStatsServiceImpl implements BizDataStatsService { |
|||
@Autowired |
|||
private CustomerStaffService customerStaffService; |
|||
@Autowired |
|||
private UserService userService; |
|||
@Autowired |
|||
private StatsStaffPatrolService statsStaffPatrolService; |
|||
|
|||
@Override |
|||
public void initStaffPatrolStats(StaffPatrolStatsFormDTO formDTO) { |
|||
//获取所有的网格员
|
|||
//1.获取所有网格用户
|
|||
List<StatsStaffPatrolRecordDailyDTO> allStaffList = customerStaffService.selectStaffGridList(formDTO); |
|||
/* if (CollectionUtils.isEmpty(allStaffList)){ |
|||
log.warn("reloadStaffPatrolStats customerId:{} have any staff,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO)); |
|||
return |
|||
}*/ |
|||
//获取所有含有网格员角色的用户
|
|||
List<CustomerStaffDTO> gridMemberList = userService.selectUserListByRoleKey(formDTO); |
|||
/*if (CollectionUtils.isEmpty(gridMemberList)){ |
|||
log.warn("reloadStaffPatrolStats customerId:{} have any gridMembers,param:{}",formDTO.getCustomerId(), JSON.toJSONString(formDTO)); |
|||
return |
|||
}*/ |
|||
|
|||
List<StatsStaffPatrolRecordDailyDTO> lastStaffPatrolList = userService.selectLastStaffPatrolList(formDTO); |
|||
Map<String, StatsStaffPatrolRecordDailyDTO> lastPatrolMap = lastStaffPatrolList.stream().collect(Collectors.toMap(o -> o.getGridId() + o.getStaffId(), o -> o, (o1, o2) -> o1)); |
|||
//构建数据 插入
|
|||
List<StatsStaffPatrolRecordDailyDTO> insertList = new ArrayList<>(); |
|||
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(new Date()); |
|||
allStaffList.forEach(gridStaff -> { |
|||
gridStaff.setDateId(dimIdBean.getDateId()); |
|||
gridStaff.setWeekId(dimIdBean.getWeekId()); |
|||
gridStaff.setQuarterId(dimIdBean.getQuarterId()); |
|||
gridStaff.setYearId(dimIdBean.getYearId()); |
|||
gridStaff.setMonthId(dimIdBean.getMonthId()); |
|||
StatsStaffPatrolRecordDailyDTO recordDailyDTO = lastPatrolMap.get(gridStaff.getGridId().concat(gridStaff.getStaffId())); |
|||
|
|||
gridStaff.setTotalTime(NumConstant.ZERO); |
|||
gridStaff.setPatrolTotal(NumConstant.ZERO); |
|||
gridStaff.setLatestPatrolStatus("end"); |
|||
//最后巡查时间
|
|||
gridStaff.setLatestPatrolTime(null); |
|||
if (recordDailyDTO != null) { |
|||
gridStaff.setLatestPatrolStatus(recordDailyDTO.getLatestPatrolStatus()); |
|||
gridStaff.setLatestPatrolTime(recordDailyDTO.getLatestPatrolTime()); |
|||
} |
|||
|
|||
gridMemberList.forEach(gridMember -> { |
|||
if (gridStaff.getStaffId().equals(gridMember.getUserId())) { |
|||
insertList.add(gridStaff); |
|||
} |
|||
}); |
|||
}); |
|||
Integer effectRow = statsStaffPatrolService.insertBatch(insertList); |
|||
log.debug("initStaffPatrolStats insert rows:{}", effectRow); |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.epmet.service.org; |
|||
|
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author liujianjun |
|||
*/ |
|||
public interface CustomerStaffService { |
|||
|
|||
/** |
|||
* desc: 条件获取 网格下的所有人 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.org.GridInfoDTO> |
|||
* @author LiuJanJun |
|||
* @date 2021/6/29 3:13 下午 |
|||
*/ |
|||
List<StatsStaffPatrolRecordDailyDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO); |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.service.org.impl; |
|||
|
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.dao.org.CustomerStaffGridDao; |
|||
import com.epmet.dto.extract.form.StaffPatrolStatsFormDTO; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
import com.epmet.service.org.CustomerStaffService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* desc: |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2021/6/29 3:14 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
@Service |
|||
@DataSource(DataSourceConstant.GOV_ORG) |
|||
public class CustomerStaffServiceImpl implements CustomerStaffService { |
|||
@Autowired |
|||
private CustomerStaffGridDao customerStaffGridDao; |
|||
|
|||
/** |
|||
* desc: 条件获取 网格下的所有人 |
|||
* |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.org.GridInfoDTO> |
|||
* @author LiuJanJun |
|||
* @date 2021/6/29 3:13 下午 |
|||
*/ |
|||
@Override |
|||
public List<StatsStaffPatrolRecordDailyDTO> selectStaffGridList(StaffPatrolStatsFormDTO formDTO) { |
|||
return customerStaffGridDao.selectGridStaffList(formDTO); |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.service.user; |
|||
|
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author liujianjun |
|||
*/ |
|||
public interface StatsStaffPatrolService { |
|||
|
|||
Integer insertBatch(List<StatsStaffPatrolRecordDailyDTO> insertList); |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.service.user.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.dao.user.StatsStaffPatrolRecordDailyDao; |
|||
import com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO; |
|||
import com.epmet.service.user.StatsStaffPatrolService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* desc: |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2021/6/30 8:33 上午 |
|||
* @version: 1.0 |
|||
*/ |
|||
@DataSource(DataSourceConstant.EPMET_USER) |
|||
@Service |
|||
public class StatsStaffPatrolServiceImpl implements StatsStaffPatrolService { |
|||
@Autowired |
|||
private StatsStaffPatrolRecordDailyDao statsStaffPatrolRecordDailyDao; |
|||
|
|||
@Override |
|||
public Integer insertBatch(List<StatsStaffPatrolRecordDailyDTO> insertList) { |
|||
System.out.println("=====:"+JSON.toJSONString(insertList)); |
|||
return statsStaffPatrolRecordDailyDao.insertBatch(insertList); |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
<?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.epmet.dao.org.CustomerStaffGridDao"> |
|||
|
|||
|
|||
|
|||
|
|||
<select id="selectGridStaffList" resultType="com.epmet.dto.user.result.StatsStaffPatrolRecordDailyDTO"> |
|||
SELECT |
|||
sg.customer_id, |
|||
sg.user_id AS staffId, |
|||
sg.grid_id, |
|||
grid.grid_name, |
|||
grid.PID agencyId, |
|||
grid.PIDS gridPids |
|||
FROM |
|||
customer_staff_grid sg |
|||
LEFT JOIN customer_grid grid ON grid.id = sg.grid_id |
|||
WHERE |
|||
sg.del_flag = '0' |
|||
<if test="customerId != null and customerId != ''"> |
|||
AND sg.customer_id = #{customerId} |
|||
</if> |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND sg.GRID_ID = #{gridId} |
|||
</if> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,58 @@ |
|||
<?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.epmet.dao.user.StatsStaffPatrolRecordDailyDao"> |
|||
<insert id="insertBatch"> |
|||
insert into stats_staff_patrol_record_daily |
|||
( |
|||
ID, |
|||
CUSTOMER_ID, |
|||
DATE_ID, |
|||
WEEK_ID, |
|||
MONTH_ID, |
|||
YEAR_ID, |
|||
QUARTER_ID, |
|||
GRID_ID, |
|||
AGENCY_ID, |
|||
GRID_PIDS, |
|||
STAFF_ID, |
|||
PATROL_TOTAL, |
|||
TOTAL_TIME, |
|||
REPORT_PROJECT_COUNT, |
|||
LATEST_PATROL_TIME, |
|||
LATEST_PATROL_STATUS, |
|||
DEL_FLAG, |
|||
REVISION, |
|||
CREATED_BY, |
|||
CREATED_TIME, |
|||
UPDATED_BY, |
|||
UPDATED_TIME |
|||
) values |
|||
<foreach collection="list" item="item" separator=","> |
|||
( |
|||
(SELECT REPLACE(UUID(), '-', '') AS id), |
|||
#{item.customerId}, |
|||
#{item.dateId}, |
|||
#{item.weekId}, |
|||
#{item.monthId}, |
|||
#{item.yearId}, |
|||
#{item.quarterId}, |
|||
#{item.gridId}, |
|||
#{item.agencyId}, |
|||
#{item.gridPids}, |
|||
#{item.staffId}, |
|||
#{item.patrolTotal}, |
|||
#{item.totalTime}, |
|||
#{item.reportProjectCount}, |
|||
#{item.latestPatrolTime}, |
|||
#{item.latestPatrolStatus}, |
|||
'0', |
|||
0, |
|||
'APP_USER', |
|||
now(), |
|||
'APP_USER', |
|||
now() |
|||
) |
|||
</foreach> |
|||
</insert> |
|||
</mapper> |
Loading…
Reference in new issue