forked from luyan/epmet-cloud-lingshan
28 changed files with 1196 additions and 14 deletions
@ -0,0 +1,69 @@ |
|||||
|
package com.epmet.dataaggre.dto.evaluationindex; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2021/11/4 3:13 下午 |
||||
|
* @DESC |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventCategoryResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 类型,project:事件, work:例行工作 |
||||
|
*/ |
||||
|
private String eventType; |
||||
|
|
||||
|
/** |
||||
|
* 分类CODE |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 分类code父级 |
||||
|
*/ |
||||
|
private String parentCategoryCode; |
||||
|
|
||||
|
/** |
||||
|
* 分类名字 |
||||
|
*/ |
||||
|
private String categoryName; |
||||
|
|
||||
|
/** |
||||
|
* 分类名字父级 |
||||
|
*/ |
||||
|
private String parentCategoryName; |
||||
|
|
||||
|
/** |
||||
|
* 项目数 |
||||
|
*/ |
||||
|
private Integer eventTotal; |
||||
|
|
||||
|
/** |
||||
|
* 分值 |
||||
|
*/ |
||||
|
private Integer score; |
||||
|
|
||||
|
private Integer totalScore; |
||||
|
|
||||
|
private List<EventCategoryResultDTO> children; |
||||
|
@JsonIgnore |
||||
|
private Integer index; |
||||
|
|
||||
|
public EventCategoryResultDTO() { |
||||
|
this.categoryCode = ""; |
||||
|
this.categoryName = ""; |
||||
|
this.eventTotal = NumConstant.ZERO; |
||||
|
this.totalScore = NumConstant.ZERO; |
||||
|
this.children = new ArrayList<>(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.epmet.dataaggre.dto.evaluationindex.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author Administrator |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventCategoryFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public interface EventCategoryForm{} |
||||
|
public interface CategoryEventExportForm {} |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 组织类型 组织:agency,网格:grid |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
@NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class}) |
||||
|
private String endTime; |
||||
|
|
||||
|
/** |
||||
|
* 开始时间 |
||||
|
*/ |
||||
|
private String startTime; |
||||
|
|
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "组织名称不能为空",groups = CategoryEventExportForm.class) |
||||
|
private String orgName; |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.epmet.dataaggre.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
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.evaluationindex.EventCategoryResultDTO; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; |
||||
|
import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
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; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author Administrator |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("pyevent") |
||||
|
@Slf4j |
||||
|
public class PingYinEventController { |
||||
|
@Resource |
||||
|
private PingYinEventService pingYinEventService; |
||||
|
|
||||
|
/** |
||||
|
* 事件赋值得分 |
||||
|
* |
||||
|
* @Param tokenDto |
||||
|
* @Return {@link Result<List<EventCategoryResultDTO>>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 9:42 |
||||
|
*/ |
||||
|
@PostMapping("getEventCategorySore") |
||||
|
public Result<List<EventCategoryResultDTO>> getEventCategorySore(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, EventCategoryFormDTO.EventCategoryForm.class); |
||||
|
return new Result<List<EventCategoryResultDTO>>().ok(pingYinEventService.getEventCategorySore(tokenDto, formDTO)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
/** |
||||
|
* 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.dataaggre.dao.evaluationindex; |
||||
|
|
||||
|
import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 指标统计服务 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface PingYinEventDao { |
||||
|
/** |
||||
|
* 获取项目分类 |
||||
|
* |
||||
|
* @Param customerId |
||||
|
* @Return {@link List< EventCategoryResultDTO>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 13:40 |
||||
|
*/ |
||||
|
List<EventCategoryResultDTO> selectProjectCategory(@Param("customerId")String customerId); |
||||
|
|
||||
|
/** |
||||
|
* 获取例行工作分类 |
||||
|
* |
||||
|
* @Param |
||||
|
* @Return {@link List< EventCategoryResultDTO>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 13:41 |
||||
|
*/ |
||||
|
List<EventCategoryResultDTO> selectWorkCategory(); |
||||
|
|
||||
|
/** |
||||
|
* 项目赋值得分 |
||||
|
* @Param formDTO |
||||
|
* @Return {@link List< EventCategoryResultDTO>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 11:00 |
||||
|
*/ |
||||
|
List<EventCategoryResultDTO> selectProjectCategoryScoreList(EventCategoryFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* 例行工作赋值得分 |
||||
|
* @Param formDTO |
||||
|
* @Return {@link List< EventCategoryResultDTO>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 11:00 |
||||
|
*/ |
||||
|
List<EventCategoryResultDTO> selectWorkCategoryScoreList(EventCategoryFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.dataaggre.service.evaluationindex; |
||||
|
|
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author Administrator |
||||
|
*/ |
||||
|
public interface PingYinEventService { |
||||
|
|
||||
|
/** |
||||
|
* 事件赋值得分 |
||||
|
* |
||||
|
* @Param tokenDto |
||||
|
* @Param formDTO |
||||
|
* @Return {@link List<EventCategoryResultDTO>} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 9:55 |
||||
|
*/ |
||||
|
List<EventCategoryResultDTO> getEventCategorySore (TokenDto tokenDto, EventCategoryFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
package com.epmet.dataaggre.service.evaluationindex.impl; |
||||
|
|
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.DateUtils; |
||||
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
||||
|
import com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; |
||||
|
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; |
||||
|
import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 指标统计服务 |
||||
|
*/ |
||||
|
@Service |
||||
|
@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) |
||||
|
@Slf4j |
||||
|
public class PingYinEventServiceImpl implements PingYinEventService { |
||||
|
|
||||
|
@Resource |
||||
|
private PingYinEventDao pingYinEventDao; |
||||
|
|
||||
|
/** |
||||
|
* 事件赋值得分 |
||||
|
* |
||||
|
* @param tokenDto |
||||
|
* @param formDTO |
||||
|
* @Param tokenDto |
||||
|
* @Param formDTO |
||||
|
* @Return {@link List < EventCategoryResultDTO >} |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/9 9:55 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<EventCategoryResultDTO> getEventCategorySore(TokenDto tokenDto, EventCategoryFormDTO formDTO) { |
||||
|
List<EventCategoryResultDTO> result = new ArrayList<>(); |
||||
|
if (StringUtils.isNotBlank(formDTO.getStartTime())){ |
||||
|
formDTO.setStartTime(DateUtils.getBeforeNDay(formDTO.getStartTime(), NumConstant.ONE)); |
||||
|
} |
||||
|
if (StringUtils.isBlank(formDTO.getOrgId())){ |
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
||||
|
if (null == staffInfo){ |
||||
|
throw new EpmetException("未查询到此工作人员的所属组织信息..."); |
||||
|
} |
||||
|
formDTO.setOrgId(staffInfo.getAgencyId()); |
||||
|
formDTO.setOrgType("agency"); |
||||
|
} |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
//获取项目分类
|
||||
|
List<EventCategoryResultDTO> projectCategoryList = pingYinEventDao.selectProjectCategory(formDTO.getCustomerId()); |
||||
|
//获取项目赋值得分统计
|
||||
|
List<EventCategoryResultDTO> projectScoreList = pingYinEventDao.selectProjectCategoryScoreList(formDTO); |
||||
|
if (CollectionUtils.isNotEmpty(projectScoreList)) { |
||||
|
projectCategoryList.forEach(item -> { |
||||
|
projectScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> { |
||||
|
item.setEventTotal(item.getEventTotal() + e.getEventTotal()); |
||||
|
item.setTotalScore(item.getTotalScore() + e.getTotalScore()); |
||||
|
}); |
||||
|
item.getChildren().forEach(son -> projectScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { |
||||
|
son.setEventTotal(e.getEventTotal()); |
||||
|
son.setTotalScore(e.getTotalScore()); |
||||
|
})); |
||||
|
}); |
||||
|
} |
||||
|
result.addAll(projectCategoryList); |
||||
|
//获取例行工作分类
|
||||
|
List<EventCategoryResultDTO> workCategoryList = pingYinEventDao.selectWorkCategory(); |
||||
|
//获取例行工作赋值得分统计
|
||||
|
List<EventCategoryResultDTO> workScoreList = pingYinEventDao.selectWorkCategoryScoreList(formDTO); |
||||
|
if (CollectionUtils.isNotEmpty(workScoreList)) { |
||||
|
workCategoryList.forEach(item -> { |
||||
|
workScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> { |
||||
|
item.setEventTotal(item.getEventTotal() + e.getEventTotal()); |
||||
|
item.setTotalScore(item.getTotalScore() + e.getTotalScore()); |
||||
|
}); |
||||
|
item.getChildren().forEach(son -> workScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { |
||||
|
son.setEventTotal(e.getEventTotal()); |
||||
|
son.setTotalScore(e.getTotalScore()); |
||||
|
})); |
||||
|
}); |
||||
|
} |
||||
|
result.addAll(workCategoryList); |
||||
|
return result; |
||||
|
} |
||||
|
} |
@ -0,0 +1,139 @@ |
|||||
|
<?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.dataaggre.dao.evaluationindex.PingYinEventDao"> |
||||
|
<!-- 查询客户下所有分类 --> |
||||
|
<resultMap id="selectCategoryByCustomerIdMap" type="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
||||
|
<result column="e" property="eventType"/> |
||||
|
<result column="c" property="categoryCode"/> |
||||
|
<result column="n" property="categoryName"/> |
||||
|
<result column="pc1" property="parentCategoryCode"/> |
||||
|
<result column="score1" property="score"/> |
||||
|
<collection property="children" ofType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
||||
|
<result column="e" property="eventType"/> |
||||
|
<result column="c2" property="categoryCode"/> |
||||
|
<result column="n2" property="categoryName"/> |
||||
|
<result column="pc2" property="parentCategoryCode"/> |
||||
|
<result column="score2" property="score"/> |
||||
|
<result column="n" property="parentCategoryName"/> |
||||
|
</collection> |
||||
|
</resultMap> |
||||
|
<select id="selectProjectCategory" resultMap="selectCategoryByCustomerIdMap"> |
||||
|
SELECT |
||||
|
'事件' AS e, |
||||
|
'事件' AS e2, |
||||
|
p1.CATEGORY_CODE AS c, |
||||
|
p2.CATEGORY_CODE AS c2, |
||||
|
p1.CATEGORY_NAME AS n, |
||||
|
p2.CATEGORY_NAME AS n2, |
||||
|
p1.PARENT_CATEGORY_CODE AS pc1, |
||||
|
p2.PARENT_CATEGORY_CODE AS pc2, |
||||
|
p1.SCORE AS score1, |
||||
|
p2.SCORE AS score2 |
||||
|
FROM customer_project_category_dict p1,customer_project_category_dict p2 |
||||
|
WHERE p1.DEL_FLAG = '0' |
||||
|
AND p2.DEL_FLAG = '0' |
||||
|
AND p1.CUSTOMER_ID = #{customerId} |
||||
|
AND p2.CUSTOMER_ID = #{customerId} |
||||
|
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE |
||||
|
AND p1.CUSTOMER_TYPE = 'internal' |
||||
|
AND p2.CUSTOMER_TYPE = 'internal' |
||||
|
AND p1.IS_DISABLE = 'enable' |
||||
|
AND p2.IS_DISABLE = 'enable' |
||||
|
ORDER BY p1.SORT, p2.SORT |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectWorkCategory" resultMap="selectCategoryByCustomerIdMap"> |
||||
|
SELECT |
||||
|
'例行工作' AS e, |
||||
|
'例行工作' AS e2, |
||||
|
p1.CATEGORY_CODE AS c, |
||||
|
p2.CATEGORY_CODE AS c2, |
||||
|
p1.CATEGORY_NAME AS n, |
||||
|
p2.CATEGORY_NAME AS n2, |
||||
|
p1.PARENT_CATEGORY_CODE AS pc1, |
||||
|
p2.PARENT_CATEGORY_CODE AS pc2, |
||||
|
p1.SCORE AS score1, |
||||
|
p2.SCORE AS score2 |
||||
|
FROM customer_patrol_work_type_dict p1,customer_patrol_work_type_dict p2 |
||||
|
WHERE p1.DEL_FLAG = '0' |
||||
|
AND p2.DEL_FLAG = '0' |
||||
|
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE |
||||
|
AND p1.IS_DISABLE = 'enable' |
||||
|
AND p2.IS_DISABLE = 'enable' |
||||
|
ORDER BY p1.SORT, p2.SORT |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectProjectCategoryScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
(SELECT |
||||
|
a.CATEGORY_CODE, |
||||
|
c.PARENT_CATEGORY_CODE, |
||||
|
COUNT( a.EVENT_ID ) AS eventTotal, |
||||
|
c.SCORE, |
||||
|
SUM( c.SCORE ) AS totalScore |
||||
|
FROM |
||||
|
screen_py_event_data a |
||||
|
INNER JOIN screen_project_data b ON a.EVENT_ID = b.PROJECT_ID |
||||
|
AND b.DEL_FLAG = '0' |
||||
|
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
||||
|
AND c.DEL_FLAG = '0' |
||||
|
AND c.CUSTOMER_ID = #{customerId} |
||||
|
AND c.IS_DISABLE = 'enable' |
||||
|
WHERE |
||||
|
a.DEL_FLAG = '0' |
||||
|
AND a.EVENT_TYPE = 'project' |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) <= #{endTime} |
||||
|
</if> |
||||
|
<if test="orgType == 'grid'"> |
||||
|
AND b.ORG_ID = #{orgId} |
||||
|
</if> |
||||
|
<if test="orgType == 'agency'"> |
||||
|
AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%') |
||||
|
</if> |
||||
|
) a |
||||
|
WHERE CATEGORY_CODE IS NOT NULL |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectWorkCategoryScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
(SELECT |
||||
|
a.CATEGORY_CODE, |
||||
|
c.PARENT_CATEGORY_CODE, |
||||
|
COUNT( a.EVENT_ID ) AS eventTotal, |
||||
|
c.SCORE, |
||||
|
SUM( c.SCORE ) AS totalScore |
||||
|
FROM |
||||
|
screen_py_event_data a |
||||
|
INNER JOIN epmet_user.patrol_routine_work b ON a.EVENT_ID = b.ID |
||||
|
AND b.DEL_FLAG = '0' |
||||
|
INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE |
||||
|
AND c.IS_DISABLE = 'enable' |
||||
|
WHERE |
||||
|
a.DEL_FLAG = '0' |
||||
|
AND a.EVENT_TYPE = 'work' |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) <= #{endTime} |
||||
|
</if> |
||||
|
<if test="orgType == 'grid'"> |
||||
|
AND b.GRID_ID = #{orgId} |
||||
|
</if> |
||||
|
<if test="orgType == 'agency'"> |
||||
|
AND b.PIDS LIKE CONCAT('%', #{orgId}, '%') |
||||
|
</if> |
||||
|
) a |
||||
|
WHERE CATEGORY_CODE IS NOT NULL |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,179 @@ |
|||||
|
package com.epmet.dto.screen; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区事件上报中间表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-07-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventreportPingyinDTO { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 上报区县代码,参照6位行政区划代码 |
||||
|
*/ |
||||
|
private String qxBm; |
||||
|
|
||||
|
/** |
||||
|
* 上报区县名称 |
||||
|
*/ |
||||
|
private String qxMc; |
||||
|
|
||||
|
/** |
||||
|
* 网格编码,参照《山东省社会治理网格化智能工作平台数据标准》 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 事件编号,可以使用区县系统中的事件唯一识别码 |
||||
|
*/ |
||||
|
private String eventCode; |
||||
|
|
||||
|
/** |
||||
|
* 事件名称 |
||||
|
*/ |
||||
|
private String eventName; |
||||
|
|
||||
|
/** |
||||
|
* 事件类别,参照《山东省社会治理网格化智能工作平台数据标准》10.19 |
||||
|
*/ |
||||
|
private String eventCategory; |
||||
|
|
||||
|
/** |
||||
|
* 上报网格员姓名 |
||||
|
*/ |
||||
|
private String gridUserName; |
||||
|
|
||||
|
/** |
||||
|
* 上报网格员的身份证号码 |
||||
|
*/ |
||||
|
private String gridUserCardid; |
||||
|
|
||||
|
/** |
||||
|
* 事件上报时间 |
||||
|
*/ |
||||
|
private Date reportTime; |
||||
|
|
||||
|
/** |
||||
|
* 事件发生时间 |
||||
|
*/ |
||||
|
private Date happenTime; |
||||
|
|
||||
|
/** |
||||
|
* 事件发生地点描述 |
||||
|
*/ |
||||
|
private String happenPlace; |
||||
|
|
||||
|
/** |
||||
|
* 事件简述,详细一些,文字数量不少于10字 |
||||
|
*/ |
||||
|
private String eventDescription; |
||||
|
|
||||
|
/** |
||||
|
* 事件办结方式,符合《标准》10.20 |
||||
|
*/ |
||||
|
private String waysOfResolving; |
||||
|
|
||||
|
/** |
||||
|
* 必填 是否化解,填写Y、N(Y 是 N 否) |
||||
|
*/ |
||||
|
private String successfulOrNo; |
||||
|
|
||||
|
/** |
||||
|
* 必填 是否办结,填写Y、N(Y 是 N 否) |
||||
|
*/ |
||||
|
private String successfulDefuse; |
||||
|
|
||||
|
/** |
||||
|
* 办结层级,符合《标准》10.21 |
||||
|
*/ |
||||
|
private String completeLevel; |
||||
|
|
||||
|
/** |
||||
|
* 办结时间,办结后填写 |
||||
|
*/ |
||||
|
private Date completeTime; |
||||
|
|
||||
|
/** |
||||
|
* 事件发生位置经度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 |
||||
|
*/ |
||||
|
private BigDecimal lng; |
||||
|
|
||||
|
/** |
||||
|
* 事件发生位置纬度,wgs84坐标系,请勿用火星坐标系,不得跑出辖区 |
||||
|
*/ |
||||
|
private BigDecimal lat; |
||||
|
|
||||
|
/** |
||||
|
* 事件主要当事人姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 事件涉及人数 |
||||
|
*/ |
||||
|
private Integer numberInvolved; |
||||
|
|
||||
|
/** |
||||
|
* 事件涉及单位名称 |
||||
|
*/ |
||||
|
private String relatedUnites; |
||||
|
|
||||
|
/** |
||||
|
* 重点场所类别,符合《标准》10.25 |
||||
|
*/ |
||||
|
private String keyAreaType; |
||||
|
|
||||
|
/** |
||||
|
* 宗教活动规模,符合《标准》10.26 |
||||
|
*/ |
||||
|
private String religionScale; |
||||
|
|
||||
|
/** |
||||
|
* 宗教类别,符合《标准》10.27 |
||||
|
*/ |
||||
|
private String religionType; |
||||
|
|
||||
|
/** |
||||
|
* 重点场所是否变动,填写Y、N(Y 是 N 否) |
||||
|
*/ |
||||
|
private String isKeyareaState; |
||||
|
|
||||
|
/** |
||||
|
* 重点人员是否在当地,填写Y、N(Y 是 N 否) |
||||
|
*/ |
||||
|
private String isKeypeopleLocate; |
||||
|
|
||||
|
/** |
||||
|
* 重点人员现状描述 |
||||
|
*/ |
||||
|
private String keypeopleStatus; |
||||
|
|
||||
|
/** |
||||
|
* 例行工作编辑插入、更新时间,县市区填写 |
||||
|
*/ |
||||
|
private Date updateTime; |
||||
|
|
||||
|
/** |
||||
|
* 事件是否删除,Y:是、N:否 |
||||
|
*/ |
||||
|
private String isDel; |
||||
|
|
||||
|
/** |
||||
|
* 入库时间,自动生成,请勿设置 |
||||
|
*/ |
||||
|
private Date recoredInsertTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
package com.epmet.dto.screen; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员例行工作信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-07-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GridstaffWorkInfoPingyinDTO { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 上报区县代码,参照6位行政区划代码 |
||||
|
*/ |
||||
|
private String qxBm; |
||||
|
|
||||
|
/** |
||||
|
* 上报区县名称 |
||||
|
*/ |
||||
|
private String qxMc; |
||||
|
|
||||
|
/** |
||||
|
* 网格编码 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 例行工作类型,应符合10.27中的例行工作类型 |
||||
|
*/ |
||||
|
private String workType; |
||||
|
|
||||
|
/** |
||||
|
* 发生日期,格式为“YYYY-MM-DD” |
||||
|
*/ |
||||
|
private Date happenTime; |
||||
|
|
||||
|
/** |
||||
|
* 基础信息主键,出租房巡查、重点场所巡查、刑满释放人员、社区矫正、吸毒人员、信访人员重点青少年和精神障碍者必填 |
||||
|
*/ |
||||
|
private Integer baseInfoId; |
||||
|
|
||||
|
/** |
||||
|
* 有无变动(异常),Y:是、N:否 |
||||
|
*/ |
||||
|
private String workResult; |
||||
|
|
||||
|
/** |
||||
|
* 说明 |
||||
|
*/ |
||||
|
private String workContent; |
||||
|
|
||||
|
/** |
||||
|
* 例行工作编辑插入、更新时间,,县市区填写 |
||||
|
*/ |
||||
|
private Date updateTime; |
||||
|
|
||||
|
/** |
||||
|
* 例行工作是否删除,Y:是、N:否 |
||||
|
*/ |
||||
|
private String isDel; |
||||
|
|
||||
|
/** |
||||
|
* 入库时间,自动生成,请勿设置 |
||||
|
*/ |
||||
|
private Date recoredInsertTime; |
||||
|
|
||||
|
private String happenTimeString; |
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.epmet.dto.screen.form;/** |
||||
|
* @author ZhaoQiFeng |
||||
|
* @date 2022/12/8 |
||||
|
* @apiNote |
||||
|
*/ |
||||
|
|
||||
|
import com.epmet.dto.screen.EventreportPingyinDTO; |
||||
|
import com.epmet.dto.screen.GridstaffWorkInfoPingyinDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/8 13:47 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SavePyEventDataFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 526763788231934112L; |
||||
|
/** |
||||
|
* 项目列表 |
||||
|
*/ |
||||
|
private List<EventreportPingyinDTO> projectList; |
||||
|
/** |
||||
|
* 例行工作列表 |
||||
|
*/ |
||||
|
private List<GridstaffWorkInfoPingyinDTO> workList; |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.epmet.dao.evaluationindex.screen; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 上报到市平台中间库的事件 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-12-08 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ScreenPyEventDataDao extends BaseDao<ScreenPyEventDataEntity> { |
||||
|
|
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.epmet.entity.evaluationindex.screen; |
||||
|
|
||||
|
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 2022-12-08 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("screen_py_event_data") |
||||
|
public class ScreenPyEventDataEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
///**
|
||||
|
// * 客户Id
|
||||
|
// */
|
||||
|
//private String customerId;
|
||||
|
//
|
||||
|
///**
|
||||
|
// * 上级组织Id
|
||||
|
// */
|
||||
|
//private String parentId;
|
||||
|
//
|
||||
|
///**
|
||||
|
// * 所有上级ID,用英文逗号分开
|
||||
|
// */
|
||||
|
//private String allParentIds;
|
||||
|
|
||||
|
/** |
||||
|
* 事件Id |
||||
|
*/ |
||||
|
private String eventId; |
||||
|
|
||||
|
/** |
||||
|
* 事件类别 上报事件:project;例行工作:work |
||||
|
*/ |
||||
|
private String eventType; |
||||
|
|
||||
|
/** |
||||
|
* 事件时间 |
||||
|
*/ |
||||
|
private Date eventCreateTime; |
||||
|
|
||||
|
/** |
||||
|
* 事件分类编码 |
||||
|
*/ |
||||
|
private String categoryCode; |
||||
|
|
||||
|
///**
|
||||
|
// * 父类事件分类编码
|
||||
|
// */
|
||||
|
//private String parentCategoryCode;
|
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.service.evaluationindex.screen; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.dto.screen.form.SavePyEventDataFormDTO; |
||||
|
import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; |
||||
|
|
||||
|
/** |
||||
|
* 上报到市平台中间库的事件 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-12-08 |
||||
|
*/ |
||||
|
public interface ScreenPyEventDataService extends BaseService<ScreenPyEventDataEntity> { |
||||
|
/** |
||||
|
* 保存同步到中间库的数据 |
||||
|
* |
||||
|
* @Param formDTO |
||||
|
* @Return |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/8 11:14 |
||||
|
*/ |
||||
|
void saveData(SavePyEventDataFormDTO formDTO); |
||||
|
|
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.epmet.service.evaluationindex.screen.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.constant.DataSourceConstant; |
||||
|
import com.epmet.dao.evaluationindex.screen.ScreenPyEventDataDao; |
||||
|
import com.epmet.dto.screen.form.SavePyEventDataFormDTO; |
||||
|
import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; |
||||
|
import com.epmet.service.evaluationindex.screen.ScreenPyEventDataService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 上报到市平台中间库的事件 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2022-12-08 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
||||
|
public class ScreenPyEventDataServiceImpl extends BaseServiceImpl<ScreenPyEventDataDao, ScreenPyEventDataEntity> implements ScreenPyEventDataService { |
||||
|
|
||||
|
/** |
||||
|
* 保存同步到中间库的数据 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @Param formDTO |
||||
|
* @Return |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/8 11:14 |
||||
|
*/ |
||||
|
@Override |
||||
|
public void saveData(SavePyEventDataFormDTO formDTO) { |
||||
|
if (CollectionUtils.isNotEmpty(formDTO.getProjectList())) { |
||||
|
formDTO.getProjectList().forEach(item -> { |
||||
|
ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity(); |
||||
|
entity.setEventId(item.getEventCode().replace("py_", "")); |
||||
|
entity.setEventType("project"); |
||||
|
entity.setEventCreateTime(item.getReportTime()); |
||||
|
entity.setCategoryCode(item.getEventCategory()); |
||||
|
LambdaQueryWrapper<ScreenPyEventDataEntity> wrapper = new LambdaQueryWrapper<>(); |
||||
|
wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); |
||||
|
wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); |
||||
|
ScreenPyEventDataEntity event = baseDao.selectOne(wrapper); |
||||
|
if (null == event) { |
||||
|
baseDao.insert(entity); |
||||
|
} else { |
||||
|
entity.setId(event.getId()); |
||||
|
baseDao.updateById(entity); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
if (CollectionUtils.isNotEmpty(formDTO.getWorkList())) { |
||||
|
formDTO.getWorkList().forEach(item -> { |
||||
|
ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity(); |
||||
|
entity.setEventId(item.getId()); |
||||
|
entity.setEventType("work"); |
||||
|
entity.setEventCreateTime(item.getHappenTime()); |
||||
|
entity.setCategoryCode(item.getWorkType()); |
||||
|
LambdaQueryWrapper<ScreenPyEventDataEntity> wrapper = new LambdaQueryWrapper<>(); |
||||
|
wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); |
||||
|
wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); |
||||
|
ScreenPyEventDataEntity event = baseDao.selectOne(wrapper); |
||||
|
if (null == event) { |
||||
|
baseDao.insert(entity); |
||||
|
} else { |
||||
|
entity.setId(event.getId()); |
||||
|
baseDao.updateById(entity); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
<?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.evaluationindex.screen.ScreenPyEventDataDao"> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue