Browse Source

发布事件接口修改 新增事件关联的工作人员信息

feature/screenDataPush
liuchuang 4 years ago
parent
commit
04a4632878
  1. 81
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/WorkUserEventsDTO.java
  2. 5
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EpdcEventSubmitFormDTO.java
  3. 84
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/WorkUserEventsController.java
  4. 33
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/WorkUserEventsDao.java
  5. 51
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/WorkUserEventsEntity.java
  6. 107
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/WorkUserEventsService.java
  7. 11
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java
  8. 117
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/WorkUserEventsServiceImpl.java
  9. 7
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml
  10. 2
      renren-cloud-generator/src/main/resources/application.yml

81
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/WorkUserEventsDTO.java

@ -0,0 +1,81 @@
/**
* 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.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
@Data
public class WorkUserEventsDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 工作人员ID
*/
private Long workUserId;
/**
* 事件ID
*/
private String eventId;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
}

5
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EpdcEventSubmitFormDTO.java

@ -173,4 +173,9 @@ public class EpdcEventSubmitFormDTO implements Serializable {
* 事件标签 * 事件标签
*/ */
private List<String> tagIds; private List<String> tagIds;
/**
* 工作人员ID
*/
private List<Long> workUserIds;
} }

84
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/WorkUserEventsController.java

@ -0,0 +1,84 @@
/**
* 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.elink.esua.epdc.modules.events.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.WorkUserEventsDTO;
import com.elink.esua.epdc.modules.events.service.WorkUserEventsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
@RestController
@RequestMapping("workusereventstag")
public class WorkUserEventsController {
@Autowired
private WorkUserEventsService workUserEventsService;
@GetMapping("page")
public Result<PageData<WorkUserEventsDTO>> page(@RequestParam Map<String, Object> params){
PageData<WorkUserEventsDTO> page = workUserEventsService.page(params);
return new Result<PageData<WorkUserEventsDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WorkUserEventsDTO> get(@PathVariable("id") String id){
WorkUserEventsDTO data = workUserEventsService.get(id);
return new Result<WorkUserEventsDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WorkUserEventsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
workUserEventsService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WorkUserEventsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
workUserEventsService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
workUserEventsService.delete(ids);
return new Result();
}
}

33
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/WorkUserEventsDao.java

@ -0,0 +1,33 @@
/**
* 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.elink.esua.epdc.modules.events.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.events.entity.WorkUserEventsEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
@Mapper
public interface WorkUserEventsDao extends BaseDao<WorkUserEventsEntity> {
}

51
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/WorkUserEventsEntity.java

@ -0,0 +1,51 @@
/**
* 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.elink.esua.epdc.modules.events.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_work_user_events_tag")
public class WorkUserEventsEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 工作人员ID
*/
private Long workUserId;
/**
* 事件ID
*/
private String eventId;
}

107
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/WorkUserEventsService.java

