diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 0bd4a76f77..973eb74fe0 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.140:3306/epmet_data_statistical?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://118.190.150.119:43306/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: root #oracle配置 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectFormDTO.java new file mode 100644 index 0000000000..0e711fa667 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectFormDTO.java @@ -0,0 +1,104 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * 收集居民信息入参 + */ +@Data +public class IcResiCollectFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + public interface InternalShowGroup extends CustomerClientShowGroup { + } + + public interface ExternalShowGroup extends CustomerClientShowGroup { + } + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 内部:internal;外部:external + */ + @NotBlank(message = "兴德路社区:internal;其他社区:external", groups = AddUserInternalGroup.class) + private String origin; + + /** + * 网格ID_后端接口赋值 + */ + private String gridId; + + /** + * 组织Id_后端接口赋值 + */ + private String agencyId; + + /** + * 组织的pid_后端接口赋值 + */ + private String pids; + + /** + * 所属小区ID + */ + @NotBlank(message = "小区不能为空", groups = InternalShowGroup.class) + private String villageId; + + /** + * 所属楼宇Id + */ + @NotBlank(message = "楼栋不能为空", groups = InternalShowGroup.class) + private String buildId; + + /** + * 单元id + */ + @NotBlank(message = "单元不能为空", groups = InternalShowGroup.class) + private String unitId; + + /** + * 所属家庭Id + */ + @NotBlank(message = "家庭不能为空", groups = InternalShowGroup.class) + private String homeId; + + /** + * 详细地址 + */ + @NotBlank(message = "家庭地址不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) + private String address; + + /** + * 1自由0租住 + */ + @NotNull(message = "房子属于自由还是组织?", groups = {InternalShowGroup.class, ExternalShowGroup.class}) + private Integer houserType; + + /** + * 户主姓名 + */ + @NotBlank(message = "户主姓名不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) + private String houserHolerName; + + /** + * 居住成员人数 + */ + @NotNull(message = "居住成员人数不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) + private Integer totalResi; + + @Valid + @NotEmpty(message = "成员信息不能为空", groups = {InternalShowGroup.class, ExternalShowGroup.class}) + private List memberList; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java new file mode 100644 index 0000000000..c9fd01798c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiCollectMemFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class IcResiCollectMemFormDTO implements Serializable { + /** + * 居住成员1姓名 + */ + private String name; + + /** + * 居住成员1身份证号 + */ + private String idNum; + + /** + * 居住成员1手机号 + */ + private String mobile; + + /** + * 居住成员1是否参加几轮全员核算检测,数字1-10 + */ + private Integer hesuanCount; + + /** + * 居住成员1新冠疫苗接种情况;1:已全程接种;2:未全程接种;0未接种; + */ + private Integer ymjz; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java new file mode 100644 index 0000000000..06c8f33f55 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -0,0 +1,51 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.IcResiCollectFormDTO; +import com.epmet.service.IcResiCollectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 居民信息采集表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-18 + */ +@RestController +@RequestMapping("icresicollect") +public class IcResiCollectController { + + @Autowired + private IcResiCollectService icResiCollectService; + + /** + * 居民信息采集_提交 + * + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcResiCollectFormDTO formDTO) { + //效验数据 + ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.AddUserInternalGroup.class); + // 内部:internal;外部:external + if ("internal".equals(formDTO.getOrigin())) { + ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.InternalShowGroup.class); + } else if ("external".equals(formDTO.getOrigin())) { + ValidatorUtils.validateEntity(formDTO, IcResiCollectFormDTO.ExternalShowGroup.class); + } + icResiCollectService.save(formDTO); + return new Result(); + } + + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java new file mode 100644 index 0000000000..81779fbe2e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectDao.java @@ -0,0 +1,17 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcResiCollectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 居民信息采集表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-18 + */ +@Mapper +public interface IcResiCollectDao extends BaseDao { + + IcResiCollectEntity selectByAddress(String address); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java new file mode 100644 index 0000000000..e4748e01b2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiMemberDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcResiMemberEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 居民信息成员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-18 + */ +@Mapper +public interface IcResiMemberDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java new file mode 100644 index 0000000000..8cd679a259 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiCollectEntity.java @@ -0,0 +1,89 @@ +package com.epmet.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-03-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_resi_collect") +public class IcResiCollectEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 内部:internal;外部:external + */ + private String origin; + + /** + * 网格ID + */ + private String gridId; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 组织的pids + */ + private String pids; + + /** + * 所属小区ID + */ + private String villageId; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 单元id + */ + private String unitId; + + /** + * 所属家庭Id + */ + private String homeId; + + /** + * 详细地址 + */ + private String address; + + /** + * 1自由0租住 + */ + private Integer houserType; + + /** + * 户主姓名 + */ + private String houserHolerName; + + /** + * 居住成员人数 + */ + private Integer totalResi; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiMemberEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiMemberEntity.java new file mode 100644 index 0000000000..91ac1538cb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiMemberEntity.java @@ -0,0 +1,59 @@ +package com.epmet.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-03-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_resi_member") +public class IcResiMemberEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * ic_resi_colllect.id + */ + private String icResiCollectId; + + /** + * 居住成员1姓名 + */ + private String name; + + /** + * 居住成员1身份证号 + */ + private String idNum; + + /** + * 居住成员1手机号 + */ + private String mobile; + + /** + * 居住成员1是否参加几轮全员核算检测,数字1-10 + */ + private Integer hesuanCount; + + /** + * 居住成员1新冠疫苗接种情况;1:已全程接种;2:未全程接种;0未接种; + */ + private Integer ymjz; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java new file mode 100644 index 0000000000..86d9d046e3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java @@ -0,0 +1,26 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.IcResiCollectFormDTO; +import com.epmet.entity.IcResiCollectEntity; + +/** + * 居民信息采集表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-18 + */ +public interface IcResiCollectService extends BaseService { + + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-03-18 + */ + void save(IcResiCollectFormDTO dto); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java new file mode 100644 index 0000000000..ebcb749e75 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java @@ -0,0 +1,56 @@ +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IcResiCollectDao; +import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.dto.form.IcResiCollectFormDTO; +import com.epmet.entity.IcResiCollectEntity; +import com.epmet.entity.IcResiMemberEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.IcResiCollectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 居民信息采集表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-18 + */ +@Service +public class IcResiCollectServiceImpl extends BaseServiceImpl implements IcResiCollectService { + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcResiCollectFormDTO formDTO) { + IcResiCollectEntity origin=baseDao.selectByAddress(formDTO.getAddress()); + if(null==origin){ + //插入主表、成员表 + IcResiCollectEntity insert=ConvertUtils.sourceToTarget(formDTO,IcResiCollectEntity.class); + if("internal".equals(formDTO.getOrigin())){ + //查询楼栋个信息 + // IcNeighborHoodDTO neighborHoodDTO=query + Result res= govOrgOpenFeignClient.getIcNeighbordhoodById(formDTO.getVillageId()); + if(!res.success()||null==res.getData()){ + // todo + } + } + List memberList=ConvertUtils.sourceToTarget(formDTO.getMemberList(),IcResiMemberEntity.class); + + }else{ + //查询成员表 + + } + IcResiCollectEntity entity = ConvertUtils.sourceToTarget(dto, IcResiCollectEntity.class); + insert(entity); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml new file mode 100644 index 0000000000..bdb41a9b91 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiMemberDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiMemberDao.xml new file mode 100644 index 0000000000..6423f7ecff --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiMemberDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file