Browse Source

Merge branch 'dev_ic_mp' into develop

dev
sunyuchao 4 years ago
parent
commit
9d8210f082
  1. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  2. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  3. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java
  4. 24
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java
  5. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/NewEventsResultDTO.java
  6. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResiEventListResultDTO.java
  7. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java
  8. 112
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  9. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml
  10. 26
      epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.17__event_scan.sql
  11. 83
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml
  12. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -146,10 +146,9 @@ public class HouseController {
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcHouseExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
}
List<IcHouseExcel> result =importResult.getList();

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java

@ -60,7 +60,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("neighborhood")
public class NeighborHoodController {
@Autowired
private IcNeighborHoodService icNeighborHoodService;
@Autowired
@ -210,7 +210,7 @@ public class NeighborHoodController {
List<Integer> numList = new ArrayList<>();
if(!CollectionUtils.isEmpty(failList)){
for ( IcNeighborHoodExcel entity : failList) {
log.error("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
log.warn("第{}行,{}",entity.getRowNum(),entity.getErrorMsg());//打印失败的行 和失败的信息
numList.add(entity.getRowNum());
}
//return new Result().error(8001,failList.get(0).getErrorMsg());
@ -231,4 +231,4 @@ public class NeighborHoodController {
}
}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java

@ -34,7 +34,7 @@ public class ResiEventFormDTO implements Serializable {
/**
* 事件内容最多1000
*/
@Length(min = 1, max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
@Length(max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
private String eventContent;
/**

24
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventListResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -45,4 +46,27 @@ public class EventListResultDTO implements Serializable {
*/
private List<String> eventImgs;
/**
* 语音附件url集合
*/
private List<String> voiceList;
/**
* 事件附件
*/
@JsonIgnore
private List<Attachment> attachmentList;
@Data
public static class Attachment {
/**
* url
*/
private String url;
/**
* 附件类型
*/
private String type;
}
}

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/NewEventsResultDTO.java

@ -40,7 +40,7 @@ public class NewEventsResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ResiEventListResultDTO.java

@ -69,7 +69,7 @@ public class ResiEventListResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/UserMentionResultDTO.java

@ -68,7 +68,7 @@ public class UserMentionResultDTO implements Serializable {
* 事件附件
*/
@JsonIgnore
private List<EventDetailResultDTO.Attachment> attachmentList;
private List<Attachment> attachmentList;
@Data
public static class Attachment {

112
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -125,6 +125,20 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
List<EventListResultDTO> result = baseDao.eventUnDisposedList(formDTO.getOrgId(), formDTO.getEventType());
if (!CollectionUtils.isEmpty(result)){
//附件按类型分组【图片、语音】
result.forEach(re->{
List<String> eventImgs = new ArrayList<>();
List<String> voiceList = new ArrayList<>();
re.getAttachmentList().forEach(file->{
if ("image".equals(file.getType())) {
eventImgs.add(file.getUrl());
} else if ("voice".equals(file.getType())) {
voiceList.add(file.getUrl());
}
});
re.setEventImgs(eventImgs);
re.setVoiceList(voiceList);
});
return result;
}
return new ArrayList<>();
@ -322,7 +336,50 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
});
//5-2.插入语音附件
if(!org.apache.commons.collections4.CollectionUtils.isEmpty(formDTO.getVoiceList())) {
eventVoiceAttachment(formDTO.getCustomerId(), resiEventEntity.getId(), formDTO.getVoiceList());
//语音附件处理【创建阿里安全审核任务】
//5-2-1.语音附件存入表中
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>();
int sort = 1;//原本下标从0开始 图片的用了1就保持一致从1开始
for (FileCommonDTO file : formDTO.getVoiceList()) {
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setResiEventId(resiEventEntity.getId());
entity.setAttachmentName(file.getName());
entity.setAttachmentFormat(file.getFormat());
entity.setAttachmentType(file.getType());
entity.setAttachmentUrl(file.getUrl());
entity.setSort(sort);
entity.setStatus(TopicConstant.AUDITING);
sort++;
resiEventAttachmentDao.insert(entity);
VoiceTaskDTO task = new VoiceTaskDTO();
task.setDataId(entity.getId());
task.setUrl(file.getUrl());
voiceDTOList.add(task);
}
//5-2-2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO();
voiceScanParamDTO.setTasks(voiceDTOList);
voiceScanParamDTO.setOpenCallBack(false);
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO);
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks();
//提交记录存入task表
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> {
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity();
taskEntity.setCustomerId(formDTO.getCustomerId());
taskEntity.setResiEventId(resiEventEntity.getId());
taskEntity.setResiEventAttachmentId(item.getDataId());
taskEntity.setTaskId(item.getTaskId());
taskEntity.setStatus(TopicConstant.AUDITING);
taskEntity.setAttachmentType(TopicConstant.VOICE);
return taskEntity;
}).collect(Collectors.toList());
resiEventScanTaskService.insertBatch(scanTaskEntityList);
}
}
//6、插入组织表
List<ResiEventReportOrgEntity> orgEntityList=getOrgList(formDTO.getCustomerId(),resiEventEntity.getId(),formDTO.getOrgList());
@ -401,62 +458,13 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
entity.setAttachmentType(img.getType());
entity.setAttachmentUrl(img.getUrl());
entity.setSort(sort);
entity.setStatus(TopicConstant.AUTO_PASSED);
sort++;
list.add(entity);
}
return list;
}
/**
* @Author sun
* @Description 事件-语音附件处理创建审核任务
**/
private void eventVoiceAttachment(String customerId, String resiEventId, List<FileCommonDTO> voiceList) {
//1.语音附件存入表中
List<VoiceTaskDTO> voiceDTOList = new ArrayList<>();
int sort = 0;
for (FileCommonDTO file : voiceList) {
ResiEventAttachmentEntity entity = new ResiEventAttachmentEntity();
entity.setCustomerId(customerId);
entity.setResiEventId(resiEventId);
entity.setAttachmentName(file.getName());
entity.setAttachmentFormat(file.getFormat());
entity.setAttachmentType(file.getType());
entity.setAttachmentUrl(file.getUrl());
entity.setSort(sort);
sort++;
resiEventAttachmentDao.insert(entity);
VoiceTaskDTO task = new VoiceTaskDTO();
task.setDataId(entity.getId());
task.setUrl(file.getUrl());
voiceDTOList.add(task);
}
//2.语音创建审核任务【定时任务会处理待审核语音后修改数据库数据】
VoiceScanParamDTO voiceScanParamDTO = new VoiceScanParamDTO();
voiceScanParamDTO.setTasks(voiceDTOList);
voiceScanParamDTO.setOpenCallBack(false);
Result<AsyncScanResult> voiceScanResult = ScanContentUtils.voiceAsyncScan(scanApiUrl.concat(voiceAsyncScanMethod), voiceScanParamDTO);
if (!voiceScanResult.success() || !voiceScanResult.getData().isAllSuccess()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
List<AsyncScanTaskDTO> taskList = voiceScanResult.getData().getSuccessTasks();
List<String> taskIds = taskList.stream().map(AsyncScanTaskDTO::getTaskId).collect(Collectors.toList());
//提交记录存入task表
List<ResiEventScanTaskEntity> scanTaskEntityList = taskList.stream().map(item -> {
ResiEventScanTaskEntity taskEntity = new ResiEventScanTaskEntity();
taskEntity.setCustomerId(customerId);
taskEntity.setResiEventId(resiEventId);
taskEntity.setResiEventAttachmentId(item.getDataId());
taskEntity.setTaskId(item.getTaskId());
taskEntity.setStatus(TopicConstant.AUDITING);
taskEntity.setAttachmentType(TopicConstant.VOICE);
return taskEntity;
}).collect(Collectors.toList());
resiEventScanTaskService.insertBatch(scanTaskEntityList);
}
}
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
//事件内容
if (StringUtils.isNotBlank(eventContent)) {
@ -1017,7 +1025,7 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
//草稿状态更新为auto_passed
ResiEventEntity draftEntity = new ResiEventEntity();
draftEntity.setId(draftId);
draftEntity.setAuditStatus(EventConstant.REVIEW);
draftEntity.setAuditStatus(EventConstant.AUTO_PASSED);
baseDao.updateById(draftEntity);
}
});