@ -0,0 +1,107 @@
/**
* 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.elink.esua.epdc.modules.events.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.WorkUserEventsDTO;
import com.elink.esua.epdc.modules.events.entity.WorkUserEventsEntity;
import java.util.List;
import java.util.Map;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
public interface WorkUserEventsService extends BaseService<WorkUserEventsEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<WorkUserEventsTagDTO>
* @author generator
* @date 2021-07-21
*/
PageData<WorkUserEventsDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<WorkUserEventsTagDTO>
* @author generator
* @date 2021-07-21
*/
List<WorkUserEventsDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return WorkUserEventsTagDTO
* @author generator
* @date 2021-07-21
*/
WorkUserEventsDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-07-21
*/
void save(WorkUserEventsDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-07-21
*/
void update(WorkUserEventsDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-07-21
*/
void delete(String[] ids);
/**
* 保存事件与工作人员关系
*
* @param eventId
* @param workUserIds
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author liuchuang
* @since 2021/7/21 14:28
*/
Result saveWorkUserRelationEventInfo(String eventId, List<Long> workUserIds);
}

11
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java

@ -61,10 +61,7 @@ import com.elink.esua.epdc.modules.category.entity.CategoryEntity;
import com.elink.esua.epdc.modules.category.service.CategoryService; import com.elink.esua.epdc.modules.category.service.CategoryService;
import com.elink.esua.epdc.modules.events.dao.EpdcEventsDao; import com.elink.esua.epdc.modules.events.dao.EpdcEventsDao;
import com.elink.esua.epdc.modules.events.entity.EpdcEventsEntity; import com.elink.esua.epdc.modules.events.entity.EpdcEventsEntity;
import com.elink.esua.epdc.modules.events.service.EpdcEventsService; import com.elink.esua.epdc.modules.events.service.*;
import com.elink.esua.epdc.modules.events.service.EventTagRelationService;
import com.elink.esua.epdc.modules.events.service.EventTagService;
import com.elink.esua.epdc.modules.events.service.ImgService;
import com.elink.esua.epdc.modules.feign.AdminFeignClient; import com.elink.esua.epdc.modules.feign.AdminFeignClient;
import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient;
import com.elink.esua.epdc.modules.feign.GroupFeignClient; import com.elink.esua.epdc.modules.feign.GroupFeignClient;
@ -130,6 +127,9 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl<EpdcEventsDao, EpdcEv
@Autowired @Autowired
private EventTagRelationService eventTagRelationService; private EventTagRelationService eventTagRelationService;
@Autowired
private WorkUserEventsService workUserEventsService;
@Override @Override
public PageData<EpdcEventsDTO> listOfPendingReviewEvents(Map<String, Object> params) { public PageData<EpdcEventsDTO> listOfPendingReviewEvents(Map<String, Object> params) {
IPage<EpdcEventsDTO> page = getPage(params); IPage<EpdcEventsDTO> page = getPage(params);
@ -206,6 +206,9 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl<EpdcEventsDao, EpdcEv
// 保存事件标签 // 保存事件标签
eventTagRelationService.saveEventTags(dto.getTagIds(), entity.getId()); eventTagRelationService.saveEventTags(dto.getTagIds(), entity.getId());
// 保存事件关联的工作人员
workUserEventsService.saveWorkUserRelationEventInfo(entity.getId(), dto.getWorkUserIds());
// 发送菜单消息-议题待回应 // 发送菜单消息-议题待回应
this.sendMenuNoticeOfEventRespond(entity.getGridId(), null); this.sendMenuNoticeOfEventRespond(entity.getGridId(), null);

117
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/WorkUserEventsServiceImpl.java

@ -0,0 +1,117 @@
/**
* 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.elink.esua.epdc.modules.events.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.WorkUserEventsDTO;
import com.elink.esua.epdc.modules.events.dao.WorkUserEventsDao;
import com.elink.esua.epdc.modules.events.entity.WorkUserEventsEntity;
import com.elink.esua.epdc.modules.events.service.WorkUserEventsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 事件工作人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-07-21
*/
@Service
public class WorkUserEventsServiceImpl extends BaseServiceImpl<WorkUserEventsDao, WorkUserEventsEntity> implements WorkUserEventsService {
@Override
public PageData<WorkUserEventsDTO> page(Map<String, Object> params) {
IPage<WorkUserEventsEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, WorkUserEventsDTO.class);
}
@Override
public List<WorkUserEventsDTO> list(Map<String, Object> params) {
List<WorkUserEventsEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, WorkUserEventsDTO.class);
}
private QueryWrapper<WorkUserEventsEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<WorkUserEventsEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public WorkUserEventsDTO get(String id) {
WorkUserEventsEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, WorkUserEventsDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(WorkUserEventsDTO dto) {
WorkUserEventsEntity entity = ConvertUtils.sourceToTarget(dto, WorkUserEventsEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(WorkUserEventsDTO dto) {
WorkUserEventsEntity entity = ConvertUtils.sourceToTarget(dto, WorkUserEventsEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result saveWorkUserRelationEventInfo(String eventId, List<Long> workUserIds) {
if (StringUtils.isNotEmpty(eventId) && CollectionUtil.isNotEmpty(workUserIds)) {
for (Long workUserId:
workUserIds) {
WorkUserEventsEntity entity = new WorkUserEventsEntity();
entity.setWorkUserId(workUserId);
entity.setEventId(eventId);
insert(entity);
}
}
return new Result();
}
}

7
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml

@ -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.elink.esua.epdc.modules.events.dao.WorkUserEventsDao">
</mapper>

2
renren-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置 #MySQL配置
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://rm-m5eguiv2827bdye798o.mysql.rds.aliyuncs.com:10001/js_esua_epdc_custom?useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://rm-m5eguiv2827bdye798o.mysql.rds.aliyuncs.com:10001/js_esua_epdc_events?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: jinshui_epdc_test username: jinshui_epdc_test
password: jinshui@833066 password: jinshui@833066
#oracle配置 #oracle配置

Loading…
Cancel
Save