From fa9129860cdc6196026a4c9090f5b99da45a31a8 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 11 May 2022 10:35:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E6=88=BF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/power/dto/rent/RentHouseDTO.java | 190 ++++++++++++++++++ .../rent/controller/RentHouseController.java | 82 ++++++++ .../power/modules/rent/dao/RentHouseDao.java | 16 ++ .../modules/rent/entity/RentHouseEntity.java | 160 +++++++++++++++ .../modules/rent/excel/RentHouseExcel.java | 121 +++++++++++ .../modules/rent/redis/RentHouseRedis.java | 30 +++ .../rent/service/RentHouseService.java | 78 +++++++ .../service/impl/RentHouseServiceImpl.java | 87 ++++++++ .../resources/mapper/rent/RentHouseDao.xml | 44 ++++ 9 files changed, 808 insertions(+) create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentHouseService.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java create mode 100644 epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java new file mode 100644 index 0000000..9074d52 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java @@ -0,0 +1,190 @@ +package com.epmet.plugin.power.dto.rent; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +public class RentHouseDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 房屋主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 片区id,neighbor_hood_part.id,可为空。 + */ + private String partId; + + /** + * 所属楼栋id + */ + private String buildingId; + + /** + * 所属单元id + */ + private String buildingUnitId; + + /** + * 房屋名字后台插入时生成 + */ + private String houseName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,1楼房,2平房,3别墅 + */ + private String houseType; + + /** + * 存储字典value + */ + private String purpose; + + /** + * 1:出租 0:自住 2:闲置 + */ + private Integer rentFlag; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 排序 + */ + private BigDecimal sort; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区 + */ + private String communityName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格 + */ + private String gridName; + + /** + * 房屋小区ID + */ + private String villageId; + + /** + * 房屋小区 + */ + private String villageName; + + /** + * 楼号ID + */ + private String buildId; + + /** + * 楼号 + */ + private String buildName; + + /** + * 单元ID + */ + private String unitId; + + /** + * 单元 + */ + private String unitName; + + /** + * 房屋ID + */ + private String homeId; + + /** + * 房屋 + */ + private String homeName; + + /** + * 购房日期 + */ + private String purchaseDate; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java new file mode 100644 index 0000000..bf9481d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java @@ -0,0 +1,82 @@ +package com.epmet.plugin.power.modules.rent.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +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.plugin.power.dto.rent.RentHouseDTO; +import com.epmet.plugin.power.modules.rent.excel.RentHouseExcel; +import com.epmet.plugin.power.modules.rent.service.RentHouseService; +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 generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@RestController +@RequestMapping("rentHouse") +public class RentHouseController { + + @Autowired + private RentHouseService rentHouseService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = rentHouseService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + RentHouseDTO data = rentHouseService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody RentHouseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + rentHouseService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody RentHouseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + rentHouseService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + rentHouseService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = rentHouseService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, RentHouseExcel.class); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java new file mode 100644 index 0000000..2975d72 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java @@ -0,0 +1,16 @@ +package com.epmet.plugin.power.modules.rent.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Mapper +public interface RentHouseDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java new file mode 100644 index 0000000..9a465d3 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java @@ -0,0 +1,160 @@ +package com.epmet.plugin.power.modules.rent.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_rent_house") +public class RentHouseEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 片区id,neighbor_hood_part.id,可为空。 + */ + private String partId; + + /** + * 所属楼栋id + */ + private String buildingId; + + /** + * 所属单元id + */ + private String buildingUnitId; + + /** + * 房屋名字后台插入时生成 + */ + private String houseName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,1楼房,2平房,3别墅 + */ + private String houseType; + + /** + * 存储字典value + */ + private String purpose; + + /** + * 1:出租 0:自住 2:闲置 + */ + private Integer rentFlag; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 排序 + */ + private BigDecimal sort; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区 + */ + private String communityName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格 + */ + private String gridName; + + /** + * 房屋小区ID + */ + private String villageId; + + /** + * 房屋小区 + */ + private String villageName; + + /** + * 楼号ID + */ + private String buildId; + + /** + * 楼号 + */ + private String buildName; + + /** + * 单元ID + */ + private String unitId; + + /** + * 单元 + */ + private String unitName; + + /** + * 房屋ID + */ + private String homeId; + + /** + * 房屋 + */ + private String homeName; + + /** + * 购房日期 + */ + private String purchaseDate; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java new file mode 100644 index 0000000..41aead0 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java @@ -0,0 +1,121 @@ +package com.epmet.plugin.power.modules.rent.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +public class RentHouseExcel { + + @Excel(name = "房屋主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "小区id") + private String neighborHoodId; + + @Excel(name = "片区id,neighbor_hood_part.id,可为空。") + private String partId; + + @Excel(name = "所属楼栋id") + private String buildingId; + + @Excel(name = "所属单元id") + private String buildingUnitId; + + @Excel(name = "房屋名字后台插入时生成") + private String houseName; + + @Excel(name = "门牌号") + private String doorName; + + @Excel(name = "房屋类型,1楼房,2平房,3别墅") + private String houseType; + + @Excel(name = "存储字典value") + private String purpose; + + @Excel(name = "1:出租 0:自住 2:闲置") + private Integer rentFlag; + + @Excel(name = "房主姓名") + private String ownerName; + + @Excel(name = "房主电话") + private String ownerPhone; + + @Excel(name = "房主身份证号") + private String ownerIdCard; + + @Excel(name = "排序") + private BigDecimal sort; + + @Excel(name = "删除标识 0未删除、1已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "社区ID") + private String communityId; + + @Excel(name = "社区") + private String communityName; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "网格") + private String gridName; + + @Excel(name = "房屋小区ID") + private String villageId; + + @Excel(name = "房屋小区") + private String villageName; + + @Excel(name = "楼号ID") + private String buildId; + + @Excel(name = "楼号") + private String buildName; + + @Excel(name = "单元ID") + private String unitId; + + @Excel(name = "单元") + private String unitName; + + @Excel(name = "房屋ID") + private String homeId; + + @Excel(name = "房屋") + private String homeName; + + @Excel(name = "购房日期") + private String purchaseDate; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java new file mode 100644 index 0000000..4165a7e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.rent.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Component +public class RentHouseRedis { + @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/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentHouseService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentHouseService.java new file mode 100644 index 0000000..27caab0 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentHouseService.java @@ -0,0 +1,78 @@ +package com.epmet.plugin.power.modules.rent.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.plugin.power.dto.rent.RentHouseDTO; +import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; + +import java.util.List; +import java.util.Map; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +public interface RentHouseService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return RentHouseDTO + * @author generator + * @date 2022-05-11 + */ + RentHouseDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-11 + */ + void save(RentHouseDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-11 + */ + void update(RentHouseDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-11 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java new file mode 100644 index 0000000..e4cef4d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.plugin.power.modules.rent.service.impl; + +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.plugin.power.modules.rent.dao.RentHouseDao; +import com.epmet.plugin.power.dto.rent.RentHouseDTO; +import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; +import com.epmet.plugin.power.modules.rent.redis.RentHouseRedis; +import com.epmet.plugin.power.modules.rent.service.RentHouseService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Service +public class RentHouseServiceImpl extends BaseServiceImpl implements RentHouseService { + + @Autowired + private RentHouseRedis rentHouseRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, RentHouseDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, RentHouseDTO.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 RentHouseDTO get(String id) { + RentHouseEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, RentHouseDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(RentHouseDTO dto) { + RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RentHouseDTO dto) { + RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml new file mode 100644 index 0000000..af389c5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file