diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java new file mode 100644 index 0000000000..0a733f35ba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java @@ -0,0 +1,120 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 核酸上报记录 + + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-25 + */ +@Data +public class IcNatDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id + */ + private String agencyId; + + /** + * 居民端小程序的用户id、数字社区的icResiUserId、其他情况无值 + */ + private String userId; + + /** + * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + */ + private String userType; + + /** + * 人员姓名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 检测时间,精确到分钟 + */ + private Date testingTime; + + /** + * 检测结果(0:阴性 1:阳性) + */ + private String testingResult; + + /** + * 检测地点 + */ + private String testingAddress; + + /** + * 文件名 + */ + private String fileName; + + /** + * 文件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * url地址 + */ + private String attachmentUrl; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java new file mode 100644 index 0000000000..8ed0f5da57 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java @@ -0,0 +1,92 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 核酸检测-上报核酸记录 + * @Author sun + */ +@Data +public class AddIcNatFormDTO implements Serializable { + private static final long serialVersionUID = 9156247659994638103L; + + public interface Nat extends CustomerClientShowGroup { + } + + /** + * 当前网格所属组织Id + */ + @NotBlank(message = "组织Id不能为空", groups = Nat.class) + private String agencyId; + /** + * 居民端小程序的用户id、数字社区的icResiUserId、其他情况无值 + */ + private String userId; + /** + * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + */ + @NotBlank(message = "居民来源不能为空", groups = Nat.class) + private String userType; + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = Nat.class) + private String name; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = Nat.class) + private String mobile; + /** + * 身份证号 + */ + @NotBlank(message = "身份证号不能为空", groups = Nat.class) + private String idCard; + /** + * 检测时间 + */ + @NotBlank(message = "检测时间不能为空", groups = Nat.class) + @JsonFormat(pattern="yyyy-MM-dd HH:mm") + private Date testingTime; + /** + * 检测结果 + */ + private String testingResult; + /** + * 检测地点 + */ + private String testingAddress; + /** + * 文件名 + */ + private String fileName; + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + /** + * 通知渠道 0小程序通知,1短信通知,多选用逗号分隔(0,1) + */ + private String channel; + /** + * 通知内容 + */ + private String content; + + //token中信息 + private String staffId; + private String customerId; + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java new file mode 100644 index 0000000000..d1a08b471c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java @@ -0,0 +1,89 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.IcNatDTO; +import com.epmet.dto.form.AddIcNatFormDTO; +import com.epmet.service.IcNatService; +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 2022-03-25 + */ +@RestController +@RequestMapping("icNuclein") +public class IcNatController { + + @Autowired + private IcNatService icNucleinService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = icNucleinService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { + IcNatDTO data = icNucleinService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcNatDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icNucleinService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcNatDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icNucleinService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icNucleinService.delete(ids); + return new Result(); + } + + + /** + * @Author sun + * @Description 核酸检测-上报核酸记录 + **/ + @NoRepeatSubmit + @PostMapping("add") + public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class); + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + icNucleinService.add(formDTO); + return new Result(); + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java new file mode 100644 index 0000000000..d2a5cffbcd --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -0,0 +1,17 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcNatEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 核酸上报记录 + + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-25 + */ +@Mapper +public interface IcNatDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java new file mode 100644 index 0000000000..94a8edabb4 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -0,0 +1,90 @@ +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-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat") +public class IcNatEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id + */ + private String agencyId; + + /** + * 居民端小程序的用户id、数字社区的icResiUserId、其他情况无值 + */ + private String userId; + + /** + * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other + */ + private String userType; + + /** + * 人员姓名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 检测时间,精确到分钟 + */ + private Date testingTime; + + /** + * 检测结果(0:阴性 1:阳性) + */ + private String testingResult; + + /** + * 检测地点 + */ + private String testingAddress; + + /** + * 文件名 + */ + private String fileName; + + /** + * 文件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * url地址 + */ + private String attachmentUrl; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java new file mode 100644 index 0000000000..36f5ec98c2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java @@ -0,0 +1,86 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcNatDTO; +import com.epmet.dto.form.AddIcNatFormDTO; +import com.epmet.entity.IcNatEntity; + +import java.util.List; +import java.util.Map; + +/** + * 核酸上报记录 + + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-03-25 + */ +public interface IcNatService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-03-25 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-03-25 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcNucleinDTO + * @author generator + * @date 2022-03-25 + */ + IcNatDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-03-25 + */ + void save(IcNatDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-03-25 + */ + void update(IcNatDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-03-25 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 核酸检测-上报核酸记录 + **/ + void add(AddIcNatFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java new file mode 100644 index 0000000000..6db2d231d1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java @@ -0,0 +1,94 @@ +package com.epmet.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.utils.ConvertUtils; +import com.epmet.dao.IcNatDao; +import com.epmet.dto.IcNatDTO; +import com.epmet.dto.form.AddIcNatFormDTO; +import com.epmet.entity.IcNatEntity; +import com.epmet.service.IcNatService; +import org.apache.commons.lang3.StringUtils; +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-03-25 + */ +@Service +public class IcNatServiceImpl extends BaseServiceImpl implements IcNatService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcNatDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcNatDTO.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 IcNatDTO get(String id) { + IcNatEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcNatDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcNatDTO dto) { + IcNatEntity entity = ConvertUtils.sourceToTarget(dto, IcNatEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcNatDTO dto) { + IcNatEntity entity = ConvertUtils.sourceToTarget(dto, IcNatEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 核酸检测-上报核酸记录 + **/ + @Override + public void add(AddIcNatFormDTO formDTO) { + + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml new file mode 100644 index 0000000000..e29e5495fb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file