Browse Source

Merge remote-tracking branch 'origin/dev_ic_platform' into dev_ic_platform

dev_shibei_match
yinzuomei 4 years ago
parent
commit
4341c47f55
  1. 68
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java
  2. 47
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java
  3. 114
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java
  4. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java
  5. 110
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java
  6. 73
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListIcNeighborHoodFormDTO.java
  7. 36
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodResultDTO.java
  8. 133
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java
  9. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java
  10. 43
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/NeighborHoodService.java
  11. 186
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/NeighborHoodServiceImpl.java
  12. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  13. 17
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java
  14. 8
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java
  15. 17
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  16. 6
      epmet-user/epmet-user-server/pom.xml
  17. 58
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

68
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<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("ninesmallplaces")
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNineSmallPlacesOption());
}
/**
* @Description 文化程度
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("education")
public Result<List<OptionResultDTO>> getEducationOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getEducationOption());
}
/**
* @Description 民族
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("nation")
public Result<List<OptionResultDTO>> getNationOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNationOption());
}
/**
* @Description 人员关系
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("relationship")
public Result<List<OptionResultDTO>> getRelationshipOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getRelationshipOption());
}
/**
* @Description 住房性质
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("house")
public Result<List<OptionResultDTO>> getHouseOption() {
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getHouseOption());
}
}

47
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<SysDictDataEntity> {
void update(SysDictDataDTO dto);
void delete(Long[] ids);
/**
* 九小场所
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:11
*/
List<OptionResultDTO> getNineSmallPlacesOption();
/**
* 文化程度
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getEducationOption();
/**
* 民族
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getNationOption();
/**
* 人员关系
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getRelationshipOption();
/**
* 住房性质
* @Param
* @Return {@link List<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
List<OptionResultDTO> getHouseOption();
}

114
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<SysDictDataDao, SysD
deleteBatchIds(Arrays.asList(ids));
}
/**
* 九小场所
*
* @Param
* @Return {@link List < OptionResultDTO >}
* @Author zhaoqifeng
* @Date 2021/10/26 17:11
*/
@Override
public List<OptionResultDTO> getNineSmallPlacesOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000001L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> 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<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getEducationOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000002L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> 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<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getNationOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000003L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> 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<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getRelationshipOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000004L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> 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<OptionResultDTO>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:12
*/
@Override
public List<OptionResultDTO> getHouseOption() {
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDictDataEntity::getDictTypeId, 1000000000000000005L);
wrapper.orderByAsc(SysDictDataEntity::getSort);
List<SysDictDataEntity> 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());
}
}

15
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";
}

110
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.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;
}

73
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;
}

36
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<Map<String,Object>> list;
}

133
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.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<PageData<IcNeighborHoodDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcNeighborHoodDTO> page = icNeighborHoodService.page(params);
return new Result<PageData<IcNeighborHoodDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<IcNeighborHoodDTO> get(@PathVariable("id") String id){
IcNeighborHoodDTO data = icNeighborHoodService.get(id);
return new Result<IcNeighborHoodDTO>().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();
}
}

9
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<IcNeighborHoodEntity> {
IPage<Map<String, Object>> searchNeighborhoodByPage(IPage<IcNeighborHoodEntity> page,@Param(Constants.WRAPPER) QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper);
}

43
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
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.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);
}

186
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<CustomerAgencyDTO> 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<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
result.setTotal(resultMap.getTotal());
result.setList(resultMap.getRecords());
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){
//如果类型是building 查楼栋
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO);
}else if(NeighborhoodConstant.HOUSE.equals(dataType)){
//如果类型是house 查房屋
IPage<Map<String, Object>> 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<CustomerAgencyDTO> 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<IcNeighborHoodPropertyEntity> 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<String,Object> columnMap = new HashMap<>();
QueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(IcNeighborHoodPropertyEntity::getNeighborHoodId,neighborHoodId);
icNeighborHoodPropertyDao.delete(queryWrapper);
}
private IPage<Map<String,Object>> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) {
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(formDTO.getPageNo(),formDTO.getPageSize());
QueryWrapper<IcNeighborHoodEntity> 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);
}
}

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -25,5 +25,22 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="searchNeighborhoodByPage" resultType="map">
select
a.id as neighborHoodId,
a.NEIGHBOR_HOOD_NAME as neighborHoodName,
a.ADDRESS as address,
a.REMARK as remark,
b.ORGANIZATION_NAME as orgName,
c.GRID_NAME as gridName
from ic_neighbor_hood a
left join customer_agency b on a.AGENCY_ID = b.ID
left join customer_grid c on a.GRID_ID = c.ID
${ew.customSqlSegment}
</select>
</mapper>

17
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<CheckFloatFootBarResultDTO> checkFloatFootBar(@RequestBody CheckFloatFootBarFormDTO checkFloatFootBarFormDTO);
/**
* desc: 获取表单填写项
* @param formDto
* @return
*/
@PostMapping(value = "/oper/customize/icform/getcustomerform", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<CustomerFormResultDTO> getCustomerForm(@RequestBody CustomerFormQueryDTO formDto);
}

8
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<CheckFloatFootBarResultDTO> checkFloatFootBar(CheckFloatFootBarFormDTO checkFloatFootBarFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "checkFloatFootBar", checkFloatFootBarFormDTO);
}
@Override
public Result<CustomerFormResultDTO> getCustomerForm(CustomerFormQueryDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerForm", formDto);
}
}

17
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<CustomerFormResultDTO>
* @author yinzuomei
* @return com.epmet.commons.tools.utils.Result<CustomerFormResultDTO>
* @author yinzuomei
* @date 2021/10/26 2:40 下午
*/
@PostMapping("getcustomerform")
public Result<CustomerFormResultDTO> getCustomerForm(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto){
formDto.setCustomerId(tokenDto.getCustomerId());
public Result<CustomerFormResultDTO> 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<CustomerFormResultDTO>().ok(icFormService.getCustomerForm(formDto));
}
@ -131,4 +132,4 @@ public class IcFormController {
ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class);
return new Result<List<ConditionResultDTO>>().ok(icFormItemService.queryConditionList(formDto));
}
}
}

6
epmet-user/epmet-user-server/pom.xml

@ -118,6 +118,12 @@
<artifactId>epmet-commons-rocketmq</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-customize-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

58
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();
}
}
@GetMapping("download/template")
public void downloadTemplate(@RequestParam String customerId) throws Exception {
CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO();
queryDTO.setFormCode("resi_base_info");
queryDTO.setCustomerId(customerId);
Result<CheckFloatFootBarResultDTO> resultForm = operCustomizeOpenFeignClient.getCustomerForm(queryDTO);
if (resultForm == null || !resultForm.success() ||resultForm.getData() == null){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
List<ExcelExportEntity> colList = new ArrayList<>();
ExcelExportEntity desginGroup = new ExcelExportEntity("表头名称","键");
desginGroup.setNeedMerge(true);
List<ExcelExportEntity> paramCols = new ArrayList<>();
List<String> headerList = Arrays.asList("头1","头2","头3");
headerList.forEach(e->{
paramCols.add(new ExcelExportEntity(e,e,30));
});
desginGroup.setList(paramCols);
colList.add(desginGroup);
List<Map<String, String>> dataList =new ArrayList<>();
Map<String,String> 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();
}
}

Loading…
Cancel
Save