9 changed files with 1076 additions and 0 deletions
@ -0,0 +1,179 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@Data |
|||
public class IcBirthRecordDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织的pids |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 所属小区ID |
|||
*/ |
|||
private String villageId; |
|||
|
|||
/** |
|||
* 所属楼宇Id |
|||
*/ |
|||
private String buildId; |
|||
|
|||
/** |
|||
* 单元id |
|||
*/ |
|||
private String unitId; |
|||
|
|||
/** |
|||
* 所属家庭Id |
|||
*/ |
|||
private String homeId; |
|||
private String home; |
|||
|
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 性别 |
|||
*/ |
|||
private String gender; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 出生日期 |
|||
*/ |
|||
private String birthday; |
|||
|
|||
/** |
|||
* 出生地 |
|||
*/ |
|||
private String birthplace; |
|||
|
|||
/** |
|||
* 是否享受福利【否:0 是:1】 |
|||
*/ |
|||
private String isWelfare; |
|||
|
|||
/** |
|||
* 父亲姓名 |
|||
*/ |
|||
private String father; |
|||
|
|||
/** |
|||
* 母亲姓名 |
|||
*/ |
|||
private String mother; |
|||
private String parentName; |
|||
/** |
|||
* 胎次 |
|||
*/ |
|||
private Integer count; |
|||
|
|||
/** |
|||
* 申报日期 |
|||
*/ |
|||
private String reportDate; |
|||
|
|||
/** |
|||
* 户主姓名 |
|||
*/ |
|||
private String householderName; |
|||
|
|||
/** |
|||
* 与户主关系【字典表】 |
|||
*/ |
|||
private String householderRelation; |
|||
|
|||
/** |
|||
* 是否勾选补充居民信息0否 1是 |
|||
*/ |
|||
private String isCheck; |
|||
/** |
|||
* 是否更新居民信息0否 1是 |
|||
*/ |
|||
@JsonIgnore |
|||
private String isReplace; |
|||
|
|||
/** |
|||
* 删除标识 0.未删除 1.已删除 |
|||
*/ |
|||
@JsonIgnore |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
@JsonIgnore |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
@JsonIgnore |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@JsonIgnore |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/5/10 10:02 |
|||
*/ |
|||
@NoArgsConstructor |
|||
@Data |
|||
public class BirthRecordFormDTO extends PageFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 5077167613040462646L; |
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
private String staffId; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
/** |
|||
* 小区ID |
|||
*/ |
|||
private String villageId; |
|||
/** |
|||
* 楼栋ID |
|||
*/ |
|||
private String buildId; |
|||
/** |
|||
* 单元ID |
|||
*/ |
|||
private String unitId; |
|||
/** |
|||
* 房屋ID |
|||
*/ |
|||
private String homeId; |
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 手机 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 身份证 |
|||
*/ |
|||
private String idCard; |
|||
/** |
|||
* 性别 |
|||
*/ |
|||
private String gender; |
|||
/** |
|||
* 出生日开始 |
|||
*/ |
|||
private String startTime; |
|||
/** |
|||
* 出生日期结束 |
|||
*/ |
|||
private String endTime; |
|||
/** |
|||
* 是否福利 |
|||
*/ |
|||
private String isWelfare; |
|||
|
|||
/** |
|||
* 是否分页 |
|||
*/ |
|||
private Boolean isPage; |
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.alibaba.excel.ExcelWriter; |
|||
import com.alibaba.excel.write.metadata.WriteSheet; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|||
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.IcBirthRecordDTO; |
|||
import com.epmet.dto.form.BirthRecordFormDTO; |
|||
import com.epmet.excel.IcBirthRecordExcel; |
|||
import com.epmet.service.IcBirthRecordService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
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.concurrent.atomic.AtomicInteger; |
|||
|
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@RequestMapping("icBirthRecord") |
|||
public class IcBirthRecordController { |
|||
|
|||
@Autowired |
|||
private IcBirthRecordService icBirthRecordService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<IcBirthRecordDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody BirthRecordFormDTO formDTO){ |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
PageData<IcBirthRecordDTO> page = icBirthRecordService.page(formDTO); |
|||
return new Result<PageData<IcBirthRecordDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<IcBirthRecordDTO> get(@PathVariable("id") String id){ |
|||
IcBirthRecordDTO data = icBirthRecordService.get(id); |
|||
return new Result<IcBirthRecordDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcBirthRecordDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icBirthRecordService.save(tokenDto, dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@LoginUser TokenDto tokenDto, @RequestBody IcBirthRecordDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icBirthRecordService.update(tokenDto, dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icBirthRecordService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@LoginUser TokenDto tokenDto, @RequestBody BirthRecordFormDTO formDTO, HttpServletResponse response) throws Exception { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
formDTO.setIsPage(false); |
|||
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|||
int pageNo = formDTO.getPageNo(); |
|||
|
|||
ExcelWriter excelWriter = null; |
|||
AtomicInteger i = new AtomicInteger(1); |
|||
try { |
|||
String fileName = "出生管理.xlsx"; |
|||
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcBirthRecordExcel.class).build(); |
|||
PageData<IcBirthRecordDTO> page = null; |
|||
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|||
do { |
|||
page = icBirthRecordService.page(formDTO); |
|||
List<IcBirthRecordExcel> list = ConvertUtils.sourceToTarget(page.getList(), IcBirthRecordExcel.class); |
|||
list.forEach(item -> { |
|||
item.setIndex(i.getAndIncrement()); |
|||
}); |
|||
excelWriter.write(list, writeSheet); |
|||
} while (CollectionUtils.isNotEmpty(page.getList()) && page.getList().size() == formDTO.getPageSize()); |
|||
} catch (Exception e) { |
|||
log.error("export exception", e); |
|||
} finally { |
|||
if (excelWriter != null) { |
|||
excelWriter.finish(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.IcBirthRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@Mapper |
|||
public interface IcBirthRecordDao extends BaseDao<IcBirthRecordEntity> { |
|||
|
|||
} |
@ -0,0 +1,131 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("ic_birth_record") |
|||
public class IcBirthRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织Id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 组织的pids |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 所属小区ID |
|||
*/ |
|||
private String villageId; |
|||
|
|||
/** |
|||
* 所属楼宇Id |
|||
*/ |
|||
private String buildId; |
|||
|
|||
/** |
|||
* 单元id |
|||
*/ |
|||
private String unitId; |
|||
|
|||
/** |
|||
* 所属家庭Id |
|||
*/ |
|||
private String homeId; |
|||
|
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 性别 |
|||
*/ |
|||
private String gender; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 出生日期 |
|||
*/ |
|||
private String birthday; |
|||
|
|||
/** |
|||
* 出生地 |
|||
*/ |
|||
private String birthplace; |
|||
|
|||
/** |
|||
* 是否享受福利【否:0 是:1】 |
|||
*/ |
|||
private String isWelfare; |
|||
|
|||
/** |
|||
* 父亲姓名 |
|||
*/ |
|||
private String father; |
|||
|
|||
/** |
|||
* 母亲姓名 |
|||
*/ |
|||
private String mother; |
|||
|
|||
/** |
|||
* 胎次 |
|||
*/ |
|||
private Integer count; |
|||
|
|||
/** |
|||
* 申报日期 |
|||
*/ |
|||
private String reportDate; |
|||
|
|||
/** |
|||
* 户主姓名 |
|||
*/ |
|||
private String householderName; |
|||
|
|||
/** |
|||
* 与户主关系【字典表】 |
|||
*/ |
|||
private String householderRelation; |
|||
|
|||
/** |
|||
* 是否勾选补充居民信息0否 1是 |
|||
*/ |
|||
private String isCheck; |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
package com.epmet.excel; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
import com.alibaba.excel.annotation.write.style.HeadStyle; |
|||
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) |
|||
@Data |
|||
public class IcBirthRecordExcel { |
|||
|
|||
@ColumnWidth(5) |
|||
@ExcelProperty(value = "序号",order = 1) |
|||
private Integer index; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "姓名",order = 1) |
|||
private String name; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "所属网格",order = 1) |
|||
private String gridName; |
|||
|
|||
@ColumnWidth(30) |
|||
@ExcelProperty(value = "所属房屋",order = 1) |
|||
private String home; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "手机号",order = 1) |
|||
private String mobile; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "身份证号",order = 1) |
|||
private String idCard; |
|||
|
|||
@ColumnWidth(5) |
|||
@ExcelProperty(value = "性别",order = 1) |
|||
private String gender; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "出生日期",order = 1) |
|||
private String birthday; |
|||
|
|||
@ColumnWidth(30) |
|||
@ExcelProperty(value = "出生地",order = 1) |
|||
private String birthplace; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "出生人的父/母姓名",order = 1) |
|||
private String parentName; |
|||
|
|||
@ColumnWidth(5) |
|||
@ExcelProperty(value = "胎次",order = 1) |
|||
private Integer count; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "申报户口日期",order = 1) |
|||
private String reportDate; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "户主姓名",order = 1) |
|||
private String householderName; |
|||
|
|||
@ColumnWidth(20) |
|||
@ExcelProperty(value = "与户主关系",order = 1) |
|||
private String householderRelation; |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.dto.IcBirthRecordDTO; |
|||
import com.epmet.dto.form.BirthRecordFormDTO; |
|||
import com.epmet.entity.IcBirthRecordEntity; |
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
public interface IcBirthRecordService extends BaseService<IcBirthRecordEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param formDTO |
|||
* @return PageData<IcBirthRecordDTO> |
|||
* @author generator |
|||
* @date 2022-05-10 |
|||
*/ |
|||
PageData<IcBirthRecordDTO> page(BirthRecordFormDTO formDTO); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return IcBirthRecordDTO |
|||
* @author generator |
|||
* @date 2022-05-10 |
|||
*/ |
|||
IcBirthRecordDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-10 |
|||
*/ |
|||
void save(TokenDto tokenDto, IcBirthRecordDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-10 |
|||
*/ |
|||
void update(TokenDto tokenDto, IcBirthRecordDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-10 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,370 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.enums.GenderEnum; |
|||
import com.epmet.commons.tools.enums.RelationshipEnum; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.IcBirthRecordDao; |
|||
import com.epmet.dao.IcResiUserDao; |
|||
import com.epmet.dto.ChangeWelfareDTO; |
|||
import com.epmet.dto.IcBirthRecordDTO; |
|||
import com.epmet.dto.form.BirthRecordFormDTO; |
|||
import com.epmet.dto.form.IcResiUserTransferFormDTO; |
|||
import com.epmet.dto.result.AllGridsByUserIdResultDTO; |
|||
import com.epmet.dto.result.HouseInfoDTO; |
|||
import com.epmet.dto.result.SyncResiResDTO; |
|||
import com.epmet.entity.IcBirthRecordEntity; |
|||
import com.epmet.entity.IcResiUserEntity; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.ChangeWelfareService; |
|||
import com.epmet.service.IcBirthRecordService; |
|||
import com.epmet.service.IcResiUserService; |
|||
import com.epmet.service.IcUserTransferRecordService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.jetbrains.annotations.NotNull; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.*; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 出生管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-10 |
|||
*/ |
|||
@Service |
|||
public class IcBirthRecordServiceImpl extends BaseServiceImpl<IcBirthRecordDao, IcBirthRecordEntity> implements IcBirthRecordService { |
|||
@Resource |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
@Resource |
|||
private IcResiUserService icResiUserService; |
|||
@Resource |
|||
private IcUserTransferRecordService icUserTransferRecordService; |
|||
@Resource |
|||
private IcResiUserDao icResiUserDao; |
|||
@Resource |
|||
private ChangeWelfareService changeWelfareService; |
|||
|
|||
@Override |
|||
public PageData<IcBirthRecordDTO> page(BirthRecordFormDTO formDTO) { |
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|||
if (null == staffInfo) { |
|||
throw new EpmetException("获取工作人员信息失败"); |
|||
} |
|||
|
|||
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
|||
LambdaQueryWrapper<IcBirthRecordEntity> wrapper = getWrapper(formDTO, staffInfo); |
|||
List<IcBirthRecordEntity> entityList = baseDao.selectList(wrapper); |
|||
PageInfo<IcBirthRecordEntity> pageInfo = new PageInfo<>(entityList); |
|||
List<IcBirthRecordDTO> list = ConvertUtils.sourceToTarget(entityList, IcBirthRecordDTO.class); |
|||
|
|||
if (CollectionUtils.isNotEmpty(list)) { |
|||
//查询网格名称
|
|||
List<String> gridIds = list.stream().map(IcBirthRecordDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); |
|||
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|||
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|||
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); |
|||
|
|||
//查询房子名称
|
|||
List<String> houseIdList = list.stream().map(IcBirthRecordDTO::getHomeId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); |
|||
Set<String> houseIds = new HashSet<>(houseIdList); |
|||
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); |
|||
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); |
|||
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); |
|||
list.forEach(item -> { |
|||
item.setGridName(gridInfoMap.get(item.getGridId())); |
|||
if (houseInfoMap.containsKey(item.getHomeId()) && null != houseInfoMap.get(item.getHomeId())) { |
|||
HouseInfoDTO houseInfoDTO = houseInfoMap.get(item.getHomeId()); |
|||
item.setHome(houseInfoDTO.getAllName()); |
|||
} |
|||
if (StringUtils.isNotBlank(item.getFather()) && StringUtils.isNotBlank(item.getMother())) { |
|||
item.setParentName(item.getFather().concat(StrConstant.SEPARATOR).concat(item.getMother())); |
|||
} else { |
|||
String parentName = StringUtils.isBlank(item.getFather())?"":item.getFather() ; |
|||
parentName = parentName.concat(StringUtils.isBlank(item.getMother())?"":item.getMother()); |
|||
item.setParentName(parentName); |
|||
} |
|||
if (StringUtils.isNotBlank(item.getHouseholderRelation())) { |
|||
item.setHouseholderRelation(RelationshipEnum.getEnum(item.getHouseholderRelation()).getName()); |
|||
} |
|||
item.setGender(GenderEnum.getName(item.getGender())); |
|||
}); |
|||
} |
|||
|
|||
return new PageData<>(list, pageInfo.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public IcBirthRecordDTO get(String id) { |
|||
IcBirthRecordEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, IcBirthRecordDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(TokenDto tokenDto, IcBirthRecordDTO dto) { |
|||
//获取工作人员信息
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|||
if (null == staffInfo) { |
|||
throw new EpmetException("获取工作人员信息失败"); |
|||
} |
|||
//
|
|||
SyncResiResDTO sync = icResiUserService.checkUser(tokenDto.getCustomerId(), dto.getIdCard(), staffInfo.getAgencyId()); |
|||
//是否补充居民信息
|
|||
if (NumConstant.ONE_STR.equals(dto.getIsCheck())) { |
|||
//判断是否可迁入
|
|||
if (!sync.getMoveInstatus()) { |
|||
throw new EpmetException("请联系" + sync.getResiAgencyName() + "迁出该居民后操作"); |
|||
} |
|||
|
|||
IcResiUserEntity userEntity = ConvertUtils.sourceToTarget(dto, IcResiUserEntity.class);; |
|||
|
|||
userEntity.setCustomerId(tokenDto.getCustomerId()); |
|||
userEntity.setAgencyId(staffInfo.getAgencyId()); |
|||
userEntity.setPids(staffInfo.getAgencyPIds()); |
|||
userEntity.setYhzgx(dto.getHouseholderRelation()); |
|||
userEntity.setStatus(NumConstant.ZERO_STR); |
|||
userEntity.setSubStatus("11"); |
|||
|
|||
//判断是否有所属组织,如果有,判断是否属于当前组织,没有的话则直接新增
|
|||
if (StringUtils.isNotEmpty(sync.getAgencyId())) { |
|||
userEntity.setId(sync.getIcResiUserId()); |
|||
if (staffInfo.getAgencyId().equals(sync.getAgencyId())) { |
|||
//组织相等的情况
|
|||
if (NumConstant.ZERO_STR.equals(sync.getStatus())) { |
|||
//正常状态
|
|||
if (!dto.getHomeId().equals(sync.getResiHomeId())) { |
|||
//房屋信息不一致
|
|||
//是否更新 为空,返回确认消息
|
|||
if (StringUtils.isBlank(dto.getIsReplace())) { |
|||
throw new EpmetException("居民信息中房屋信息与当前选择房屋不一致,是否更新?"); |
|||
} else if (NumConstant.ONE_STR.equals(dto.getIsReplace())) { |
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
} |
|||
} else { |
|||
//房屋信息一致
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
} |
|||
} else { |
|||
//迁出或注销状态,
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, dto, staffInfo, sync); |
|||
} |
|||
} else { |
|||
//组织不相等的情况
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, dto, staffInfo, sync); |
|||
|
|||
} |
|||
} else { |
|||
//添加居民信息
|
|||
icResiUserDao.insert(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, dto, staffInfo, sync); |
|||
} |
|||
} |
|||
|
|||
//生成出生记录
|
|||
IcBirthRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcBirthRecordEntity.class); |
|||
entity.setCustomerId(tokenDto.getCustomerId()); |
|||
entity.setAgencyId(staffInfo.getAgencyId()); |
|||
entity.setPids(staffInfo.getAgencyPIds()); |
|||
insert(entity); |
|||
|
|||
//记录享受福利信息
|
|||
if (NumConstant.ONE_STR.equals(dto.getIsWelfare())) { |
|||
ChangeWelfareDTO welfare = new ChangeWelfareDTO(); |
|||
welfare.setCustomerId(tokenDto.getCustomerId()); |
|||
welfare.setGridId(dto.getGridId()); |
|||
welfare.setUserId(sync.getIcResiUserId()); |
|||
welfare.setIdCard(dto.getIdCard()); |
|||
welfare.setMobile(dto.getMobile()); |
|||
welfare.setName(dto.getName()); |
|||
welfare.setGender(dto.getGender()); |
|||
welfare.setJoinReason("出生登记选定"); |
|||
changeWelfareService.saveWelfareInfo(welfare); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(TokenDto tokenDto, IcBirthRecordDTO dto) { |
|||
|
|||
IcBirthRecordEntity record = baseDao.selectById(dto.getId()); |
|||
|
|||
//获取工作人员信息
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|||
if (null == staffInfo) { |
|||
throw new EpmetException("获取工作人员信息失败"); |
|||
} |
|||
if (NumConstant.ONE_STR.equals(dto.getIsCheck()) && NumConstant.ONE_STR.equals(record.getIsCheck())) { |
|||
throw new EpmetException("已补充到居民信息"); |
|||
} |
|||
//是否补充居民信息
|
|||
SyncResiResDTO sync = icResiUserService.checkUser(tokenDto.getCustomerId(), dto.getIdCard(), staffInfo.getAgencyId()); |
|||
if (NumConstant.ONE_STR.equals(dto.getIsCheck())) { |
|||
//判断是否可迁入
|
|||
if (!sync.getMoveInstatus()) { |
|||
throw new EpmetException("请联系" + sync.getResiAgencyName() + "迁出该居民后操作"); |
|||
} |
|||
|
|||
IcResiUserEntity userEntity = ConvertUtils.sourceToTarget(record, IcResiUserEntity.class); |
|||
userEntity.setCustomerId(tokenDto.getCustomerId()); |
|||
userEntity.setAgencyId(staffInfo.getAgencyId()); |
|||
userEntity.setPids(staffInfo.getAgencyPIds()); |
|||
userEntity.setYhzgx(dto.getHouseholderRelation()); |
|||
userEntity.setStatus(NumConstant.ZERO_STR); |
|||
userEntity.setSubStatus("11"); |
|||
|
|||
//判断是否有所属组织,如果有,判断是否属于当前组织,没有的话则直接新增
|
|||
if (StringUtils.isNotEmpty(sync.getAgencyId())) { |
|||
userEntity.setId(sync.getIcResiUserId()); |
|||
if (staffInfo.getAgencyId().equals(sync.getAgencyId())) { |
|||
//组织相等的情况
|
|||
if (NumConstant.ZERO_STR.equals(sync.getStatus())) { |
|||
//正常状态
|
|||
if (!dto.getHomeId().equals(sync.getResiHomeId())) { |
|||
//房屋信息不一致
|
|||
//是否更新 为空,返回确认消息
|
|||
if (StringUtils.isBlank(dto.getIsReplace())) { |
|||
throw new EpmetException("居民信息中房屋信息与当前选择房屋不一致,是否更新?"); |
|||
} else if (NumConstant.ONE_STR.equals(dto.getIsReplace())) { |
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
} |
|||
} else { |
|||
//房屋信息一致
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
} |
|||
} else { |
|||
//迁出或注销状态,
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, ConvertUtils.sourceToTarget(record, IcBirthRecordDTO.class), staffInfo, sync); |
|||
} |
|||
} else { |
|||
//组织不相等的情况
|
|||
//更新居民信息
|
|||
icResiUserDao.updateById(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, ConvertUtils.sourceToTarget(record, IcBirthRecordDTO.class), staffInfo, sync); |
|||
|
|||
} |
|||
} else { |
|||
//添加居民信息
|
|||
icResiUserDao.insert(userEntity); |
|||
//迁入记录
|
|||
extracted(tokenDto, dto, staffInfo, sync); |
|||
} |
|||
} |
|||
|
|||
IcBirthRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcBirthRecordEntity.class); |
|||
entity.setGridId(null); |
|||
entity.setBuildId(null); |
|||
entity.setUnitId(null); |
|||
entity.setHomeId(null); |
|||
entity.setName(null); |
|||
entity.setMobile(null); |
|||
entity.setIdCard(null); |
|||
if (NumConstant.ONE_STR.equals(record.getIsCheck())) { |
|||
entity.setIsCheck(null); |
|||
} |
|||
if (NumConstant.ONE_STR.equals(record.getIsWelfare())) { |
|||
entity.setIsWelfare(null); |
|||
} |
|||
updateById(entity); |
|||
|
|||
if (NumConstant.ZERO_STR.equals(record.getIsWelfare()) && NumConstant.ONE_STR.equals(dto.getIsWelfare())) { |
|||
ChangeWelfareDTO welfare = new ChangeWelfareDTO(); |
|||
welfare.setCustomerId(tokenDto.getCustomerId()); |
|||
welfare.setGridId(record.getGridId()); |
|||
welfare.setUserId(sync.getIcResiUserId()); |
|||
welfare.setIdCard(record.getIdCard()); |
|||
welfare.setMobile(record.getMobile()); |
|||
welfare.setName(record.getName()); |
|||
welfare.setGender(record.getGender()); |
|||
welfare.setJoinReason("出生登记选定"); |
|||
changeWelfareService.saveWelfareInfo(welfare); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@NotNull |
|||
private LambdaQueryWrapper<IcBirthRecordEntity> getWrapper(BirthRecordFormDTO formDTO, CustomerStaffInfoCacheResult staffInfo) { |
|||
LambdaQueryWrapper<IcBirthRecordEntity> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(IcBirthRecordEntity::getCustomerId, formDTO.getCustomerId()); |
|||
wrapper.and(wq -> wq.eq(IcBirthRecordEntity::getAgencyId, staffInfo.getAgencyId()).or().like(IcBirthRecordEntity::getPids, staffInfo.getAgencyId())); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getGridId()), IcBirthRecordEntity::getGridId, formDTO.getGridId()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getVillageId()), IcBirthRecordEntity::getVillageId, formDTO.getVillageId()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getBuildId()), IcBirthRecordEntity::getBuildId, formDTO.getBuildId()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcBirthRecordEntity::getUnitId, formDTO.getUnitId()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getHomeId()), IcBirthRecordEntity::getHomeId, formDTO.getHomeId()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getGender()), IcBirthRecordEntity::getGender, formDTO.getGender()); |
|||
wrapper.eq(StringUtils.isNotBlank(formDTO.getIsWelfare()), IcBirthRecordEntity::getIsWelfare, formDTO.getIsWelfare()); |
|||
wrapper.like(StringUtils.isNotBlank(formDTO.getName()), IcBirthRecordEntity::getName, formDTO.getName()); |
|||
wrapper.like(StringUtils.isNotBlank(formDTO.getMobile()), IcBirthRecordEntity::getMobile, formDTO.getMobile()); |
|||
wrapper.like(StringUtils.isNotBlank(formDTO.getIdCard()), IcBirthRecordEntity::getIdCard, formDTO.getIdCard()); |
|||
wrapper.ge(StringUtils.isNotBlank(formDTO.getStartTime()), IcBirthRecordEntity::getBirthday, formDTO.getStartTime()); |
|||
wrapper.le(StringUtils.isNotBlank(formDTO.getEndTime()), IcBirthRecordEntity::getBirthday, formDTO.getEndTime()); |
|||
return wrapper; |
|||
} |
|||
|
|||
/** |
|||
* 迁入记录 |
|||
* @Param tokenDto |
|||
* @Param dto |
|||
* @Param staffInfo |
|||
* @Param sync |
|||
* @Return |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/5/11 9:15 |
|||
*/ |
|||
private void extracted(TokenDto tokenDto, IcBirthRecordDTO dto, CustomerStaffInfoCacheResult staffInfo, SyncResiResDTO sync) { |
|||
IcResiUserTransferFormDTO transfer = new IcResiUserTransferFormDTO(); |
|||
transfer.setCustomerId(tokenDto.getCustomerId()); |
|||
transfer.setStaffId(tokenDto.getUserId()); |
|||
transfer.setIcUserId(sync.getIcResiUserId()); |
|||
transfer.setType("in"); |
|||
transfer.setNewAgencyId(staffInfo.getAgencyId()); |
|||
transfer.setNewGridId(dto.getGridId()); |
|||
transfer.setNewNeighborHoodId(dto.getVillageId()); |
|||
transfer.setNewBuildingId(dto.getBuildId()); |
|||
transfer.setNewBuildingUnitId(dto.getUnitId()); |
|||
transfer.setNewHouseId(dto.getHomeId()); |
|||
transfer.setTransferTime(new Date()); |
|||
transfer.setReason("出生登记"); |
|||
transfer.setOrigin("birth"); |
|||
icUserTransferRecordService.moveOutResi(transfer); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
<?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.dao.IcBirthRecordDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.IcBirthRecordEntity" id="icBirthRecordMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="villageId" column="VILLAGE_ID"/> |
|||
<result property="buildId" column="BUILD_ID"/> |
|||
<result property="unitId" column="UNIT_ID"/> |
|||
<result property="homeId" column="HOME_ID"/> |
|||
<result property="name" column="NAME"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="gender" column="GENDER"/> |
|||
<result property="idCard" column="ID_CARD"/> |
|||
<result property="birthday" column="BIRTHDAY"/> |
|||
<result property="birthplace" column="BIRTHPLACE"/> |
|||
<result property="isWeifare" column="IS_WEIFARE"/> |
|||
<result property="father" column="FATHER"/> |
|||
<result property="monther" column="MONTHER"/> |
|||
<result property="count" column="COUNT"/> |
|||
<result property="reportDate" column="REPORT_DATE"/> |
|||
<result property="householderName" column="HOUSEHOLDER_NAME"/> |
|||
<result property="householderRelation" column="HOUSEHOLDER_RELATION"/> |
|||
<result property="isCheck" column="IS_CHECK"/> |
|||
<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"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue