Browse Source

网格员数据上报接口模板

master
sunyuchao 4 years ago
parent
commit
37767d0dff
  1. 29
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java
  2. 28
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java
  3. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  4. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  5. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java
  6. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  7. 36
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  8. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  9. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  10. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  11. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml
  12. 81
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java
  13. 65
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java
  14. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java
  15. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java
  16. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java

29
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/OpenStaffDetailFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dataaggre.dto.epmetuser.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 对外接口--查询工作人员基本信息-接口入参
* @Auth sun
*/
@Data
public class OpenStaffDetailFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 客户Id
*/
@NotBlank(message = "客户Id不能为空", groups = OpenStaffDetailFormDTO.Open.class)
private String customerId;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = OpenStaffDetailFormDTO.Open.class)
private String mobile;
public interface Open extends CustomerClientShowGroup {}
}

28
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/OpenStaffDetailResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 对外接口--查询工作人员基本信息-接口返参
* @Auth sun
*/
@Data
public class OpenStaffDetailResultDTO implements Serializable {
private static final long serialVersionUID = 7129564173128153335L;
//工作人员用户id
private String staffId = "";
//工作人员姓名
private String staffName = "";
//手机号
private String mobile = "";
//用户所属组织id
private String agencyId = "";
//用户所属组织全路径名称
private String agencyAllName = "";
//客户Id
private String customerId = "";
}

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -7,9 +7,11 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.OpenStaffDetailResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
@ -79,5 +81,16 @@ public class EpmetUserController {
return new Result<PatrolDateListResultDTO>().ok(epmetUserService.patrolDateList(formDTO));
}
/**
* @Param formDTO
* @Description 对外接口--查询工作人员基本信息
* @author sun
*/
@PostMapping("open-staffdetail")
public Result<OpenStaffDetailResultDTO> openStaffDetail(@RequestBody OpenStaffDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, OpenStaffDetailFormDTO.Open.class);
return new Result<OpenStaffDetailResultDTO>().ok(epmetUserService.openStaffDetail(formDTO));
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -18,8 +18,10 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 政府工作人员表
@ -30,4 +32,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
/**
* @Description 按staffId查询基础信息
* @author sun
*/
CustomerStaffDTO selectByMobile(@Param("customerId") String customerId, @Param("mobile") String mobile);
}

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java

@ -18,6 +18,7 @@
package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
import com.epmet.dataaggre.entity.govorg.CustomerStaffAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,4 +39,9 @@ public interface CustomerStaffAgencyDao extends BaseDao<CustomerStaffAgencyEntit
**/
CustomerStaffAgencyDTO selectByStaffId(@Param("userId") String userId);
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
CustomerAgencyDTO selectAgencyByStaffId(@Param("customerId") String customerId, @Param("staffId") String staffId);
}

13
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,12 +1,10 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.PatrolRecordListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import java.util.List;
@ -64,4 +62,11 @@ public interface EpmetUserService {
*/
List<GridStaffResultDTO> staffGridRole(List<GridStaffResultDTO> forms, String staffName);
/**
* @Param formDTO
* @Description 对外接口--查询工作人员基本信息
* @author sun
*/
OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO);
}

36
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -4,15 +4,19 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.CustomerStaffDao;
import com.epmet.dataaggre.dao.epmetuser.StaffPatrolRecordDao;
import com.epmet.dataaggre.dao.epmetuser.StaffRoleDao;
import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO;
import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
@ -49,6 +53,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private StaffPatrolRecordService staffPatrolRecordService;
@Resource
private StaffRoleDao staffRoleDao;
@Resource
private CustomerStaffDao customerStaffDao;
/**
* @Description 根据UserIds查询
@ -247,5 +253,35 @@ public class EpmetUserServiceImpl implements EpmetUserService {
return result;
}
/**
* @Param formDTO
* @Description 对外接口--查询工作人员基本信息
* @author sun
*/
@Override
public OpenStaffDetailResultDTO openStaffDetail(OpenStaffDetailFormDTO formDTO) {
OpenStaffDetailResultDTO resultDTO = new OpenStaffDetailResultDTO();
//1.按staffId查询基础信息
CustomerStaffDTO staffDTO = customerStaffDao.selectByMobile(formDTO.getCustomerId(), formDTO.getMobile());
if (null == staffDTO) {
return resultDTO;
}
//2.查询工作人员所属组织信息
CustomerAgencyDTO agencyDTO = govOrgService.gridByAgencyId(formDTO.getCustomerId(), staffDTO.getUserId());
//3.封装数据并返回
resultDTO.setCustomerId(formDTO.getCustomerId());
if (null != agencyDTO) {
resultDTO.setAgencyId(agencyDTO.getId());
resultDTO.setAgencyAllName(agencyDTO.getAllParentName());
}
resultDTO.setStaffId(staffDTO.getUserId());
resultDTO.setStaffName(staffDTO.getRealName());
resultDTO.setMobile(formDTO.getMobile());
return resultDTO;
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -1,5 +1,6 @@
package com.epmet.dataaggre.service.govorg;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
@ -59,4 +60,10 @@ public interface GovOrgService {
* @author sun
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds, String staffName);
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
CustomerAgencyDTO gridByAgencyId(String customerId, String staffId);
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -11,6 +11,7 @@ import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao;
import com.epmet.dataaggre.dao.govorg.CustomerGridDao;
import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO;
@ -264,4 +265,13 @@ public class GovOrgServiceImpl implements GovOrgService {
return result;
}
/**
* @Description 查询工作人员所属组织信息
* @author sun
*/
@Override
public CustomerAgencyDTO gridByAgencyId(String customerId, String staffId) {
return customerStaffAgencyDao.selectAgencyByStaffId(customerId, staffId);
}
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -3,4 +3,16 @@
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.CustomerStaffDao">
<select id="selectByMobile" resultType="com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND mobile = #{mobile}
LIMIT 1
</select>
</mapper>

14
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml

@ -16,4 +16,18 @@
AND user_id = #{userId}
</select>
<select id="selectAgencyByStaffId" resultType="com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO">
SELECT
ca.id,
ca.all_parent_name
FROM
customer_staff_agency csa
INNER JOIN customer_agency ca ON csa.agency_id = ca.id
WHERE
csa.del_flag = '0'
AND ca.del_flag = '0'
AND csa.customer_id = #{customerId}
AND csa.user_id = #{staffId}
</select>
</mapper>

81
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadDataFormDTO.java

@ -0,0 +1,81 @@
package com.epmet.dto.stats.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Description 数据上报--网格员事件总数上报-接口入参
* @Auth sun
*/
@Data
public class GmUploadDataFormDTO implements Serializable {
private static final long serialVersionUID = -9178779369245037701L;
/**
* 为true时需要删除历史数据
*/
private Boolean isFirst;
//客户Id
private String customerId;
//日维度Id
private String dateId;
//数据集合对象
@NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class)
private List<DataList> dataList;
public interface AgencyProjectForm extends CustomerClientShowGroup {}
@Data
public static class DataList{
//客户Id 【dim_customer.id】
private String customerId;
//机关Id 【dim_agency.id】
private String agencyId;
//日维度Id 【dim_date.id】
private String dateId;
//月维度Id 【dim_month.id】
private String monthId;
//年维度Id 【dim_year.id】
private String yearId;
//网格id
private String gridId;
//上级ID(网格所属Agency的上级组织Id)
private String pid;
//所有agencyId的上级组织ID(包含agencyId)
private String pids;
//工作人员id
private String staffId;
//工作人员姓名
private String staffName;
//项目立项数,截止到当前dateId的总数
private Integer projectCount;
//议题转项目数,截止到当前dateId的总数
private Integer issueToProjectCount;
//议题关闭数,截止到当前dateId的总数
private Integer closedIssueCount;
//项目响应数,截止到当前dateId的总数
private Integer projectResponseCount;
//项目吹哨数,截止到当前dateId的总数
private Integer projectTransferCount;
//项目结案数,dateId这一天的增量
private Integer projectClosedCount;
//项目立项数,dateId这一天的增量
private Integer projectIncr;
//议题转项目数,dateId这一天的增量
private Integer issueToProjectIncr;
//议题关闭数,dateId这一天的增量
private Integer closedIssueIncr;
//项目响应数,dateId这一天的增量
private Integer projectResponseIncr;
//项目吹哨数,dateId这一天的增量
private Integer projectTransferIncr;
//项目结案数,截止到当前dateId的总数
private Integer projectClosedIncr;
}
}