2
epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml

@ -122,6 +122,8 @@ openapi:
method:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
voiceAsyncScan: /voiceAsyncScan
voiceResults: /voiceResults
#pageHelper分页插件
pagehelper:

26
epmet-module/gov-project/gov-project-server/src/main/resources/db/migration/V0.0.17__event_scan.sql

@ -0,0 +1,26 @@
ALTER TABLE `resi_event`
ADD COLUMN `AUDIT_STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'auto_passed' COMMENT '事件审核状态[涉及附件审核需要加的状态](审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)' AFTER `UPDATED_TIME`,
ADD COLUMN `AUDIT_REASON` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核理由' AFTER `AUDIT_STATUS`;
CREATE TABLE `resi_event_scan_task` (
`ID` varchar(64) NOT NULL COMMENT '唯一标识',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`RESI_EVENT_ID` varchar(64) NOT NULL COMMENT '事件Id,关联resi_event的id',
`RESI_EVENT_ATTACHMENT_ID` varchar(64) NOT NULL COMMENT '事件附件表主键,对应dataId',
`TASK_ID` varchar(64) NOT NULL COMMENT '阿里云审核任务Id',
`STATUS` varchar(32) NOT NULL COMMENT '审核状态【auditing: 审核中;\r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;】',
`ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型(视频 - video、 语音 - voice 文件 - doc)',
`DEL_FLAG` char(1) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) NOT NULL COMMENT '操作人,API审核结果,存储为SCAN_USER或者APP_USER',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件附件安全校验任务表';
ALTER TABLE `resi_event_attachment`
ADD COLUMN `STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'auto_passed' COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态' AFTER `UPDATED_TIME`,
ADD COLUMN `REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '失败原因' AFTER `STATUS`;

83
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventDao.xml

