Browse Source

Merge branch 'dev_epidemic_situation' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_epidemic_situation

 Conflicts:
	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java
	epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java
	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
master
wangxianzhang 3 years ago
parent
commit
a16eff63c5
  1. 20
      epmet-commons/epmet-commons-tools/pom.xml
  2. 57
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java
  3. 6
      epmet-module/data-report/data-report-server/pom.xml
  4. 4
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java
  5. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java
  6. 29
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java
  7. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java
  8. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionFormDTO.java
  9. 35
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java
  10. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java
  11. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java
  12. 63
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java
  13. 114
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java
  14. 19
      epmet-user/epmet-user-server/pom.xml
  15. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java
  16. 88
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java
  17. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java
  18. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java
  19. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
  20. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java
  21. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java
  22. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java
  23. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java
  24. 61
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java
  25. 84
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  26. 140
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java
  27. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx
  28. 28
      epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml
  29. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

20
epmet-commons/epmet-commons-tools/pom.xml

@ -24,6 +24,7 @@
<gson.version>2.8.6</gson.version>
<jsoup.version>1.11.3</jsoup.version>
<lombok.version>1.18.4</lombok.version>
<easyexcel.version>3.0.3</easyexcel.version>
</properties>
<dependencies>
@ -177,6 +178,25 @@
<artifactId>javase</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>

57
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ChannelEnum.java

@ -0,0 +1,57 @@
package com.epmet.commons.tools.enums;
import com.epmet.commons.tools.exception.EpmetErrorCode;
/**
* @author Administrator
*/
public enum ChannelEnum {
//通知渠道 0小程序通知,1短信通知
APP("0", "小程序通知"),
MESSAGE("1", "短信通知"),
ALL("2", "小程序通知,短信通知");
private String code;
private String name;
ChannelEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
ChannelEnum[] houseTypeEnums = values();
for (ChannelEnum houseTypeEnum : houseTypeEnums) {
if (houseTypeEnum.getCode() == code) {
return houseTypeEnum.getName();
}
}
return EpmetErrorCode.SERVER_ERROR.getMsg();
}
public static String getCode(String name) {
ChannelEnum[] houseTypeEnums = values();
for (ChannelEnum houseTypeEnum : houseTypeEnums) {
if (houseTypeEnum.getName().equals(name)) {
return houseTypeEnum.getCode();
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

6
epmet-module/data-report/data-report-server/pom.xml

@ -100,12 +100,6 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

4
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java

@ -164,6 +164,10 @@ public interface UserMessageTypeConstant {
*/
String PROJECT_REMIND="project_remind";
/**
* 防疫通知
*/
String ANTIEPIDEMIC="antiepidemic";
/**

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -129,10 +130,10 @@ public class IcNatDTO implements Serializable {
/**
* 通知渠道 0小程序通知1短信通知多选是数组
*/
private List<String> channel;
private List<String> channel = new ArrayList<>();
/**
* 通知内容
*/
private String content;
private String content = "";
}

29
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java

@ -1,8 +1,12 @@
package com.epmet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.util.List;
/**
@ -19,26 +23,41 @@ public class IcNoticeDTO implements Serializable {
/**
* 唯一标识
*/
@JsonIgnore
private String id;
/**
* 客户Id customer.id
*/
@JsonIgnore
private String customerId;
/**
* 通知渠道 0小程序通知1短信通知
*/
private String channel;
private List<String> channelList;
/**
* 通知来源 0行程上报1疫苗接种2核酸检测
*/
@JsonIgnore
private String origin;
/**
* 用户ID
*/
@JsonIgnore
private String userId;
/**
* 手机号
*/
@JsonIgnore
private String mobile;
/**
* 被通知人身份证号
*/
@JsonIgnore
private String idCard;
/**
@ -54,31 +73,37 @@ public class IcNoticeDTO implements Serializable {
/**
* 删除标识0.未删除 1.已删除
*/
@JsonIgnore
private Integer delFlag;
/**
* 乐观锁
*/
@JsonIgnore
private Integer revision;
/**
* 创建人
*/
@JsonIgnore
private String createdBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date createdTime;
/**
* 更新人
*/
@JsonIgnore
private String updatedBy;
/**
* 更新时间
*/
@JsonIgnore
private Date updatedTime;
}

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcNatFormDTO.java

@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -56,7 +57,7 @@ public class AddIcNatFormDTO implements Serializable {
/**
* 检测时间
*/
@NotBlank(message = "检测时间不能为空", groups = Nat.class)
//@NotBlank(message = "检测时间不能为空", groups = Nat.class)
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date natTime;
/**
@ -83,11 +84,11 @@ public class AddIcNatFormDTO implements Serializable {
/**
* 通知渠道 0小程序通知1短信通知多选是数组
*/
private List<String> channel;
private List<String> channel = new ArrayList<>();
/**
* 通知内容
*/
private String content;
private String content = "";
//token中信息
private String customerId;

27
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionFormDTO.java

@ -1,27 +0,0 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/3/28 13:47
* @DESC
*/
@Data
public class CancelAttentionFormDTO implements Serializable {
private static final long serialVersionUID = 2252387281427013057L;
/**
* 身份证
*/
private String idCard;
/**
* 关注类型核酸检测2疫苗接种1
*/
private Integer attentionType ;
}

35
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CancelAttentionPackageFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2022/3/28 16:48
* @DESC
*/
@Data
public class CancelAttentionPackageFormDTO implements Serializable {
private static final long serialVersionUID = 2198470055930997870L;
public interface CancelAttentionPackageForm{}
/**
* 身份证
*/
@NotNull(message = "idCard不能为空",groups = CancelAttentionPackageForm.class)
private List<String> idCards;
/**
* 关注类型核酸检测2疫苗接种1
*/
@NotNull(message = "attentionType不能为空",groups = CancelAttentionPackageForm.class)
private Integer attentionType ;
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/3/28 16:13
*/
@Data
public class IcNoticeFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 7392894573654015338L;
private String customerId;
@NotBlank(message = "身份证号不能为空", groups = DefaultGroup.class)
private String idCard;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyNatListFormDTO.java

@ -1,17 +1,17 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 核酸检测-我的上报记录
* @Author sun
*/
@Data
public class MyNatListFormDTO implements Serializable {
public class MyNatListFormDTO extends PageFormDTO {
private static final long serialVersionUID = 9156247659994638103L;
public interface MyNat extends CustomerClientShowGroup {
@ -49,11 +49,6 @@ public class MyNatListFormDTO implements Serializable {
* 检测结束时间yyyy-MM-dd HH:mm间yy-mm-dd
*/
private String endTime;
/**
* 分页参数
*/
private Integer pageNo = 1;
private Integer pageSize = 10;
/**
* 核酸记录Id
@ -61,7 +56,9 @@ public class MyNatListFormDTO implements Serializable {
@NotBlank(message = "核酸记录Id不能为空", groups = { Detail.class, Del.class, Synchro.class})
private String icNatId;
//token信息
/**
* token里设置
*/
private String customerId;
private String userId;

63
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java

@ -0,0 +1,63 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/3/28 14:14
*/
@NoArgsConstructor
@Data
public class SendNoticeFormDTO implements Serializable {
private static final long serialVersionUID = 4800907725063604885L;
private String customerId;
/**
* 用户列表
*/
@NotNull(message = "用户列表不能为空", groups = DefaultGroup.class)
private List<UserListBean> userList;
/**
* 通知渠道通知渠道 0小程序通知1短信通知
*/
@NotNull(message = "通知渠道不能为空", groups = DefaultGroup.class)
private List<String> channel;
/**
* 通知来源 0 行程上报1 疫苗接种2 核酸检测
*/
@NotNull(message = "通知来源不能为空", groups = DefaultGroup.class)
private String origin;
/**
* 通知内容
*/
@NotNull(message = "通知内容不能为空", groups = DefaultGroup.class)
private String content;
/**
* 组织名
*/
@NotNull(message = "组织名不能为空", groups = DefaultGroup.class)
private String orgName;
@NoArgsConstructor
@Data
public static class UserListBean {
/**
* 用户ID
*/
private String userId;
/**
* 手机号
*/
private String mobile;
/**
* 身份证
*/
private String idCard;
}
}

114
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatListResultDTO.java

@ -1,76 +1,88 @@
package com.epmet.dto.result;
import com.alibaba.excel.annotation.ExcelIgnore;
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 com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Description 核酸检测-我的上报记录
* @Author sun
*/
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44)
@Data
public class NatListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
//总条数
private Integer total;
List<NatListDTO> list = new ArrayList<>();
/**
* 核酸记录Id
*/
@ExcelIgnore
private String icNatId;
/**
* 组织Id
*/
@ExcelIgnore
private String agencyId;
/**
* 居民端小程序的用户id数字社区的icResiUserId其他情况无值
*/
@ExcelIgnore
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
@ExcelIgnore
private String userType;
@Data
public static class NatListDTO {
/**
* 姓名
*/
@ColumnWidth(20)
@ExcelProperty("姓名")
private String name;
/**
* 核酸记录Id
*/
private String icNatId;
/**
* 组织Id
*/
private String agencyId;
/**
* 居民端小程序的用户id数字社区的icResiUserId其他情况无值
*/
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
private String userType;
/**
* 手机号
*/
@ColumnWidth(20)
@ExcelProperty("手机号")
private String mobile;
/**
* 姓名
*/
private String name;
/**
* 身份证号
*/
@ColumnWidth(25)
@ExcelProperty("身份证号")
private String idCard;
/**
* 手机号
*/
private String mobile;
/**
* 检测时间,yyyy-MM-dd HH:mm
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@ColumnWidth(25)
@ExcelProperty("检测时间")
private Date natTime;
/**
* 身份证号
*/
private String idCard;
/**
* 检测结果
*/
@ColumnWidth(20)
@ExcelProperty("检测结果")
private String natResult;
/**
* 检测时间,yyyy-MM-dd HH:mm
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date natTime;
/**
* 检测地点
*/
@ColumnWidth(30)
@ExcelProperty("检测地点")
private String natAddress;
/**
* 检测结果
*/
private String natResult;
/**
* 检测地点
*/
private String natAddress;
}
}

19
epmet-user/epmet-user-server/pom.xml

@ -18,25 +18,6 @@
<artifactId>epmet-admin-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.3</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>

18
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java

@ -12,10 +12,7 @@ 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.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.form.CancelAttentionFormDTO;
import com.epmet.dto.form.NatListFormDTO;
import com.epmet.dto.form.VaccinationAddFormDTO;
import com.epmet.dto.form.VaccinationListFormDTO;
import com.epmet.dto.form.*;
import com.epmet.service.IcEpidemicSpecialAttentionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -55,15 +52,13 @@ public class IcEpidemicSpecialAttentionController {
/**
* Desc:疫苗接种关注名单核酸检测关注名单新增
* @param list
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2022/3/28 13:35
*/
@PostMapping("vaccination-add")
public Result vaccinationAdd(@RequestBody List<IcEpidemicSpecialAttentionDTO> list,@LoginUser TokenDto tokenDto){
VaccinationAddFormDTO formDTO = new VaccinationAddFormDTO();
formDTO.setList(list);
public Result vaccinationAdd(@RequestBody VaccinationAddFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, VaccinationAddFormDTO.VaccinationAddForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
@ -85,13 +80,14 @@ public class IcEpidemicSpecialAttentionController {
/**
* Desc: 取消关注
* @param list
* @param formDTO
* @author zxc
* @date 2022/3/28 13:51
*/
@PostMapping("cancel-attention")
public Result cancelAttention(@RequestBody List<CancelAttentionFormDTO> list){
icEpidemicSpecialAttentionService.cancelAttention(list);
public Result cancelAttention(@RequestBody CancelAttentionPackageFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, CancelAttentionPackageFormDTO.CancelAttentionPackageForm.class);
icEpidemicSpecialAttentionService.cancelAttention(formDTO);
return new Result();
}

88
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java

@ -1,5 +1,8 @@
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.AppClientConstant;
@ -8,12 +11,13 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.ResultDataResolver;
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.EpmetRequestHolder;
import com.epmet.commons.tools.utils.FileUtils;
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.DefaultGroup;
@ -30,13 +34,22 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcNatService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -64,7 +77,7 @@ public class IcNatController implements ResultDataResolver {
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
@NoRepeatSubmit
//@NoRepeatSubmit
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class);
@ -91,10 +104,10 @@ public class IcNatController implements ResultDataResolver {
**/
@NoRepeatSubmit
@PostMapping("natlist")
public Result<NatListResultDTO> natList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
public Result<PageData<NatListResultDTO>> natList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<NatListResultDTO>().ok(icNucleinService.natList(formDTO));
return new Result<PageData<NatListResultDTO>>().ok(icNucleinService.natList(formDTO));
}
/**
@ -114,7 +127,8 @@ public class IcNatController implements ResultDataResolver {
**/
@NoRepeatSubmit
@PostMapping("edit")
public Result edit(@RequestBody AddIcNatFormDTO formDTO) {
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
icNucleinService.edit(formDTO);
return new Result();
}
@ -199,5 +213,69 @@ public class IcNatController implements ResultDataResolver {
return new Result();
}
/**
* @Author sun
* @Description 核酸核酸检测信息下载模板
**/
@RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadTemplate(HttpServletResponse response) throws IOException {
response.setCharacterEncoding("UTF-8");
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition");
//response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("社区自组织导入模板", "UTF-8") + ".xlsx");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat.xlsx");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.copy(is, os);
} finally {
if (is != null) {
is.close();
}
}
}
/**
* @Author sun
* @Description 核酸核酸检测信息列表
**/
@NoRepeatSubmit
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO, HttpServletResponse response) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
//formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
//formDTO.setUserId("73ae6280e46a6653a5605d51d5462725");
formDTO.setPage(false);
ExcelWriter excelWriter = null;
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
int pageNo = formDTO.getPageNo();
try {
// 这里 需要指定写用哪个class去写
String fileName = "核酸检测信息.xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response),NatListResultDTO.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build();
PageData<NatListResultDTO> data = null;
do {
data = icNucleinService.natList(formDTO);
formDTO.setPageNo(++pageNo);
excelWriter.write(data.getList(), writeSheet);
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size()==formDTO.getPageSize());
}catch (Exception e){
log.error("export exception", e);
}finally {
// 千万别忘记finish 会帮忙关闭流
if (excelWriter != null) {
excelWriter.finish();
}
}
}
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java

@ -1,21 +1,22 @@
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.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.service.IcNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 防疫通知
@ -31,8 +32,9 @@ public class IcNoticeController {
private IcNoticeService icNoticeService;
@RequestMapping("page")
public Result<PageData<IcNoticeDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcNoticeDTO> page = icNoticeService.page(params);
public Result<PageData<IcNoticeDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody IcNoticeFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
PageData<IcNoticeDTO> page = icNoticeService.page(formDTO);
return new Result<PageData<IcNoticeDTO>>().ok(page);
}
@ -68,6 +70,12 @@ public class IcNoticeController {
return new Result();
}
@PostMapping("sendNotice")
public Result sendNotice(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
icNoticeService.sendNotice(formDTO);
return new Result();
}
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java

@ -5,6 +5,7 @@ import com.epmet.dto.form.VaccinationListFormDTO;
import com.epmet.dto.result.VaccinationListResultDTO;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -33,4 +34,22 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao<IcEpidemicSpecial
*/
List<VaccinationListResultDTO> natList(VaccinationListFormDTO formDTO);
/**
* Desc: 取消关注
* @param list
* @param attentionType
* @author zxc
* @date 2022/3/28 16:59
*/
void cancelAttention(@Param("list")List<String> list,@Param("attentionType")Integer attentionType);
/**
* Desc: 查询已经存在的关注
* @param attentionType
* @param list
* @author zxc
* @date 2022/3/28 17:29
*/
List<String> getExistList(@Param("attentionType")Integer attentionType,@Param("list")List<String> list);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java

@ -29,11 +29,11 @@ public interface IcNatDao extends BaseDao<IcNatEntity> {
* @Author sun
* @Description 核酸核酸检测信息列表
**/
List<NatListResultDTO.NatListDTO> getNatList(MyNatListFormDTO formDTO);
List<NatListResultDTO> getNatList(MyNatListFormDTO formDTO);
/**
* @Author sun
* @Description 删除/取消同步操作--物理删除业务数据
**/
boolean delById(@Param("icNatId") String icNatId);
}
int delById(@Param("icNatId") String icNatId);
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java

@ -1,13 +1,10 @@
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;
/**
* 防疫通知
*
@ -36,6 +33,15 @@ public class IcNoticeEntity extends BaseEpmetEntity {
*/
private String origin;
/**
* 用户ID
*/
private String userId;
/**
* 手机号
*/
private String mobile;
/**
* 被通知人身份证号
*/

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java

@ -3,7 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.form.CancelAttentionFormDTO;
import com.epmet.dto.form.CancelAttentionPackageFormDTO;
import com.epmet.dto.form.VaccinationAddFormDTO;
import com.epmet.dto.form.VaccinationListFormDTO;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity;
@ -106,9 +106,9 @@ public interface IcEpidemicSpecialAttentionService extends BaseService<IcEpidemi
/**
* Desc: 取消关注
* @param list
* @param formDTO
* @author zxc
* @date 2022/3/28 13:51
*/
void cancelAttention(List<CancelAttentionFormDTO> list);
void cancelAttention(CancelAttentionPackageFormDTO formDTO);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatService.java

@ -11,7 +11,6 @@ import com.epmet.entity.IcNatEntity;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
/**
* 核酸上报记录
@ -36,8 +35,9 @@ public interface IcNatService extends BaseService<IcNatEntity> {
/**
* @Author sun
* @Description 核酸核酸检测信息列表
**/
NatListResultDTO natList(MyNatListFormDTO formDTO);
*
* @return*/
PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO);
/**
* @Author sun
@ -68,4 +68,4 @@ public interface IcNatService extends BaseService<IcNatEntity> {
* @param filePath
*/
void execAsyncExcelImport(Path filePath, String importTaskId);
}
}

25
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.entity.IcNoticeEntity;
import java.util.List;
@ -19,12 +21,12 @@ public interface IcNoticeService extends BaseService<IcNoticeEntity> {
/**
* 默认分页
*
* @param params
* @param dto
* @return PageData<IcNoticeDTO>
* @author generator
* @date 2022-03-28
*/
PageData<IcNoticeDTO> page(Map<String, Object> params);
PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO);
/**
* 默认查询
@ -75,4 +77,23 @@ public interface IcNoticeService extends BaseService<IcNoticeEntity> {
* @date 2022-03-28
*/
void delete(String[] ids);
/**
* 发送通知
*
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/3/28 14:19
*/
void sendNotice(SendNoticeFormDTO formDTO);
/**
* 获取人员最新一条通知
* @Param idCard
* @Return {@link IcNoticeDTO}
* @Author zhaoqifeng
* @Date 2022/3/28 15:43
*/
IcNoticeDTO getNotice(String customerId, String idCard);
}

61
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

@ -7,20 +7,20 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.IcEpidemicSpecialAttentionDao;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO;
import com.epmet.dto.form.CancelAttentionFormDTO;
import com.epmet.dto.form.NatListFormDTO;
import com.epmet.dto.form.VaccinationAddFormDTO;
import com.epmet.dto.form.VaccinationListFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.VaccinationListResultDTO;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity;
import com.epmet.service.IcEpidemicSpecialAttentionService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 疫情特别关注
@ -100,10 +101,10 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
*/
@Override
public PageData vaccinationList(VaccinationListFormDTO formDTO) {
PageData result = new PageData(new ArrayList(), NumConstant.ZERO_L);
PageData<VaccinationListResultDTO> result = new PageData(new ArrayList(), NumConstant.ZERO_L);
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("查询到工作人员信息"+formDTO.getUserId());
throw new EpmetException("查询到工作人员信息"+formDTO.getUserId());
}
formDTO.setOrgId(staffInfo.getAgencyId());
// 关注类型,核酸检测:2,疫苗接种:1
@ -128,6 +129,11 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
result.setTotal(list.size());
}
}
int i = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
for (VaccinationListResultDTO v : result.getList()) {
i += 1;
v.setSort(i);
}
return result;
}
@ -138,8 +144,40 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
* @date 2022/3/28 13:35
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void vaccinationAdd(VaccinationAddFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("未查询到工作人员信息"+formDTO.getUserId());
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
if (null == agencyInfo){
throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId());
}
List<IcEpidemicSpecialAttentionEntity> entities = ConvertUtils.sourceToTarget(formDTO.getList(), IcEpidemicSpecialAttentionEntity.class);
List<String> idCards = entities.stream().map(m -> m.getIdCard()).collect(Collectors.toList());
Integer attentionType = entities.get(NumConstant.ZERO).getAttentionType();
List<String> existList = baseDao.getExistList(attentionType, idCards);
if (CollectionUtils.isNotEmpty(existList)){
for (String s : existList) {
for (int i = NumConstant.ZERO; i < entities.size(); i++) {
if (s.equals(entities.get(i).getIdCard())){
entities.remove(i);
continue;
}
}
}
}
entities.forEach(e -> {
e.setIsAttention(NumConstant.ONE);
e.setOrgId(agencyInfo.getId());
e.setPid(agencyInfo.getPid());
e.setPids(agencyInfo.getPids());
e.setCustomerId(formDTO.getCustomerId());
});
insertBatch(entities);
//TODO 发送通知
}
/**
@ -157,13 +195,16 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
/**
* Desc: 取消关注
* @param list
* @param formDTO
* @author zxc
* @date 2022/3/28 13:51
*/
@Override
public void cancelAttention(List<CancelAttentionFormDTO> list) {
@Transactional(rollbackFor = Exception.class)
public void cancelAttention(CancelAttentionPackageFormDTO formDTO) {
if (CollectionUtils.isNotEmpty(formDTO.getIdCards())){
baseDao.cancelAttention(formDTO.getIdCards(), formDTO.getAttentionType());
}
}
}

