Browse Source

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

master
wangxianzhang 3 years ago
parent
commit
e52badbd1f
  1. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  3. 39
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  4. 77
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  5. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java
  6. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java
  7. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java
  8. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  9. 44
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java
  10. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  11. 80
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  12. 2
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__modify_trip_report.sql
  13. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/trip_report_import_template.xlsx
  14. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  15. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

5
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java

@ -9,9 +9,10 @@ public interface IcResiUserConstant {
String IC_RESI_USER = "ic_resi_user";
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端小程序的人resi;数字社区的居民icresi;单独录入input; 导入import
*/
String USER_TYPE_RESI="resi";
String USER_TYPE_IC_RESI="icresi";
String USER_TYPE_OTHER="other";
String USER_TYPE_INPUT="input";
String USER_TYPE_IMPORT="import";
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -64,7 +64,7 @@ public class IcTripReportRecordDTO implements Serializable {
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端小程序的人resi;数字社区的居民icresi;单独录入input; 导入import
*/
private String userType;

39
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java

@ -24,12 +24,19 @@ public class IcTripReportFormDTO implements Serializable {
public interface ResiUserRequired extends CustomerClientShowGroup {
}
public interface PcInternalGroup {
public interface PcAddOrUpdateInternalGroup {
}
public interface PcRequired extends CustomerClientShowGroup {
public interface PcAddRequired extends CustomerClientShowGroup {
}
public interface IcResiInternalGroup {
}
public interface PcUpdateRequired extends CustomerClientShowGroup {
}
@NotBlank(message = "主键不能为空", groups = {PcUpdateRequired.class})
private String id;
/**
* 客户Id
*/
@ -38,54 +45,54 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String name;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String idCard;
/**
* 是否添加到核算检测关注名单,true加入默认false不加入
*/
@NotNull(message = "是否添加到核算检测关注名单", groups = {PcRequired.class})
@NotNull(message = "是否添加到核算检测关注名单", groups = {PcAddRequired.class,PcUpdateRequired.class})
private Boolean heSuanCheck;
/**
* 现居地编码
*/
@NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String presentAddressCode;
/**
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String presentAddress;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String detailAddress;
/**
* 来源地区编码
*/
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String sourceAddressCode;
/**
* 来源地区地址
*/
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String sourceAddress;
/**
@ -93,7 +100,7 @@ public class IcTripReportFormDTO implements Serializable {
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class,PcRequired.class})
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private Date arriveDate;
/**
@ -106,7 +113,7 @@ public class IcTripReportFormDTO implements Serializable {
/**
* 备注信息
*/
@Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class,PcRequired.class})
@Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class})
private String remark;
@ -127,11 +134,11 @@ public class IcTripReportFormDTO implements Serializable {
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端上报是后端赋值
* 居民端小程序的人resi;数字社区的居民icresi;单独录入input; 导入import
* 居民端上报是后端赋值导入后端赋值
* pc录入是前端赋值
*/
@NotBlank(message = "数字社区的居民:icresi;其他:other", groups = {PcInternalGroup.class})
@NotBlank(message = "数字社区的居民:icresi;其他:other", groups = {PcAddOrUpdateInternalGroup.class})
private String userType;
/**

77
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -6,19 +6,24 @@ import com.epmet.commons.tools.dto.form.PageFormDTO;
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.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.dto.form.PageTripReportFormDTO;
import com.epmet.service.IcTripReportRecordService;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
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;
@ -50,12 +55,6 @@ public class IcTripReportRecordController {
return new Result<PageData<IcTripReportRecordDTO>>().ok(page);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<IcTripReportRecordDTO> get(@PathVariable("id") String id){
IcTripReportRecordDTO data = icTripReportRecordService.get(id);
return new Result<IcTripReportRecordDTO>().ok(data);
}
/**
* pc: 行程上报-新增
* @param formDTO
@ -66,7 +65,7 @@ public class IcTripReportRecordController {
public Result save(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcRequired.class,IcTripReportFormDTO.PcInternalGroup.class);
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcAddRequired.class,IcTripReportFormDTO.PcAddOrUpdateInternalGroup.class);
if(IcResiUserConstant.USER_TYPE_IC_RESI.equals(formDTO.getUserType())){
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.IcResiInternalGroup.class);
}
@ -74,20 +73,35 @@ public class IcTripReportRecordController {
return new Result().ok(id);
}
/**
* pc: 行程上报-修改
* @param formDTO
* @return
*/
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody IcTripReportRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icTripReportRecordService.update(dto);
return new Result();
public Result update(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.PcUpdateRequired.class,IcTripReportFormDTO.PcAddOrUpdateInternalGroup.class);
if(IcResiUserConstant.USER_TYPE_IC_RESI.equals(formDTO.getUserType())){
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.IcResiInternalGroup.class);
}
return new Result().ok(icTripReportRecordService.update(formDTO));
}
/**
* pc:行程上报-删除
*
* @param ids
* @return
*/
@PostMapping("delete")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
icTripReportRecordService.delete(ids);
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody String[] ids) {
if (ArrayUtils.isEmpty(ids)) {
return new Result();
}
icTripReportRecordService.delete(tokenDto.getCustomerId(),tokenDto.getUserId(),ids);
return new Result();
}
@ -119,4 +133,29 @@ public class IcTripReportRecordController {
return new Result<List<IcTripReportRecordDTO>>().ok(icTripReportRecordService.resiList(formDTO));
}
/**
* pc:行程上报-下载模板
* @param response
* @throws IOException
*/
@RequestMapping(value = "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/trip_report_import_template.xlsx");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.copy(is, os);
} finally {
if (is != null) {
is.close();
}
}
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java

