From 4f2da6e6882b9ae938aad17d8fbb06ac980074a7 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 13 May 2020 14:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E4=B8=9A=E9=A1=B9=E7=9B=AE=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esua/epdc/modules/group/dao/GroupDao.java | 12 ++ .../modules/group/entity/GroupEntity.java | 5 + .../epdc/modules/group/excel/GroupExcel.java | 3 + .../controller/PropertyProjectController.java | 94 +++++++++++ .../project/dao/PropertyProjectDao.java | 46 ++++++ .../project/entity/PropertyProjectEntity.java | 94 +++++++++++ .../project/excel/PropertyProjectExcel.java | 89 ++++++++++ .../project/redis/PropertyProjectRedis.java | 47 ++++++ .../service/PropertyProjectService.java | 95 +++++++++++ .../impl/PropertyProjectServiceImpl.java | 154 ++++++++++++++++++ .../main/resources/mapper/group/GroupDao.xml | 8 + .../mapper/project/PropertyProjectDao.xml | 53 ++++++ 12 files changed, 700 insertions(+) create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/controller/PropertyProjectController.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/dao/PropertyProjectDao.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectEntity.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/excel/PropertyProjectExcel.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/redis/PropertyProjectRedis.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/PropertyProjectService.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/impl/PropertyProjectServiceImpl.java create mode 100644 epdc-cloud-property/src/main/resources/mapper/project/PropertyProjectDao.xml diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java index 7b1db63..a0fcb32 100644 --- a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/dao/GroupDao.java @@ -26,6 +26,7 @@ import com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO; import com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO; import com.elink.esua.epdc.modules.group.entity.GroupEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -199,4 +200,15 @@ public interface GroupDao extends BaseDao { * @since 2020/3/7 2:08 */ List selectListOfPartyGroups(String deptId); + + /** + * + * 逻辑删除群组 + * + * @params [ProjectIds] + * @return int + * @author zhangyuan + * @since 2020/5/12 2:08 + */ + int deleteGroupByProjectIds(@Param("projectIds") List projectIds); } diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/entity/GroupEntity.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/entity/GroupEntity.java index 997a50e..e452880 100644 --- a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/entity/GroupEntity.java +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/entity/GroupEntity.java @@ -58,6 +58,11 @@ public class GroupEntity extends BaseEpdcEntity { */ private String groupCategory; + /** + * 物业项目ID + */ + private String propertyProjectId; + // /** // * 区 // */ diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/excel/GroupExcel.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/excel/GroupExcel.java index bdd6912..555eeee 100644 --- a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/excel/GroupExcel.java +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/group/excel/GroupExcel.java @@ -46,6 +46,9 @@ public class GroupExcel { @Excel(name = "社群类别 0:党员群,1:自建群") private String groupCategory; + @Excel(name = "物业项目ID") + private String propertyProjectId; + @Excel(name = "区") private String area; diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/controller/PropertyProjectController.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/controller/PropertyProjectController.java new file mode 100644 index 0000000..773565d --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/controller/PropertyProjectController.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.project.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.project.PropertyProjectDTO; +import com.elink.esua.epdc.modules.project.excel.PropertyProjectExcel; +import com.elink.esua.epdc.modules.project.service.PropertyProjectService; +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 zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@RestController +@RequestMapping("propertyproject") +public class PropertyProjectController { + + @Autowired + private PropertyProjectService propertyProjectService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = propertyProjectService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PropertyProjectDTO data = propertyProjectService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PropertyProjectDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + propertyProjectService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PropertyProjectDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + propertyProjectService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + propertyProjectService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = propertyProjectService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, PropertyProjectExcel.class); + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/dao/PropertyProjectDao.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/dao/PropertyProjectDao.java new file mode 100644 index 0000000..ccf3884 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/dao/PropertyProjectDao.java @@ -0,0 +1,46 @@ +/** + * 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.project.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.group.GroupManagementDTO; +import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@Mapper +public interface PropertyProjectDao extends BaseDao { + + /** + * 项目列表 + * + * @return java.util.List + * @params [params] + * @author zhangyuan + * @since 2019/10/11 14:54 + */ + List selectListOfGroups(Map params); +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectEntity.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectEntity.java new file mode 100644 index 0000000..1f03188 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/entity/PropertyProjectEntity.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.project.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_property_project") +public class PropertyProjectEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String grid; + + /** + * 物业项目名称 + */ + private String projectName; + + /** + * 物业名称 + */ + private String propertyName; + + /** + * 物业电话 + */ + private String propertyTel; + + /** + * 物业负责人 + */ + private String propertyManager; + + /** + * 物业地址 + */ + private String propertyAddress; + + /** + * 父所有部门 + */ + private String parentDeptIds; + + /** + * 父所有部门 + */ + private String parentDeptNames; + + /** + * 所有部门ID + */ + private String allDeptIds; + + /** + * 所有部门名称 + */ + private String allDeptNames; + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/excel/PropertyProjectExcel.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/excel/PropertyProjectExcel.java new file mode 100644 index 0000000..7524df7 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/excel/PropertyProjectExcel.java @@ -0,0 +1,89 @@ +/** + * 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.project.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@Data +public class PropertyProjectExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "网格名称") + private String grid; + + @Excel(name = "物业项目名称") + private String projectName; + + @Excel(name = "物业名称") + private String propertyName; + + @Excel(name = "物业电话") + private String propertyTel; + + @Excel(name = "物业负责人") + private String propertyManager; + + @Excel(name = "物业地址") + private String propertyAddress; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标记(0-否,1-是)") + private String delFlag; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "父所有部门") + private String parentDeptIds; + + @Excel(name = "父所有部门") + private String parentDeptNames; + + @Excel(name = "所有部门ID") + private String allDeptIds; + + @Excel(name = "所有部门名称") + private String allDeptNames; + + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/redis/PropertyProjectRedis.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/redis/PropertyProjectRedis.java new file mode 100644 index 0000000..539e587 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/redis/PropertyProjectRedis.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.project.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@Component +public class PropertyProjectRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/PropertyProjectService.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/PropertyProjectService.java new file mode 100644 index 0000000..1e6fb2d --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/PropertyProjectService.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.project.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.project.PropertyProjectDTO; +import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; + +import java.util.List; +import java.util.Map; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +public interface PropertyProjectService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-09 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-09 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return PropertyProjectDTO + * @author generator + * @date 2020-05-09 + */ + PropertyProjectDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-09 + */ + void save(PropertyProjectDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-09 + */ + void update(PropertyProjectDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-09 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/impl/PropertyProjectServiceImpl.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/impl/PropertyProjectServiceImpl.java new file mode 100644 index 0000000..8ee524c --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/project/service/impl/PropertyProjectServiceImpl.java @@ -0,0 +1,154 @@ +/** + * 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.project.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.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.modules.group.dao.GroupDao; +import com.elink.esua.epdc.modules.group.entity.GroupEntity; +import com.elink.esua.epdc.modules.project.dao.PropertyProjectDao; +import com.elink.esua.epdc.dto.project.PropertyProjectDTO; +import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; +import com.elink.esua.epdc.modules.project.redis.PropertyProjectRedis; +import com.elink.esua.epdc.modules.project.service.PropertyProjectService; +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 javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 物业项目表 + * + * @author zhangyuan qu@elink-cn.com + * @since v1.0.0 2020-05-09 + */ +@Service +public class PropertyProjectServiceImpl extends BaseServiceImpl implements PropertyProjectService { + + @Autowired + private PropertyProjectRedis propertyProjectRedis; + + @Resource + private GroupDao groupDao; + + private final String avatarUrl = "https://epdc-yushan.elinkservice.cn/files-pro/20200512/e58074e631c5413692623b63fd51f580.png"; + + @Override + public PageData page(Map params) { + IPage page = getPage(params); + List entityList = baseDao.selectListOfGroups(params); + List list = ConvertUtils.sourceToTarget(entityList, PropertyProjectDTO.class); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PropertyProjectDTO.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 PropertyProjectDTO get(String id) { + PropertyProjectEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, PropertyProjectDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PropertyProjectDTO dto) { + PropertyProjectEntity entity = ConvertUtils.sourceToTarget(dto, PropertyProjectEntity.class); + entity = gridInfo(entity); + entity.setDelFlag("0"); + baseDao.insert(entity); + + // 创建物业项目的同时创建群 + GroupEntity groupEntity = new GroupEntity(); + groupEntity.setPropertyProjectId(entity.getId()); + groupEntity.setGroupAvatar(avatarUrl); + groupEntity.setGroupName(entity.getProjectName() + "群"); + groupEntity.setGroupCategory("2"); + groupEntity.setGrid(entity.getGrid()); + groupEntity.setGridId(Long.parseLong(entity.getGridId())); + groupEntity.setDelFlag("0"); + groupEntity.setCreatedBy(entity.getCreatedBy()); + groupEntity.setCreatedTime(entity.getCreatedTime()); + groupEntity.setAllDeptIds(entity.getAllDeptIds()); + groupEntity.setAllDeptNames(entity.getAllDeptNames()); + groupEntity.setParentDeptIds(entity.getParentDeptIds()); + groupEntity.setParentDeptNames(entity.getParentDeptNames()); + groupDao.insert(groupEntity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PropertyProjectDTO dto) { + PropertyProjectEntity entity = ConvertUtils.sourceToTarget(dto, PropertyProjectEntity.class); + entity = gridInfo(entity); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + groupDao.deleteGroupByProjectIds(Arrays.asList(ids)); + } + + /** + * 处理级联选择器的网格信息 + * + * @param entity + * @return + */ + private PropertyProjectEntity gridInfo(PropertyProjectEntity entity) { + String[] deptIds = entity.getAllDeptIds().trim().replaceAll("]", "").replaceAll("\\[", "").replaceAll("\"", "").replaceAll("'", "").split(","); + String[] deptNames = entity.getAllDeptNames().trim().split("/"); + String[] parentDeptIds = Arrays.copyOf(deptIds, deptIds.length - 1); + String[] parentDeptNames = Arrays.copyOf(deptNames, deptNames.length - 1); + + if (deptIds.length > 0 && deptNames.length > 0) { + entity.setGridId(deptIds[0]); + entity.setGrid(deptNames[0]); + entity.setAllDeptIds(StringUtils.join(deptIds, ",")); + entity.setAllDeptNames(StringUtils.join(deptNames, "-")); + entity.setParentDeptIds(StringUtils.join(parentDeptIds, ",")); + entity.setParentDeptNames(StringUtils.join(parentDeptNames, "-")); + } + return entity; + } +} \ No newline at end of file diff --git a/epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml b/epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml index 97bf9fa..d7a0e05 100644 --- a/epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml +++ b/epdc-cloud-property/src/main/resources/mapper/group/GroupDao.xml @@ -406,4 +406,12 @@ ORDER BY FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) AND GROUP_CATEGORY = '0' + + + UPDATE epdc_group SET DEL_FLAG = '1', UPDATED_TIME = NOW() WHERE + PROPERTY_PROJECT_ID in + + #{projectIds} + + diff --git a/epdc-cloud-property/src/main/resources/mapper/project/PropertyProjectDao.xml b/epdc-cloud-property/src/main/resources/mapper/project/PropertyProjectDao.xml new file mode 100644 index 0000000..cde3b92 --- /dev/null +++ b/epdc-cloud-property/src/main/resources/mapper/project/PropertyProjectDao.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + ID, GRID_ID, GRID, PROJECT_NAME, PROPERTY_NAME, PROPERTY_TEL, PROPERTY_MANAGER, PROPERTY_ADDRESS, + SORT, REVISION, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, PARENT_DEPT_IDS, + PARENT_DEPT_NAMES, ALL_DEPT_IDS, ALL_DEPT_NAMES + + + \ No newline at end of file