@ -10,46 +10,51 @@
<result property="eventTime" column="eventTime"/>
<result property="isProject" column="isProject"/>
<result property="redDot" column="redDot"/>
<collection property="eventImgs" ofType="java.lang.String">
<result column="img"/>
<collection property="attachmentList" ofType="com.epmet.dto.result.EventListResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
</resultMap>
<select id="eventUnDisposedList" resultMap="eventUnDisposedListMap">
SELECT rea.ATTACHMENT_URL AS img,t.* FROM
(SELECT
re.EVENT_CONTENT AS eventContent,
<if test='eventType == "undisposed" '>
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "processed" '>
IFNULL(DATE_FORMAT(re.LATEST_OPERATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "transferred" '>
IFNULL(DATE_FORMAT(re.CLOSE_CASE_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0' AND re.audit_status = 'auto_passed')
AND ro.DEL_FLAG = '0'
and ro.ORG_ID = #{orgId}
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
</if>
SELECT
rea.id AS resiEventAttachmentId,
rea.ATTACHMENT_URL AS url,
rea.ATTACHMENT_TYPE AS type,
t.*
FROM
(
SELECT
re.EVENT_CONTENT AS eventContent,
<if test='eventType == "undisposed" '>
IFNULL(DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "processed" '>
IFNULL(DATE_FORMAT(re.LATEST_OPERATED_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
<if test='eventType == "transferred" '>
IFNULL(DATE_FORMAT(re.CLOSE_CASE_TIME,'%Y-%m-%d %H:%i'),'') AS eventTime,
</if>
re.ID AS eventId,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
(CASE WHEN ro.RED_DOT = 1 THEN TRUE ELSE FALSE END) AS redDot
FROM resi_event_report_org ro
INNER JOIN resi_event re ON (ro.RESI_EVENT_ID = re.ID AND re.DEL_FLAG = '0' AND re.audit_status = 'auto_passed')
AND ro.DEL_FLAG = '0'
AND ro.ORG_ID = #{orgId}
<if test='eventType == "undisposed" '>
AND ro.ORG_READ = 'un_read'
</if>
<if test='eventType == "processed" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'processing'
</if>
<if test='eventType == "transferred" '>
AND ro.ORG_READ = 'read'
AND re.`STATUS` = 'closed_case'
</if>
)t
LEFT JOIN resi_event_attachment rea
ON (rea.RESI_EVENT_ID = t.eventId
and rea.DEL_FLAG = '0'
AND rea.ATTACHMENT_TYPE = 'image')
LEFT JOIN resi_event_attachment rea ON (rea.resi_event_id = t.eventId AND rea.del_flag = '0' AND rea.attachment_type = 'image')
<if test='eventType == "undisposed" '>
ORDER BY t.eventTime,rea.sort asc
</if>
@ -126,6 +131,7 @@
<result column="eventImg"/>
</collection>-->
<collection property="attachmentList" ofType="com.epmet.dto.result.EventDetailResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -146,6 +152,7 @@
(CASE WHEN re.READ_FLAG = 1 THEN FALSE ELSE TRUE END) AS isRollback,
(CASE WHEN re.SHIFT_PROJECT = 1 THEN TRUE ELSE FALSE END) AS isProject,
IFNULL(re.project_id,'') AS projectId,
ea.id AS resiEventAttachmentId,
ea.ATTACHMENT_URL AS url,
ea.ATTACHMENT_TYPE AS type,
IF(ISNULL(em.USER_SHOW_NAME),NULL,concat('人大代表-',em.USER_SHOW_NAME)) AS person,
@ -186,6 +193,7 @@
<result property="eventTime" column="eventTime"/>
<result property="eventId" column="eventId"/>
<collection property="attachmentList" ofType="com.epmet.dto.result.NewEventsResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -197,6 +205,7 @@
SELECT
IFNULL(re.EVENT_CONTENT,'') AS eventContent,
DATE_FORMAT(re.CREATED_TIME,'%Y-%m-%d %H:%i') AS eventTime,
ea.id AS resiEventAttachmentId,
ea.attachment_url AS url,
ea.attachment_type AS type,
re.id as eventId
@ -240,6 +249,7 @@
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<collection property="attachmentList" ofType="com.epmet.dto.result.ResiEventListResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -257,6 +267,7 @@
re.`status`,
re.shift_project,
re.latest_operated_time,
rea.id AS resiEventAttachmentId,
rea.attachment_url AS url,
rea.attachment_type AS type,
re.read_flag,

2
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ResiEventMentionDao.xml

@ -11,6 +11,7 @@
<result property="shiftProject" column="SHIFT_PROJECT" />
<result property="showTime" column="LATEST_OPERATED_TIME" />
<collection property="attachmentList" ofType="com.epmet.dto.result.UserMentionResultDTO$Attachment">
<result column="resiEventAttachmentId"/><!-- 附件表ID,如果附件url和type一样会被去重 加上id就可以了 -->
<result column="url" property="url"/>
<result column="type" property="type"/>
</collection>
@ -33,6 +34,7 @@
re.`STATUS`,
re.SHIFT_PROJECT,
re.LATEST_OPERATED_TIME,
rea.id AS resiEventAttachmentId,
rea.attachment_url AS url,
rea.attachment_type AS type
FROM

Loading…
Cancel
Save