84
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -25,11 +25,13 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcNatDao;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.AddIcNatFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.MyNatListFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.dto.result.MyNatListResultDTO;
import com.epmet.dto.result.NatListResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
@ -40,9 +42,11 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcNatService;
import com.epmet.service.IcNoticeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@ -54,6 +58,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.util.ArrayList;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
@ -79,6 +84,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private IcNoticeService icNoticeService;
@Autowired
private OssFeignClient ossFeignClient;
@ -87,6 +95,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
* @Description 核酸检测-上报核酸记录
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(AddIcNatFormDTO formDTO) {
//1.获取所填居民所属组织缓存信息
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId());
@ -100,7 +109,16 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO) {
//TODO
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setOrgName(agencyInfo.getOrganizationName());
icNoticeService.sendNotice(dto);
}
}
@ -119,10 +137,10 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
/**
* @Author sun
* @Description 核酸核酸检测信息列表
**/
*
* @return*/
@Override
public NatListResultDTO natList(MyNatListFormDTO formDTO) {
NatListResultDTO resultDTO = new NatListResultDTO();
public PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO) {
//1.根据orgType值判断是查询当前组织下还是整个客户下数据
if ("current".equals(formDTO.getOrgType())) {
//获取工作人员缓存信息
@ -134,12 +152,9 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
}
//2.按条件查询业务数据
PageInfo<NatListResultDTO.NatListDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.isPage())
.doSelectPageInfo(() -> baseDao.getNatList(formDTO));
resultDTO.setTotal((int) data.getTotal());
resultDTO.setList(data.getList());
return resultDTO;
return new PageData(data.getList(),data.getTotal());
}
/**
@ -157,7 +172,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class);
//2.查询对应的通知记录信息
//TODO
IcNoticeDTO dto = icNoticeService.getNotice(entity.getCustomerId(), entity.getIdCard());
if (null != dto) {
resultDTO.setChannel(dto.getChannelList());
resultDTO.setContent(dto.getContent());
}
return resultDTO;
}
@ -167,17 +186,34 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
* @Description 核酸核酸检测信息修改
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(AddIcNatFormDTO formDTO) {
//1.更新核酸记录表数据
IcNatEntity entity = ConvertUtils.sourceToTarget(formDTO, IcNatEntity.class);
entity.setId(formDTO.getIcNatId());
if (!updateById(entity)) {
log.error(String.format("数据修改失败,核酸记录Id->", formDTO.getIcNatId()));
log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败");
}
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO) {
//TODO
IcNatEntity icNatEntity = baseDao.selectById(formDTO.getIcNatId());
//1.获取所填居民所属组织缓存信息
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(icNatEntity.getAgencyId());
if (null == agencyInfo) {
throw new RenException(String.format("获取组织缓存信息失败%s", icNatEntity.getAgencyId()));
}
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setOrgName(agencyInfo.getOrganizationName());
icNoticeService.sendNotice(dto);
}
}
@ -186,10 +222,11 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
* @Description 核酸核酸检测信息删除/取消同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void del(MyNatListFormDTO formDTO) {
//1.物理删除业务数据
if (baseDao.delById(formDTO.getIcNatId())) {
log.error(String.format("数据删除/取消同步失败,核酸记录Id->", formDTO.getIcNatId()));
if (baseDao.delById(formDTO.getIcNatId()) < NumConstant.ONE) {
log.error(String.format("数据删除/取消同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据操作失败");
}
}
@ -199,20 +236,21 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
* @Description 核酸核酸检测信息同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void synchro(MyNatListFormDTO formDTO) {
//1.获取工作人员缓存数据
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//1.根据核酸记录Id查询业务数据并进行必要校验
IcNatEntity entity = baseDao.selectById(formDTO.getIcNatId());
if (null == entity || formDTO.getAgencyId().equals(entity.getAgencyId())
if (null == entity || staffInfo.getAgencyId().equals(entity.getAgencyId())
|| (!"import".equals(entity.getUserType()) && !"synchro".equals(entity.getUserType()))) {
log.error(String.format("数据同步失败,核酸记录Id->", formDTO.getIcNatId()));
log.error(String.format("数据同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,不是导入数据或非本组织数据");
}
//2.获取工作人员缓存数据
//获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//3.待同步组织新增业务数据
entity.setId("");
entity.setAgencyId(staffInfo.getAgencyId());
@ -312,4 +350,4 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
public void batchPersist(List<IcNatEntity> entities) {
insertBatch(entities);
}
}
}

140
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java

@ -1,23 +1,39 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.*;
import com.epmet.commons.tools.enums.ChannelEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dao.IcNoticeDao;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.ProjectSendMsgFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.IcNoticeEntity;
import com.epmet.feign.MessageFeignClient;
import com.epmet.service.IcNoticeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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 javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 防疫通知
@ -25,16 +41,35 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-03-28
*/
@Slf4j
@Service
public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEntity> implements IcNoticeService {
@Resource
private MessageFeignClient messageFeignClient;
@Override
public PageData<IcNoticeDTO> page(Map<String, Object> params) {
IPage<IcNoticeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, IcNoticeDTO.class);
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LambdaQueryWrapper<IcNoticeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNoticeEntity::getCustomerId, formDTO.getCustomerId());
wrapper.eq(IcNoticeEntity::getIdCard, formDTO.getIdCard());
wrapper.orderByDesc(IcNoticeEntity::getCreatedTime);
List<IcNoticeEntity> list = baseDao.selectList(wrapper);
PageInfo<IcNoticeEntity> pageInfo = new PageInfo<>(list);
List<IcNoticeDTO> dtoList = ConvertUtils.sourceToTarget(list, IcNoticeDTO.class);
if (CollectionUtils.isNotEmpty(dtoList)) {
dtoList.forEach(item -> {
List<String> channelList = Arrays.asList(item.getChannel().split(StrConstant.COMMA));
if (channelList.size() == NumConstant.ONE) {
item.setChannel(ChannelEnum.getName(channelList.get(0)));
} else {
item.setChannel(ChannelEnum.getName(NumConstant.TWO_STR));
}
});
}
return new PageData<>(dtoList, pageInfo.getTotal());
}
@Override
@ -80,4 +115,91 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 发送通知
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/3/28 14:19
*/
@Override
public void sendNotice(SendNoticeFormDTO formDTO) {
//保存消息
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA);
List<IcNoticeEntity> entityList = formDTO.getUserList().stream().map(item -> {
IcNoticeEntity entity = new IcNoticeEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setChannel(channel);
entity.setContent(formDTO.getContent());
entity.setOrigin(formDTO.getOrigin());
entity.setUserId(item.getUserId());
entity.setMobile(item.getMobile());
entity.setIdCard(item.getIdCard());
entity.setOrgName(formDTO.getOrgName());
return entity;
}).collect(Collectors.toList());
insertBatch(entityList);
//通知
List<UserMessageFormDTO> msgList = new ArrayList<>();
//短信消息
List<ProjectSendMsgFormDTO> smsList = new ArrayList<>();
entityList.forEach(item -> {
if (StringUtils.isNotBlank(item.getUserId())) {
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(item.getCustomerId());
messageFormDTO.setApp(AppClientConstant.APP_GOV);
messageFormDTO.setGridId(StrConstant.STAR);
messageFormDTO.setUserId(item.getUserId());
messageFormDTO.setTitle("您有一条通知消息!");
messageFormDTO.setMessageContent(item.getContent());
messageFormDTO.setReadFlag(Constant.UNREAD);
messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC);
messageFormDTO.setTargetId(item.getId());
msgList.add(messageFormDTO);
}
//TODO
if (StringUtils.isNotBlank(item.getMobile())) {
ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO();
sms.setCustomerId(item.getCustomerId());
sms.setMobile(item.getMobile());
sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_OVERDUE);
sms.setParameterKey("send_msg");
smsList.add(sms);
}
});
Result result = messageFeignClient.saveUserMessageList(msgList);
if (!result.success()) {
log.error("发送小程序消息失败" + JSON.toJSONString(result));
}
}
/**
* 获取人员最新一条通知
*
* @param idCard
* @Param idCard
* @Return {@link IcNoticeDTO}
* @Author zhaoqifeng
* @Date 2022/3/28 15:43
*/
@Override
public IcNoticeDTO getNotice(String customerId, String idCard) {
IcNoticeDTO result = new IcNoticeDTO();
LambdaQueryWrapper<IcNoticeEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcNoticeEntity::getCustomerId, customerId);
wrapper.eq(IcNoticeEntity::getIdCard, idCard);
wrapper.orderByDesc(IcNoticeEntity::getCreatedTime);
List<IcNoticeEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(list)) {
result = ConvertUtils.sourceToTarget(list.get(NumConstant.ZERO), IcNoticeDTO.class);
result.setChannelList(Arrays.asList(result.getChannel().split(StrConstant.COMMA)));
}
return result;
}
}

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_nat.xlsx

Binary file not shown.

28
epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml

@ -3,6 +3,20 @@
<mapper namespace="com.epmet.dao.IcEpidemicSpecialAttentionDao">
<!-- 取消关注 -->
<update id="cancelAttention">
UPDATE ic_epidemic_special_attention
SET UPDATED_TIME = NOW(),
IS_ATTENTION = 0
WHERE del_flag = 0
AND attention_type = #{attentionType}
AND id_card IN (
<foreach collection="list" item="l" separator=",">
#{l}
</foreach>
)
</update>
<!-- 疫苗接种关注名单 -->
<select id="vaccinationList" resultType="com.epmet.dto.result.VaccinationListResultDTO">
SELECT
@ -63,5 +77,19 @@
ORDER BY a.CREATED_TIME DESC
</select>
<!-- 查询已经存在的关注 -->
<select id="getExistList" resultType="java.lang.String">
SELECT
ID_CARD
FROM ic_epidemic_special_attention
WHERE DEL_FLAG = 0
AND ATTENTION_TYPE = #{attentionType}
AND ID_CARD IN (
<foreach collection="list" item="l" separator=",">
#{l}
</foreach>
)
</select>
</mapper>

8
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -22,9 +22,10 @@
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
ORDER BY nat_time DESC
</select>
<select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO$NatListDTO">
<select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT
id icNatId,
agency_id agencyId,
@ -42,7 +43,7 @@
del_flag = '0'
AND customer_id = #{customerId}
<if test='null != agencyId and "" != agencyId'>
AND pids like concat('%', #{agencyId}, '%')
AND (agency_id = #{agencyId} OR pids like concat('%', #{agencyId}, '%'))
</if>
<if test='null != name and "" != name'>
AND name like concat('%', #{name}, '%')
@ -59,10 +60,11 @@
<if test='null != endTime and "" != endTime'>
AND nat_time <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY nat_time, id_card DESC
</select>
<delete id="delById">
DELETE FROM ic_nat WHERE id = #{icNatId}
</delete>
</mapper>
</mapper>

Loading…
Cancel
Save