diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java index 8b26c48efd..af65d4fd90 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java @@ -8,18 +8,19 @@ package com.epmet.controller; -import com.epmet.dto.SysDictDataDTO; -import com.epmet.service.SysDictDataService; -import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.SysDictDataDTO; +import com.epmet.service.SysDictDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; /** @@ -78,4 +79,65 @@ public class SysDictDataController { return new Result(); } + /** + * @Description 九小场所 + * @Param + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/10/26 17:27 + */ + @PostMapping("ninesmallplaces") + public Result> getNineSmallPlacesOption() { + return new Result>().ok(sysDictDataService.getNineSmallPlacesOption()); + } + + /** + * @Description 文化程度 + * @Param + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/10/26 17:27 + */ + @PostMapping("education") + public Result> getEducationOption() { + return new Result>().ok(sysDictDataService.getEducationOption()); + } + + /** + * @Description 民族 + * @Param + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/10/26 17:27 + */ + @PostMapping("nation") + public Result> getNationOption() { + return new Result>().ok(sysDictDataService.getNationOption()); + } + + /** + * @Description 人员关系 + * @Param + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/10/26 17:27 + */ + @PostMapping("relationship") + public Result> getRelationshipOption() { + return new Result>().ok(sysDictDataService.getRelationshipOption()); + } + + /** + * @Description 住房性质 + * @Param + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/10/26 17:27 + */ + @PostMapping("house") + public Result> getHouseOption() { + return new Result>().ok(sysDictDataService.getHouseOption()); + } + + } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java index 2e01f49d91..bcc3bd3953 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java @@ -8,11 +8,13 @@ package com.epmet.service; -import com.epmet.dto.SysDictDataDTO; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.SysDictDataDTO; import com.epmet.entity.SysDictDataEntity; +import java.util.List; import java.util.Map; /** @@ -31,5 +33,48 @@ public interface SysDictDataService extends BaseService { void update(SysDictDataDTO dto); void delete(Long[] ids); + /** + * 九小场所 + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:11 + */ + List getNineSmallPlacesOption(); + + /** + * 文化程度 + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + List getEducationOption(); + + /** + * 民族 + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + List getNationOption(); + + /** + * 人员关系 + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + List getRelationshipOption(); + /** + * 住房性质 + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + List getHouseOption(); } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java index 8a13891ab9..e1c5e266f3 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java @@ -8,9 +8,11 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.SysDictDataDao; @@ -22,7 +24,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 字典类型 @@ -85,4 +89,114 @@ public class SysDictDataServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/10/26 17:11 + */ + @Override + public List getNineSmallPlacesOption() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000001L); + wrapper.orderByAsc(SysDictDataEntity::getSort); + List list = baseDao.selectList(wrapper); + return list.stream().map(item -> { + OptionResultDTO dto = new OptionResultDTO(); + dto.setValue(item.getDictValue()); + dto.setLabel(item.getDictLabel()); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 文化程度 + * + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + @Override + public List getEducationOption() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000002L); + wrapper.orderByAsc(SysDictDataEntity::getSort); + List list = baseDao.selectList(wrapper); + return list.stream().map(item -> { + OptionResultDTO dto = new OptionResultDTO(); + dto.setValue(item.getDictValue()); + dto.setLabel(item.getDictLabel()); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 民族 + * + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + @Override + public List getNationOption() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000003L); + wrapper.orderByAsc(SysDictDataEntity::getSort); + List list = baseDao.selectList(wrapper); + return list.stream().map(item -> { + OptionResultDTO dto = new OptionResultDTO(); + dto.setValue(item.getDictValue()); + dto.setLabel(item.getDictLabel()); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 人员关系 + * + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + @Override + public List getRelationshipOption() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000004L); + wrapper.orderByAsc(SysDictDataEntity::getSort); + List list = baseDao.selectList(wrapper); + return list.stream().map(item -> { + OptionResultDTO dto = new OptionResultDTO(); + dto.setValue(item.getDictValue()); + dto.setLabel(item.getDictLabel()); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 住房性质 + * + * @Param + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/10/26 17:12 + */ + @Override + public List getHouseOption() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000005L); + wrapper.orderByAsc(SysDictDataEntity::getSort); + List list = baseDao.selectList(wrapper); + return list.stream().map(item -> { + OptionResultDTO dto = new OptionResultDTO(); + dto.setValue(item.getDictValue()); + dto.setLabel(item.getDictLabel()); + return dto; + }).collect(Collectors.toList()); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java new file mode 100644 index 0000000000..a7b77e0b90 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java @@ -0,0 +1,15 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2020/11/10 5:18 下午 + */ +public interface NeighborhoodConstant { + + String NEIGHBOR_HOOD= "neighbourHood"; + + String BUILDING = "building"; + + String HOUSE = "house"; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java new file mode 100644 index 0000000000..76a0e52504 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java @@ -0,0 +1,110 @@ +/** + * 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.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + + +@Data +public class IcNeighborHoodFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface DeleteGroup extends CustomerClientShowGroup { + } + /** + * 小区id + */ + @NotBlank(message = "小区id不能为空", groups = {UpdateGroup.class,DeleteGroup.class}) + private String neighborHoodId; + + /** + * 小区名称 + */ + @NotBlank(message = "小区名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @Length(max=50,message = "小区名称不能超过50个字", groups = {AddGroup.class, UpdateGroup.class}) + private String neighborHoodName; + + /** + * 客户id + */ + /* @NotBlank(message = "客户id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String customerId;*/ + + /** + * 组织id + */ + @NotBlank(message = "组织id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String agencyId; + + + /** + * 网格id + */ + @NotBlank(message = "网格id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String gridId; + /** + * 关联物业id + */ + @NotBlank(message = "关联物业ID不能为空", groups = {UpdateGroup.class}) + private String propertyId; + + /** + * 详细地址 + */ + @NotBlank(message = "详细地址不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String address; + + /** + * 备注 + */ + @NotBlank(message = "备注不能为空", groups = {UpdateGroup.class}) + @Length(max=500,message = "备注不能超过500个字", groups = {AddGroup.class, UpdateGroup.class}) + private String remark; + /** + * 坐标位置 + */ + @NotBlank(message = "坐标位置不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String location; + + + /** + * 中心点位:经度 + */ + @NotBlank(message = "经度不能为空", groups = {UpdateGroup.class}) + private String longitude; + + /** + * 中心点位:纬度 + */ + @NotBlank(message = "维度不能为空", groups = {UpdateGroup.class}) + private String latitude; + + + + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java new file mode 100644 index 0000000000..49839dfe4a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java @@ -0,0 +1,73 @@ +package com.epmet.dto.form;/** + * Created by 11 on 2020/3/19. + */ + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.io.Serializable; + +/** + * @Description 陌生人导览查询附近网格传参定义 + * @ClassName ListCustomerGridFormDTO + * @Author wangc + * @date 2020.03.19 15:00 + */ +@Data +public class ListIcNeighborHoodFormDTO implements Serializable{ + + private static final long serialVersionUID = -1L; + + + /** + * 当前页 + * */ + private Integer pageNo = 1; + + /** + * 每页显示数量 + * */ + private Integer pageSize = 20; + + /** + * 组织ID + */ + private String agencyId; + /** + * 网格ID + */ + private String gridId; + /** + * 小区名字 + */ + private String neighborHoodName; + /** + * 楼栋名字 + */ + private String buildingName; + /** + * 房主姓名 + */ + private String ownerName; + /** + * 房主电话 + */ + private String ownerPhone; + /** + * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】 + */ +// @Pattern(regexp = "^(neighbourHood|building|house)?$",message = "数据类型选择错误") + private String dataType; + /** + * 楼栋ID + */ + private String buildingId; + /** + * 小区ID + */ + private String neighborHoodId; + + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java new file mode 100644 index 0000000000..77358255e1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * @Description 网格列表信息 + * @ClassName GridListInfoResultDTO + * @Author wangc + * @date 2020.04.23 14:21 + */ +@Data +public class IcNeighborHoodResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 总条数 + * */ + private Long total; + + /** + * 数据类型【小区:neighbourHood,楼栋:building,房屋:house】 + * */ + private String dataType; + + /** + * 结果集 + */ + private List> list; + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java new file mode 100644 index 0000000000..bde7b11c0c --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java @@ -0,0 +1,133 @@ +/** + * 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.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.dto.form.IcNeighborHoodFormDTO; +import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.service.IcNeighborHoodService; +import com.epmet.service.NeighborHoodService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 小区表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +@RestController +@RequestMapping("neighborhood") +public class NeighborHoodController { + + @Autowired + private IcNeighborHoodService icNeighborHoodService; + @Autowired + private NeighborHoodService neighborHoodService; + + + + + @PostMapping("neighborhoodlist") + public Result neighborhoodlist(@RequestBody ListIcNeighborHoodFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class); + IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO); + return new Result().ok(icNeighborHoodResultDTO); + + } + + @PostMapping("neighborhoodadd") + public Result neighborhoodadd(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + String customerId = tokenDTO.getCustomerId(); + + neighborHoodService.AddNeighborhood(customerId,formDTO); + return new Result(); + } + + @PostMapping("neighborhoodupdate") + public Result neighborhoodupdate(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + String customerId = tokenDTO.getCustomerId(); + neighborHoodService.UpdateNeighborhood(customerId,formDTO); + return new Result(); + } + + @PostMapping("neighborhooddel") + public Result neighborhooddel(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ + //效验数据 + ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class); + String neighborHoodId = formDTO.getNeighborHoodId(); + neighborHoodService.DelNeighborhood(neighborHoodId); + return new Result(); + } + + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icNeighborHoodService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IcNeighborHoodDTO data = icNeighborHoodService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IcNeighborHoodDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icNeighborHoodService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IcNeighborHoodDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icNeighborHoodService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icNeighborHoodService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index 1635ddcce2..9616584401 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -17,9 +17,15 @@ package com.epmet.dao; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcNeighborHoodEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Map; /** * 小区表 @@ -29,5 +35,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcNeighborHoodDao extends BaseDao { - + + IPage> searchNeighborhoodByPage(IPage page,@Param(Constants.WRAPPER) QueryWrapper neighborHoodEntityQueryWrapper); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java new file mode 100644 index 0000000000..7b25482b6a --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java @@ -0,0 +1,43 @@ +/** + * 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.epmet.service; + +import com.epmet.dto.form.IcNeighborHoodFormDTO; +import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.IcNeighborHoodResultDTO; + +/** + * 小区表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +public interface NeighborHoodService{ + + void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO); + + IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO); + + void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO); + + /** + * 删除小区 + * @param neighborHoodId + */ + void DelNeighborhood(String neighborHoodId); +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java new file mode 100644 index 0000000000..b6c2a4347c --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java @@ -0,0 +1,186 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.NeighborhoodConstant; +import com.epmet.dao.IcNeighborHoodDao; +import com.epmet.dao.IcNeighborHoodPropertyDao; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.dto.IcNeighborHoodPropertyDTO; +import com.epmet.dto.form.IcNeighborHoodFormDTO; +import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.IcNeighborHoodResultDTO; +import com.epmet.entity.IcNeighborHoodEntity; +import com.epmet.entity.IcNeighborHoodPropertyEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.IcNeighborHoodPropertyService; +import com.epmet.service.IcNeighborHoodService; +import com.epmet.service.NeighborHoodService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +@Slf4j +@Service +public class NeighborHoodServiceImpl implements NeighborHoodService { + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + + @Autowired + private IcNeighborHoodService icNeighborHoodService; + + @Autowired + private IcNeighborHoodPropertyService icNeighborHoodPropertyService; + + @Resource + private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; + + @Resource + private IcNeighborHoodDao icNeighborHoodDao; + + @Override + @Transactional(rollbackFor = Exception.class) + public void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) { + IcNeighborHoodDTO icNeighborHoodDTO = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodDTO.class); + icNeighborHoodDTO.setCustomerId(customerId); + Result customerAgencyResult = govOrgOpenFeignClient.getAgencyById(icNeighborHoodDTO.getAgencyId()); +// customerAgency.getData().get + if (!customerAgencyResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO()); + icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid()); + icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids()); + icNeighborHoodService.save(icNeighborHoodDTO); + + //设置物业关联 + String propertyId = formDTO.getPropertyId(); + if(!StringUtils.isEmpty(propertyId)){ + //保存物业关系表 + IcNeighborHoodPropertyDTO icNeighborHoodPropertyDTO = new IcNeighborHoodPropertyDTO(); + icNeighborHoodPropertyDTO.setNeighborHoodId(icNeighborHoodDTO.getId()); + icNeighborHoodPropertyDTO.setPropertyId(propertyId); + icNeighborHoodPropertyService.save(icNeighborHoodPropertyDTO); + } + } + + /** + * 查询 + * @param formDTO + */ + @Override + public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) { + String dataType = formDTO.getDataType(); + Integer pageNo = formDTO.getPageNo(); + Integer pageSize = formDTO.getPageSize(); + + + + IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); + result.setDataType(dataType); + + if(StringUtils.isEmpty(dataType)|| NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){ + //如果类型是neighbourHood 查小区 + IPage> resultMap = searchNeighborhood(formDTO); + result.setTotal(resultMap.getTotal()); + result.setList(resultMap.getRecords()); + }else if(NeighborhoodConstant.BUILDING.equals(dataType)){ + //如果类型是building 查楼栋 + IPage> resultMap = searchNeighborhood(formDTO); + }else if(NeighborhoodConstant.HOUSE.equals(dataType)){ + //如果类型是house 查房屋 + IPage> resultMap = searchNeighborhood(formDTO); + } + return result; + + } + /** + * 更新 + * @param customerId + * @param formDTO + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) { + IcNeighborHoodDTO icNeighborHoodDTO = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodDTO.class); + icNeighborHoodDTO.setId(formDTO.getNeighborHoodId()); + icNeighborHoodDTO.setCustomerId(customerId); + + Result customerAgencyResult = govOrgOpenFeignClient.getAgencyById(icNeighborHoodDTO.getAgencyId()); +// customerAgency.getData().get + if (!customerAgencyResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO()); + icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid()); + icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids()); + icNeighborHoodService.update(icNeighborHoodDTO); + + //设置物业关联 + String propertyId = formDTO.getPropertyId(); + String neighborHoodId = icNeighborHoodDTO.getId(); + if(!StringUtils.isEmpty(propertyId)){ + //更新物业关系表 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(IcNeighborHoodPropertyEntity::getNeighborHoodId,neighborHoodId); + IcNeighborHoodPropertyEntity icNeighborHoodProperty = icNeighborHoodPropertyDao.selectOne(queryWrapper); + icNeighborHoodProperty = Optional.ofNullable(icNeighborHoodProperty).orElse(new IcNeighborHoodPropertyEntity()); + icNeighborHoodProperty.setNeighborHoodId(neighborHoodId); + icNeighborHoodProperty.setPropertyId(propertyId); + if(StringUtils.isEmpty(icNeighborHoodProperty.getId())){ + //插入 + icNeighborHoodPropertyService.insert(icNeighborHoodProperty); + }else{ + //更新 + icNeighborHoodPropertyService.updateById(icNeighborHoodProperty); + } + + + } + } + + /** + * 删除 + * @param neighborHoodId + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void DelNeighborhood(String neighborHoodId) { + //删除小区 + icNeighborHoodService.deleteById(neighborHoodId); + //删除小区物业关联 + Map columnMap = new HashMap<>(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(IcNeighborHoodPropertyEntity::getNeighborHoodId,neighborHoodId); + icNeighborHoodPropertyDao.delete(queryWrapper); + + } + + private IPage> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) { + + IPage page = new Page(formDTO.getPageNo(),formDTO.getPageSize()); + + QueryWrapper neighborHoodEntityQueryWrapper = new QueryWrapper<>(); + neighborHoodEntityQueryWrapper.lambda() + .eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId()) + .like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName()); + + + return icNeighborHoodDao.searchNeighborhoodByPage(page, neighborHoodEntityQueryWrapper); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index b76ab56c4b..8a057c3a9f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -25,5 +25,22 @@ + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index fd56957265..3bfeb03e14 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -5,15 +5,12 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallbackFactory; -import org.springframework.cloud.openfeign.FeignClient; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerFormQueryDTO; import com.epmet.dto.form.CustomerFunctionListFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; +import com.epmet.dto.result.CustomerFormResultDTO; import com.epmet.dto.result.DefaultFunctionListResultDTO; -import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; +import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; @@ -47,4 +44,12 @@ public interface OperCustomizeOpenFeignClient { */ @PostMapping(value = "/oper/customize/customerfootbar/checkfloatfootbar", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result checkFloatFootBar(@RequestBody CheckFloatFootBarFormDTO checkFloatFootBarFormDTO); + + /** + * desc: 获取表单填写项 + * @param formDto + * @return + */ + @PostMapping(value = "/oper/customize/icform/getcustomerform", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result getCustomerForm(@RequestBody CustomerFormQueryDTO formDto); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index 2fe50e5c9f..8b8bda2a13 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -6,11 +6,12 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.CustomerFormQueryDTO; import com.epmet.dto.form.CustomerFunctionListFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; +import com.epmet.dto.result.CustomerFormResultDTO; import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.OperCustomizeOpenFeignClient; -import org.springframework.stereotype.Component; import java.util.List; @@ -49,4 +50,9 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe public Result checkFloatFootBar(CheckFloatFootBarFormDTO checkFloatFootBarFormDTO) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "checkFloatFootBar", checkFloatFootBarFormDTO); } + + @Override + public Result getCustomerForm(CustomerFormQueryDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerForm", formDto); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java index b66f95f083..6dabcc62bf 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java @@ -17,9 +17,7 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -34,6 +32,7 @@ import com.epmet.dto.result.CustomerFormResultDTO; import com.epmet.excel.IcFormExcel; import com.epmet.service.IcFormItemService; import com.epmet.service.IcFormService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -51,7 +50,7 @@ import java.util.Map; @RestController @RequestMapping("icform") public class IcFormController { - + @Autowired private IcFormService icFormService; @Autowired @@ -104,13 +103,15 @@ public class IcFormController { * 获取居民信息表单 * * @param formDto - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei * @date 2021/10/26 2:40 下午 */ @PostMapping("getcustomerform") - public Result getCustomerForm(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto){ - formDto.setCustomerId(tokenDto.getCustomerId()); + public Result getCustomerForm(@RequestHeader(required = false) String customerId, @RequestBody CustomerFormQueryDTO formDto){ + if (StringUtils.isBlank(formDto.getCustomerId())){ + formDto.setCustomerId(customerId); + } ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class); return new Result().ok(icFormService.getCustomerForm(formDto)); } @@ -131,4 +132,4 @@ public class IcFormController { ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class); return new Result>().ok(icFormItemService.queryConditionList(formDto)); } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 79c3f816af..a70950c101 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -118,6 +118,12 @@ epmet-commons-rocketmq 2.0.0 + + com.epmet + oper-customize-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 5dca820caf..c24cc5f309 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -17,7 +17,12 @@ package com.epmet.controller; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; @@ -25,19 +30,22 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcResiUserDTO; -import com.epmet.dto.UserResiInfoDTO; +import com.epmet.dto.form.CustomerFormQueryDTO; import com.epmet.dto.form.IcResiUserFormDTO; +import com.epmet.dto.result.CheckFloatFootBarResultDTO; import com.epmet.excel.IcResiUserExcel; +import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcResiUserService; +import org.apache.poi.ss.usermodel.Workbook; 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; +import java.io.FileOutputStream; +import java.util.*; /** @@ -49,7 +57,9 @@ import java.util.Map; @RestController @RequestMapping("icresiuser") public class IcResiUserController { - + + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; @Autowired private IcResiUserService icResiUserService; @@ -115,4 +125,40 @@ public class IcResiUserController { return new Result(); } -} \ No newline at end of file + @GetMapping("download/template") + public void downloadTemplate(@RequestParam String customerId) throws Exception { + CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO(); + queryDTO.setFormCode("resi_base_info"); + queryDTO.setCustomerId(customerId); + + Result resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO); + if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + List colList = new ArrayList<>(); + + ExcelExportEntity desginGroup = new ExcelExportEntity("表头名称","键"); + desginGroup.setNeedMerge(true); + List paramCols = new ArrayList<>(); + List headerList = Arrays.asList("头1","头2","头3"); + headerList.forEach(e->{ + paramCols.add(new ExcelExportEntity(e,e,30)); + }); + + desginGroup.setList(paramCols); + colList.add(desginGroup); + List> dataList =new ArrayList<>(); + Map dataMap = new HashMap<>(); + dataMap.put("头1","1"); + dataMap.put("头2","2"); + dataMap.put("头3","3"); + dataList.add(dataMap); + ExportParams entity = new ExportParams(); + Workbook workbook = ExcelExportUtil.exportExcel(entity, colList, dataList); + //ExcelExportUtil.exportExcel + FileOutputStream fos = new FileOutputStream("//Users/liujianjun/Downloads/基础信息表/Dow.tt.xls"); + workbook.write(fos); + fos.close(); + } + +}