Commit 779b76de authored by zhangjianqian's avatar zhangjianqian

Merge remote-tracking branch 'origin/master'

parents 163d557b f32036d1
......@@ -23,7 +23,7 @@ import com.zehong.system.service.ISysMenuService;
/**
* 登录验证
*
*
* @author zehong
*/
@RestController
......@@ -46,7 +46,7 @@ public class SysLoginController
/**
* 登录方法
*
*
* @param loginBody 登录信息
* @return 结果
*/
......@@ -56,14 +56,14 @@ public class SysLoginController
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
loginBody.getUuid(),loginBody.getRememberPsw());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
*
* @return 用户信息
*/
@GetMapping("getInfo")
......@@ -85,7 +85,7 @@ public class SysLoginController
/**
* 获取路由信息
*
*
* @return 路由信息
*/
@GetMapping("getRouters")
......
......@@ -11,10 +11,7 @@ import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.service.ITTrainCourseService;
import io.swagger.annotations.Api;
......@@ -206,4 +203,33 @@ public class TTrainCourseController extends BaseController
ExcelUtil<TTrainUserCourse> util = new ExcelUtil<TTrainUserCourse>(TTrainUserCourse.class);
return util.exportExcel(persons, "考试详细数据");
}
/**
* 手机端 最新消息查询
*/
@GetMapping("/latestNews")
public TNews latestNews(Long recipientId){
//最新消息查询
return tTrainCourseService.selectLatestNews(recipientId);
}
/**
* 手机端 查询历史消息
* @param recipientId
* @return
*/
@GetMapping("/historicalMessages")
public List<TNews> historicalMessages(Long recipientId){
return tTrainCourseService.historicalMessages(recipientId);
}
/**
* 修改消息状态为已读
*/
@GetMapping("/updateReadStatus")
public AjaxResult updateReadStatus(Long newsId){
return toAjax(tTrainCourseService.updateReadStatus(newsId));
}
}
......@@ -2,7 +2,7 @@ package com.zehong.common.core.domain.model;
/**
* 用户登录对象
*
*
* @author zehong
*/
public class LoginBody
......@@ -27,6 +27,20 @@ public class LoginBody
*/
private String uuid = "";
/**
* 手机端 记住密码登录 验证是否通过验证码
* @return
*/
private int rememberPsw;
public int getRememberPsw() {
return rememberPsw;
}
public void setRememberPsw(int rememberPsw) {
this.rememberPsw = rememberPsw;
}
public String getUsername()
{
return username;
......
......@@ -25,7 +25,7 @@ import com.zehong.system.service.ISysUserService;
/**
* 登录校验方法
*
*
* @author zehong
*/
@Component
......@@ -39,33 +39,35 @@ public class SysLoginService
@Autowired
private RedisCache redisCache;
@Autowired
private ISysUserService userService;
/**
* 登录验证
*
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
public String login(String username, String password, String code, String uuid)
public String login(String username, String password, String code, String uuid,int rememberPsw)
{
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
if (captcha == null)
if (captcha == null&&rememberPsw!=1)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha))
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
if (rememberPsw!=1) {
if (!code.equalsIgnoreCase(captcha)) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
}
}
// 用户验证
Authentication authentication = null;
......
package com.zehong.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* 手机端消息封装类
*/
public class TNews {
private Integer newsId;
/**
* 所属模块 0培训课程 1试卷考试 2隐患台账
*/
private Integer module;
/**
* 消息内容
*/
private String messageContent;
/**
* 发布人id
*/
private Long publisherId;
/**
* 接收人id
*/
private Integer recipientId;
/**
* 发布时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date releaseTime;
/**
* 读取状态 0未读取 1读取
*/
private Integer readStatus;
private Long moduleId;
public Long getModuleId() {
return moduleId;
}
public void setModuleId(Long moduleId) {
this.moduleId = moduleId;
}
public Integer getNewsId() {
return newsId;
}
public void setNewsId(Integer newsId) {
this.newsId = newsId;
}
public Integer getModule() {
return module;
}
public void setModule(Integer module) {
this.module = module;
}
public String getMessageContent() {
return messageContent;
}
public void setMessageContent(String messageContent) {
this.messageContent = messageContent;
}
public Long getPublisherId() {
return publisherId;
}
public void setPublisherId(Long publisherId) {
this.publisherId = publisherId;
}
public Integer getRecipientId() {
return recipientId;
}
public void setRecipientId(Integer recipientId) {
this.recipientId = recipientId;
}
public Date getReleaseTime() {
return releaseTime;
}
public void setReleaseTime(Date releaseTime) {
this.releaseTime = releaseTime;
}
public Integer getReadStatus() {
return readStatus;
}
public void setReadStatus(Integer readStatus) {
this.readStatus = readStatus;
}
@Override
public String toString() {
return "TNews{" +
"newsId=" + newsId +
", module=" + module +
", messageContent='" + messageContent + '\'' +
", publisherId=" + publisherId +
", recipientId=" + recipientId +
", releaseTime=" + releaseTime +
", readStatus=" + readStatus +
'}';
}
}
......@@ -12,7 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat;
/**
* 隐患台账对象 t_staning_book
*
*
* @author zehong
* @date 2022-10-07
*/
......@@ -66,9 +66,12 @@ public class TStaningBook extends BaseEntity
/** 整改建议 */
@Excel(name = "整改建议")
private String proposal;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date rectificationTerm;
/** 投入费用 */
@Excel(name = "投入费用")
private String investmentCost;
......@@ -218,241 +221,241 @@ public class TStaningBook extends BaseEntity
this.bookId = bookId;
}
public Long getBookId()
public Long getBookId()
{
return bookId;
}
public void setTroubleName(String troubleName)
public void setTroubleName(String troubleName)
{
this.troubleName = troubleName;
}
public String getTroubleName()
public String getTroubleName()
{
return troubleName;
}
public void setTroubleType(Integer troubleType)
public void setTroubleType(Integer troubleType)
{
this.troubleType = troubleType;
}
public Integer getTroubleType()
public Integer getTroubleType()
{
return troubleType;
}
public void setTroubleLevel(Integer troubleLevel)
public void setTroubleLevel(Integer troubleLevel)
{
this.troubleLevel = troubleLevel;
}
public Integer getTroubleLevel()
public Integer getTroubleLevel()
{
return troubleLevel;
}
public void setMeasures(String measures)
public void setMeasures(String measures)
{
this.measures = measures;
}
public String getMeasures()
public String getMeasures()
{
return measures;
}
public void setTroubleHarm(String troubleHarm)
public void setTroubleHarm(String troubleHarm)
{
this.troubleHarm = troubleHarm;
}
public String getTroubleHarm()
public String getTroubleHarm()
{
return troubleHarm;
}
public void setEscalation(Long escalation)
public void setEscalation(Long escalation)
{
this.escalation = escalation;
}
public Long getEscalation()
public Long getEscalation()
{
return escalation;
}
public void setFindTime(Date findTime)
public void setFindTime(Date findTime)
{
this.findTime = findTime;
}
public Date getFindTime()
public Date getFindTime()
{
return findTime;
}
public void setPicture(String picture)
public void setPicture(String picture)
{
this.picture = picture;
}
public String getPicture()
public String getPicture()
{
return picture;
}
public void setEnclosure(String enclosure)
public void setEnclosure(String enclosure)
{
this.enclosure = enclosure;
}
public String getEnclosure()
public String getEnclosure()
{
return enclosure;
}
public void setProposal(String proposal)
public void setProposal(String proposal)
{
this.proposal = proposal;
}
public String getProposal()
public String getProposal()
{
return proposal;
}
public void setInvestmentCost(String investmentCost)
public void setInvestmentCost(String investmentCost)
{
this.investmentCost = investmentCost;
}
public String getInvestmentCost()
public String getInvestmentCost()
{
return investmentCost;
}
public void setInvestmentMaterial(String investmentMaterial)
public void setInvestmentMaterial(String investmentMaterial)
{
this.investmentMaterial = investmentMaterial;
}
public String getInvestmentMaterial()
public String getInvestmentMaterial()
{
return investmentMaterial;
}
public void setRectification(Long rectification)
public void setRectification(Long rectification)
{
this.rectification = rectification;
}
public Long getRectification()
public Long getRectification()
{
return rectification;
}
public void setRectificationPictrue(String rectificationPictrue)
public void setRectificationPictrue(String rectificationPictrue)
{
this.rectificationPictrue = rectificationPictrue;
}
public String getRectificationPictrue()
public String getRectificationPictrue()
{
return rectificationPictrue;
}
public void setRectificationText(String rectificationText)
public void setRectificationText(String rectificationText)
{
this.rectificationText = rectificationText;
}
public String getRectificationText()
public String getRectificationText()
{
return rectificationText;
}
public void setRectificationTime(Date rectificationTime)
public void setRectificationTime(Date rectificationTime)
{
this.rectificationTime = rectificationTime;
}
public Date getRectificationTime()
public Date getRectificationTime()
{
return rectificationTime;
}
public void setRemarks(String remarks)
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
public String getRemarks()
{
return remarks;
}
public void setFinishDay(Long finishDay)
public void setFinishDay(Long finishDay)
{
this.finishDay = finishDay;
}
public Long getFinishDay()
public Long getFinishDay()
{
return finishDay;
}
public void setInspectPictrue(String inspectPictrue)
public void setInspectPictrue(String inspectPictrue)
{
this.inspectPictrue = inspectPictrue;
}
public String getInspectPictrue()
public String getInspectPictrue()
{
return inspectPictrue;
}
public void setInspectTime(Date inspectTime)
public void setInspectTime(Date inspectTime)
{
this.inspectTime = inspectTime;
}
public Date getInspectTime()
public Date getInspectTime()
{
return inspectTime;
}
public void setInspectResult(String inspectResult)
public void setInspectResult(String inspectResult)
{
this.inspectResult = inspectResult;
}
public String getInspectResult()
public String getInspectResult()
{
return inspectResult;
}
public void setPersonLiable(Long personLiable)
public void setPersonLiable(Long personLiable)
{
this.personLiable = personLiable;
}
public Long getPersonLiable()
public Long getPersonLiable()
{
return personLiable;
}
public void setState(Integer state)
public void setState(Integer state)
{
this.state = state;
}
public Integer getState()
public Integer getState()
{
return state;
}
public void setDeptId(Long deptId)
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
public Long getDeptId()
{
return deptId;
}
public void setWorkId(Long workId)
public void setWorkId(Long workId)
{
this.workId = workId;
}
public Long getWorkId()
public Long getWorkId()
{
return workId;
}
public void setIsDel(Integer isDel)
public void setIsDel(Integer isDel)
{
this.isDel = isDel;
}
public Integer getIsDel()
public Integer getIsDel()
{
return isDel;
}
......
......@@ -3,6 +3,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TNews;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.UserCourseVo;
......@@ -87,4 +88,36 @@ public interface TTrainCourseMapper
List<StatisticsTrainCourse> statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse);
List<UserCourseVo> userCourseLists(TStaffForm tStaff);
/**
* 消息添加
* @param tNews
*/
void insertNews(TNews tNews);
/**
* 手机端 最新消息查询
* @param recipientId
* @return
*/
TNews selectLatestNews(Long recipientId);
/**
* 手机端 查询历史消息
* @param recipientId
* @return
*/
List<TNews> historicalMessages(Long recipientId);
/**
* 修改消息状态为已读
* @param newsId
* @return
*/
int updateReadStatus(Long newsId);
/**
* 查询接收人姓名
*/
String selectRecipient(Long userid);
}
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TNews;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.form.TStaffForm;
......@@ -118,5 +119,26 @@ public interface ITTrainCourseService
* @return
*/
List<TTrainUserCourse> examDetails(Long courseId);
/**
* 最新消息查询
* @param recipientId
* @return
*/
TNews selectLatestNews(Long recipientId);
/**
* 手机端 查询历史消息
* @param recipientId
* @return
*/
List<TNews> historicalMessages(Long recipientId);
/**
* 修改消息状态为已读
* @param newsId
* @return
*/
int updateReadStatus(Long newsId);
}
package com.zehong.system.service.impl;
import cn.hutool.core.date.DateTime;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TNews;
import com.zehong.system.domain.TStaningBook;
import com.zehong.system.domain.vo.HiddenStatVO;
import com.zehong.system.mapper.SysDeptMapper;
import com.zehong.system.mapper.THiddenTroubleWorkMapper;
import com.zehong.system.mapper.TStaningBookMapper;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.service.ITStaningBookService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -17,12 +23,12 @@ import java.util.*;
/**
* 隐患台账Service业务层处理
*
*
* @author zehong
* @date 2022-07-09
*/
@Service
public class TStaningBookServiceImpl implements ITStaningBookService
public class TStaningBookServiceImpl implements ITStaningBookService
{
private static final Logger logger = LoggerFactory.getLogger(TStaningBookServiceImpl.class);
@Autowired
......@@ -31,10 +37,11 @@ public class TStaningBookServiceImpl implements ITStaningBookService
private THiddenTroubleWorkMapper tHiddenTroubleWorkMapper;
@Autowired
private SysDeptMapper deptMapper;
@Autowired
private TTrainCourseMapper tTrainCourseMapper;
/**
* 查询隐患台账
*
*
* @param bookId 隐患台账ID
* @return 隐患台账
*/
......@@ -46,7 +53,7 @@ public class TStaningBookServiceImpl implements ITStaningBookService
/**
* 查询隐患台账列表
*
*
* @param tStaningBook 隐患台账
* @return 隐患台账
*/
......@@ -76,7 +83,7 @@ public class TStaningBookServiceImpl implements ITStaningBookService
}
/**
* 新增隐患台账
*
*
* @param tStaningBook 隐患台账
* @return 结果
*/
......@@ -84,12 +91,39 @@ public class TStaningBookServiceImpl implements ITStaningBookService
public int insertTStaningBook(TStaningBook tStaningBook)
{
tStaningBook.setCreateTime(DateUtils.getNowDate());
return tStaningBookMapper.insertTStaningBook(tStaningBook);
/** 手机端消息新封装类 */
TNews tNews=new TNews();
/**设置所属模块*/
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("隐患排查:"+tStaningBook.getTroubleName()+",请于"+myDate+"前整改完毕。");
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
/** 发布人ID*/
tNews.setPublisherId(userId);
/** 接收人id*/
tNews.setRecipientId(Math.toIntExact(tStaningBook.getRectification()));
int i = tStaningBookMapper.insertTStaningBook(tStaningBook);
/** 所属模块id*/
tNews.setModuleId(Long.valueOf(tStaningBook.getBookId()));
tNews.setReleaseTime(new DateTime());
/**
* 消息添加
*/
tTrainCourseMapper.insertNews(tNews);
return i;
}
/**
* 修改隐患台账
*
*
* @param tStaningBook 隐患台账
* @return 结果
*/
......@@ -101,7 +135,7 @@ public class TStaningBookServiceImpl implements ITStaningBookService
/**
* 批量删除隐患台账
*
*
* @param bookIds 需要删除的隐患台账ID
* @return 结果
*/
......@@ -113,7 +147,7 @@ public class TStaningBookServiceImpl implements ITStaningBookService
/**
* 删除隐患台账信息
*
*
* @param bookId 隐患台账ID
* @return 结果
*/
......
package com.zehong.system.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.TTrainPlan;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.*;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.mapper.TTrainCourseMapper;
......@@ -17,10 +17,12 @@ import com.zehong.system.mapper.TTrainCourseTopicMapper;
import com.zehong.system.mapper.TTrainPlanMapper;
import com.zehong.system.mapper.TTrainUserCourseMapper;
import com.zehong.system.service.ITTrainCourseService;
import jdk.nashorn.internal.runtime.regexp.joni.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -72,6 +74,38 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
if(userIds==null||userIds.size()==0){
return 0;
}
//查询考试详情
TTrainCourse tTrainCourse1 = tTrainCourseMapper.selectTTrainCourseById(courseId);
for (int i=0;i<userIds.size();i++){
/** 手机端消息新封装类 */
TNews tNews=new TNews();
/**设置所属模块*/
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())){
/**设置消息内容*/
tNews.setMessageContent("培训课程:"+tTrainCourse1.getCourseName()+",已发布,请于"+myDate+"前进行学习");
}else {
SecurityUtils.getUsername();
tNews.setMessageContent("您有一场新的试卷考试");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
/** 发布人ID*/
tNews.setPublisherId(userId);
/** 接收人id*/
tNews.setRecipientId(Integer.valueOf(userIds.get(i)));
/** 所属模块id*/
tNews.setModuleId(courseId);
tNews.setReleaseTime(new DateTime());
/**
* 消息添加
*/
tTrainCourseMapper.insertNews(tNews);
}
tTrainCourseMapper.insertUserCourse(courseId,userIds,course.getPersonnelType());
course.setStatus(1);
course.setReleaseTime(new Date());
......@@ -357,7 +391,39 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
}
//新增考试人员
List<JSONObject> personList = JSONObject.parseArray(course.getTestPersons(),JSONObject.class);
List<String> persons = personList.stream().map(item ->String.valueOf(item.get("peoPleId"))).collect(Collectors.toList());
//查询考试详情
TTrainCourse tTrainCourse1 = tTrainCourseMapper.selectTTrainCourseById(tTrainCourse.getCourseId());
for (int i=0;i<persons.size();i++){
/** 手机端消息新封装类 */
TNews tNews=new TNews();
/**设置所属模块*/
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())){
/**设置消息内容*/
tNews.setMessageContent("培训课程:"+tTrainCourse1.getCourseName()+"已发布,请于"+myDate+"前进行学习");
}else {
tNews.setMessageContent("考试:"+tTrainCourse1.getCourseName()+"已发布,请于"+myDate+"前进行学习");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
/** 发布人ID*/
tNews.setPublisherId(userId);
/** 接收人id*/
tNews.setRecipientId(Integer.valueOf(persons.get(i)));
/** 所属模块id*/
tNews.setModuleId(tTrainCourse.getCourseId());
tNews.setReleaseTime(new DateTime());
/**
* 消息添加
*/
tTrainCourseMapper.insertNews(tNews);
}
tTrainCourseMapper.insertUserCourse(tTrainCourse.getCourseId(),persons,tTrainCourse.getPersonnelType());
tTrainCourse.setStatus(1);
tTrainCourse.setReleaseTime(new Date());
......@@ -405,4 +471,35 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
}
/**
* 手机端 最新消息查询
* @param recipientId
* @return
*/
@Override
public TNews selectLatestNews(Long recipientId) {
return tTrainCourseMapper.selectLatestNews(recipientId);
}
/**
* 手机端 查询历史消息
* @param recipientId
* @return
*/
@Override
public List<TNews> historicalMessages(Long recipientId) {
return tTrainCourseMapper.historicalMessages(recipientId);
}
/**
* 修改消息状态为已读
* @param newsId
* @return
*/
@Override
public int updateReadStatus(Long newsId) {
return tTrainCourseMapper.updateReadStatus(newsId);
}
}
......@@ -32,14 +32,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<resultMap id="StatisticsTrainCourseResult" type="StatisticsTrainCourse">
<result property="courseId" column="course_id" />
<result property="courseName" column="course_name" />
<result property="courseId" column="course_id" />
<result property="courseName" column="course_name" />
<result property="releaseTime" column="release_time" />
<result property="dataKind" column="data_kind" />
<result property="count" column="count" />
<result property="test" column="test" />
<result property="pass" column="pass" />
<result property="rate" column="rate" />
</resultMap>
<resultMap id="TNewsResult" type="TNews">
<result property="newsId" column="news_id" />
<result property="module" column="module" />
<result property="messageContent" column="message_content" />
<result property="publisherId" column="publisher_id" />
<result property="recipientId" column="recipient_id" />
<result property="releaseTime" column="release_time" />
<result property="dataKind" column="data_kind" />
<result property="count" column="count" />
<result property="test" column="test" />
<result property="pass" column="pass" />
<result property="rate" column="rate" />
<result property="readStatus" column="read_status" />
</resultMap>
<sql id="selectTTrainCourseVo">
......@@ -171,6 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item},#{courseId},#{personnelType},NOW())
</foreach>
</insert>
<select id="userCourseList" resultType="com.zehong.system.domain.vo.UserCourseVo">
SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,c.is_verifty_face AS isVeriftyFace,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
......@@ -228,4 +239,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE uc.user_id = #{staffId} and uc.personnel_type ='1'
and data_kind=#{dataKind}
</select>
<!--消息添加-->
<insert id="insertNews">
insert into t_news (module_id,module,message_content,publisher_id,recipient_id,release_time)
values (#{moduleId},#{module},#{messageContent},#{publisherId},#{recipientId},#{releaseTime})
</insert>
<!--手机端 最新消息查询-->
<select id="selectLatestNews" resultMap="TNewsResult" >
select * from t_news where read_status='0'and recipient_id=#{recipientId} order by release_time desc limit 0,1
</select>
<!--手机端 查询历史消息-->
<select id="historicalMessages" resultMap="TNewsResult">
select * from t_news where read_status='1' and recipient_id=#{recipientId} order by release_time desc
</select>
<!--修改消息状态为已读-->
<update id="updateReadStatus">
update t_news set read_status='1' where news_id=#{newsId}
</update>
<!--查询接收人姓名-->
<select id="selectRecipient" resultType="java.lang.String">
select nick_name from sys_user where user_id=#{userid}
</select>
</mapper>
......@@ -36,6 +36,7 @@
"@riophae/vue-treeselect": "^0.4.0",
"axios": "0.21.0",
"clipboard": "2.0.6",
"gcoord": "^0.3.2",
"core-js": "^3.19.1",
"echarts": "^5.3.3",
"element-ui": "^2.15.10",
......
/*
* @Author: your name
* @Date: 2021-12-07 14:19:18
* @LastEditTime: 2022-10-22 10:31:44
* @LastEditTime: 2023-03-15 16:47:50
* @LastEditors: 纪泽龙 jizelong@qq.com
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /cesium-vue/src/utils/seieumClass.js
*/
import gcoord from "gcoord";
import AroundPoint from "./cesiumRoamStart";
const MAPTYPE = {
gps: "WGS84",
gaode: "GCJ02",
baidu: "BD09",
};
window.danger = { name: "", colorNum: null, path: [], data: {} };
window.dangerArr = JSON.parse(localStorage.getItem('J') )?.length>0? JSON.parse(localStorage.getItem('J') ): [];
window.dangerArr =
JSON.parse(localStorage.getItem("J"))?.length > 0
? JSON.parse(localStorage.getItem("J"))
: [];
window.repeat = () => {
window.danger = { name: "", path: [], data: {} };
};
......@@ -15,8 +27,8 @@ window.save = () => {
window.dangerArr.push(window.danger);
const json = JSON.stringify(window.dangerArr);
localStorage.setItem("J", json);
console.log(json)
window.repeat()
console.log(json);
window.repeat();
};
var viewModel = {
......@@ -173,6 +185,8 @@ export default class CreateCesium {
infowindowTimer = null;
// 用来记录同频定时器的timer
animationTimer = null;
// 一个漫游对象,从外部引入new的类
roamObj = null;
constructor(container, urlArr, Vue, config) {
this.vue = Vue;
console.log("Vue", this.vue.$store);
......@@ -295,10 +309,12 @@ export default class CreateCesium {
* @return {*}
*/
async addtiles(urlArr, main) {
urlArr.forEach((url) => {
console.log("urlArr", urlArr);
urlArr.forEach((item) => {
const tileset = new Cesium.Cesium3DTileset({
url,
url: item.url,
});
this.scene.primitives.add(tileset);
// console.log("adsf")
tileset.readyPromise.then(async (tileset) => {
......@@ -308,12 +324,20 @@ export default class CreateCesium {
);
const longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
const latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
var gps = [longitudeString, latitudeString];
console.log("tileset加载完毕", gps);
var lnglat = [longitudeString, latitudeString];
console.log("tileset加载完毕", lnglat);
// 阻塞转换成高德坐标
let gaodeLnglat = (await this.gpsToGaode(gps))[0];
console.log("坐标换算完毕", gaodeLnglat);
// 如果startMapType起始是gps,则不转换,如果起始是高德就要转换,因为现在用的是gps的坐标系
let nowLngLat;
if (item.startMapType === "gps") {
nowLngLat = lnglat;
} else {
// nowLngLat = (await this.gpsToGaode(gps))[0];
nowLngLat = this.gaodeToGps(lnglat, item);
}
// 漫游旋转用的坐标
this.romanLngLat = nowLngLat;
console.log("坐标换算完毕123123123123123123", nowLngLat);
// AMap.convertFrom(gps, "gps", (status, result) =>{
// if (result.info === "ok") {
// var lnglats = result.locations; // Array.<LngLat>
......@@ -326,9 +350,9 @@ export default class CreateCesium {
0.0
);
let offset = Cesium.Cartesian3.fromRadians(
Cesium.Math.toRadians(gps[0]),
Cesium.Math.toRadians(gps[1]),
-161.1
Cesium.Math.toRadians(nowLngLat[0]),
Cesium.Math.toRadians(nowLngLat[1]),
item.height
);
// let offset = Cesium.Cartesian3.fromRadians(
// Cesium.Math.toRadians(gaodeLnglat.lng),
......@@ -345,7 +369,7 @@ export default class CreateCesium {
color: "color('rgba(255,255,255,1)')",
});
// 主场景12312312;
console.log("gaodeLnglat", gaodeLnglat);
// console.log("gaodeLnglat", gaodeLnglat);
console.log("main", main);
// 1.6454928984350525 -1.0974068412623752 0.00004639407505457882 114.14437322429676 38.398663934418344 319.0140849711926
if (main) {
......@@ -354,20 +378,21 @@ export default class CreateCesium {
setTimeout(() => {
this.viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(
114.08040670822453,
38.24912720167037,
// 114.08040670822453,
// 38.24912720167037,
...nowLngLat,
784
), //定位坐标点,建议使用谷歌地球坐标位置无偏差
orientation: {
// heading: 1.6454928984350525, // 方向
// pitch: -1.0974068412623752, // 倾斜角度
// roll: 0.00004639407505457882,
// heading: Cesium.Math.toRadians(20.0), // 方向
// pitch: Cesium.Math.toRadians(-90.0,), // 倾斜角度
// roll: 1.3,
heading: Cesium.Math.toRadians(0), // 方向
pitch: Cesium.Math.toRadians(-81.61), // 倾斜角度
// roll: 1.3,
// heading: Cesium.Math.toRadians(0.0), // 方向
// pitch: Cesium.Math.toRadians(-81.0,), // 倾斜角度
// roll: 5,
heading: 1.5882496193148399,
pitch: -1.5707963057214722,
},
duration: 0.1, //定位的时间间隔
});
......@@ -383,6 +408,68 @@ export default class CreateCesium {
});
});
}
// 围绕点漫游
roamStart() {
if (this.roamObj) return;
var heading = this.viewer.scene.camera.heading;
var pitch = this.viewer.scene.camera.pitch;
this.viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(
// 114.08040670822453,
// 38.24912720167037,
...this.romanLngLat,
200
), //定位坐标点,建议使用谷歌地球坐标位置无偏差
orientation: {
// heading: 1.6454928984350525, // 方向
// pitch: -1.0974068412623752, // 倾斜角度
// roll: 0.00004639407505457882,
// heading: Cesium.Math.toRadians(20.0), // 方向
// pitch: Cesium.Math.toRadians(-90.0,), // 倾斜角度
// heading: 1.5882496193148399,
// pitch: -1.5707963057214722,
},
duration: 1, //定位的时间间隔
complete: () => {
console.log("开始漫游");
this.roamObj = new AroundPoint(
this.viewer,
0.2,
new Cesium.Cartesian3.fromDegrees(...this.romanLngLat),
200,
// 1.5882496193148399,
// -1.5707963057214722
);
this.roamObj.start();
},
});
}
roamStop() {
if (!this.roamObj) return;
this.roamObj.stop();
this.roamObj = null;
}
getcameraPosInfo() {
// 获取 相机姿态信息
var head = viewer.scene.camera.heading;
var pitch = viewer.scene.camera.pitch;
var roll = viewer.scene.camera.roll;
var info = { head: head, pitch: pitch, roll: roll };
// 获取位置 wgs84的地心坐标系,x,y坐标值以弧度来表示
var position = viewer.scene.camera.positionCartographic; //with longitude and latitude expressed in radians and height in meters.
//以下方式也可以获取相机位置只是返回的坐标系不一样
// var position = viewer.scene.camera.position //cartesian3 空间直角坐标系
// var ellipsoid = scene.globe.ellipsoid;
// var position =ellipsoid.cartesianToCartographic(viewer.scene.camera.position)//
// 弧度转经纬度
var longitude = Cesium.Math.toDegrees(position.longitude).toFixed(6);
var latitude = Cesium.Math.toDegrees(position.latitude).toFixed(6);
var height = position.height;
return { lng: longitude, lat: latitude, h: height, mat: info };
}
// 增加事件监听
posLng = null;
......@@ -576,8 +663,9 @@ export default class CreateCesium {
// );
}, Cesium.ScreenSpaceEventType.WHEEL);
// 摄像机监听
this.viewer.camera.changed.addEventListener((percentage) => {
this.viewer.camera.changed.addEventListener((percentage, b) => {
// 打印中心点坐标、高度
// console.log(this.viewer.camera)
// 当鼠地图移动的时候与相机事件隔离
if (!this.mouseDownFlag) {
// console.log("相机发生变化");
......@@ -1075,6 +1163,18 @@ export default class CreateCesium {
});
});
}
// 转换坐标
gaodeToGps(lnglatArr, data) {
console.log(MAPTYPE[data.startMapType], MAPTYPE[data.toMapType]);
let a = gcoord.transform(
lnglatArr, // 经纬度坐标
gcoord[MAPTYPE[data.startMapType]], // 当前坐标系
gcoord[MAPTYPE[data.toMapType]] // 目标坐标系
// gcoord.GCJ02,
// gcoord.WGS84
);
return a;
}
// 相机镜头
zoomTo(tileset) {
this.viewer.zoomTo(tileset);
......
/*
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2023-03-15 13:49:30
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-03-15 16:46:54
* @FilePath: /danger-manage-web/src/utils/cesium/cesiumRoamStart.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export default class AroundPoint {
constructor(viewer, amount, position, height, heading, pitch) {
this._viewer = viewer;
this._amount = amount;
this._position = position;
this.height = height;
this.heading = heading;
this.pitch = pitch;
}
_bindEvent() {
this._viewer.clock.onTick.addEventListener(this._aroundPoint, this);
}
_unbindEvent() {
this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);
}
start() {
this._viewer.clock.shouldAnimate = true;
this._unbindEvent();
this._bindEvent();
return this;
}
stop() {
this._unbindEvent();
return this;
}
// 相机绕点旋转函数
_aroundPoint() {
let heading = this._viewer.camera.heading;
let pitch = this._viewer.camera.pitch;
// console.log(Cesium.Math.toRadians(this._amount))
heading += Cesium.Math.toRadians(this._amount);
if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
heading = 0
}
// 用新坐标替换旧坐标
this.heading = heading;
this.pitch = pitch;
this._viewer.camera.lookAt(
this._position,
new Cesium.HeadingPitchRange(heading, pitch, this.height)
);
}
}
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-06-16 15:03:40
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-15 11:07:10
* @LastEditTime: 2023-03-14 09:39:50
* @FilePath: /danger-manage-web/src/views/bigwindow/index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -29,12 +29,12 @@ import Video from "@/components/bigWindow/video";
import Null from "@/components/bigWindow/Null";
import Danger from "@/components/bigWindow/Danger";
import danger from "@/assets/images/danger.png";
import Editor from '@/components/Editor';
import Editor from "@/components/Editor";
export default {
name: "bigWindow",
components:{
Editor
components: {
Editor,
},
data() {
return {
......@@ -179,10 +179,18 @@ export default {
],
};
},
mounted() {
this.Cesium = new CreateCesium(
"mapbox",
["../3dtiles/jsondata/tileset.json"],
[
{
url: "../3dtiles/jsondata/tileset.json", //路径
startMapType: "gps", //初始坐标系
toMapType: "", //要转换坐标系
height:-161.1, //模型高度调整
},
],
this
);
this.danger.forEach((item) => {
......@@ -205,7 +213,7 @@ export default {
beforeDestroy() {
// 挂掉该关的 infowindow 跟计算infowindow位置的计时器
this.Cesium.clearInfoWindow();
this.Cesium.destroy()
this.Cesium.destroy();
},
};
</script>
......@@ -225,7 +233,7 @@ export default {
right: 20px;
z-index: 10;
}
.go-index{
.go-index {
position: fixed;
top: 20px;
left: 20px;
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-06-16 15:03:40
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-02-01 09:48:47
* @LastEditTime: 2023-03-14 09:36:37
* @FilePath: /danger-manage-web/src/views/bigwindow/index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -207,7 +207,13 @@ export default {
mounted() {
this.Cesium = new CreateCesium(
"mapbox",
["../3dtiles/jsondata/tileset.json"],
// ["../3dtiles/jsondata/tileset.json"],
{
url: "../3dtiles/jsondata/tileset.json", //路径
startMapType: "gps", //初始坐标系
toMapType: "", //要转换坐标系
height: -161.1, //模型高度调整
},
this
);
// this.danger.forEach((item) => {
......@@ -251,7 +257,7 @@ export default {
<style lang="scss" scoped>
.big-window {
width: 100%;
position:relative;
position: relative;
// height: calc(100vh - 84px);
height: calc(100vh - 50px);
#mapbox {
......
......@@ -227,10 +227,10 @@
this.testStatDetailOpen = true;
this.courseName=courseName;
this.queryDetailParams.courseId=courseId;
this.getTestStatDetails(courseId);
this.getTestStatDetails();
},
getTestStatDetails(courseId){
this.queryDetailParams.courseId = courseId;
getTestStatDetails(){
//this.queryDetailParams.courseId = courseId;
testPersonDetailByCourseId(this.queryDetailParams).then(res =>{
this.testStatDetailData = res.rows.map((item, index) => {
return {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-03 10:51:24
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-11-22 14:16:37
* @LastEditTime: 2023-03-15 17:59:14
* @FilePath: /danger-manage-web/src/views/index.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -362,10 +362,31 @@ export default {
mounted() {
this.Cesium = new CreateCesium(
"mapbox",
["../3dtiles/jsondata/tileset.json"],
// ["../3dtiles/jsondata/tileset.json"],
[
{
url: "../3dtiles/jsondata/tileset.json", //路径
startMapType: "gps", //初始坐标系
toMapType: "", //要转换坐标系
height: -161.1, //模型高度调整
},
// {
// url: "../3dtiles/ZeHongZhuanHuan/tileset.json",
// startMapType: "gps",
// toMapType: "gps",
// height: 35 ,
// },
// {
// url: "../3dtiles/MapTilerCeShi/tileset.json",
// startMapType: "gaode",
// toMapType: "gps",
// height: -161,
// },
],
this
);
this.init();
window.C = this.Cesium;
},
beforeDestroy() {
// 挂掉该关的 infowindow 跟计算infowindow位置的计时器
......@@ -436,7 +457,7 @@ export default {
// 视频
if (item.mapDeviceType == 5) {
console.log(item,"item");
console.log(item, "item");
obj = {
latitude: item.latitude,
longitude: item.longitude,
......@@ -460,7 +481,9 @@ export default {
// 探测介质
tcjz: item.mapDeviceMedium,
sbzt: item.monitorDeviceStatus,
jcz:item.monitorValue?item.monitorValue + "" + item.mapDeviceUnit:'-',
jcz: item.monitorValue
? item.monitorValue + "" + item.mapDeviceUnit
: "-",
shortNum: 12,
config: { scale: 1, textHeight: -94 },
};
......
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