Browse Source

死亡人员名单功能

develop
zhangyuan 3 years ago
parent
commit
211d083127
  1. 109
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentDeathDTO.java
  2. 81
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentDeathController.java
  3. 16
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentDeathDao.java
  4. 79
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentDeathEntity.java
  5. 72
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentDeathExcel.java
  6. 30
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentDeathRedis.java
  7. 79
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentDeathService.java
  8. 127
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentDeathServiceImpl.java
  9. 28
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentDeathDao.xml

109
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentDeathDTO.java

@ -0,0 +1,109 @@
package com.epmet.plugin.power.dto.rent;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
@Data
public class RentDeathDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* epmet用户主键
*/
private String userId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 手机号
*/
private String mobile;
/**
* 性别 0女 1男
*/
private String gender;
/**
* 类型 0 租客 1 房东
*/
private String type;
/**
* 加入时间
*/
private String joinDate;
/**
* 加入原因
*/
private String joinReason;
/**
* 移除时间
*/
private String removeDate;
/**
* 移除原因
*/
private String removeReason;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 客户ID
*/
private String customerId;
}

81
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentDeathController.java

@ -0,0 +1,81 @@
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.RentDeathDTO;
import com.epmet.plugin.power.modules.rent.excel.RentDeathExcel;
import com.epmet.plugin.power.modules.rent.service.RentDeathService;
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-05
*/
@RestController
@RequestMapping("rentDeath")
public class RentDeathController {
@Autowired
private RentDeathService rentDeathService;
@RequestMapping("page")
public Result<PageData<RentDeathDTO>> page(@RequestParam Map<String, Object> params){
PageData<RentDeathDTO> page = rentDeathService.page(params);
return new Result<PageData<RentDeathDTO>>().ok(page);
}
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
public Result<RentDeathDTO> get(@PathVariable("id") String id){
RentDeathDTO data = rentDeathService.get(id);
return new Result<RentDeathDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody RentDeathDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return rentDeathService.save(dto);
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody RentDeathDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
rentDeathService.update(dto);
return new Result();
}
@RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE})
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
rentDeathService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<RentDeathDTO> list = rentDeathService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, RentDeathExcel.class);
}
}

16
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentDeathDao.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.RentDeathEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
@Mapper
public interface RentDeathDao extends BaseDao<RentDeathEntity> {
}

79
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentDeathEntity.java

@ -0,0 +1,79 @@
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.util.Date;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pli_rent_death")
public class RentDeathEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* epmet用户主键
*/
private String userId;
/**
* 姓名
*/
private String name;
/**
* 身份证
*/
private String idCard;
/**
* 手机号
*/
private String mobile;
/**
* 性别 0女 1男
*/
private String gender;
/**
* 类型 0 租客 1 房东
*/
private String type;
/**
* 加入时间
*/
private String joinDate;
/**
* 加入原因
*/
private String joinReason;
/**
* 移除时间
*/
private String removeDate;
/**
* 移除原因
*/
private String removeReason;
/**
* 客户ID
*/
private String customerId;
}

72
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentDeathExcel.java

@ -0,0 +1,72 @@
package com.epmet.plugin.power.modules.rent.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
@Data
public class RentDeathExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "epmet用户主键")
private String userId;
@Excel(name = "姓名")
private String name;
@Excel(name = "身份证")
private String idCard;
@Excel(name = "手机号")
private String mobile;
@Excel(name = "性别 0女 1男")
private String gender;
@Excel(name = "类型 0 租客 1 房东")
private String type;
@Excel(name = "加入时间")
private String joinDate;
@Excel(name = "加入原因")
private String joinReason;
@Excel(name = "移除时间")
private String removeDate;
@Excel(name = "移除原因")
private String removeReason;
@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 customerId;
}

30
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentDeathRedis.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-05
*/
@Component
public class RentDeathRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

79
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentDeathService.java

@ -0,0 +1,79 @@
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.commons.tools.utils.Result;
import com.epmet.plugin.power.dto.rent.RentDeathDTO;
import com.epmet.plugin.power.modules.rent.entity.RentDeathEntity;
import java.util.List;
import java.util.Map;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
public interface RentDeathService extends BaseService<RentDeathEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<RentDeathDTO>
* @author generator
* @date 2022-05-05
*/
PageData<RentDeathDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<RentDeathDTO>
* @author generator
* @date 2022-05-05
*/
List<RentDeathDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return RentDeathDTO
* @author generator
* @date 2022-05-05
*/
RentDeathDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-05-05
*/
Result save(RentDeathDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-05-05
*/
void update(RentDeathDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-05-05
*/
void delete(String[] ids);
}

127
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentDeathServiceImpl.java

@ -0,0 +1,127 @@
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.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
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.form.RentTenantDataFormDTO;
import com.epmet.dto.result.RentTenantDataResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.plugin.power.dto.rent.RentDeathDTO;
import com.epmet.plugin.power.modules.rent.dao.RentDeathDao;
import com.epmet.plugin.power.modules.rent.entity.RentDeathEntity;
import com.epmet.plugin.power.modules.rent.redis.RentDeathRedis;
import com.epmet.plugin.power.modules.rent.service.RentDeathService;
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.*;
/**
* 死亡名单表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-05
*/
@Service
public class RentDeathServiceImpl extends BaseServiceImpl<RentDeathDao, RentDeathEntity> implements RentDeathService {
@Autowired
private RentDeathRedis rentDeathRedis;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
LoginUserUtil loginUserUtil;
@Override
public PageData<RentDeathDTO> page(Map<String, Object> params) {
IPage<RentDeathEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, RentDeathDTO.class);
}
@Override
public List<RentDeathDTO> list(Map<String, Object> params) {
List<RentDeathEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, RentDeathDTO.class);
}
private QueryWrapper<RentDeathEntity> getWrapper(Map<String, Object> params){
String id = (String) params.get(FieldConstant.ID_HUMP);
String name = (String) params.get("name");
String idCard = (String) params.get("idCard");
String mobile = (String) params.get("mobile");
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
QueryWrapper<RentDeathEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(name), "NAME", name);
wrapper.eq(StringUtils.isNotBlank(idCard), "ID_CARD", idCard);
wrapper.eq(StringUtils.isNotBlank(mobile), "MOBILE", mobile);
wrapper.ge(StringUtils.isNotBlank(startTime), "JOIN_DATE", startTime);
wrapper.le(StringUtils.isNotBlank(endTime), "JOIN_DATE", endTime);
return wrapper;
}
@Override
public RentDeathDTO get(String id) {
RentDeathEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, RentDeathDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result save(RentDeathDTO dto) {
RentTenantDataFormDTO formDTO = new RentTenantDataFormDTO();
formDTO.setUserId(dto.getUserId());
formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId());
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class);
Result<RentTenantDataResultDTO> result = epmetUserOpenFeignClient.getRentResiUserInfo(formDTO);
dto.setIdCard(result.getData().getIdCard());
dto.setMobile(result.getData().getMobile());
Map<String, Object> params = new HashMap<>(4);
params.put("idCard", dto.getIdCard());
if (!list(params).isEmpty()) {
return new Result().error("该人员已经迁入死亡人口");
}
dto.setJoinDate(DateUtils.format(new Date()));
RentDeathEntity entity = ConvertUtils.sourceToTarget(dto, RentDeathEntity.class);
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId());
insert(entity);
return new Result();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(RentDeathDTO dto) {
RentDeathEntity entity = ConvertUtils.sourceToTarget(dto, RentDeathEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

28
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentDeathDao.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.plugin.power.modules.rent.dao.RentDeathDao">
<resultMap type="com.epmet.plugin.power.modules.rent.entity.RentDeathEntity" id="rentDeathMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="name" column="NAME"/>
<result property="idCard" column="ID_CARD"/>
<result property="mobile" column="MOBILE"/>
<result property="gender" column="GENDER"/>
<result property="type" column="TYPE"/>
<result property="joinDate" column="JOIN_DATE"/>
<result property="joinReason" column="JOIN_REASON"/>
<result property="removeDate" column="REMOVE_DATE"/>
<result property="removeReason" column="REMOVE_REASON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="customerId" column="CUSTOMER_ID"/>
</resultMap>
</mapper>
Loading…
Cancel
Save