@ -33,4 +33,13 @@ public interface IcTripReportRecordDao extends BaseDao<IcTripReportRecordEntity>
* @return
*/
List<IcTripReportRecordDTO> pageList(PageTripReportFormDTO formDTO);
/**
* pc:行程上报-删除
* @param userId
* @param agencyId
* @param ids
* @return
*/
int batchDel(@Param("userId")String userId,@Param("agencyId")String agencyId, @Param("ids")String[] ids);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java

@ -62,7 +62,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity {
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
* 居民端小程序的人resi;数字社区的居民icresi;单独录入input; 导入import
*/
private String userType;

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatExcelImportListener.java

@ -70,7 +70,7 @@ public class IcNatExcelImportListener implements ReadListener<IcNatImportExcelDa
icNatEntity.setAgencyId(currentAgencyId);
icNatEntity.setPids(currentAgencyPids);
icNatEntity.setUserId(currentUserId);
icNatEntity.setUserType("other");
icNatEntity.setUserType("import");
icNatEntity.setNatResult(natResult);
icNatEntity.setAttachmentType("");
icNatEntity.setAttachmentUrl("");

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java

@ -39,16 +39,6 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
*/
List<IcTripReportRecordDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return IcTripReportRecordDTO
* @author generator
* @date 2022-03-25
*/
IcTripReportRecordDTO get(String id);
/**
* pc: 行程上报-新增
*
@ -67,17 +57,17 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
* @author generator
* @date 2022-03-25
*/
void update(IcTripReportRecordDTO dto);
String update(IcTripReportFormDTO dto);
/**
* 批量删除
* pc:行程上报-删除
*
* @param ids
* @return void
* @author generator
* @date 2022-03-25
*/
void delete(String[] ids);
void delete(String customerId,String userId,String[] ids);
/**
* 居民端小程序上报行程

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

@ -5,14 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.*;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.ChannelEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
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.UserBaseInfoDTO;
import com.epmet.dto.form.IcNoticeFormDTO;
import com.epmet.dto.form.ProjectSendMsgFormDTO;
import com.epmet.dto.form.SendNoticeFormDTO;
@ -20,6 +23,7 @@ import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.IcNoticeEntity;
import com.epmet.feign.MessageFeignClient;
import com.epmet.service.IcNoticeService;
import com.epmet.service.UserBaseInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -44,6 +48,8 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
@Resource
private MessageFeignClient messageFeignClient;
@Resource
private UserBaseInfoService userBaseInfoService;
@Override
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) {
@ -123,8 +129,14 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
*/
@Override
public void sendNotice(SendNoticeFormDTO formDTO) {
String orgName = "";
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null != staffInfo) {
orgName = staffInfo.getAgencyName();
}
//保存消息
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA);
String finalOrgName = orgName;
List<IcNoticeEntity> entityList = formDTO.getUserList().stream().map(item -> {
IcNoticeEntity entity = new IcNoticeEntity();
entity.setCustomerId(formDTO.getCustomerId());
@ -134,7 +146,7 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
entity.setUserId(item.getUserId());
entity.setMobile(item.getMobile());
entity.setIdCard(item.getIdCard());
entity.setOrgName(formDTO.getOrgName());
entity.setOrgName(finalOrgName);
return entity;
}).collect(Collectors.toList());
insertBatch(entityList);
@ -145,18 +157,24 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
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);
if (StringUtils.isNotBlank(item.getIdCard())) {
//根据身份证获取居民ID
List<UserBaseInfoDTO> userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard());
if (CollectionUtils.isNotEmpty(userList)) {
userList.forEach(user -> {
UserMessageFormDTO messageFormDTO = new UserMessageFormDTO();
messageFormDTO.setCustomerId(item.getCustomerId());
messageFormDTO.setApp(AppClientConstant.APP_GOV);
messageFormDTO.setGridId(StrConstant.STAR);
messageFormDTO.setUserId(user.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())) {

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

@ -1267,7 +1267,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
if (houseInfoMap.containsKey(item.getHomeId()) && null != houseInfoMap.get(item.getHomeId())) {
HouseInfoDTO houseInfoDTO = houseInfoMap.get(item.getHomeId());
item.setHomeId(houseInfoDTO.getAllName());
item.setHouseName(houseInfoDTO.getAllName());
}
});
}
@ -1300,12 +1300,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//查询房子名称
Set<String> houseIds = new HashSet<>();
houseIds.add(result.getHomeId());
Result<List<HouseInfoDTO>> houseInfoRes=govOrgOpenFeignClient.queryListHouseInfo(new HashSet<>(houseIds),formDTO.getCustomerId());
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()));
if (houseInfoMap.containsKey(result.getHomeId()) && null != houseInfoMap.get(result.getHomeId())) {
HouseInfoDTO houseInfoDTO = houseInfoMap.get(result.getHomeId());
result.setHomeId(houseInfoDTO.getAllName());
result.setHouseName(houseInfoDTO.getAllName());
}
}
return result;

