diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/ItemDTO.java b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/ItemDTO.java new file mode 100755 index 000000000..847b2786e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/item/ItemDTO.java @@ -0,0 +1,177 @@ +/** + * 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.item; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Data +public class ItemDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 事件ID + */ + private String eventId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 议题内容 + */ + private String issueContent; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private String areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private String streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private String communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private String gridId; + + /** + * 议题位置地址 + */ + private String issueAddress; + + /** + * 议题分类ID + */ + private String issueCategoryId; + + /** + * 议题位置纬度 + */ + private BigDecimal issusLatitude; + + /** + * 议题位置经度 + */ + private BigDecimal issueLongitude; + + /** + * 友邻社区ID + */ + private String friendlyCommunityId; + + /** + * 评价打分 + */ + private Integer issueScore; + + /** + * 项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题 + */ + private Integer itemState; + + /** + * 删除标识 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/controller/ItemController.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/controller/ItemController.java new file mode 100755 index 000000000..fdb352fce --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/controller/ItemController.java @@ -0,0 +1,94 @@ +/** + * 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.item.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +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.item.ItemDTO; +import com.elink.esua.epdc.modules.item.excel.ItemExcel; +import com.elink.esua.epdc.modules.item.service.ItemService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@RestController +@RequestMapping("item") +public class ItemController { + + @Autowired + private ItemService itemService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = itemService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ItemDTO data = itemService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ItemDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + itemService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ItemDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + itemService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + itemService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = itemService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ItemExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.java new file mode 100755 index 000000000..0511d971b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/dao/ItemDao.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.item.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.item.entity.ItemEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Mapper +public interface ItemDao extends BaseDao { + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/entity/ItemEntity.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/entity/ItemEntity.java new file mode 100755 index 000000000..e766df97e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/entity/ItemEntity.java @@ -0,0 +1,147 @@ +/** + * 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.item.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_item") +public class ItemEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 事件ID + */ + private String eventId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 用户ID + */ + private String userId; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户头像 + */ + private String userFace; + + /** + * 议题内容 + */ + private String issueContent; + + /** + * 区 + */ + private String area; + + /** + * 区ID + */ + private String areaId; + + /** + * 街道 + */ + private String street; + + /** + * 街道ID + */ + private String streetId; + + /** + * 社区 + */ + private String community; + + /** + * 社区ID + */ + private String communityId; + + /** + * 网格 + */ + private String grid; + + /** + * 网格ID + */ + private String gridId; + + /** + * 议题位置地址 + */ + private String issueAddress; + + /** + * 议题分类ID + */ + private String issueCategoryId; + + /** + * 议题位置纬度 + */ + private BigDecimal issusLatitude; + + /** + * 议题位置经度 + */ + private BigDecimal issueLongitude; + + /** + * 友邻社区ID + */ + private String friendlyCommunityId; + + /** + * 评价打分 + */ + private Integer issueScore; + + /** + * 项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题 + */ + private Integer itemState; + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/excel/ItemExcel.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/excel/ItemExcel.java new file mode 100755 index 000000000..357e46e39 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/excel/ItemExcel.java @@ -0,0 +1,120 @@ +/** + * 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.item.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Data +public class ItemExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "事件ID") + private String eventId; + + @Excel(name = "议题ID") + private String issueId; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "用户昵称") + private String nickName; + + @Excel(name = "用户头像") + private String userFace; + + @Excel(name = "议题内容") + private String issueContent; + + @Excel(name = "区") + private String area; + + @Excel(name = "区ID") + private String areaId; + + @Excel(name = "街道") + private String street; + + @Excel(name = "街道ID") + private String streetId; + + @Excel(name = "社区") + private String community; + + @Excel(name = "社区ID") + private String communityId; + + @Excel(name = "网格") + private String grid; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "议题位置地址") + private String issueAddress; + + @Excel(name = "议题分类ID") + private String issueCategoryId; + + @Excel(name = "议题位置纬度") + private BigDecimal issusLatitude; + + @Excel(name = "议题位置经度") + private BigDecimal issueLongitude; + + @Excel(name = "友邻社区ID") + private String friendlyCommunityId; + + @Excel(name = "评价打分") + private Integer issueScore; + + @Excel(name = "项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题") + private Integer itemState; + + @Excel(name = "删除标识 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/redis/ItemRedis.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/redis/ItemRedis.java new file mode 100755 index 000000000..0708cc77a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/redis/ItemRedis.java @@ -0,0 +1,47 @@ +/** + * 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.item.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Component +public class ItemRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/ItemService.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/ItemService.java new file mode 100755 index 000000000..6e2d87563 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/ItemService.java @@ -0,0 +1,95 @@ +/** + * 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.item.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.item.ItemDTO; +import com.elink.esua.epdc.modules.item.entity.ItemEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +public interface ItemService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author + * @date + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author + * @date + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ItemDTO + * @author + * @date + */ + ItemDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author + * @date + */ + void save(ItemDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author + * @date + */ + void update(ItemDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author + * @date + */ + void delete(String[] ids); +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/impl/ItemServiceImpl.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/impl/ItemServiceImpl.java new file mode 100755 index 000000000..b0671d2a2 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/item/service/impl/ItemServiceImpl.java @@ -0,0 +1,104 @@ +/** + * 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.item.service.impl; + +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.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.dto.item.ItemDTO; +import com.elink.esua.epdc.modules.item.dao.ItemDao; +import com.elink.esua.epdc.modules.item.entity.ItemEntity; +import com.elink.esua.epdc.modules.item.redis.ItemRedis; +import com.elink.esua.epdc.modules.item.service.ItemService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 项目表 项目表 + * + * @author yujintao yujintao@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@Service +public class ItemServiceImpl extends BaseServiceImpl implements ItemService { + + @Autowired + private ItemRedis itemRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ItemDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ItemDTO.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 ItemDTO get(String id) { + ItemEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ItemDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ItemDTO dto) { + ItemEntity entity = ConvertUtils.sourceToTarget(dto, ItemEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ItemDTO dto) { + ItemEntity entity = ConvertUtils.sourceToTarget(dto, ItemEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml new file mode 100755 index 000000000..61f8a3ccc --- /dev/null +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/item/ItemDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +