Commit c50c0c19 authored by 吴卿华's avatar 吴卿华

正元app消息模块

parent 87649777
...@@ -66,9 +66,12 @@ public class TStaningBook extends BaseEntity ...@@ -66,9 +66,12 @@ public class TStaningBook extends BaseEntity
/** 整改建议 */ /** 整改建议 */
@Excel(name = "整改建议") @Excel(name = "整改建议")
private String proposal; private String proposal;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date rectificationTerm; private Date rectificationTerm;
/** 投入费用 */ /** 投入费用 */
@Excel(name = "投入费用") @Excel(name = "投入费用")
private String investmentCost; private String investmentCost;
......
...@@ -115,4 +115,9 @@ public interface TTrainCourseMapper ...@@ -115,4 +115,9 @@ public interface TTrainCourseMapper
* @return * @return
*/ */
int updateReadStatus(Long newsId); int updateReadStatus(Long newsId);
/**
* 查询接收人姓名
*/
String selectRecipient(Long userid);
} }
...@@ -91,14 +91,16 @@ public class TStaningBookServiceImpl implements ITStaningBookService ...@@ -91,14 +91,16 @@ public class TStaningBookServiceImpl implements ITStaningBookService
public int insertTStaningBook(TStaningBook tStaningBook) public int insertTStaningBook(TStaningBook tStaningBook)
{ {
tStaningBook.setCreateTime(DateUtils.getNowDate()); tStaningBook.setCreateTime(DateUtils.getNowDate());
/** 手机端消息新封装类 */ /** 手机端消息新封装类 */
TNews tNews=new TNews(); TNews tNews=new TNews();
/**设置所属模块*/ /**设置所属模块*/
tNews.setModule(2); tNews.setModule(2);
//查询接收人姓名
// String nickName = tTrainCourseMapper.selectRecipient(tStaningBook.getRectification());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String myDate = simpleDateFormat.format(tStaningBook.getRectificationTerm());
/**设置内容*/ /**设置内容*/
tNews.setMessageContent("您有一条新的隐患整改信息"); tNews.setMessageContent("隐患排查:"+tStaningBook.getTroubleName()+",请于"+myDate+"前整改完毕。");
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
Long userId = user.getUserId(); Long userId = user.getUserId();
......
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ 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;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -69,7 +70,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -69,7 +70,6 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
return 0; return 0;
} }
List<String> userIds = tTrainPlanMapper.selectAlluserByplanId(course.getCourseType()); List<String> userIds = tTrainPlanMapper.selectAlluserByplanId(course.getCourseType());
System.out.println(userIds);
//异常数据 //异常数据
if(userIds==null||userIds.size()==0){ if(userIds==null||userIds.size()==0){
return 0; return 0;
...@@ -81,9 +81,11 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -81,9 +81,11 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
TNews tNews=new TNews(); TNews tNews=new TNews();
/**设置所属模块*/ /**设置所属模块*/
tNews.setModule(Integer.valueOf(tTrainCourse1.getDataKind())); tNews.setModule(Integer.valueOf(tTrainCourse1.getDataKind()));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String myDate = simpleDateFormat.format(tTrainCourse1.getTestEndTime());
if ("0".equals(tTrainCourse1.getDataKind())){ if ("0".equals(tTrainCourse1.getDataKind())){
/**设置消息内容*/ /**设置消息内容*/
tNews.setMessageContent("您有一场新的培训课程"); tNews.setMessageContent("培训课程:"+tTrainCourse1.getCourseName()+",已发布,请于"+myDate+"前进行学习");
}else { }else {
SecurityUtils.getUsername(); SecurityUtils.getUsername();
tNews.setMessageContent("您有一场新的试卷考试"); tNews.setMessageContent("您有一场新的试卷考试");
...@@ -390,12 +392,13 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService ...@@ -390,12 +392,13 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
TNews tNews=new TNews(); TNews tNews=new TNews();
/**设置所属模块*/ /**设置所属模块*/
tNews.setModule(Integer.valueOf(tTrainCourse1.getDataKind())); tNews.setModule(Integer.valueOf(tTrainCourse1.getDataKind()));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String myDate = simpleDateFormat.format(tTrainCourse1.getTestEndTime());
if ("0".equals(tTrainCourse1.getDataKind())){ if ("0".equals(tTrainCourse1.getDataKind())){
/**设置消息内容*/ /**设置消息内容*/
tNews.setMessageContent("您有一场新的培训课程"); tNews.setMessageContent("培训课程:"+tTrainCourse1.getCourseName()+"已发布,请于"+myDate+"前进行学习");
}else { }else {
SecurityUtils.getUsername(); tNews.setMessageContent("考试:"+tTrainCourse1.getCourseName()+"已发布,请于"+myDate+"前进行学习");
tNews.setMessageContent("您有一场新的试卷考试");
} }
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
......
...@@ -256,9 +256,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -256,9 +256,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from t_news where read_status='1' and recipient_id=#{recipientId} order by release_time desc select * from t_news where read_status='1' and recipient_id=#{recipientId} order by release_time desc
</select> </select>
<!--修改消息状态为已读--> <!--修改消息状态为已读-->
<update id="updateReadStatus"> <update id="updateReadStatus">
update t_news set read_status='1' where news_id=#{newsId} update t_news set read_status='1' where news_id=#{newsId}
</update> </update>
<!--查询接收人姓名-->
<select id="selectRecipient" resultType="java.lang.String">
select nick_name from sys_user where user_id=#{userid}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment