Browse Source

报事?

master
yinzuomei 4 years ago
parent
commit
379eb16df7
  1. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java
  2. 34
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java
  3. 51
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ResiEventFormDTO.java
  4. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java
  5. 61
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java
  6. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java
  7. 117
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/MentionUserFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 被艾特的人
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 15:51
*/
@Data
public class MentionUserFormDTO implements Serializable {
/**
* 人大代表用户id
*/
private String npcUserId;
/**
* 人大代表注册网格id
*/
private String gridId;
/**
* 人大代表注册网格所属社区id
*/
private String agencyId;
/**
* 注册网格的所有上级
*/
private String pids;
}

34
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ReportOrgFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 报给谁
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 15:51
*/
@Data
public class ReportOrgFormDTO implements Serializable {
/**
* 报给 网格grid 社区community 街道:street 区县级: district 市级: city 省级:province
*/
private String orgType;
/**
* 报给的组织或者网格id
*/
private String orgId;
/**
* org_id的上级组织idorg_id是跟组织此列为0
*/
private String orgPid;
/**
* org_id的所有上级组织idorg_id是跟组织此列为0
*/
private String orgPids;
}

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

@ -1,9 +1,14 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
/**
* 我要报事-提交
@ -17,6 +22,52 @@ public class ResiEventFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 用户所在网格id
*/
@NotBlank(message = "不能为空",groups = AddUserInternalGroup.class)
private String gridId;
/**
* 事件内容最多1000
*/
@Length(min = 1, max = 1000, message = "请填写内容,最多输入1000字", groups = AddUserShowGroup.class)
private String eventContent;
/**
* 纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
/**
* 地址
*/
@NotBlank(message = "地址不能为空",groups = AddUserShowGroup.class)
private String address;
/**
* 附件列表
*/
private List<FileCommonDTO> attachmentList;
/**
* @的人
*/
private List<MentionUserFormDTO> npcUserList;
/**
* 报给谁
*/
@NotEmpty(message = "不能为空",groups = AddUserInternalGroup.class)
private List<ReportOrgFormDTO> orgList;
//以下参数从token中获取

3
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/EventConstant.java

@ -14,4 +14,7 @@ public interface EventConstant {
String EVENT_UN_DISPOSED = "undisposed";
String EVENT_TRANSFERRED = "transferred";
String EVENT_STATUS_PROCESSING="processing";
String READ="read";
String UN_READ="un_read";
}

61
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ResiEventAction.java

@ -0,0 +1,61 @@
package com.epmet.constant;
import com.epmet.commons.tools.constant.StrConstant;
/**
* resi_event_operation_log事件操作日志枚举类
*
* @author yinzuomei@elink-cn.com
* @date 2021/8/3 16:38
*/
public enum ResiEventAction {
// 1、发布事件:publish;
// 2、撤回事件:recall;
// 3、复:reply;
// 4、立项:shift_project;
// 5、办结:close_case;
// 6、选择是否已解决:choose_resolve;
// 7、查看阅读事件:read:人大代表未读=>已读;工作人员待处理=>处理中;
PUBLISH ( "publish",""),
RECALL( "recall",""),
REPLY ("reply",""),
SHIFIT_PROJECT ( "shift_project",""),
CLOSE_CASE ( "close_case",""),
CHOOSE_RESOLVE ( "choose_resolve",""),
READ( "read","");
private String code;
private String desc;
ResiEventAction(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static String getDesc(String code) {
ResiEventAction[] businessModeEnums = values();
for (ResiEventAction resiEventAction : businessModeEnums) {
if (resiEventAction.getCode()==code) {
return resiEventAction.getDesc();
}
}
return StrConstant.EPMETY_STR;
}
public String getCode(){
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc(){
return this.desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ResiEventController.java

@ -17,14 +17,12 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.EventDetailResultDTO;
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.dto.form.*;
import com.epmet.dto.result.EventDetailResultDTO;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.dto.result.ResiEventIdDTO;
@ -70,11 +68,11 @@ public class ResiEventController {
* @author yinzuomei
* @date 2021/8/3 10:46
*/
@PostMapping("report")
public Result<ResiEventIdDTO> report(@LoginUser TokenDto tokenDto, @RequestBody ResiEventFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
//校验参数
//todo
ValidatorUtils.validateEntity(formDTO,ResiEventFormDTO.AddUserShowGroup.class,ResiEventFormDTO.AddUserInternalGroup.class);
return new Result<ResiEventIdDTO>().ok(resiEventService.report(formDTO));
}

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

@ -18,25 +18,36 @@
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.EventConstant;
import com.epmet.dao.ResiEventDao;
import com.epmet.dto.form.EventDetailFormDTO;
import com.epmet.dto.form.EventListFormDTO;
import com.epmet.dto.form.UpdateViewTimeFormDTO;
import com.epmet.dto.result.EventDetailResultDTO;
import com.epmet.dto.result.EventListResultDTO;
import com.epmet.dto.form.ChooseResolveFormDTO;
import com.epmet.dto.form.MyReportedFormDTO;
import com.epmet.dto.form.ReCallEventFormDTO;
import com.epmet.dto.form.ResiEventFormDTO;
import com.epmet.dto.result.MyReportedResultDTO;
import com.epmet.dto.result.ResiEventIdDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.ResiEventEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 居民报事表
@ -44,8 +55,18 @@ import java.util.List;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-03
*/
@Slf4j
@Service
public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEventEntity> implements ResiEventService {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
/**
* @Description 群众直报待处理处理中已办结列表
@ -102,15 +123,83 @@ public class ResiEventServiceImpl extends BaseServiceImpl<ResiEventDao, ResiEven
*/
@Override
public ResiEventIdDTO report(ResiEventFormDTO formDTO) {
//1、事件内容审核
//2、图片审核
this.scanContent(formDTO.getEventContent(), formDTO.getAttachmentList());
//3、查询当前所在网格的信息
Result<GridInfoResultDTO> gridInfoRes=govOrgOpenFeignClient.queryGridInfo(formDTO.getGridId());
if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("网格信息查询异常");
}
ResiEventEntity resiEventEntity= ConvertUtils.sourceToTarget(formDTO,ResiEventEntity.class);
resiEventEntity.setAgencyId(gridInfoRes.getData().getParentAgencyId());
resiEventEntity.setPids(gridInfoRes.getData().getPids());
resiEventEntity.setReportUserId(formDTO.getUserId());
//todo
resiEventEntity.setIsParty("?????");
resiEventEntity.setStatus(EventConstant.EVENT_STATUS_PROCESSING);
resiEventEntity.setShiftProject(false);
resiEventEntity.setProjectId(StrConstant.EPMETY_STR);
resiEventEntity.setRecallFlag(false);
resiEventEntity.setReadFlag(false);
resiEventEntity.setRedDot(false);
resiEventEntity.setLatestOperatedTime(new Date());
resiEventEntity.setCreatedTime(resiEventEntity.getLatestOperatedTime());
resiEventEntity.setUpdatedTime(resiEventEntity.getLatestOperatedTime());
baseDao.insert(resiEventEntity);
//4、插入主表resi_event
//5、插入附件表
//6、插入组织表
//7、插入艾特人表
//8、插入log日志
return null;
}
private void scanContent(String eventContent, List<FileCommonDTO> attachmentList) {
//事件内容
if (StringUtils.isNotBlank(eventContent)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(eventContent);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
}
List<String> imgList=new ArrayList<>();
for(FileCommonDTO fileCommonDTO:attachmentList){
if("image".equals(fileCommonDTO.getType())){
imgList.add(fileCommonDTO.getUrl());
}
}
//事件图片
if (!CollectionUtils.isEmpty(imgList)) {
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(imgUrl -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(imgUrl);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
}
}
}
}
/**
* 撤回事件
*

Loading…
Cancel
Save