80
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.service.IcNoticeService;
import com.epmet.service.IcTripReportRecordService;
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.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -41,6 +42,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-03-25
*/
@Slf4j
@Service
public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportRecordDao, IcTripReportRecordEntity> implements IcTripReportRecordService {
@Autowired
@ -108,12 +110,6 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
return wrapper;
}
@Override
public IcTripReportRecordDTO get(String id) {
IcTripReportRecordEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class);
}
/**
* pc: 行程上报-新增
* @param formDTO
@ -122,7 +118,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Transactional(rollbackFor = Exception.class)
public String save(IcTripReportFormDTO formDTO) {
//如果是单个录入的,默认数据属于当前用户所属组织id
if(IcResiUserConstant.USER_TYPE_OTHER.equals(formDTO.getUserType())){
if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
@ -141,24 +137,32 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
}
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
//注意这里的userId是指的pc平台的居民
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
dto.setOrigin(NumConstant.ZERO_STR);
dto.setContent(formDTO.getContent());
dto.setOrgName(agencyInfoCache.getOrganizationName());
icNoticeService.sendNotice(dto);
sendNotice(formDTO,agencyInfoCache.getOrganizationName());
}
return entity.getId();
}
/**
* 加入核算检测关注
* 行程上报-发送通知
* @param formDTO
*/
private void sendNotice(IcTripReportFormDTO formDTO,String agencyName) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
//注意这里的userId是指的pc平台的居民
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
dto.setOrigin(NumConstant.ZERO_STR);
dto.setContent(formDTO.getContent());
dto.setOrgName(agencyName);
icNoticeService.sendNotice(dto);
}
/**
* 行程上报-加入核算检测关注
* @param formDTO
*/
private void vaccinationAdd(IcTripReportFormDTO formDTO) {
@ -181,16 +185,42 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcTripReportRecordDTO dto) {
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class);
public String update(IcTripReportFormDTO formDTO) {
IcTripReportRecordEntity origin=baseDao.selectById(formDTO.getId());
if(null==origin){
log.warn("ic_trip_report_record记录不存在id:",formDTO.getId());
return formDTO.getId();
}
//如果是单个录入的,默认数据属于当前用户所属组织id
if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class);
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId());
if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
entity.setPids(agencyInfoCache.getPids());
//1.修改行程记录表
updateById(entity);
if(formDTO.getHeSuanCheck()){
// 2.加入核算检测关注名单,如果之前关注了,会在通知的service层移除
vaccinationAdd(formDTO);
}
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) {
sendNotice(formDTO,agencyInfoCache.getOrganizationName());
}
return entity.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
public void delete(String customerId, String userId, String[] ids) {
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(customerId,userId);
baseDao.batchDel(userId,staffInfo.getAgencyId(),ids);
}
/**

2
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.28__modify_trip_report.sql

@ -0,0 +1,2 @@
alter table ic_trip_report_record MODIFY COLUMN PIDS VARCHAR(255) COMMENT 'agency_id的所有上级';
alter table ic_trip_report_record MODIFY COLUMN USER_TYPE VARCHAR(32) NOT NULL COMMENT '居民端小程序的人:resi;数字社区的居民:icresi;单独录入:input; 导入:import';

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

Binary file not shown.

2
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -690,7 +690,7 @@
AND MOBILE LIKE concat( '%', #{mobile}, '%' )
</if>
<if test="idCard != null and idCard != ''">
AND ID_CARD LIKE concat( '%', #{idCard}, '%' )
AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' )
</if>
) t
WHERE

11
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -56,4 +56,15 @@
ORDER BY
r.CREATED_TIME DESC
</select>
<update id="batchDel" parameterType="map">
update ic_trip_report_record set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=NOW()
WHERE USER_TYPE !='resi'
AND AGENCY_ID=#{agencyId}
AND (
<foreach collection="ids" item="id" separator=" OR ">
id=#{id}
</foreach>
)
</update>
</mapper>
Loading…
Cancel
Save