From 04a463287893cfab6985cddae78d7703ca42cfda Mon Sep 17 00:00:00 2001 From: liuchuang Date: Wed, 21 Jul 2021 14:33:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BA=8B=E4=BB=B6=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9=20=E6=96=B0=E5=A2=9E=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=85=B3=E8=81=94=E7=9A=84=E5=B7=A5=E4=BD=9C=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esua/epdc/dto/WorkUserEventsDTO.java | 81 ++++++++++++ .../events/form/EpdcEventSubmitFormDTO.java | 5 + .../controller/WorkUserEventsController.java | 84 +++++++++++++ .../modules/events/dao/WorkUserEventsDao.java | 33 +++++ .../events/entity/WorkUserEventsEntity.java | 51 ++++++++ .../events/service/WorkUserEventsService.java | 107 ++++++++++++++++ .../service/impl/EpdcEventsServiceImpl.java | 21 ++-- .../impl/WorkUserEventsServiceImpl.java | 117 ++++++++++++++++++ .../mapper/events/WorkUserEventsDao.xml | 7 ++ .../src/main/resources/application.yml | 4 +- 10 files changed, 499 insertions(+), 11 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/WorkUserEventsDTO.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/WorkUserEventsController.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/WorkUserEventsDao.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/WorkUserEventsEntity.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/WorkUserEventsService.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/WorkUserEventsServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/WorkUserEventsDTO.java b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/WorkUserEventsDTO.java new file mode 100644 index 00000000..b12933b3 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EpdcEventSubmitFormDTO.java b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EpdcEventSubmitFormDTO.java index f4379e4f..8cc5a106 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/form/EpdcEventSubmitFormDTO.java +++ b/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 tagIds; + + /** + * 工作人员ID + */ + private List workUserIds; } diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/WorkUserEventsController.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/WorkUserEventsController.java new file mode 100644 index 00000000..2975aed2 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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> page(@RequestParam Map params){ + PageData page = workUserEventsService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WorkUserEventsDTO data = workUserEventsService.get(id); + return new Result().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(); + } + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/WorkUserEventsDao.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/WorkUserEventsDao.java new file mode 100644 index 00000000..2d27a671 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/WorkUserEventsEntity.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/WorkUserEventsEntity.java new file mode 100644 index 00000000..83e91095 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/WorkUserEventsService.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/WorkUserEventsService.java new file mode 100644 index 00000000..6ed89fdf --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-07-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-07-21 + */ + List list(Map 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 workUserIds); +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java index 83506f9a..d74abb9e 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EpdcEventsServiceImpl.java +++ b/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.events.dao.EpdcEventsDao; 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.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.events.service.*; import com.elink.esua.epdc.modules.feign.AdminFeignClient; import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; import com.elink.esua.epdc.modules.feign.GroupFeignClient; @@ -130,6 +127,9 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl listOfPendingReviewEvents(Map params) { IPage page = getPage(params); @@ -206,6 +206,9 @@ public class EpdcEventsServiceImpl extends BaseServiceImpl userMobiles){ // 审核操作发送短信 SmsNoticeFormDTO sms = new SmsNoticeFormDTO(); diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/WorkUserEventsServiceImpl.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/WorkUserEventsServiceImpl.java new file mode 100644 index 00000000..1059ad12 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements WorkUserEventsService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WorkUserEventsDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WorkUserEventsDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 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(); + } + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml new file mode 100644 index 00000000..d31b0530 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/WorkUserEventsDao.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/renren-cloud-generator/src/main/resources/application.yml b/renren-cloud-generator/src/main/resources/application.yml index bc9edc65..fac37ad4 100644 --- a/renren-cloud-generator/src/main/resources/application.yml +++ b/renren-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 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 password: jinshui@833066 #oracle配置 @@ -46,4 +46,4 @@ pagehelper: #指定数据库,可选值有【mysql、oracle、sqlserver、postgresql】 renren: - database: mysql \ No newline at end of file + database: mysql