提交 06e96cd6 authored 作者: 宋文杰's avatar 宋文杰

fix(info information): fix info information to add reporter field and receiver_name field

上级 78b1a916
...@@ -39,9 +39,13 @@ public class InfoInformationsDto implements Serializable { ...@@ -39,9 +39,13 @@ public class InfoInformationsDto implements Serializable {
*/ */
private String infoRemark; private String infoRemark;
/** /**
* 发布人id * 上报人id
*/ */
private Integer reporterId; private Integer reporterId;
/**
* 上报人
*/
private String reporter;
/** /**
* 上报时间 * 上报时间
*/ */
......
...@@ -47,9 +47,13 @@ private static final long serialVersionUID = 1L; ...@@ -47,9 +47,13 @@ private static final long serialVersionUID = 1L;
*/ */
private String infoRemark; private String infoRemark;
/** /**
* 发布人id * 上报人id
*/ */
private Integer reporterId; private Integer reporterId;
/**
* 上报人
*/
private String reporter;
/** /**
* 上报时间 * 上报时间
*/ */
......
...@@ -41,5 +41,9 @@ private static final long serialVersionUID = 1L; ...@@ -41,5 +41,9 @@ private static final long serialVersionUID = 1L;
* 接收人id * 接收人id
*/ */
private Integer receiverId; private Integer receiverId;
/**
* 接收人姓名
*/
private String receiverName;
} }
package com.elephant.framework.galaxy.aroad.module.info.service.impl; package com.elephant.framework.galaxy.aroad.module.info.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.attendance.dto.MemberDto;
import com.elephant.framework.galaxy.aroad.module.info.dto.InfoInformationsDto; import com.elephant.framework.galaxy.aroad.module.info.dto.InfoInformationsDto;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoInformations; import com.elephant.framework.galaxy.aroad.module.info.entity.InfoInformations;
import com.elephant.framework.galaxy.aroad.module.info.entity.InfoReceivers; import com.elephant.framework.galaxy.aroad.module.info.entity.InfoReceivers;
import com.elephant.framework.galaxy.aroad.module.info.mapper.InfoInformationsMapper; import com.elephant.framework.galaxy.aroad.module.info.mapper.InfoInformationsMapper;
import com.elephant.framework.galaxy.aroad.module.info.service.InfoInformationsService; import com.elephant.framework.galaxy.aroad.module.info.service.InfoInformationsService;
import com.elephant.framework.galaxy.aroad.module.info.service.InfoReceiversService; import com.elephant.framework.galaxy.aroad.module.info.service.InfoReceiversService;
import com.elephant.framework.galaxy.aroad.module.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -26,6 +28,9 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap ...@@ -26,6 +28,9 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap
@Autowired @Autowired
private InfoReceiversService infoReceiversService; private InfoReceiversService infoReceiversService;
@Autowired
private UserService userService;
/** /**
* @Description: 新增上报信息 * @Description: 新增上报信息
* @Param: [info] * @Param: [info]
...@@ -35,12 +40,17 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap ...@@ -35,12 +40,17 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap
*/ */
@Transactional @Transactional
public Boolean saveInformations(InfoInformationsDto info){ public Boolean saveInformations(InfoInformationsDto info){
List<MemberDto> users = userService.getUsers(info.getReceiverIds());
if(users == null || users.size() <= 0){
return false;
}
InfoInformations information = InfoInformations.builder() InfoInformations information = InfoInformations.builder()
.templateId(info.getTemplateId()) .templateId(info.getTemplateId())
.infoTitle(info.getInfoTitle()) .infoTitle(info.getInfoTitle())
.infoContent(info.getInfoContent()) .infoContent(info.getInfoContent())
.infoRemark(info.getInfoRemark()) .infoRemark(info.getInfoRemark())
.reporterId(info.getReporterId()) .reporterId(info.getReporterId())
.reporter(info.getReporter())
.reportingTime(info.getReportingTime()) .reportingTime(info.getReportingTime())
.build(); .build();
baseMapper.saveInformations(information); baseMapper.saveInformations(information);
...@@ -51,6 +61,11 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap ...@@ -51,6 +61,11 @@ public class InfoInformationsServiceImpl extends ServiceImpl<InfoInformationsMap
.infoId(information.getInfoId()) .infoId(information.getInfoId())
.deptId(info.getDeptId()) .deptId(info.getDeptId())
.receiverId(r) .receiverId(r)
.receiverName(users.stream()
.filter((s) -> s.getId().equals(r))
.findFirst()
.get()
.getName())
.build()); .build());
}); });
return infoReceiversService.saveBatch(receivers); return infoReceiversService.saveBatch(receivers);
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<insert id="saveInformations" useGeneratedKeys="true" keyProperty="infoId"> <insert id="saveInformations" useGeneratedKeys="true" keyProperty="infoId">
insert into insert into
info_informations(template_id, info_title,info_content,info_remark,reporter_id,reporting_time) info_informations(template_id, info_title,info_content,info_remark,reporter_id,reporter,reporting_time)
values values
(#{templateId}, #{infoTitle},#{infoContent},#{infoRemark},#{reporterId},#{reportingTime}) (#{templateId}, #{infoTitle},#{infoContent},#{infoRemark},#{reporterId},#{reporter},#{reportingTime})
</insert> </insert>
</mapper> </mapper>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
</resultMap> </resultMap>
<resultMap id="memberDtoMap" type="com.elephant.framework.galaxy.aroad.module.attendance.dto.MemberDto"> <resultMap id="memberDtoMap" type="com.elephant.framework.galaxy.aroad.module.attendance.dto.MemberDto">
<result property="id" column="user_id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
</resultMap> </resultMap>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论