65
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/GmUploadEventFormDTO.java

@ -0,0 +1,65 @@
package com.epmet.dto.stats.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Description 数据上报--网格员事件总数上报-接口入参
* @Auth sun
*/
@Data
public class GmUploadEventFormDTO implements Serializable {
private static final long serialVersionUID = -9178779369245037701L;
//为true时需要删除历史数据
private Boolean isFirst;
//客户Id
private String customerId;
//日维度Id
private String dateId;
//数据集合对象
@NotEmpty(message = "数据集合对象不能为空",groups = AgencyProjectForm.class)
private List<DataList> dataList;
public interface AgencyProjectForm extends CustomerClientShowGroup {}
@Data
public static class DataList{
//客户Id 【dim_customer.id】
private String customerId;
//机关Id 【dim_agency.id】
private String agencyId;
//日维度Id 【dim_date.id】
private String dateId;
//周维度Id 【dim_week.id】
private String weekId;
//月维度Id 【dim_month.id】
private String monthId;
//季ID
private String quarterId;
//年维度Id 【dim_year.id】
private String yearId;
//网格id
private String gridId;
//网格所有上级id
private String gridPids;
//产品这边工作人员用户id
private String staffId;
//巡查次数
private Integer patrolTotal = 0;
//巡查时长 单位:秒
private Integer totalTime = 0;
//事件数【立项项目数】
private Integer reportProjectCount = 0;
//最新的巡查开始时间
private String latestPatrolTime;
//最新的巡查状态 正在巡查中:patrolling;结束:end
private String latestPatrolStatus = "end";
}
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java

@ -1,9 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.stats.form.GmUploadDataFormDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.service.StatsUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -32,4 +36,27 @@ public class StatsUserController {
statsUserService.partition(formDTO);
return new Result();
}
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
@PostMapping("gm-uploadevent")
public Result gmUploadEvent(@RequestBody GmUploadEventFormDTO formDTO) {
statsUserService.gmUploadEvent(formDTO);
return new Result();
}
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
@PostMapping("gm-uploaddata")
public Result gmUploadData(@RequestBody GmUploadDataFormDTO formDTO) {
statsUserService.gmUploadData(formDTO);
return new Result();
}
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsUserService.java

@ -1,6 +1,8 @@
package com.epmet.service;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.stats.form.GmUploadDataFormDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
/**
* @author wangc
@ -17,4 +19,18 @@ public interface StatsUserService {
* @date 2020.06.28 14:38
**/
void partition(StatsFormDTO formDTO);
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
void gmUploadEvent(GmUploadEventFormDTO formDTO);
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
void gmUploadData(GmUploadDataFormDTO formDTO);
}

24
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java

@ -7,6 +7,8 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.stats.form.GmUploadDataFormDTO;
import com.epmet.dto.stats.form.GmUploadEventFormDTO;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.service.StatsUserService;
import com.epmet.service.stats.DimAgencyService;
@ -130,4 +132,26 @@ public class StatsUserServiceImpl implements StatsUserService {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, ModuleConstant.EXCEPTION_DING_INTERCEPTOR_PREFIX_GRID_USER_STATISTICAL, customerId, new Date().toString(), e.getMessage()));
}
}
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
@Override
public void gmUploadEvent(GmUploadEventFormDTO formDTO) {
}
/**
* @Param formDTO
* @Description 数据上报--网格员事件总数上报
* @author sun
*/
@Override
public void gmUploadData(GmUploadDataFormDTO formDTO) {
}
}

Loading…
Cancel
Save