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